summaryrefslogtreecommitdiff
path: root/src/piraha/Generic.cc
diff options
context:
space:
mode:
authorsbrandt <sbrandt@17b73243-c579-4c4c-a9d2-2d5706c11dac>2013-07-29 16:14:18 +0000
committersbrandt <sbrandt@17b73243-c579-4c4c-a9d2-2d5706c11dac>2013-07-29 16:14:18 +0000
commit677fef1c09eddc56d13b1f500399efc862cab209 (patch)
tree9d1e9809b7f7945958e2b1bea4cb8a3040c859b1 /src/piraha/Generic.cc
parent6d2556e527db748b6b6bee3298ea97f83326c1c2 (diff)
Make the --python flag work.
git-svn-id: http://svn.cactuscode.org/flesh/trunk@5037 17b73243-c579-4c4c-a9d2-2d5706c11dac
Diffstat (limited to 'src/piraha/Generic.cc')
-rw-r--r--src/piraha/Generic.cc9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/piraha/Generic.cc b/src/piraha/Generic.cc
index 21012a85..d9b3f84b 100644
--- a/src/piraha/Generic.cc
+++ b/src/piraha/Generic.cc
@@ -17,7 +17,7 @@ void read_file(const char *file,std::string& buf) {
}
void usage() {
- std::cerr << "usage: generic [--perl] grammar input" << std::endl;
+ std::cerr << "usage: generic [--perl|--python] grammar input" << std::endl;
exit(2);
}
@@ -50,6 +50,7 @@ bool newEnd(std::string& in,const char *new_end,std::string& out) {
int main(int argc,char **argv) {
std::string grammarArg, inputArg;
bool perlFlag = false;
+ bool pythonFlag = false;
bool oFlag = false;
std::string outFile;
int narg = 0;
@@ -57,6 +58,8 @@ int main(int argc,char **argv) {
std::string arg = argv[n];
if(arg == "--perl") {
perlFlag = true;
+ } else if(arg == "--python") {
+ pythonFlag = true;
} else if(arg == "-o") {
outFile = argv[++n];
oFlag = true;
@@ -76,6 +79,8 @@ int main(int argc,char **argv) {
if(!oFlag) {
if(perlFlag) {
newEnd(inputArg,".pm",outFile);
+ } else if(pythonFlag) {
+ newEnd(inputArg,".py",outFile);
} else {
newEnd(inputArg,".pegout",outFile);
}
@@ -101,6 +106,8 @@ int main(int argc,char **argv) {
mg->children.push_back(src_file);
if(perlFlag) {
mg->dumpPerl(o);
+ } else if(pythonFlag) {
+ mg->dumpPython(o);
} else {
mg->dump(o);
}