equal
deleted
inserted
replaced
26 _self generate. |
26 _self generate. |
27 ]. |
27 ]. |
28 configuration arguments: arguments. |
28 configuration arguments: arguments. |
29 |
29 |
30 |
30 |
31 compiler := PPCCompiler new. |
31 compiler := PPCCodeGen new. |
32 compiler arguments: arguments. |
32 compiler arguments: arguments. |
33 |
33 |
34 visitor := PPCCodeGenerator new. |
34 visitor := PPCCodeGenerator new. |
35 visitor compiler: compiler. |
35 visitor compiler: compiler. |
36 visitor arguments: arguments. |
36 visitor arguments: arguments. |
138 self assert:parser parse:'ab' to:'ab'. |
138 self assert:parser parse:'ab' to:'ab'. |
139 self assert:parser parse:'cz' to:'cz'. |
139 self assert:parser parse:'cz' to:'cz'. |
140 self assert:parser fail:''. |
140 self assert:parser fail:''. |
141 |
141 |
142 "Created: / 16-06-2015 / 07:22:19 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
142 "Created: / 16-06-2015 / 07:22:19 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
143 ! |
|
144 |
|
145 testActionNode7 |
|
146 node := ((#letter asParser , #letter asParser) |
|
147 ==> [:nodes | self createStringFromCharacters: nodes ]) asCompilerTree. |
|
148 node child markForInline. |
|
149 |
|
150 self compileTree:node. |
|
151 |
|
152 self assert:parser parse:'ab' to:'ab'. |
|
153 self assert:parser parse:'cz' to:'cz'. |
|
154 self assert:parser fail:''. |
|
155 |
|
156 "Created: / 27-07-2015 / 15:48:14 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
143 ! |
157 ! |
144 |
158 |
145 testAnyNode |
159 testAnyNode |
146 node := PPCForwardNode new |
160 node := PPCForwardNode new |
147 child: PPCAnyNode new; |
161 child: PPCAnyNode new; |
458 literal: 'foo'; |
472 literal: 'foo'; |
459 yourself. |
473 yourself. |
460 self compileTree: node. |
474 self compileTree: node. |
461 |
475 |
462 self assert: parser class methodDictionary size = 1. |
476 self assert: parser class methodDictionary size = 1. |
463 self assert: (parser class methodDictionary includesKey: #lit_0). |
477 self assert: (parser class methodDictionary includesKey: #lit). |
464 self assert: parser parse: 'foo' to: 'foo'. |
478 self assert: parser parse: 'foo' to: 'foo'. |
465 self assert: parser parse: 'foobar' to: 'foo' end: 3. |
479 self assert: parser parse: 'foobar' to: 'foo' end: 3. |
466 self assert: parser fail: 'boo'. |
480 self assert: parser fail: 'boo'. |
467 ! |
481 ! |
468 |
482 |
1106 self assert: parser parse: 'foo' to: $f end: 1. |
1120 self assert: parser parse: 'foo' to: $f end: 1. |
1107 self assert: parser parse: 'bar' to: $b end: 1. |
1121 self assert: parser parse: 'bar' to: $b end: 1. |
1108 self assert: parser parse: '' to: nil. |
1122 self assert: parser parse: '' to: nil. |
1109 ! ! |
1123 ! ! |
1110 |
1124 |
|
1125 !PPCCodeGeneratorTest methodsFor:'utilities'! |
|
1126 |
|
1127 createStringFromCharacters: characters |
|
1128 ^ String withAll: characters |
|
1129 |
|
1130 "Created: / 27-07-2015 / 15:47:35 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1131 ! ! |
|
1132 |