separated instance creation from scanning
authorpenk
Wed, 29 Jan 2003 18:58:13 +0100
changeset 1362 b51578f0182e
parent 1361 c428c186c1e3
child 1363 2ce77081f79a
separated instance creation from scanning and refactored to allow for adjustments (allowSqueakExtensions) between creation and scanning.
Scanner.st
--- a/Scanner.st	Tue Jan 28 20:49:58 2003 +0100
+++ b/Scanner.st	Wed Jan 29 18:58:13 2003 +0100
@@ -18,11 +18,11 @@
 		requestor exitBlock errorFlag ignoreErrors ignoreWarnings
 		saveComments currentComments collectedSource
 		allowUnderscoreInIdentifier allowDollarInIdentifier
-		allowOldStyleAssignment scanColonAsKeyword warnSTXSpecialComment
-		warnUnderscoreInIdentifier warnOldStyleAssignment
-		warnCommonMistakes outStream outCol warnSTXNameSpaceUse
-		warnPossibleIncompatibilities warnDollarInIdentifier
-		inArrayLiteral'
+		allowOldStyleAssignment scanColonAsKeyword allowSqueakExtensions
+		warnSTXSpecialComment warnUnderscoreInIdentifier
+		warnOldStyleAssignment warnCommonMistakes outStream outCol
+		warnSTXNameSpaceUse warnPossibleIncompatibilities
+		warnDollarInIdentifier inArrayLiteral'
 	classVariableNames:'TypeArray ActionArray Warnings EmptySourceNotificationSignal
 		WarnSTXSpecials WarnOldStyleAssignment WarnUnderscoreInIdentifier
 		WarnCommonMistakes WarnPossibleIncompatibilities
@@ -279,7 +279,6 @@
         Compiler allowDollarInIdentifiers:false"
 
     AllowDollarInIdentifier := aBoolean.
-    self setupActions
 
     "Created: 7.9.1997 / 01:34:49 / cg"
     "Modified: 7.9.1997 / 01:39:30 / cg"
@@ -297,7 +296,6 @@
         Compiler allowDolphinComputedArrays:true"
 
     AllowDolphinExtensions := aBoolean.
-    self setupActions
 
     "
      self allowDolphinExtensions:true
@@ -333,7 +331,6 @@
     "
 
     AllowQualifiedNames := aBoolean.
-    self setupActions
 
     "
      self allowQualifiedNames:true
@@ -353,7 +350,6 @@
         Compiler allowSqueakComputedArrays:true"
 
     AllowSqueakExtensions := aBoolean.
-    self setupActions
 
     "
      self allowSqueakExtensions:true
@@ -681,6 +677,80 @@
     ^ tokenValue
 
     "Created: / 21.12.2001 / 22:38:08 / cg"
+!
+
+warnDollarInIdentifier
+    "return the value of the instance variable 'warnDollarInIdentifier' (automatically generated)"
+
+    ^ warnDollarInIdentifier
+!
+
+warnPossibleIncompatibilities
+    "return the value of the instance variable 'warnPossibleIncompatibilities' (automatically generated)"
+
+    ^ warnPossibleIncompatibilities
+!
+
+warnSTXNameSpaceUse
+    "return the value of the instance variable 'warnSTXNameSpaceUse' (automatically generated)"
+
+    ^ warnSTXNameSpaceUse
+! !
+
+!Scanner methodsFor:'accessing-flags'!
+
+allowDollarInIdentifier
+    "return the value of the instance variable 'allowDollarInIdentifier' (automatically generated)"
+
+    ^ allowDollarInIdentifier
+!
+
+allowOldStyleAssignment
+    "return the value of the instance variable 'allowOldStyleAssignment' (automatically generated)"
+
+    ^ allowOldStyleAssignment
+!
+
+allowSqueakExtensions
+    ^ allowSqueakExtensions
+!
+
+allowSqueakExtensions:aBoolean
+    allowSqueakExtensions := aBoolean
+!
+
+allowUnderscoreInIdentifier
+    "return the value of the instance variable 'allowUnderscoreInIdentifier' (automatically generated)"
+
+    ^ allowUnderscoreInIdentifier
+!
+
+scanColonAsKeyword
+    ^ scanColonAsKeyword
+!
+
+warnCommonMistakes
+    "return the value of the instance variable 'warnCommonMistakes' (automatically generated)"
+
+    ^ warnCommonMistakes
+!
+
+warnOldStyleAssignment
+    "return the value of the instance variable 'warnOldStyleAssignment' (automatically generated)"
+
+    ^ warnOldStyleAssignment
+!
+
+warnSTXSpecialComment
+    "return the value of the instance variable 'warnSTXSpecialComment' (automatically generated)"
+
+    ^ warnSTXSpecialComment
+!
+
+warnUnderscoreInIdentifier
+    "return the value of the instance variable 'warnUnderscoreInIdentifier' (automatically generated)"
+
+    ^ warnUnderscoreInIdentifier
 ! !
 
 !Scanner methodsFor:'directives'!
@@ -1215,6 +1285,7 @@
     allowUnderscoreInIdentifier := AllowUnderscoreInIdentifier.
     allowDollarInIdentifier := AllowDollarInIdentifier.
     allowOldStyleAssignment := AllowOldStyleAssignment.
+    allowSqueakExtensions := AllowSqueakExtensions.
 
     "/ not used here, but eases subclassing for other languages.
     scanColonAsKeyword := true. 
@@ -1228,6 +1299,28 @@
     "Modified: / 17.10.1998 / 15:48:06 / cg"
 !
 
+initializeFlagsFrom:aScanner
+    "initialize flags from another scanner"
+
+    ignoreErrors := aScanner ignoreErrors.
+    ignoreWarnings := aScanner ignoreWarnings.
+
+    warnSTXSpecialComment := aScanner warnSTXSpecialComment.
+    warnSTXNameSpaceUse := aScanner warnSTXNameSpaceUse.
+    warnUnderscoreInIdentifier := aScanner warnUnderscoreInIdentifier.
+    warnDollarInIdentifier := aScanner warnDollarInIdentifier.
+    warnOldStyleAssignment := aScanner warnOldStyleAssignment.
+    warnCommonMistakes := aScanner warnCommonMistakes.
+    warnPossibleIncompatibilities := aScanner warnPossibleIncompatibilities.
+
+    allowUnderscoreInIdentifier := aScanner allowUnderscoreInIdentifier.
+    allowDollarInIdentifier := aScanner allowDollarInIdentifier.
+    allowOldStyleAssignment := aScanner allowOldStyleAssignment.
+    allowSqueakExtensions := aScanner allowSqueakExtensions.
+
+    scanColonAsKeyword := aScanner scanColonAsKeyword. 
+!
+
 initializeFor:aStringOrStream
     "initialize the new scanner & prepare for reading from aStringOrStream"
 
@@ -2507,7 +2600,7 @@
 !Scanner class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libcomp/Scanner.st,v 1.159 2002-12-09 10:11:35 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libcomp/Scanner.st,v 1.160 2003-01-29 17:58:13 penk Exp $'
 ! !
 
 Scanner initialize!