compiler/PPCNode.st
changeset 414 0eaf09920532
parent 392 9b297f0d949c
child 421 7e08b31e0dae
equal deleted inserted replaced
413:5389e6fbb3bc 414:0eaf09920532
     1 "{ Package: 'stx:goodies/petitparser/compiler' }"
     1 "{ Package: 'stx:goodies/petitparser/compiler' }"
     2 
     2 
     3 Object subclass:#PPCNode
     3 Object subclass:#PPCNode
     4 	instanceVariableNames:'contextFree name'
     4 	instanceVariableNames:'contextFree name firstSet firstCharSet'
     5 	classVariableNames:''
     5 	classVariableNames:''
     6 	poolDictionaries:''
     6 	poolDictionaries:''
     7 	category:'PetitCompiler-Nodes'
     7 	category:'PetitCompiler-Nodes'
     8 !
     8 !
       
     9 
       
    10 !PPCNode class methodsFor:'as yet unclassified'!
       
    11 
       
    12 new
       
    13 	^ self basicNew initialize
       
    14 ! !
     9 
    15 
    10 !PPCNode methodsFor:'accessing'!
    16 !PPCNode methodsFor:'accessing'!
    11 
    17 
    12 children
    18 children
    13 	^ #()
    19 	^ #()
    67 check
    73 check
    68 	"nothing to do"
    74 	"nothing to do"
    69 	^ nil
    75 	^ nil
    70 !
    76 !
    71 
    77 
       
    78 firstCharSetCached
       
    79 	firstCharSet ifNil: [ 
       
    80  		firstCharSet := self firstCharSet.
       
    81 	].
       
    82 	^ firstCharSet
       
    83 !
       
    84 
    72 firstSetSuchThat: block
    85 firstSetSuchThat: block
    73 	^ self firstSetSuchThat: block into: (OrderedCollection new) openSet: IdentitySet new.
    86 	^ self firstSetSuchThat: block into: (OrderedCollection new) openSet: IdentitySet new.
    74 !
    87 !
    75 
    88 
    76 firstSetSuchThat: block into: aCollection openSet: aSet
    89 firstSetSuchThat: block into: aCollection openSet: aSet
   111 ! !
   124 ! !
   112 
   125 
   113 !PPCNode methodsFor:'as yet unclassified'!
   126 !PPCNode methodsFor:'as yet unclassified'!
   114 
   127 
   115 firstSet
   128 firstSet
   116 	^ self firstSetSuchThat: [ :e | e isFirstSetTerminal ]
   129 	firstSet ifNil: [ 
       
   130 		firstSet := self firstSetSuchThat: [ :e | e isFirstSetTerminal ].
       
   131 	].
       
   132 	^ firstSet
   117 !
   133 !
   118 
   134 
   119 name
   135 name
   120 	^ name
   136 	^ name
   121 ! !
   137 ! !