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