"{ Package: 'stx:goodies/petitparser/compiler' }"
"{ NameSpace: Smalltalk }"
PPCAbstractLiteralNode subclass:#PPCLiteralNode
instanceVariableNames:''
classVariableNames:''
poolDictionaries:''
category:'PetitCompiler-Nodes'
!
!PPCLiteralNode methodsFor:'compiling'!
compileWith: compiler effect: effect id: id
| encodedLiteral |
encodedLiteral := self encodeQuotes: literal.
compiler startMethod: id.
compiler addVariable: 'retval'.
compiler addVariable: 'position'.
compiler add: 'position := context position.'.
compiler add: 'retval := context next: ', literal size asString, '.'.
compiler add: 'retval = #''', encodedLiteral, ''' ifTrue: [ ^ #''', encodedLiteral, '''].'.
compiler add: 'context position: position.'.
compiler add: '^ self error: ''', encodedLiteral, ' expected'' at: position'.
^ compiler stopMethod.
! !
!PPCLiteralNode methodsFor:'optimizing'!
asInlined
^ PPCInlineLiteralNode new
literal: literal;
name: name;
yourself
! !