equal
deleted
inserted
replaced
|
1 "{ Package: 'stx:goodies/petitparser/compiler' }" |
|
2 |
|
3 PPCAbstractLiteralNode subclass:#PPCNotLiteralNode |
|
4 instanceVariableNames:'' |
|
5 classVariableNames:'' |
|
6 poolDictionaries:'' |
|
7 category:'PetitCompiler-Nodes' |
|
8 ! |
|
9 |
|
10 PPCNotLiteralNode comment:'' |
|
11 ! |
|
12 |
|
13 !PPCNotLiteralNode methodsFor:'accessing'! |
|
14 |
|
15 asInlined |
|
16 ^ PPCInlineNotLiteralNode new |
|
17 name: name; |
|
18 literal: literal; |
|
19 yourself |
|
20 ! |
|
21 |
|
22 firstCharParser |
|
23 ^ literal first asParser |
|
24 ! |
|
25 |
|
26 literal |
|
27 |
|
28 ^ literal |
|
29 ! |
|
30 |
|
31 literal: anObject |
|
32 |
|
33 literal := anObject |
|
34 ! |
|
35 |
|
36 prefix |
|
37 ^ #notLit |
|
38 ! ! |
|
39 |
|
40 !PPCNotLiteralNode methodsFor:'as yet unclassified'! |
|
41 |
|
42 compileWith: compiler effect: effect id: id |
|
43 | encodedLiteral size | |
|
44 encodedLiteral := self encodeQuotes: literal. |
|
45 size := literal size asString. |
|
46 |
|
47 compiler startMethod: id. |
|
48 compiler add: '((context peek: ', size, ') =#''', encodedLiteral, ''')'. |
|
49 compiler indent. |
|
50 compiler add: ' ifTrue: [ self error: ''', encodedLiteral, ' not expected'' ]'. |
|
51 compiler add: ' ifFalse: [ nil ].'. |
|
52 compiler dedent. |
|
53 ^ compiler stopMethod. |
|
54 ! ! |
|
55 |