| @@ -813,16 +813,15 @@ def _make_parser_test(LEXER, PARSER): | |||||
| def test_templates(self): | def test_templates(self): | ||||
| g = _Lark(r""" | g = _Lark(r""" | ||||
| start: number_list "\n" number_dict | |||||
| start: "[" sep{NUMBER, ","} "]" | |||||
| sep{item, delim}: item (delim item)* | sep{item, delim}: item (delim item)* | ||||
| number_list: "[" sep{NUMBER, ","} "]" | |||||
| number_dict: "{" sep{(NUMBER ":" NUMBER), ";"} "}" // Just to test this | |||||
| NUMBER: /\d+/ | NUMBER: /\d+/ | ||||
| %ignore " " | %ignore " " | ||||
| """) | """) | ||||
| x = g.parse("[1, 2, 3, 4] {1:2, 3:4, 5:6}") | |||||
| print(x) | |||||
| x = g.parse("[1] {1:2}") | |||||
| x = g.parse("[1, 2, 3, 4]") | |||||
| self.assertSequenceEqual(x.children,['1', '2', '3', '4']) | |||||
| x = g.parse("[1]") | |||||
| self.assertSequenceEqual(x.children,['1']) | |||||
| print(x) | print(x) | ||||
| def test_token_collision_WS(self): | def test_token_collision_WS(self): | ||||