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