equal
deleted
inserted
replaced
9 category:'PetitCompiler-Nodes' |
9 category:'PetitCompiler-Nodes' |
10 ! |
10 ! |
11 |
11 |
12 !PPCTokenNode methodsFor:'accessing'! |
12 !PPCTokenNode methodsFor:'accessing'! |
13 |
13 |
14 initialize |
14 prefix |
15 super initialize. |
15 ^ #token |
16 ! |
|
17 |
|
18 rewrite: changeStatus |
|
19 | | |
|
20 super rewrite: changeStatus. |
|
21 |
|
22 (self allNodes anySatisfy: [ :node | node asFast ~= node ]) ifTrue: [ |
|
23 changeStatus change. |
|
24 self replace: child with: (child transform: [:node | node asFast]). |
|
25 ] |
|
26 ! |
16 ! |
27 |
17 |
28 tokenClass |
18 tokenClass |
29 |
19 |
30 ^ tokenClass |
20 ^ tokenClass |
31 ! |
21 ! |
32 |
22 |
33 tokenClass: anObject |
23 tokenClass: anObject |
34 |
24 |
35 tokenClass := anObject |
25 tokenClass := anObject |
36 ! ! |
|
37 |
|
38 !PPCTokenNode methodsFor:'as yet unclassified'! |
|
39 |
|
40 compileWith: compiler effect: effect id: id |
|
41 | | |
|
42 |
|
43 compiler startMethod: id. |
|
44 compiler addVariable: 'start'. |
|
45 compiler addVariable: 'end'. |
|
46 |
|
47 compiler add: 'start := context position + 1.'. |
|
48 compiler call: (self child compileWith: compiler). |
|
49 compiler add: 'error ifTrue: [ ^ self ].'. |
|
50 compiler add: 'end := context position.'. |
|
51 |
|
52 compiler add: '^ ', tokenClass asString, ' on: (context collection) |
|
53 start: start |
|
54 stop: end |
|
55 value: nil'. |
|
56 ^ compiler stopMethod. |
|
57 ! |
26 ! |
58 |
27 |
59 prefix |
28 tokenType |
60 ^ #token |
29 ^ self identityHash printString |
61 ! ! |
30 ! ! |
62 |
31 |
63 !PPCTokenNode methodsFor:'comparing'! |
32 !PPCTokenNode methodsFor:'comparing'! |
64 |
33 |
65 = anotherNode |
34 = anotherNode |
69 |
38 |
70 hash |
39 hash |
71 ^ super hash bitXor: tokenClass hash |
40 ^ super hash bitXor: tokenClass hash |
72 ! ! |
41 ! ! |
73 |
42 |
|
43 !PPCTokenNode methodsFor:'visiting'! |
|
44 |
|
45 accept: visitor |
|
46 ^ visitor visitTokenNode: self |
|
47 ! ! |
|
48 |