compiler/tests/extras/PPCLRPState.st
changeset 515 b5316ef15274
child 534 a949c4fe44df
equal deleted inserted replaced
502:1e45d3c96ec5 515:b5316ef15274
       
     1 "{ Package: 'stx:goodies/petitparser/compiler/tests/extras' }"
       
     2 
       
     3 "{ NameSpace: Smalltalk }"
       
     4 
       
     5 PPCLRPContainedElement subclass:#PPCLRPState
       
     6 	instanceVariableNames:'name body nestedMachine startTime compareMachines'
       
     7 	classVariableNames:''
       
     8 	poolDictionaries:''
       
     9 	category:'PetitCompiler-Extras-Tests-LRP'
       
    10 !
       
    11 
       
    12 !PPCLRPState class methodsFor:'instance creation'!
       
    13 
       
    14 name: aString body: anArray
       
    15     |retval|
       
    16     retval := self new.
       
    17     retval name: aString.
       
    18     retval body: anArray.
       
    19     ^retval
       
    20 ! !
       
    21 
       
    22 !PPCLRPState methodsFor:'accessing'!
       
    23 
       
    24 body
       
    25     ^ body
       
    26 !
       
    27 
       
    28 body: anObject
       
    29     body := anObject.
       
    30     body do: [ :aBodyElement|
       
    31         (aBodyElement isKindOf: PPCLRPContainedElement)
       
    32             ifTrue: [aBodyElement container: self] ].
       
    33 !
       
    34 
       
    35 fullName
       
    36     ^self container fullName, '/', self name 
       
    37 !
       
    38 
       
    39 machines
       
    40     ^self body select:[:item | item class = PPCLRPMachine]
       
    41 !
       
    42 
       
    43 name
       
    44     ^ name
       
    45 !
       
    46 
       
    47 name: anObject
       
    48     name := anObject
       
    49 ! !
       
    50 
       
    51 !PPCLRPState methodsFor:'error handing'!
       
    52 
       
    53 onErrorNode: aBlock parser: aPPCLRPParser
       
    54 
       
    55     ^body do:[:aNode| aNode onErrorNode: aBlock parser: aPPCLRPParser]
       
    56 ! !
       
    57 
       
    58 !PPCLRPState methodsFor:'printing'!
       
    59 
       
    60 printOn: aStream
       
    61     aStream nextPutAll: 'PPCLRPState '.
       
    62     aStream nextPutAll: self name.
       
    63     aStream nextPutAll: ' : '.
       
    64     aStream nextPutAll: self body asString.
       
    65     
       
    66 ! !
       
    67 
       
    68 !PPCLRPState methodsFor:'visiting'!
       
    69 
       
    70 acceptVisitor: aPPCLRPNodeVisitor
       
    71     aPPCLRPNodeVisitor visitStateNode: self.
       
    72 ! !
       
    73