SyntaxElement.st
changeset 10021 af3ee96d9f16
child 10068 5ff502cb7f74
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SyntaxElement.st	Fri Jul 01 16:19:26 2011 +0200
@@ -0,0 +1,184 @@
+"
+ COPYRIGHT (c) 2006 by eXept Software AG
+	      All Rights Reserved
+
+ This software is furnished under a license and may be used
+ only in accordance with the terms of that license and with the
+ inclusion of the above copyright notice.   This software may not
+ be provided or otherwise made available to, or used by, any
+ other person.  No title to or ownership of the software is
+ hereby transferred.
+"
+"{ Package: 'stx:libtool' }"
+
+Magnitude subclass:#SyntaxElement
+	instanceVariableNames:'start stop type value next prev'
+	classVariableNames:''
+	poolDictionaries:''
+	category:'Interface-CodeView-Syntax'
+!
+
+!SyntaxElement class methodsFor:'documentation'!
+
+copyright
+"
+ COPYRIGHT (c) 2006 by eXept Software AG
+	      All Rights Reserved
+
+ This software is furnished under a license and may be used
+ only in accordance with the terms of that license and with the
+ inclusion of the above copyright notice.   This software may not
+ be provided or otherwise made available to, or used by, any
+ other person.  No title to or ownership of the software is
+ hereby transferred.
+"
+! !
+
+!SyntaxElement class methodsFor:'instance creation'!
+
+from: start to: stop
+
+    ^self new
+        start: start;
+        stop: stop.
+
+    "Created: / 14-02-2010 / 13:13:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+from: start to: stop type: type
+
+    ^self new
+        start: start;
+        stop: stop;
+        type: type
+
+    "Created: / 14-02-2010 / 14:09:20 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+from: start to: stop type: type value: value
+
+    ^self new
+        start: start;
+        stop: stop;
+        type: type;
+        value: value
+
+    "Created: / 14-02-2010 / 17:41:54 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!SyntaxElement methodsFor:'accessing'!
+
+next
+    ^ next
+!
+
+next:aSyntaxElement
+    next := aSyntaxElement.
+    next prev: self.
+
+    "Modified: / 14-02-2010 / 17:44:48 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+prev
+    ^ prev
+!
+
+prev:aSyntaxElement
+    prev := aSyntaxElement.
+!
+
+start
+    ^ start
+!
+
+start:anInteger
+    start := anInteger.
+!
+
+stop
+    ^ stop
+!
+
+stop:anInteger
+    stop := anInteger.
+!
+
+type
+    ^ type
+!
+
+type:aSymbol
+    type := aSymbol.
+!
+
+value
+    ^ value
+!
+
+value:anObject
+    value := anObject.
+! !
+
+!SyntaxElement methodsFor:'comparing'!
+
+< anObject
+
+    anObject isNumber ifTrue:[^stop < anObject].
+    anObject class == self class ifFalse:[^false].
+
+    ^stop < anObject start
+
+    "Created: / 14-02-2010 / 13:39:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+= anObject
+
+    anObject class == self class ifFalse:[^false].
+
+    ^start == (anObject start) and:
+        [stop == (anObject stop) and:
+            [type == (anObject type)]].
+
+    "Created: / 14-02-2010 / 13:33:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+hash
+
+    ^start hash bitXor:[stop hash bitXor:[type hash]].
+
+    "Created: / 14-02-2010 / 13:30:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!SyntaxElement methodsFor:'double dispatching'!
+
+lessFromInteger:anInteger
+
+    ^stop < anInteger
+
+    "Created: / 14-02-2010 / 13:49:50 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!SyntaxElement methodsFor:'printing & storing'!
+
+printOn:aStream
+    "append a printed representation if the receiver to the argument, aStream"
+
+    super printOn:aStream.
+    aStream nextPut:$(.
+    type printOn: aStream.
+    aStream nextPut:$:.    
+    value printOn:aStream.
+    aStream nextPut:$).
+
+    "Modified: / 25-06-2010 / 13:20:13 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!SyntaxElement class methodsFor:'documentation'!
+
+version_CVS
+    ^ '$Header: /cvs/stx/stx/libtool/SyntaxElement.st,v 1.1 2011-07-01 14:19:26 cg Exp $'
+!
+
+version_SVN
+    ^ '§Id: SyntaxElement.st 7582 2010-06-25 13:26:33Z vranyj1 §'
+! !