compiler/PEGFsaPair.st
changeset 502 1e45d3c96ec5
child 515 b5316ef15274
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/compiler/PEGFsaPair.st	Fri Jul 24 15:06:54 2015 +0100
@@ -0,0 +1,54 @@
+"{ Package: 'stx:goodies/petitparser/compiler' }"
+
+"{ NameSpace: Smalltalk }"
+
+Object subclass:#PEGFsaPair
+	instanceVariableNames:'first second'
+	classVariableNames:''
+	poolDictionaries:''
+	category:'PetitCompiler-FSA'
+!
+
+!PEGFsaPair class methodsFor:'instance creation'!
+
+with: a with: b
+    ^ PEGFsaPair new
+        first: a;
+        second: b;
+        yourself
+! !
+
+!PEGFsaPair methodsFor:'accessing'!
+
+first
+    ^ first
+!
+
+first: anObject
+    first := anObject
+!
+
+second
+    ^ second
+!
+
+second: anObject
+    second := anObject
+! !
+
+!PEGFsaPair methodsFor:'comparing'!
+
+= anObject
+    (anObject == self) ifTrue: [ ^ true ].
+    (anObject class == self class) ifFalse: [ ^ false ].
+    
+    ((anObject first == first) and: [anObject second == second]) ifTrue: [ ^ true ].
+    ((anObject first == second) and: [anObject second == first]) ifTrue: [ ^ true ].
+    
+    ^ false	
+!
+
+hash
+    ^ first hash bitXor: second hash
+! !
+