(self)
| 280 | ) |
| 281 | |
| 282 | def test_repeat_0_complex(self) -> None: |
| 283 | grammar = """ |
| 284 | start: term ('+' term)* NEWLINE |
| 285 | term: NUMBER |
| 286 | """ |
| 287 | parser_class = make_parser(grammar) |
| 288 | node = parse_string("1 + 2 + 3\n", parser_class) |
| 289 | self.assertEqual( |
| 290 | node, |
| 291 | [ |
| 292 | TokenInfo( |
| 293 | NUMBER, string="1", start=(1, 0), end=(1, 1), line="1 + 2 + 3\n" |
| 294 | ), |
| 295 | [ |
| 296 | [ |
| 297 | TokenInfo( |
| 298 | OP, string="+", start=(1, 2), end=(1, 3), line="1 + 2 + 3\n" |
| 299 | ), |
| 300 | TokenInfo( |
| 301 | NUMBER, |
| 302 | string="2", |
| 303 | start=(1, 4), |
| 304 | end=(1, 5), |
| 305 | line="1 + 2 + 3\n", |
| 306 | ), |
| 307 | ], |
| 308 | [ |
| 309 | TokenInfo( |
| 310 | OP, string="+", start=(1, 6), end=(1, 7), line="1 + 2 + 3\n" |
| 311 | ), |
| 312 | TokenInfo( |
| 313 | NUMBER, |
| 314 | string="3", |
| 315 | start=(1, 8), |
| 316 | end=(1, 9), |
| 317 | line="1 + 2 + 3\n", |
| 318 | ), |
| 319 | ], |
| 320 | ], |
| 321 | TokenInfo( |
| 322 | NEWLINE, string="\n", start=(1, 9), end=(1, 10), line="1 + 2 + 3\n" |
| 323 | ), |
| 324 | ], |
| 325 | ) |
| 326 | |
| 327 | def test_repeat_1_simple(self) -> None: |
| 328 | grammar = """ |
nothing calls this directly
no test coverage detected