*** empty log message ***
authorclaus
Wed, 30 Mar 1994 12:07:33 +0200
changeset 17 f06d70d785dc
parent 16 1abb86677ea6
child 18 343ca93df0e0
*** empty log message ***
AssignNd.st
AssignmentNode.st
Scanner.st
UnaryNd.st
UnaryNode.st
--- a/AssignNd.st	Fri Feb 25 14:16:27 1994 +0100
+++ b/AssignNd.st	Wed Mar 30 12:07:33 1994 +0200
@@ -22,7 +22,7 @@
 COPYRIGHT (c) 1989 by Claus Gittinger
               All Rights Reserved
 
-$Header: /cvs/stx/stx/libcomp/Attic/AssignNd.st,v 1.4 1993-12-11 01:05:14 claus Exp $
+$Header: /cvs/stx/stx/libcomp/Attic/AssignNd.st,v 1.5 1994-03-30 10:06:50 claus Exp $
 '!
 
 !AssignmentNode class methodsFor:'instance creation'!
@@ -40,11 +40,23 @@
     ^ value
 ! !
 
+!AssignmentNode methodsFor:'queries'!
+
+isAssignment
+    "return true, if this is a node for an assignment"
+
+    ^ true
+! !
+
 !AssignmentNode methodsFor:'accessing'!
 
 variable:v expression:e
     variable := v.
     expression := e
+!
+
+expression
+    ^ expression
 ! !
 
 !AssignmentNode methodsFor:'code generation'!
--- a/AssignmentNode.st	Fri Feb 25 14:16:27 1994 +0100
+++ b/AssignmentNode.st	Wed Mar 30 12:07:33 1994 +0200
@@ -22,7 +22,7 @@
 COPYRIGHT (c) 1989 by Claus Gittinger
               All Rights Reserved
 
-$Header: /cvs/stx/stx/libcomp/AssignmentNode.st,v 1.4 1993-12-11 01:05:14 claus Exp $
+$Header: /cvs/stx/stx/libcomp/AssignmentNode.st,v 1.5 1994-03-30 10:06:50 claus Exp $
 '!
 
 !AssignmentNode class methodsFor:'instance creation'!
@@ -40,11 +40,23 @@
     ^ value
 ! !
 
+!AssignmentNode methodsFor:'queries'!
+
+isAssignment
+    "return true, if this is a node for an assignment"
+
+    ^ true
+! !
+
 !AssignmentNode methodsFor:'accessing'!
 
 variable:v expression:e
     variable := v.
     expression := e
+!
+
+expression
+    ^ expression
 ! !
 
 !AssignmentNode methodsFor:'code generation'!
--- a/Scanner.st	Fri Feb 25 14:16:27 1994 +0100
+++ b/Scanner.st	Wed Mar 30 12:07:33 1994 +0200
@@ -16,7 +16,8 @@
                               tokenName tokenLineNr
                               thisChar peekChar
                               requestor exitBlock
-                              errorFlag ignoreErrors
+                              errorFlag 
+                              ignoreErrors ignoreWarnings
                               saveComments currentComments'
           classVariableNames:'typeArray ActionArray'
             poolDictionaries:''
@@ -29,7 +30,7 @@
              All Rights Reserved
 
 Scanner reads from a stream and returns individual smalltalk tokens
-$Header: /cvs/stx/stx/libcomp/Scanner.st,v 1.6 1994-02-25 12:50:14 claus Exp $
+$Header: /cvs/stx/stx/libcomp/Scanner.st,v 1.7 1994-03-30 10:07:33 claus Exp $
 '!
 
 !Scanner class methodsFor:'instance creation'!
@@ -54,6 +55,7 @@
     currentComments := nil.
     saveComments := false.
     ignoreErrors := false.
+    ignoreWarnings := false.
 
     ActionArray isNil ifTrue:[
         ActionArray := Array new:256.
@@ -102,6 +104,7 @@
     currentComments := nil.
     saveComments := false.
     ignoreErrors := false.
+    ignoreWarnings := false.
 !
 
 notifying:anObject
@@ -116,6 +119,12 @@
     ignoreErrors := true
 !
 
+ignoreWarnings
+    "turn off notification of warnings"
+
+    ignoreWarnings := true
+!
+
 backupPosition
     "if reading from a stream, at the end we might have read
      one token too many"
@@ -131,7 +140,9 @@
     "show an errormessage on the Transcript"
 
     ignoreErrors ifFalse:[
-        Transcript showCr:(pos printString , ' ' , aMessage)
+        Smalltalk silentLoading == true ifFalse:[
+            Transcript showCr:(pos printString , ' ' , aMessage)
+        ]
     ]
 !
 
@@ -154,7 +165,9 @@
      Return the result passed back by the requestor."
 
     requestor isNil ifTrue:[
-        self showErrorMessage:aMessage position:position.
+        ignoreWarnings ifFalse:[
+            self showErrorMessage:aMessage position:position.
+        ].
         ^ false
     ].
     ^ requestor warning:aMessage position:position to:endPos
@@ -198,6 +211,49 @@
     ^ self warning:aMessage position:tokenPosition
 ! !
 
+!Scanner methodsFor:'general scanning'!
+
+scanPositionsFor:aTokenString inString:aSourceString
+    "scan aSourceString for occurrances of aTokenString.
+     Return a collection of start positions.
+     Added for VW compatibility (to support syntax-highlight)."
+
+    |searchType searchName searchValue positions t|
+
+    "
+     first, look what kind of token we have to search for
+    "
+    self initializeFor:(ReadStream on:aTokenString).
+    self nextToken.
+    searchType := tokenType.
+    searchName := tokenName.
+    searchValue := tokenValue.
+
+    "
+     start the real work ...
+    "
+    self initializeFor:(ReadStream on:aSourceString).
+    positions := OrderedCollection new.
+
+    [(t := self nextToken) ~~ #EOF] whileTrue:[
+        searchType == t ifTrue:[
+            (searchName isNil or:[tokenName = searchName]) ifTrue:[
+                (searchValue isNil or:[tokenValue = searchValue]) ifTrue:[
+                    positions add:tokenPosition.
+                ]
+            ]
+        ]
+    ].
+
+    ^ positions
+
+    "
+     Scanner new scanPositionsFor:'hello' inString:'foo bar hello baz hello'
+     Scanner new scanPositionsFor:'3.14' inString:'foo 3.145 bar hello 3.14 baz hello 3.14'
+     Scanner new scanPositionsFor:'16' inString:'foo 16 bar hello 16r10 baz hello 2r10000'
+    "
+! !
+
 !Scanner methodsFor:'reading next token'!
 
 skipComment
@@ -210,10 +266,11 @@
     thisChar := source peek.
 
     "special ST/X addition:
-     a $/ right after initial double quote makes it an up-to-end-of-line comment,
+     a $/ right after the initial double quote makes it an up-to-end-of-line comment,
      which is very useful to comment out parts of filed-in source code.
-     Since this is non standard, use it in very rare cases only. 
-     (maybe the upcoming ansi-standard adds something similar)"
+     Since this is non-standard, use it in very rare cases only. 
+     (maybe the upcoming ansi-standard adds something similar - in this case, I will
+      change it without notice)"
 
     thisChar == $/ ifTrue:[
         [thisChar notNil and:[thisChar ~~ Character cr]] whileTrue:[
@@ -392,7 +449,13 @@
     (nextChar == $r) ifTrue:[
         radix := value.
         source next.
+        s := 1.
+        source peek == $- ifTrue:[
+            source next.
+            s := -1
+        ].
         value := Integer readFrom:source radix:radix.
+        value := value * s.
         nextChar := source peek
     ].
     (nextChar == $.) ifTrue:[
--- a/UnaryNd.st	Fri Feb 25 14:16:27 1994 +0100
+++ b/UnaryNd.st	Wed Mar 30 12:07:33 1994 +0200
@@ -22,7 +22,7 @@
 COPYRIGHT (c) 1989 by Claus Gittinger
               All Rights Reserved
 
-$Header: /cvs/stx/stx/libcomp/Attic/UnaryNd.st,v 1.6 1994-02-25 12:49:52 claus Exp $
+$Header: /cvs/stx/stx/libcomp/Attic/UnaryNd.st,v 1.7 1994-03-30 10:07:15 claus Exp $
 '!
 
 !UnaryNode class methodsFor:'instance creation'!
@@ -122,9 +122,13 @@
 
     ((selector = 'self') or:[
      (selector = 'super') or:[
-     (Smalltalk includesKey:selector)]]) ifTrue:[
+     (selector = 'thisContext') or:[
+     (selector = 'true') or:[
+     (selector = 'false') or:[
+     (Smalltalk includesKey:selector)]]]]]) ifTrue:[
         ^ 'funny selector; possible missing ''.'' or keyword'
     ].
+
     "more to come ..."
     ^ nil
 ! !
--- a/UnaryNode.st	Fri Feb 25 14:16:27 1994 +0100
+++ b/UnaryNode.st	Wed Mar 30 12:07:33 1994 +0200
@@ -22,7 +22,7 @@
 COPYRIGHT (c) 1989 by Claus Gittinger
               All Rights Reserved
 
-$Header: /cvs/stx/stx/libcomp/UnaryNode.st,v 1.6 1994-02-25 12:49:52 claus Exp $
+$Header: /cvs/stx/stx/libcomp/UnaryNode.st,v 1.7 1994-03-30 10:07:15 claus Exp $
 '!
 
 !UnaryNode class methodsFor:'instance creation'!
@@ -122,9 +122,13 @@
 
     ((selector = 'self') or:[
      (selector = 'super') or:[
-     (Smalltalk includesKey:selector)]]) ifTrue:[
+     (selector = 'thisContext') or:[
+     (selector = 'true') or:[
+     (selector = 'false') or:[
+     (Smalltalk includesKey:selector)]]]]]) ifTrue:[
         ^ 'funny selector; possible missing ''.'' or keyword'
     ].
+
     "more to come ..."
     ^ nil
 ! !