SyntaxElement.st
branchjv
changeset 15566 184cea584be5
parent 13178 c9bf900fe729
parent 15468 dfa524854f25
child 16797 4f240085a622
--- a/SyntaxElement.st	Sun Jan 12 23:30:25 2014 +0000
+++ b/SyntaxElement.st	Wed Apr 01 10:38:01 2015 +0100
@@ -1,3 +1,5 @@
+"{ Encoding: utf8 }"
+
 "
  COPYRIGHT (c) 2010 by Jan Vrany, SWING Research Group. CTU in Prague
               All Rights Reserved
@@ -25,8 +27,10 @@
 "
 "{ Package: 'stx:libtool' }"
 
+"{ NameSpace: Smalltalk }"
+
 Magnitude subclass:#SyntaxElement
-	instanceVariableNames:'start stop type value next prev'
+	instanceVariableNames:'start stop type value next prev node'
 	classVariableNames:''
 	poolDictionaries:''
 	category:'Interface-CodeView-Syntax'
@@ -131,12 +135,18 @@
 !
 
 next
+    <resource: #obsolete>
+    "/ please use nextElement: - this is easier to find in the browser
+
     ^ next
 !
 
 next:aSyntaxElement
+    <resource: #obsolete>
+    "/ please use nextElement: - this is easier to find in the browser
+
     next := aSyntaxElement.
-    next prev: self.
+    next previousElement: self.
 
     "Modified: / 14-02-2010 / 17:44:48 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
@@ -149,17 +159,31 @@
 
 nextElement:aSyntaxElement
     next := aSyntaxElement.
-    next prev: self.
+    next previousElement: self.
 
     "Modified: / 14-02-2010 / 17:44:48 / Jan Vrany <jan.vrany@fit.cvut.cz>"
     "Created: / 21-08-2011 / 09:47:15 / cg"
 !
 
+node
+    ^ node
+!
+
+node:something
+    node := something.
+!
+
 prev
+    <resource: #obsolete>
+    "/ please use nextElement: - this is easier to find in the browser
+
     ^ prev
 !
 
 prev:aSyntaxElement
+    <resource: #obsolete>
+    "/ please use nextElement: - this is easier to find in the browser
+
     prev := aSyntaxElement.
 !
 
@@ -240,7 +264,7 @@
 !SyntaxElement methodsFor:'double dispatching'!
 
 lessFromInteger:anInteger
-    ^stop < anInteger
+    ^ self stop < anInteger
 
     "Created: / 14-02-2010 / 13:49:50 / Jan Vrany <jan.vrany@fit.cvut.cz>"
     "Modified (format): / 27-07-2012 / 21:53:33 / cg"
@@ -273,6 +297,14 @@
     ^ false.
 !
 
+isInBlockScope:aBlockScopeOrNil
+    ^ node notNil and:[ node block == aBlockScopeOrNil ]
+!
+
+isInSameBlockScopeAs:anotherElement
+    ^  node notNil and:[ anotherElement isInBlockScope:node block ]
+!
+
 isSelector
     ^ type == #selector
 
@@ -285,32 +317,46 @@
     "Created: / 21-08-2011 / 09:31:20 / cg"
 !
 
-isVariable
-    ^ false
-!
-
 isVariableOrSelf
     ^ self isVariable or:[self isSelf]
 
     "Created: / 21-08-2011 / 09:31:33 / cg"
 ! !
 
+!SyntaxElement methodsFor:'testing'!
+
+isClassVariable
+    ^ node notNil and:[node isVariable and:[node isClassVariable]]
+!
+
+isGlobal
+    ^ node notNil and:[ node isGlobal ]
+!
+
+isInstanceVariable
+    ^ node notNil and:[node isVariable and:[node isInstanceVariable]]
+
+    "Created: / 01-07-2013 / 21:54:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+isVariable
+    ^ node notNil and:[ node isVariable ]
+
+    "Created: / 21-08-2011 / 09:09:00 / cg"
+    "Modified: / 16-02-2012 / 19:24:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
 !SyntaxElement class methodsFor:'documentation'!
 
 version
-    ^ '$Id: SyntaxElement.st 8048 2012-09-07 17:28:09Z vranyj1 $'
+    ^ '$Header: /cvs/stx/stx/libtool/SyntaxElement.st,v 1.11 2015-02-28 00:30:41 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libtool/SyntaxElement.st,v 1.7 2013-06-24 13:43:05 cg Exp $'
-!
-
-version_HG
-
-    ^ '$Changeset: <not expanded> $'
+    ^ '$Header: /cvs/stx/stx/libtool/SyntaxElement.st,v 1.11 2015-02-28 00:30:41 cg Exp $'
 !
 
 version_SVN
-    ^ '$Id: SyntaxElement.st,v 1.7 2013-06-24 13:43:05 cg Exp $'
+    ^ '$Id: SyntaxElement.st,v 1.11 2015-02-28 00:30:41 cg Exp $'
 ! !