Revision: 17745
Author: [email protected]
Date: Thu Nov 14 13:45:27 2013 UTC
Log: Experimental lexer generator: Force code actions.
I.e., always execute "code" type actions when in a state.
Down to 18 failures.
BUG=
[email protected]
Review URL: https://codereview.chromium.org/72613005
http://code.google.com/p/v8/source/detail?r=17745
Modified:
/branches/experimental/parser/tools/lexer_generator/code_generator.py
=======================================
--- /branches/experimental/parser/tools/lexer_generator/code_generator.py
Thu Nov 14 12:43:42 2013 UTC
+++ /branches/experimental/parser/tools/lexer_generator/code_generator.py
Thu Nov 14 13:45:27 2013 UTC
@@ -68,6 +68,11 @@
state.node_number())
action = state.action()
+ if (action and action.type() != 'terminate' and
+ action.type() != 'terminate_illegal' and action.type() != 'code'
and
+ action.type() != 'push_token' and action.type() != 'skip'):
+ raise Exception("unknown type %s" % action.type())
+
if action:
if action.type() == 'terminate':
code += 'PUSH_TOKEN(Token::EOS); return 0;'
@@ -78,6 +83,8 @@
elif action.type() == 'skip':
code += 'SKIP(); goto code_start;'
return code
+ elif action.type() == 'code':
+ code += '%s\n' % action.data()
code += '''
//fprintf(stderr, "char at hand is %c (%d)\\n", yych, yych);\n'''
@@ -91,15 +98,12 @@
''' % s.node_number()
if action:
- if action.type() == 'code':
- code += '%s\n\ngoto code_%s;\n' % (action.data(),
- start_node_number)
- elif action.type() == 'push_token':
+ if action.type() == 'push_token':
content = 'PUSH_TOKEN(Token::%s);' % action.data()
code += '%s\ngoto code_%s;\n' % (content,
start_node_number)
- else:
- raise Exception("unknown type %s" % action.type())
+ elif action.type() == 'code':
+ code += 'goto code_start;'
else:
code += 'goto default_action;'
return code
--
--
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.