compiler/PPCAbstractLiteralNode.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Mon, 03 Nov 2014 11:30:59 +0000
changeset 407 a0e6299c7337
parent 392 9b297f0d949c
child 414 0eaf09920532
permissions -rw-r--r--
Removed unused / obsolete methods from PPToken * remove PPToken class>>on:start:stop * remove PPToken>>initializeOn:start:stop

"{ Package: 'stx:goodies/petitparser/compiler' }"

PPCNode subclass:#PPCAbstractLiteralNode
	instanceVariableNames:'literal'
	classVariableNames:''
	poolDictionaries:''
	category:'PetitCompiler-Nodes'
!

!PPCAbstractLiteralNode methodsFor:'accessing'!

acceptsEpsilon
	^ literal size = 0
!

firstCharParser
	^ literal first asParser
!

literal
	
	^ literal
!

literal: anObject
	
	literal := anObject
!

prefix
	^ #lit
! !

!PPCAbstractLiteralNode methodsFor:'compiling'!

encodeQuotes: string
	| x s |
	s := WriteStream on: ''.
	1 to: string size do: [ :i|
		s nextPut: (x := string at: i).
		x = $' ifTrue: [ s nextPut: x ].
	].
	^ s contents
! !