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

Unified Diff: tools/lexer_generator/rule_parser.py

Issue 152513004: Experimental parser: some tuple removal (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/parser
Patch Set: Created 6 years, 11 months 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/lexer_test.py ('k') | tools/lexer_generator/term_test.py » ('j') | 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 72d4e105bb716c36603f01fecc89e407cba6c323..1884df567cb49461d13415c2ab322c9df7a40e68 100644
--- a/tools/lexer_generator/rule_parser.py
+++ b/tools/lexer_generator/rule_parser.py
@@ -26,7 +26,7 @@
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import ply.yacc as yacc
-from automaton import Action
+from automaton import Term, Action
from rule_lexer import RuleLexer
from regex_parser import RegexParser
from nfa_builder import NfaBuilder
@@ -148,12 +148,9 @@ class RuleParser:
| IDENTIFIER LEFT_PARENTHESIS RIGHT_PARENTHESIS
| IDENTIFIER LEFT_PARENTHESIS action_params RIGHT_PARENTHESIS'''
if len(p) == 2 or len(p) == 4:
- p[0] = (p[1], None)
+ p[0] = Term(p[1])
elif len(p) == 5:
- if len(p[3]) == 1:
- p[0] = (p[1], p[3][0])
- else:
- p[0] = (p[1], p[3])
+ p[0] = Term(p[1], *p[3])
else:
raise Exception()
« no previous file with comments | « tools/lexer_generator/lexer_test.py ('k') | tools/lexer_generator/term_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698