compiler/PPCStarAnyNode.st
changeset 391 553a5456963b
child 392 9b297f0d949c
equal deleted inserted replaced
390:17ba167b8ee1 391:553a5456963b
       
     1 "{ Package: 'stx:goodies/petitparser/compiler' }"
       
     2 
       
     3 PPCNode subclass:#PPCStarAnyNode
       
     4 	instanceVariableNames:''
       
     5 	classVariableNames:''
       
     6 	poolDictionaries:''
       
     7 	category:'PetitCompiler-Nodes'
       
     8 !
       
     9 
       
    10 PPCStarAnyNode comment:''
       
    11 !
       
    12 
       
    13 !PPCStarAnyNode methodsFor:'as yet unclassified'!
       
    14 
       
    15 acceptsEpsilon
       
    16 	^ true
       
    17 !
       
    18 
       
    19 acceptsEpsilonOpenSet: set
       
    20 	^ true
       
    21 !
       
    22 
       
    23 compileWith: compiler effect: effect id: id
       
    24 	compiler startMethod: id.
       
    25 	compiler addVariable: 'retval size'.
       
    26 	compiler add: 'size := context size - context position.'.
       
    27 	compiler add: 'retval := Array new: size.'.
       
    28 	compiler add: '(1 to: size) do: [ :e | retval at: e put: context next ].'.
       
    29 	compiler add: '^ retval'.
       
    30  ^ compiler stopMethod.
       
    31 !
       
    32 
       
    33 prefix
       
    34 	^ #starAny
       
    35 ! !
       
    36