#FEATURE by exept
authorClaus Gittinger <cg@exept.de>
Mon, 07 Oct 2019 19:04:17 +0200
changeset 4578 6a1d8da4191d
parent 4577 5dbab4d69ae8
child 4579 9159b45cd8a9
#FEATURE by exept class: AbstractSyntaxHighlighter added: #postProcessTree:forText: changed: #formatExpression:in: #formatMethod:source:in:using:
AbstractSyntaxHighlighter.st
--- a/AbstractSyntaxHighlighter.st	Mon Oct 07 19:03:50 2019 +0200
+++ b/AbstractSyntaxHighlighter.st	Mon Oct 07 19:04:17 2019 +0200
@@ -531,11 +531,13 @@
 
     self nextToken.
     tree := self expression.
-    "/ now, convert the emphasis-array to a runArray
-    text emphasisCollection:(text emphasis asRunArray).
+    tree notNil ifTrue:[
+        "/ now, convert the emphasis-array to a runArray
+        text emphasisCollection:(text emphasis asRunArray).
 
-    tree == #Error ifTrue:[
-        ^ self class colorize:text forErrorAtPosition:(self sourceStream position) withOriginal:aString.
+        tree == #Error ifTrue:[
+            ^ self class colorize:text forErrorAtPosition:(self sourceStream position) withOriginal:aString.
+        ].
     ].
     ^ text
 
@@ -587,13 +589,16 @@
         self sourceText:newText.
 
         tree := self parseMethod.
-        newText := self sourceText.  "/ might have changed identity
-        "/ now, convert the emphasis-array to a runArray
-        newText emphasisCollection:(newText emphasis asRunArray).
+        tree notNil ifTrue:[
+            newText := self sourceText.  "/ might have changed identity
+            "/ now, convert the emphasis-array to a runArray
+            newText emphasisCollection:(newText emphasis asRunArray).
 
-        tree == #Error ifTrue:[
-            ^ self class colorize:newText forErrorAtPosition:source position withOriginal:aString.
-        ].
+            tree == #Error ifTrue:[
+                ^ self class colorize:newText forErrorAtPosition:source position withOriginal:aString.
+            ].
+            self postProcessTree:tree forText:newText
+        ].    
         ^ newText
     ]
 
@@ -788,6 +793,14 @@
     self markVariable:v from:pos to:endPos assigned:false
 
     "Modified: / 30-11-2010 / 14:44:28 / cg"
+!
+
+postProcessTree:tree forText:text
+    "allows for additional checks to be done on the tree
+     (checking arguments to a call-node in expecco, for example)"
+
+    "/ intentionaly left blank here.
+
 ! !
 
 !AbstractSyntaxHighlighter class methodsFor:'documentation'!