compiler/PEGFsaInterpret.st
changeset 518 a6d8b93441b0
parent 516 3b81c9e53352
equal deleted inserted replaced
517:9a7fa841f12e 518:a6d8b93441b0
    49     ]
    49     ]
    50 !
    50 !
    51 
    51 
    52 reportStates: states
    52 reportStates: states
    53     debug ifTrue: [ 
    53     debug ifTrue: [ 
    54         Transcript show: 'states: '; show: states asString; cr
    54         Transcript show: 'states: '; show: states printString; cr
    55     ]
    55     ]
       
    56 
       
    57     "Modified: / 17-08-2015 / 13:37:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    56 ! !
    58 ! !
    57 
    59 
    58 !PEGFsaInterpret methodsFor:'initialization'!
    60 !PEGFsaInterpret methodsFor:'initialization'!
    59 
    61 
    60 initialize
    62 initialize
   160 !
   162 !
   161 
   163 
   162 return: states
   164 return: states
   163     | return |
   165     | return |
   164     return := IdentityDictionary new.
   166     return := IdentityDictionary new.
   165     retvals keysAndValuesRemove: [ :key :record | record position isNil ].
   167     retvals keys do:[:key | 
       
   168         | value |
   166 
   169 
       
   170         value := retvals at: key.
       
   171         (value position isNil) ifTrue:[ 
       
   172             retvals removeKey: key
       
   173         ].
       
   174     ].
   167     retvals keysAndValuesDo: [ :key :value |
   175     retvals keysAndValuesDo: [ :key :value |
   168         return at: key put: value position
   176         return at: key put: value position
   169     ].
   177     ].
   170     ^ return
   178     ^ return
       
   179 
       
   180     "Modified: / 17-08-2015 / 13:45:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   171 !
   181 !
   172 
   182 
   173 sortedTransitionsFor: state
   183 sortedTransitionsFor: state
   174     self error: 'deprecated!!'.
   184     self error: 'deprecated!!'.
   175     ^ (fsa transitionsFor: state) asOrderedCollection
   185     ^ (fsa transitionsFor: state) asOrderedCollection