equal
deleted
inserted
replaced
1 "{ Package: 'stx:goodies/petitparser/compiler' }" |
|
2 |
|
3 "{ NameSpace: Smalltalk }" |
|
4 |
|
5 PPCLiteralNode subclass:#PPCInlineLiteralNode |
|
6 instanceVariableNames:'' |
|
7 classVariableNames:'' |
|
8 poolDictionaries:'' |
|
9 category:'PetitCompiler-Nodes' |
|
10 ! |
|
11 |
|
12 !PPCInlineLiteralNode methodsFor:'compiling'! |
|
13 |
|
14 compileWith: compiler effect: effect id: id |
|
15 | encodedLiteral | |
|
16 |
|
17 encodedLiteral := self encodeQuotes: literal. |
|
18 compiler startInline: id. |
|
19 compiler add: '((context peek: ', literal size asString, ') = #''', encodedLiteral, ''')'. |
|
20 compiler indent. |
|
21 compiler add: ' ifTrue: [ context skip: ', literal size asString, '. #''', encodedLiteral, ''']'. |
|
22 compiler add: ' ifFalse: [ self error: ''', encodedLiteral, ' expected'' ].'. |
|
23 compiler dedent. |
|
24 ^ compiler stopInline. |
|
25 ! ! |
|
26 |
|
27 !PPCInlineLiteralNode methodsFor:'printing'! |
|
28 |
|
29 asInlined |
|
30 ^ self |
|
31 ! |
|
32 |
|
33 printOn: aStream |
|
34 aStream nextPutAll: '#inline'. |
|
35 super printOn: aStream |
|
36 ! ! |
|
37 |
|