compiler/PPCChoiceNode.st
changeset 452 9f4558b3be66
parent 438 20598d7ce9fa
child 464 f6d77fee9811
equal deleted inserted replaced
438:20598d7ce9fa 452:9f4558b3be66
    10 !
    10 !
    11 
    11 
    12 !PPCChoiceNode methodsFor:'accessing'!
    12 !PPCChoiceNode methodsFor:'accessing'!
    13 
    13 
    14 prefix
    14 prefix
    15 	^ #ch
    15     ^ #ch
    16 ! !
    16 ! !
    17 
    17 
    18 !PPCChoiceNode methodsFor:'analysis'!
    18 !PPCChoiceNode methodsFor:'analysis'!
    19 
    19 
    20 acceptsEpsilon
    20 acceptsEpsilon
    21 	^ self acceptsEpsilonOpenSet: IdentitySet new.
    21     ^ self acceptsEpsilonOpenSet: IdentitySet new.
    22 !
    22 !
    23 
    23 
    24 acceptsEpsilonOpenSet: set
    24 acceptsEpsilonOpenSet: set
    25 	set add: self.
    25     set add: self.
    26 	^ self children anySatisfy: [:e | e acceptsEpsilonOpenSet: set ].
    26     ^ self children anySatisfy: [:e | e acceptsEpsilonOpenSet: set ].
       
    27 !
       
    28 
       
    29 check
       
    30     ^ self children asIdentitySet size = children size ifFalse: [ 
       
    31         Transcript cr; show: 'WARNING: Identical children in choice!!'; cr.
       
    32         nil.
       
    33     ] ifTrue: [ nil ]
       
    34 !
       
    35 
       
    36 recognizedSentencesPrim
       
    37     | retval |
       
    38     (self children anySatisfy: [ :child | child hasFiniteLanguage not ]) ifTrue: [ ^ #() ].
       
    39     
       
    40     retval := Set new.
       
    41     self children do: [ : child |
       
    42         retval addAll: child recognizedSentences.
       
    43     ].
       
    44     ^ retval asArray
    27 ! !
    45 ! !
    28 
    46 
    29 !PPCChoiceNode methodsFor:'visiting'!
    47 !PPCChoiceNode methodsFor:'visiting'!
    30 
    48 
    31 accept: visitor
    49 accept: visitor
    32 	^ visitor visitChoiceNode: self
    50     ^ visitor visitChoiceNode: self
    33 ! !
    51 ! !
    34 
    52