Revision: 17738
Author: [email protected]
Date: Thu Nov 14 11:48:38 2013 UTC
Log: Experimental lexer generator: build fixes.
BUG=
[email protected]
Review URL: https://codereview.chromium.org/61023006
http://code.google.com/p/v8/source/detail?r=17738
Modified:
/branches/experimental/parser/tools/lexer_generator/code_generator.py
/branches/experimental/parser/tools/lexer_generator/rule_parser.py
=======================================
--- /branches/experimental/parser/tools/lexer_generator/code_generator.py
Thu Nov 14 10:58:08 2013 UTC
+++ /branches/experimental/parser/tools/lexer_generator/code_generator.py
Thu Nov 14 11:48:38 2013 UTC
@@ -121,16 +121,25 @@
code += CodeGenerator.dfa_state_to_code(state, start_node_number)
return code
code = dfa.visit_all_states(f, code)
+
+ default_action_code = ''
+ if rule_processor.default_action:
+ if rule_processor.default_action.type() == 'push_token':
+ default_action_code = '''
+default_action:
+ //fprintf(stderr, "default action\\n");
+ PUSH_TOKEN(Token::%s)
+ goto code_%s;''' % (rule_processor.default_action.data(),
start_node_number)
+ else:
+ raise Exception("Default action type %s not supported" %
action.type())
+
code += '''
CHECK(false);
-default_action:
- //fprintf(stderr, "default action\\n");
- %s
- goto code_%s;
+%s
return 0;
}
}
}
-''' % (rule_processor.default_action, start_node_number)
+''' % default_action_code
return code
=======================================
--- /branches/experimental/parser/tools/lexer_generator/rule_parser.py Thu
Nov 14 10:46:34 2013 UTC
+++ /branches/experimental/parser/tools/lexer_generator/rule_parser.py Thu
Nov 14 11:48:38 2013 UTC
@@ -312,4 +312,6 @@
# build the automata
for rule_name, graph in rule_map.items():
self.__automata[rule_name] = RuleProcessor.Automata(builder, graph)
- self.default_action = parser_state.rules['default']['default_action']
+
+ default_action = parser_state.rules['default']['default_action']
+ self.default_action = Action(default_action[0], default_action[1]) if
default_action else None
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.