compiler/PPCInlineNotLiteralNode.st
changeset 438 20598d7ce9fa
parent 437 54b3bc9e3987
child 442 d333233f7ebd
child 452 9f4558b3be66
equal deleted inserted replaced
437:54b3bc9e3987 438:20598d7ce9fa
     1 "{ Package: 'stx:goodies/petitparser/compiler' }"
       
     2 
       
     3 "{ NameSpace: Smalltalk }"
       
     4 
       
     5 PPCNotLiteralNode subclass:#PPCInlineNotLiteralNode
       
     6 	instanceVariableNames:''
       
     7 	classVariableNames:''
       
     8 	poolDictionaries:''
       
     9 	category:'PetitCompiler-Nodes'
       
    10 !
       
    11 
       
    12 !PPCInlineNotLiteralNode methodsFor:'as yet unclassified'!
       
    13 
       
    14 compileWith: compiler effect: effect id: id
       
    15 	| encodedLiteral size |
       
    16 	encodedLiteral := self encodeQuotes: literal.
       
    17 	size := literal size asString.
       
    18 	
       
    19 	compiler startInline: id.
       
    20 	compiler add: '((context peek: ', size, ') =#''', encodedLiteral, ''')'.
       
    21 	compiler indent.
       
    22 	compiler add: ' ifTrue: [ self error: ''', encodedLiteral, ' not expected'' ]'.
       
    23 	compiler add: ' ifFalse: [ nil ].'.
       
    24 	compiler dedent.
       
    25  ^ compiler stopInline.
       
    26 ! !
       
    27 
       
    28 !PPCInlineNotLiteralNode methodsFor:'printing'!
       
    29 
       
    30 asInlined
       
    31 	^ self
       
    32 !
       
    33 
       
    34 printOn: aStream
       
    35 	aStream nextPutAll: #inlined.
       
    36 	super printOn: aStream.
       
    37 ! !
       
    38