Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(137)

Unified Diff: tools/lexer_generator/rule_parser.py

Issue 85853003: Experimental parser: simplify goto logic (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/parser
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/lexer_generator/dfa_optimizer.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/lexer_generator/rule_parser.py
diff --git a/tools/lexer_generator/rule_parser.py b/tools/lexer_generator/rule_parser.py
index df19a3108bfcfca911512519d49de1861fc5ca5f..e91a4fb857c44387a43184789ca33700eab6cf03 100644
--- a/tools/lexer_generator/rule_parser.py
+++ b/tools/lexer_generator/rule_parser.py
@@ -134,7 +134,7 @@ class RuleParser:
def p_action_part(self, p):
'''action_part : code
- | identifier_action'''
+ | identifier_action'''
p[0] = p[1]
def p_maybe_transition(self, p):
@@ -150,7 +150,10 @@ class RuleParser:
if len(p) == 2 or len(p) == 4:
p[0] = (p[1], None)
elif len(p) == 5:
- p[0] = (p[1], p[3])
+ if len(p[3]) == 1:
+ p[0] = (p[1], p[3][0])
+ else:
+ p[0] = (p[1], p[3])
else:
raise Exception()
@@ -158,9 +161,9 @@ class RuleParser:
'''action_params : IDENTIFIER
| IDENTIFIER COMMA action_params'''
if len(p) == 2:
- p[0] = p[1]
+ p[0] = (p[1],)
elif len(p) == 4:
- p[0] = (p[1], p[3])
+ p[0] = tuple(([p[1]] + list(p[3])))
else:
raise Exception()
« no previous file with comments | « tools/lexer_generator/dfa_optimizer.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698