compiler/PPCCharSetPredicateNode.st
changeset 391 553a5456963b
child 392 9b297f0d949c
equal deleted inserted replaced
390:17ba167b8ee1 391:553a5456963b
       
     1 "{ Package: 'stx:goodies/petitparser/compiler' }"
       
     2 
       
     3 PPCAbstractPredicateNode subclass:#PPCCharSetPredicateNode
       
     4 	instanceVariableNames:''
       
     5 	classVariableNames:''
       
     6 	poolDictionaries:''
       
     7 	category:'PetitCompiler-Nodes'
       
     8 !
       
     9 
       
    10 PPCCharSetPredicateNode comment:''
       
    11 !
       
    12 
       
    13 !PPCCharSetPredicateNode methodsFor:'as yet unclassified'!
       
    14 
       
    15 asInlined
       
    16 	^ PPCInlineCharSetPredicateNode new
       
    17 		predicate: predicate;
       
    18 		name: name;
       
    19 		yourself
       
    20 !
       
    21 
       
    22 bodyOfPredicate: compiler
       
    23 	| classification classificationId |
       
    24 	classification := self extendClassification: predicate classification.
       
    25 	classificationId := compiler idFor: classification prefixed: #classification.
       
    26 	compiler addConstant: classification as: classificationId.
       
    27 	
       
    28 	compiler addOnLine: '(', classificationId, ' at: context peek asInteger)'.
       
    29 	compiler indent.
       
    30 	compiler add: 'ifFalse: [ self error: ''predicate not found'' ]'.
       
    31 	compiler add: 'ifTrue: [ context next ].'.
       
    32 	compiler dedent.
       
    33 !
       
    34 
       
    35 start: compiler id: id
       
    36 	compiler startMethod: id
       
    37 !
       
    38 
       
    39 stop: compiler
       
    40 	^ compiler stopMethod
       
    41 ! !
       
    42