#UI_ENHANCEMENT by cg
authorClaus Gittinger <cg@exept.de>
Wed, 23 Nov 2016 16:56:51 +0100
changeset 4054 93b38c1d51ef
parent 4053 60b82c3d5ad1
child 4057 af2ccd5e7eca
child 4061 ebdd14acce2d
#UI_ENHANCEMENT by cg class: Parser changed: #primary_identifier #variableOrError:
Parser.st
--- a/Parser.st	Wed Nov 23 15:49:12 2016 +0100
+++ b/Parser.st	Wed Nov 23 16:56:51 2016 +0100
@@ -7881,13 +7881,12 @@
     varName := tokenName.
 
     autoDefineVariables isNil ifTrue:[
-        (requestor notNil
-          and:[ (autoDefineVariables := requestor perform:#autoDefineVariables ifNotUnderstood:nil) notNil]
-        ) ifFalse:[
-            autoDefineVariables := false
-        ].
+        autoDefineVariables := false.    
+        requestor notNil ifTrue:[
+            autoDefineVariables := requestor perform:#autoDefineVariables ifNotUnderstood:false.
+        ]
     ].    
-    (currentBlock isNil and:[ autoDefineVariables ~~ false ]) ifTrue:[
+    (autoDefineVariables ~~ false) ifTrue:[
         var := self variableOrError:varName.
         self nextToken.
         
@@ -8883,12 +8882,9 @@
         vars notNil ifTrue:[
             varIndex := vars findFirst:[:aBlockVar | aBlockVar name = varName].
             varIndex ~~ 0 ifTrue:[
-                ^ (VariableNode type:#BlockVariable
-                               name:varName
-                              token:(vars at:varIndex)
-                              index:varIndex
-                              block:searchBlock
-                               from:currentBlock)
+                ^ (VariableNode type:#BlockVariable name:varName 
+                        token:(vars at:varIndex) index:varIndex 
+                        block:searchBlock from:currentBlock)
                     startPosition: tokenPosition endPosition: tokenPosition + varName size - 1
             ].
         ].
@@ -8897,12 +8893,9 @@
         args notNil ifTrue:[
             varIndex := args findFirst:[:aBlockArg | aBlockArg name = varName].
             varIndex ~~ 0 ifTrue:[
-                ^ (VariableNode type:#BlockArg
-                               name:varName
-                              token:(args at:varIndex)
-                              index:varIndex
-                              block:searchBlock
-                               from:currentBlock)
+                ^ (VariableNode type:#BlockArg name:varName
+                        token:(args at:varIndex) index:varIndex
+                        block:searchBlock from:currentBlock)
                     startPosition: tokenPosition endPosition: tokenPosition + varName size - 1
             ].
 
@@ -8934,11 +8927,8 @@
             varNames size > 0 ifTrue:[
                 varIndex := varNames lastIndexOf:varName.
                 varIndex ~~ 0 ifTrue:[
-                    ^ (VariableNode
-                            type:#ContextVariable
-                            name:varName
-                            context:con
-                            index:varIndex)
+                    ^ (VariableNode type:#ContextVariable name:varName
+                            context:con index:varIndex)
                         startPosition: tokenPosition endPosition: tokenPosition + varName size - 1
                 ].
             ].
@@ -8986,11 +8976,8 @@
                 ].
             ].
             parseForCode ifFalse:[self rememberInstVarUsed:varName].
-            ^ (VariableNode
-                    type:#InstanceVariable
-                    name:varName
-                    index:varIndex
-                    selfValue:selfValue)
+            ^ (VariableNode type:#InstanceVariable name:varName
+                    index:varIndex selfValue:selfValue)
                     startPosition: tokenPosition endPosition: tokenPosition + varName size - 1
         ].
 
@@ -9015,10 +9002,8 @@
                         contextToEvaluateIn notNil ifTrue:[
                             "/ allow it in a doIt ...
 
-                            ^ (VariableNode type:#ClassInstanceVariable
-                                           name:varName
-                                          index:varIndex
-                                      selfClass:aClass)
+                            ^ (VariableNode type:#ClassInstanceVariable name:varName
+                                    index:varIndex selfClass:aClass)
                                 startPosition: tokenPosition endPosition: tokenPosition + varName size - 1
                         ].
                         self parseError:'access to class-inst-var from inst method is not allowed'.
@@ -9108,29 +9093,23 @@
         ]
     ].
 
-    (self isDoIt) ifTrue:[
-        "is it a workspace variable ?"
+    autoDefineVariables isNil ifTrue:[
+        autoDefineVariables := false.    
         (requestor notNil and:[requestor isStream not]) ifTrue:[
-            "/ when parsing doits, this is done twice;
-            "/ first, for the parse, then as a block-code
-            "/ for the code.
-            "/ We only care for WorkspaceVars in doIts
-            (self isDoIt) ifTrue:[
-                (Workspace notNil
-                and:[(holder := Workspace workspaceVariableHolderAt:varName) notNil])
-                ifTrue:[
-                    ^ (VariableNode type:#WorkspaceVariable holder:holder name:varName)
-                        startPosition: tokenPosition endPosition: tokenPosition + varName size - 1
-                ]
-            ]
-        ].
-        "is it a doIt variable ?"
-
-        "/ (requestor notNil and:[requestor isStream not]) ifTrue:[
-            "/ when parsing doits, this is done twice;
-            "/ first, for the parse, then as a block-code
-            "/ for the code.
-            "/ We only care for WorkspaceVars in doIts
+            autoDefineVariables := requestor perform:#autoDefineVariables ifNotUnderstood:false.
+        ]
+    ].    
+    (autoDefineVariables ~~ false) ifTrue:[
+        "is it a workspace variable ?"
+
+        (Workspace notNil
+        and:[(holder := Workspace workspaceVariableHolderAt:varName) notNil])
+        ifTrue:[
+            ^ (VariableNode type:#WorkspaceVariable holder:holder name:varName)
+                startPosition: tokenPosition endPosition: tokenPosition + varName size - 1
+        ].
+        self isDoIt ifTrue:[
+            "is it a doIt variable ?"
 
             (doItTemporaries notNil
             and:[(holder := doItTemporaries at:varName asSymbol ifAbsent:nil) notNil])
@@ -9138,7 +9117,7 @@
                 ^ (VariableNode type:#DoItTemporary holder:holder name:varName)
                     startPosition: tokenPosition endPosition: tokenPosition + varName size - 1
             ].
-        "/ ].
+        ].
     ].
     
     "/ do not raise parseError here, but instead report it a the old stupid #Error token.