compiler/PEGFsaEpsilonTransition.st
changeset 515 b5316ef15274
equal deleted inserted replaced
502:1e45d3c96ec5 515:b5316ef15274
       
     1 "{ Package: 'stx:goodies/petitparser/compiler' }"
       
     2 
       
     3 "{ NameSpace: Smalltalk }"
       
     4 
       
     5 PEGFsaTransition subclass:#PEGFsaEpsilonTransition
       
     6 	instanceVariableNames:''
       
     7 	classVariableNames:''
       
     8 	poolDictionaries:''
       
     9 	category:'PetitCompiler-FSA'
       
    10 !
       
    11 
       
    12 !PEGFsaEpsilonTransition methodsFor:'gt'!
       
    13 
       
    14 gtName
       
    15     | gtName |
       
    16     gtName := '<eps>'.
       
    17     priority < 0 ifTrue: [ gtName := gtName, ',', priority asString ].
       
    18     ^ gtName
       
    19 ! !
       
    20 
       
    21 !PEGFsaEpsilonTransition methodsFor:'modifications'!
       
    22 
       
    23 decreasePriorityBy: value
       
    24     "
       
    25         My value has special semantics, when I have negative priority, all the reachable states and transitions should
       
    26         be decreased by that value.
       
    27         
       
    28         In case I am preceded by another epsilon with negative priority, I do not decrease my value, that would multiply
       
    29         the the negative priority effect....
       
    30     "
       
    31     ^ self
       
    32 ! !
       
    33 
       
    34 !PEGFsaEpsilonTransition methodsFor:'set operations'!
       
    35 
       
    36 intersection: anotherState
       
    37     ^ anotherState
       
    38 ! !
       
    39 
       
    40 !PEGFsaEpsilonTransition methodsFor:'testing'!
       
    41 
       
    42 isEpsilon
       
    43     ^ true
       
    44 !
       
    45 
       
    46 isEpsilonTransition
       
    47     ^ true
       
    48 ! !
       
    49