Revision: 17766
Author:   [email protected]
Date:     Thu Nov 14 21:09:14 2013 UTC
Log:      Experimental parser: small cleanup

[email protected]

BUG=

Review URL: https://codereview.chromium.org/70103016
http://code.google.com/p/v8/source/detail?r=17766

Modified:
 /branches/experimental/parser/src/lexer/lexer_py.re
 /branches/experimental/parser/tools/lexer_generator/automaton.py
 /branches/experimental/parser/tools/lexer_generator/dfa.py
 /branches/experimental/parser/tools/lexer_generator/rule_parser.py

=======================================
--- /branches/experimental/parser/src/lexer/lexer_py.re Thu Nov 14 20:25:22 2013 UTC +++ /branches/experimental/parser/src/lexer/lexer_py.re Thu Nov 14 21:09:14 2013 UTC
@@ -208,7 +208,7 @@
 "*/"             <|skip|>
 # TODO find a way to generate the below rule
 /\*[^\/]/        <||continue>
-line_terminator  <|push_line_terminator|continue>
+line_terminator  <push_line_terminator||continue>
 catch_all        <||continue>

 <<HtmlComment>>
@@ -216,5 +216,5 @@
 # TODO find a way to generate the below rules
 /--./            <||continue>
 /-./             <||continue>
-line_terminator  <|push_line_terminator|continue>
+line_terminator  <push_line_terminator||continue>
 catch_all <||continue>
=======================================
--- /branches/experimental/parser/tools/lexer_generator/automaton.py Thu Nov 14 20:51:16 2013 UTC +++ /branches/experimental/parser/tools/lexer_generator/automaton.py Thu Nov 14 21:09:14 2013 UTC
@@ -37,6 +37,7 @@
         continue
       assert type(action) == TupleType and len(action)
       assert action[0] != None
+    assert entry_action or match_action
     self.__entry_action = entry_action
     self.__match_action = match_action
     self.__precedence = precedence
=======================================
--- /branches/experimental/parser/tools/lexer_generator/dfa.py Thu Nov 14 20:51:16 2013 UTC +++ /branches/experimental/parser/tools/lexer_generator/dfa.py Thu Nov 14 21:09:14 2013 UTC
@@ -218,10 +218,9 @@
       action = state.action()
       all_keys.append(state.key_iter())
       if action:
-        # TODO add this back
-        # assert state in self.__terminal_set
         if state not in terminal_set:
-          action = "nonterminal action " + str(action)
+          assert action.entry_action()
+          action = ("nonterminal action", action)
       elif state in terminal_set:
         action = "terminal_set"
       if not action in action_map:
=======================================
--- /branches/experimental/parser/tools/lexer_generator/rule_parser.py Thu Nov 14 20:25:22 2013 UTC +++ /branches/experimental/parser/tools/lexer_generator/rule_parser.py Thu Nov 14 21:09:14 2013 UTC
@@ -148,7 +148,7 @@
     if len(p) == 2:
       p[0] = (p[1], None)
     elif len(p) == 5:
-      p[0] = (p[1], p[2])
+      p[0] = (p[1], p[3])
     else:
       raise Exception()

@@ -319,7 +319,7 @@
         assert catch_all == (None, None, 'continue'), "unimplemented"
         graphs.append(NfaBuilder.add_continue(NfaBuilder.catch_all()))
       graph = NfaBuilder.or_graphs(graphs)
-      rule_map[k] = graph
+      rule_map[subgraph] = graph
     # process first the subgraphs, then the default graph
     for k, v in parser_state.rules.items():
       if k == 'default': continue

--
--
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.

Reply via email to