Prepare toggle for debug parser/codegen

This commit is contained in:
Markus Hauschild
2013-06-01 23:26:43 +02:00
parent c78cb29076
commit 792c8b578a

View File

@@ -32,6 +32,9 @@
int main() { int main() {
srand(42); srand(42);
bool debugParser = false;
bool debugCodeGen = false;
lexertl::rules rules; lexertl::rules rules;
lexertl::state_machine state_machine; lexertl::state_machine state_machine;
@@ -123,6 +126,18 @@ int main() {
return 0; return 0;
} }
if (input == "@dp") {
debugParser = !debugParser;
std::cout << "Debugging for the parser: " << debugParser << std::endl;
continue;
}
if (input == "@dc") {
debugCodeGen = !debugCodeGen;
std::cout << "Debugging for the code generation: " << debugCodeGen << std::endl;
continue;
}
auto iter = input.begin(); auto iter = input.begin();
auto end = input.end(); auto end = input.end();
lexertl::smatch results(iter, end); lexertl::smatch results(iter, end);
@@ -140,7 +155,9 @@ int main() {
} }
} while (results.id != 0); } while (results.id != 0);
module->dump(); if (debugCodeGen) {
module->dump();
}
} }
scullyParserFree(parser, free); scullyParserFree(parser, free);