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

Unified Diff: tools/lexer_generator/automata_test.py

Issue 73143002: Experimental parser: cleanup after grammar refactor (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/action_test.py ('k') | tools/lexer_generator/automaton.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/lexer_generator/automata_test.py
diff --git a/tools/lexer_generator/automata_test.py b/tools/lexer_generator/automata_test.py
index 70711f33088d158fc0124d00bf50bdfb0d62d266..44fa5c3071dffe1e0118d11dbd72c82ab96d580c 100644
--- a/tools/lexer_generator/automata_test.py
+++ b/tools/lexer_generator/automata_test.py
@@ -40,6 +40,9 @@ def build_automata(string):
dfa = dfa_from_nfa(nfa)
return (nfa, dfa, dfa.minimize())
+def simple_action(string):
+ return Action(None, (string, None))
+
class AutomataTestCase(unittest.TestCase):
# (pattern, should match, should not match)
@@ -81,8 +84,8 @@ class AutomataTestCase(unittest.TestCase):
automaton.to_dot()
def test_actions(self):
- left_action = Action("LEFT_ACTION")
- right_action = Action("RIGHT_ACTION")
+ left_action = simple_action("LEFT_ACTION")
+ right_action = simple_action("RIGHT_ACTION")
left = RegexParser.parse("left")
right = RegexParser.parse("right")
left = NfaBuilder.add_action(left, left_action)
@@ -96,9 +99,9 @@ class AutomataTestCase(unittest.TestCase):
for i, action in enumerate(actions):
self.assertEqual(action, expected[i])
def verify_miss(string, expected):
- verify(string, expected + [Action('MISS',)])
+ verify(string, expected + [Dfa.miss_action()])
def verify_hit(string, expected):
- verify(string, expected + [Action('TERMINATE',)])
+ verify(string, expected + [Dfa.terminal_action()])
(l, r) = left_action, right_action
verify_hit("left", [l])
verify_miss("lefta", [l])
« no previous file with comments | « tools/lexer_generator/action_test.py ('k') | tools/lexer_generator/automaton.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698