(self)
| 325 | ) |
| 326 | |
| 327 | def test_repeat_1_simple(self) -> None: |
| 328 | grammar = """ |
| 329 | start: thing thing+ NEWLINE |
| 330 | thing: NUMBER |
| 331 | """ |
| 332 | parser_class = make_parser(grammar) |
| 333 | node = parse_string("1 2 3\n", parser_class) |
| 334 | self.assertEqual( |
| 335 | node, |
| 336 | [ |
| 337 | TokenInfo(NUMBER, string="1", start=(1, 0), end=(1, 1), line="1 2 3\n"), |
| 338 | [ |
| 339 | TokenInfo( |
| 340 | NUMBER, string="2", start=(1, 2), end=(1, 3), line="1 2 3\n" |
| 341 | ), |
| 342 | TokenInfo( |
| 343 | NUMBER, string="3", start=(1, 4), end=(1, 5), line="1 2 3\n" |
| 344 | ), |
| 345 | ], |
| 346 | TokenInfo( |
| 347 | NEWLINE, string="\n", start=(1, 5), end=(1, 6), line="1 2 3\n" |
| 348 | ), |
| 349 | ], |
| 350 | ) |
| 351 | with self.assertRaises(SyntaxError): |
| 352 | parse_string("1\n", parser_class) |
| 353 | |
| 354 | def test_repeat_1_complex(self) -> None: |
| 355 | grammar = """ |
nothing calls this directly
no test coverage detected