59 classification at: index put: (aBlock |
59 classification at: index put: (aBlock |
60 value: (Character value: index)) ]. |
60 value: (Character value: index)) ]. |
61 ! |
61 ! |
62 |
62 |
63 compileAny: compiler |
63 compileAny: compiler |
64 compiler add: '(context atEnd not)'. |
64 compiler code: '(context atEnd not)'. |
65 ! |
65 ! |
66 |
66 |
67 compileCharacter: compiler |
67 compileCharacter: compiler |
68 self assert: (classification select: [ :e | e ]) size = 1. |
68 self assert: (classification select: [ :e | e ]) size = 1. |
69 |
69 |
70 classification keysAndValuesDo: [ :index :value | value ifTrue: [ |
70 classification keysAndValuesDo: [ :index :value | value ifTrue: [ |
71 (index > 32 and: [ index < 127 ]) ifTrue: [ |
71 (index > 32 and: [ index < 127 ]) ifTrue: [ |
72 compiler add: '(context peek == ', (Character value: index) storeString, ')' |
72 compiler code: '(context peek == ', (Character value: index) storeString, ')' |
73 ] ifFalse: [ |
73 ] ifFalse: [ |
74 id := compiler idFor: (Character value: index) defaultName: #character. |
74 id := compiler idFor: (Character value: index) defaultName: #character. |
75 compiler addConstant: (Character value: index) as: id. |
75 compiler addConstant: (Character value: index) as: id. |
76 compiler add: '(context peek = ', id, ')'. |
76 compiler code: '(context peek = ', id, ')'. |
77 ] |
77 ] |
78 ] ]. |
78 ] ]. |
79 ! |
79 ! |
80 |
80 |
81 compileGuard: compiler id: symbol |
81 compileGuard: compiler id: symbol |
82 self id: symbol. |
82 self id: symbol. |
83 ^ self compileGuard: compiler |
83 ^ self compileGuard: compiler |
84 ! |
84 ! |
85 |
85 |
86 compileMessage: compiler |
86 compileMessage: compiler |
87 compiler add: '(context peek ', message, ')' |
87 compiler code: '(context peek ', message, ')' |
88 ! |
88 ! |
89 |
89 |
90 testAny |
90 testAny |
91 ^ classification allSatisfy: [ :e | e ]. |
91 ^ classification allSatisfy: [ :e | e ]. |
92 ! |
92 ! |
110 | array | |
110 | array | |
111 self assert: id isNotNil. |
111 self assert: id isNotNil. |
112 |
112 |
113 array := ((classification asOrderedCollection) addLast: false; yourself) asArray. |
113 array := ((classification asOrderedCollection) addLast: false; yourself) asArray. |
114 compiler addConstant: array as: id. |
114 compiler addConstant: array as: id. |
115 compiler add: '(', id, ' at: context peek asInteger)'. |
115 compiler code: '(', id, ' at: context peek asInteger)'. |
116 ! |
116 ! |
117 |
117 |
118 compileGuard: compiler |
118 compileGuard: compiler |
119 self assert: self makesSense description: 'No Guard could be compiled'. |
119 self assert: self makesSense description: 'No Guard could be compiled'. |
120 self assert: id notNil. |
120 self assert: id notNil. |