47 |
45 |
48 compileWith: compiler effect: effect id: id |
46 compileWith: compiler effect: effect id: id |
49 | | |
47 | | |
50 |
48 |
51 compiler startMethod: id. |
49 compiler startMethod: id. |
52 compiler startTokenMode. |
|
53 compiler addVariable: 'start'. |
50 compiler addVariable: 'start'. |
54 compiler addVariable: 'end'. |
51 compiler addVariable: 'end'. |
55 |
52 |
56 " |
|
57 (compiler guards and: [ (guardSet := compiler guardCharSet: self) isNil not ]) ifTrue: [ |
|
58 guardSetId := (compiler idFor: guardSet prefixed: #guard). |
|
59 compiler addConstant: guardSet as: guardSetId. |
|
60 compiler add: 'context atEnd ifTrue: [ ^ self error ].'. |
|
61 compiler add: '(', guardSetId, ' value: context peek) ifFalse: [ ^ self error ].'. |
|
62 ]. |
|
63 " |
|
64 compiler add: 'start := context position + 1.'. |
53 compiler add: 'start := context position + 1.'. |
65 compiler call: (self child compileWith: compiler). |
54 compiler call: (self child compileWith: compiler). |
66 compiler add: 'error ifTrue: [ ^ self ].'. |
55 compiler add: 'error ifTrue: [ ^ self ].'. |
67 compiler add: 'end := context position.'. |
56 compiler add: 'end := context position.'. |
68 |
57 |
69 compiler add: '^ ', tokenClass asString, ' on: (context collection) |
58 compiler add: '^ ', tokenClass asString, ' on: (context collection) |
70 start: start |
59 start: start |
71 stop: end |
60 stop: end |
72 value: nil'. |
61 value: nil'. |
73 compiler stopTokenMode. |
|
74 ^ compiler stopMethod. |
62 ^ compiler stopMethod. |
75 ! |
63 ! |
76 |
64 |
77 prefix |
65 prefix |
78 ^ #token |
66 ^ #token |