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

Unified Diff: tools/lexer_generator/rule_parser_test.py

Issue 62103017: Experimental parser: rule 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/rule_parser.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_test.py
diff --git a/tools/lexer_generator/rule_parser_test.py b/tools/lexer_generator/rule_parser_test.py
index 00a9c1ca610ca334b1f82e731ad4d3a4263caa79..716a29b8f16a214df0cbb2f8a08aa81b36f1097b 100644
--- a/tools/lexer_generator/rule_parser_test.py
+++ b/tools/lexer_generator/rule_parser_test.py
@@ -40,12 +40,12 @@ class RuleParserTestCase(unittest.TestCase):
def test_basic(self):
self.parse('''
alias = /regex/;
-<cond1> /regex/ <<cond2>>
-<cond1> alias <<cond2>>
-<cond2> /regex/ {body}
-<cond2> alias {body}
-<cond3> /regex/ {body} <<cond1>>
-<cond3> alias {body} <<cond1>>''')
+<<cond1>> /regex/ <||cond2>
+<<cond1>> alias <||cond2>
+<<cond2>> /regex/ <|{body}|>
+<<cond2>> alias <|{body}|>
+<<cond3>> /regex/ <{body}||>
+<<cond3>> alias <{body}||>''')
self.assertTrue(len(self.state.aliases), 1)
self.assertTrue('alias' in self.state.aliases)
@@ -73,8 +73,8 @@ alias = /regex/;
def test_more_complicated(self):
self.parse('''
alias = "regex;with;semicolon";
-<cond1> "regex3}with}braces}" {body {with} braces }
-<cond1> "regex4{with{braces}" {body {with} braces }''')
+<<cond1>> "regex3}with}braces}" <|{body {with} braces }|>
+<<cond1>> "regex4{with{braces}" <{body {with} braces }||>''')
self.assertEquals(self.state.aliases['alias'],
RegexParser.parse("regex;with;semicolon"))
@@ -86,13 +86,13 @@ alias = "regex;with;semicolon";
# ('body', 'body {with} braces }'))
def test_body_with_if(self):
- self.parse('<cond> "regex" { if (foo) { bar } }')
+ self.parse('<<cond>> "regex" <|{ if (foo) { bar } }|>')
# self.assertEquals(
# self.parse['cond']['regex'],
# ('body', 'if (foo) { bar }'))
def test_regexp_with_count(self):
- self.parse('<cond> /regex{1,3}/ { if (foo) { bar } }')
+ self.parse('<<cond>> /regex{1,3}/ <|{ if (foo) { bar } }|>')
# self.assertEquals(
# self.parse['cond']['regex{1,3}'],
# ('body', 'if (foo) { bar }'))
« no previous file with comments | « tools/lexer_generator/rule_parser.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698