equal
deleted
inserted
replaced
44 ! |
44 ! |
45 |
45 |
46 setUp |
46 setUp |
47 options := PPCCompilationOptions default |
47 options := PPCCompilationOptions default |
48 profile: true; |
48 profile: true; |
|
49 tokenize: true; |
49 yourself. |
50 yourself. |
50 |
51 |
51 configuration := PPCTokenizingConfiguration new. |
52 configuration := PPCConfiguration new. |
52 configuration context options: options. |
53 configuration context options: options. |
53 |
54 |
54 self cleanClass. |
55 self cleanClass. |
55 |
56 |
56 "Modified: / 28-08-2015 / 14:20:21 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
57 "Modified: / 04-09-2015 / 16:21:36 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
57 ! |
58 ! |
58 |
59 |
59 tearDown |
60 tearDown |
60 "self cleanClass" |
61 "self cleanClass" |
61 ! |
62 ! |
480 self assert: (parser scanner class methodDictionary includesKey: #scan_fooToken). |
481 self assert: (parser scanner class methodDictionary includesKey: #scan_fooToken). |
481 ! |
482 ! |
482 |
483 |
483 testWhitespace |
484 testWhitespace |
484 | token ws trimmingToken | |
485 | token ws trimmingToken | |
485 options inline: false. |
486 |
486 |
487 configuration removePass: PPCInliningVisitor. |
487 token := 'foo' asParser token. |
488 token := 'foo' asParser token. |
488 ws := #blank asParser star name: 'consumeWhitespace'; yourself. |
489 ws := #blank asParser star name: 'consumeWhitespace'; yourself. |
489 trimmingToken := ((ws, token, ws) ==> #second) |
490 trimmingToken := ((ws, token, ws) ==> #second) |
490 propertyAt: 'trimmingToken' put: true; |
491 propertyAt: 'trimmingToken' put: true; |
491 yourself. |
492 yourself. |
496 self assert: parser parse: ' foo '. |
497 self assert: parser parse: ' foo '. |
497 self assert: result first inputValue = 'foo'. |
498 self assert: result first inputValue = 'foo'. |
498 |
499 |
499 self assert: (context invocations select: [:e | e = #scan_consumeWhitespace ]) size = 3. |
500 self assert: (context invocations select: [:e | e = #scan_consumeWhitespace ]) size = 3. |
500 |
501 |
501 "Modified: / 04-09-2015 / 06:13:18 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
502 "Modified: / 04-09-2015 / 15:02:02 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
502 ! |
503 ! |
503 |
504 |
504 testWhitespace2 |
505 testWhitespace2 |
505 | token ws trimmingToken | |
506 | token ws trimmingToken | |
506 options inline: false. |
507 |
507 |
508 configuration removePass: PPCInliningVisitor. |
508 token := 'foo' asParser token. |
509 token := 'foo' asParser token. |
509 ws := #blank asParser star name: 'consumeWhitespace'; yourself. |
510 ws := #blank asParser star name: 'consumeWhitespace'; yourself. |
510 trimmingToken := ((ws, token, ws) ==> #second) |
511 trimmingToken := ((ws, token, ws) ==> #second) |
511 propertyAt: 'trimmingToken' put: true; |
512 propertyAt: 'trimmingToken' put: true; |
512 yourself. |
513 yourself. |
518 self assert: result first inputValue = 'foo'. |
519 self assert: result first inputValue = 'foo'. |
519 self assert: result second inputValue = 'foo'. |
520 self assert: result second inputValue = 'foo'. |
520 |
521 |
521 self assert: (context invocations select: [:e | e = #scan_consumeWhitespace ]) size = 4. |
522 self assert: (context invocations select: [:e | e = #scan_consumeWhitespace ]) size = 4. |
522 |
523 |
523 "Modified: / 04-09-2015 / 06:13:43 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
524 "Modified: / 04-09-2015 / 15:02:08 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
524 ! |
525 ! |
525 |
526 |
526 testWhitespace3 |
527 testWhitespace3 |
527 | token ws trimmingToken | |
528 | token ws trimmingToken | |
528 options inline: false. |
529 |
529 |
530 configuration removePass: PPCInliningVisitor. |
530 token := 'foo' asParser token. |
531 token := 'foo' asParser token. |
531 ws := #blank asParser star name: 'consumeWhitespace'; yourself. |
532 ws := #blank asParser star name: 'consumeWhitespace'; yourself. |
532 trimmingToken := ((ws, token, ws) ==> #second) |
533 trimmingToken := ((ws, token, ws) ==> #second) |
533 propertyAt: 'trimmingToken' put: true; |
534 propertyAt: 'trimmingToken' put: true; |
534 yourself. |
535 yourself. |
541 self assert: result second inputValue = 'foo'. |
542 self assert: result second inputValue = 'foo'. |
542 self assert: result third inputValue = 'foo'. |
543 self assert: result third inputValue = 'foo'. |
543 |
544 |
544 self assert: (context invocations select: [:e | e = #scan_consumeWhitespace ]) size = 5. |
545 self assert: (context invocations select: [:e | e = #scan_consumeWhitespace ]) size = 5. |
545 |
546 |
546 "Modified: / 04-09-2015 / 06:13:49 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
547 "Modified: / 04-09-2015 / 15:02:19 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
547 ! ! |
548 ! ! |
548 |
549 |