compiler/PEGFsaPair.st
changeset 502 1e45d3c96ec5
child 515 b5316ef15274
equal deleted inserted replaced
464:f6d77fee9811 502:1e45d3c96ec5
       
     1 "{ Package: 'stx:goodies/petitparser/compiler' }"
       
     2 
       
     3 "{ NameSpace: Smalltalk }"
       
     4 
       
     5 Object subclass:#PEGFsaPair
       
     6 	instanceVariableNames:'first second'
       
     7 	classVariableNames:''
       
     8 	poolDictionaries:''
       
     9 	category:'PetitCompiler-FSA'
       
    10 !
       
    11 
       
    12 !PEGFsaPair class methodsFor:'instance creation'!
       
    13 
       
    14 with: a with: b
       
    15     ^ PEGFsaPair new
       
    16         first: a;
       
    17         second: b;
       
    18         yourself
       
    19 ! !
       
    20 
       
    21 !PEGFsaPair methodsFor:'accessing'!
       
    22 
       
    23 first
       
    24     ^ first
       
    25 !
       
    26 
       
    27 first: anObject
       
    28     first := anObject
       
    29 !
       
    30 
       
    31 second
       
    32     ^ second
       
    33 !
       
    34 
       
    35 second: anObject
       
    36     second := anObject
       
    37 ! !
       
    38 
       
    39 !PEGFsaPair methodsFor:'comparing'!
       
    40 
       
    41 = anObject
       
    42     (anObject == self) ifTrue: [ ^ true ].
       
    43     (anObject class == self class) ifFalse: [ ^ false ].
       
    44     
       
    45     ((anObject first == first) and: [anObject second == second]) ifTrue: [ ^ true ].
       
    46     ((anObject first == second) and: [anObject second == first]) ifTrue: [ ^ true ].
       
    47     
       
    48     ^ false	
       
    49 !
       
    50 
       
    51 hash
       
    52     ^ first hash bitXor: second hash
       
    53 ! !
       
    54