28 |
28 |
29 !PPCAbstractCharacterNode methodsFor:'analysis'! |
29 !PPCAbstractCharacterNode methodsFor:'analysis'! |
30 |
30 |
31 firstCharParser |
31 firstCharParser |
32 ^ character asParser |
32 ^ character asParser |
|
33 ! |
|
34 |
|
35 firstCharSet |
|
36 ^ PPCharSetPredicate on: [:e | e = character ] |
33 ! ! |
37 ! ! |
34 |
38 |
35 !PPCAbstractCharacterNode methodsFor:'compiling'! |
39 !PPCAbstractCharacterNode methodsFor:'compiling'! |
36 |
40 |
37 body: compiler |
41 body: compiler |
38 | id | |
42 | id | |
39 |
43 |
40 character ppcPrintable ifTrue: [ |
44 character ppcPrintable ifTrue: [ |
41 id := character storeString. |
45 id := character storeString |
42 ] ifFalse: [ |
46 ] ifFalse: [ |
43 id := compiler idFor: character prefixed: #char. |
47 id := compiler idFor: character prefixed: #char. |
44 compiler addConstant: (Character value: character asInteger) as: id . |
48 compiler addConstant: (Character value: character asInteger) as: id . |
45 ]. |
49 ]. |
46 |
50 |
47 compiler add: '(context peek == ', id, ')'. |
51 compiler add: '(context peek == ', id, ')'. |
48 compiler indent. |
52 compiler indent. |
49 compiler add: 'ifFalse: [ self error: ''', character asInteger asString, ' expected'' at: context position ] '. |
53 compiler add: 'ifFalse: [ self error: ''', character asInteger asString, ' expected'' at: context position ] '. |
50 compiler add: 'ifTrue: [ context next ].'. |
54 compiler add: 'ifTrue: [ context next ].'. |
51 compiler dedent. |
55 compiler dedent. |
52 |
|
53 "Modified: / 30-10-2014 / 10:59:57 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
54 ! |
56 ! |
55 |
57 |
56 compileWith: compiler effect: effect id: id |
58 compileWith: compiler effect: effect id: id |
57 self start: compiler id: id. |
59 self start: compiler id: id. |
58 self body: compiler. |
60 self body: compiler. |
59 ^ self stop: compiler. |
61 ^ self stop: compiler. |
60 ! |
62 ! |
61 |
63 |
62 compileWith: compiler id: id |
64 compileWith: compiler id: id. |
63 self start: compiler. |
65 self start: compiler. |
64 self body: compiler. |
66 self body: compiler. |
65 ^ compiler stopMethod. |
67 ^ compiler stopMethod. |
66 ! ! |
68 ! ! |
67 |
69 |
68 !PPCAbstractCharacterNode class methodsFor:'documentation'! |
70 !PPCAbstractCharacterNode class methodsFor:'documentation'! |
69 |
71 |
70 version_HG |
72 version_HG |