Distinguish separators from main tokens via a property on transitions

It was incorrect to store it as a property on the lexical states themselves
This commit is contained in:
Max Brunsfeld 2016-05-19 16:25:44 -07:00
parent 59712ec492
commit a3679fbb1f
13 changed files with 157 additions and 153 deletions

View file

@ -328,7 +328,10 @@ class CCodeGenerator {
}
void add_advance_action(const AdvanceAction &action) {
line("ADVANCE(" + to_string(action.state_index) + ");");
if (action.in_main_token)
line("ADVANCE(" + to_string(action.state_index) + ");");
else
line("SKIP(" + to_string(action.state_index) + ");");
}
void add_accept_token_action(const AcceptTokenAction &action) {
@ -529,6 +532,10 @@ class CCodeGenerator {
}
}
string _boolean(bool value) {
return value ? "true" : "false";
}
bool has_sanitized_name(string name) {
for (const auto &pair : sanitized_names)
if (pair.second == name)