equal
deleted
inserted
replaced
321 self assert: result isEmpty. |
321 self assert: result isEmpty. |
322 self assert: context tokenReads size = 1. |
322 self assert: context tokenReads size = 1. |
323 |
323 |
324 ! |
324 ! |
325 |
325 |
|
326 testCompileStar3 |
|
327 parser := 'a' asParser trimmingToken star, 'b' asParser trimmingToken |
|
328 compileWithConfiguration: configuration. |
|
329 |
|
330 self assert: parser parse: 'ab'. |
|
331 self assert: parser parse: 'aaab'. |
|
332 self assert: result size = 2. |
|
333 self assert: result first size = 3. |
|
334 |
|
335 self assert: parser fail: 'ac'. |
|
336 ! |
|
337 |
326 testCompileTokenComplex2 |
338 testCompileTokenComplex2 |
327 | a b argumentsWith | |
339 | a b argumentsWith | |
328 "based on the PPSmalltlakGrammar>>blockArgumentsWith" |
340 "based on the PPSmalltlakGrammar>>blockArgumentsWith" |
329 a := $| asParser smalltalkToken |
341 a := $| asParser smalltalkToken |
330 yourself. |
342 yourself. |
335 yourself. |
347 yourself. |
336 |
348 |
337 parser := argumentsWith compileWithConfiguration: configuration. |
349 parser := argumentsWith compileWithConfiguration: configuration. |
338 self assert: parser parse: '|'. |
350 self assert: parser parse: '|'. |
339 |
351 |
340 self assert: parser parse: ']'. |
352 self assert: parser parse: ']' end: 0. |
341 ! |
353 ! |
342 |
354 |
343 testCompileTokenComplex3 |
355 testCompileTokenComplex3 |
344 | choice1 choice2 a1 b1 a2 b2 tricky | |
356 | choice1 choice2 a1 b1 a2 b2 tricky | |
345 a1 := $| asParser token |
357 a1 := $| asParser token |
461 compileWithConfiguration: configuration. |
473 compileWithConfiguration: configuration. |
462 |
474 |
463 self assert: parser parse: 'foofoo'. |
475 self assert: parser parse: 'foofoo'. |
464 self assert: result first inputValue = 'foo'. |
476 self assert: result first inputValue = 'foo'. |
465 self assert: result second inputValue = 'foo'. |
477 self assert: result second inputValue = 'foo'. |
466 self assert: (parser class methodDictionary includesKey: #fooToken). |
478 self assert: (parser scanner class methodDictionary includesKey: #fooToken). |
|
479 self assert: (parser scanner class methodDictionary includesKey: #scan_fooToken). |
467 ! |
480 ! |
468 |
481 |
469 testWhitespace |
482 testWhitespace |
470 | token ws trimmingToken | |
483 | token ws trimmingToken | |
471 configuration arguments inline: false. |
484 configuration arguments inline: false. |
480 compileWithConfiguration: configuration. |
493 compileWithConfiguration: configuration. |
481 |
494 |
482 self assert: parser parse: ' foo '. |
495 self assert: parser parse: ' foo '. |
483 self assert: result first inputValue = 'foo'. |
496 self assert: result first inputValue = 'foo'. |
484 |
497 |
485 self assert: (context invocations select: [:e | e = #consumeWhitespace ]) size = 3. |
498 self assert: (context invocations select: [:e | e = #scan_consumeWhitespace ]) size = 3. |
486 ! |
499 ! |
487 |
500 |
488 testWhitespace2 |
501 testWhitespace2 |
489 | token ws trimmingToken | |
502 | token ws trimmingToken | |
490 configuration arguments inline: false. |
503 configuration arguments inline: false. |
500 |
513 |
501 self assert: parser parse: ' foo foo '. |
514 self assert: parser parse: ' foo foo '. |
502 self assert: result first inputValue = 'foo'. |
515 self assert: result first inputValue = 'foo'. |
503 self assert: result second inputValue = 'foo'. |
516 self assert: result second inputValue = 'foo'. |
504 |
517 |
505 self assert: (context invocations select: [:e | e = #consumeWhitespace ]) size = 4. |
518 self assert: (context invocations select: [:e | e = #scan_consumeWhitespace ]) size = 4. |
506 ! |
519 ! |
507 |
520 |
508 testWhitespace3 |
521 testWhitespace3 |
509 | token ws trimmingToken | |
522 | token ws trimmingToken | |
510 configuration arguments inline: false. |
523 configuration arguments inline: false. |
521 self assert: parser parse: ' foo foo foo '. |
534 self assert: parser parse: ' foo foo foo '. |
522 self assert: result first inputValue = 'foo'. |
535 self assert: result first inputValue = 'foo'. |
523 self assert: result second inputValue = 'foo'. |
536 self assert: result second inputValue = 'foo'. |
524 self assert: result third inputValue = 'foo'. |
537 self assert: result third inputValue = 'foo'. |
525 |
538 |
526 self assert: (context invocations select: [:e | e = #consumeWhitespace ]) size = 5. |
539 self assert: (context invocations select: [:e | e = #scan_consumeWhitespace ]) size = 5. |
527 ! ! |
540 ! ! |
528 |
541 |