tools/GroovySourceHighlighter.st
changeset 3789 957010ea4ec1
parent 3492 d6932ea1ff39
--- a/tools/GroovySourceHighlighter.st	Thu Oct 26 22:38:06 2017 +0100
+++ b/tools/GroovySourceHighlighter.st	Tue Dec 05 22:04:46 2017 +0000
@@ -1,5 +1,3 @@
-"{ Encoding: utf8 }"
-
 "
  COPYRIGHT (c) 1996-2015 by Claus Gittinger
 
@@ -161,12 +159,16 @@
 
 formatClassDefinition:source in:class
     preferences isNil ifTrue:[
-        preferences := UserPreferences current.
+        "/ The `...codeViewThene ? UserPreferences current` trick below is 
+        "/ there to make this code working with both old and editor-thene-aware 
+        "/ code. Will wanish as soon as editor thene support will be
+        "/ integrated.
+        preferences := UserPreferences current codeViewTheme ? UserPreferences current. 
     ].
     ^ self format: source
 
     "Created: / 04-08-2011 / 23:44:52 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified (format): / 02-10-2013 / 14:41:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 05-12-2017 / 21:15:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 formatClassDefinition:source in:class elementsInto: els
@@ -180,12 +182,16 @@
 formatExpression:source in:class
 
     preferences isNil ifTrue:[
-        preferences := UserPreferences current.
-    ].
+        "/ The `...codeViewThene ? UserPreferences current` trick below is 
+        "/ there to make this code working with both old and editor-thene-aware 
+        "/ code. Will wanish as soon as editor thene support will be
+        "/ integrated.
+        preferences := UserPreferences current codeViewTheme ? UserPreferences current.
+     ].
     ^ self format: source
 
     "Created: / 04-08-2011 / 23:45:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified: / 02-10-2013 / 14:41:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 05-12-2017 / 21:15:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 formatExpression:source in:class elementsInto: els
@@ -199,21 +205,33 @@
 formatMethod:mth source:source in:class using: prefs
     preferences := prefs.
     preferences isNil ifTrue:[
-        preferences := UserPreferences current.
+        "/ The `...codeViewThene ? UserPreferences current` trick below is 
+        "/ there to make this code working with both old and editor-thene-aware 
+        "/ code. Will wanish as soon as editor thene support will be
+        "/ integrated.
+        preferences := UserPreferences current codeViewTheme ? UserPreferences current.
     ].
     ^ self format: source
 
     "Created: / 04-08-2011 / 23:45:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified: / 02-10-2013 / 14:41:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 05-12-2017 / 21:15:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 formatMethod:mth source:source in:class using: prefs elementsInto: els
 
     preferences := prefs.
+    preferences isNil ifTrue:[
+        "/ The `...codeViewThene ? UserPreferences current` trick below is 
+        "/ there to make this code working with both old and editor-thene-aware 
+        "/ code. Will wanish as soon as editor thene support will be
+        "/ integrated.
+        preferences := UserPreferences current codeViewTheme ? UserPreferences current.
+    ].  
     sourceIndex := els.
     ^self formatMethod:mth source:source in:class using: prefs
 
     "Created: / 04-08-2011 / 23:42:54 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 05-12-2017 / 21:16:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 formatMethod:mthd source:newCode line: line number: lnr in:cls using:syntaxPreferences
@@ -224,18 +242,22 @@
     sourceText := line asText.
     preferences := syntaxPreferences.
     preferences isNil ifTrue:[
-        preferences := UserPreferences current.
-    ]. 
+ preferences isNil ifTrue:[
+        "/ The `...codeViewThene ? UserPreferences current` trick below is 
+        "/ there to make this code working with both old and editor-thene-aware 
+        "/ code. Will wanish as soon as editor thene support will be
+        "/ integrated.
+        preferences := UserPreferences current codeViewTheme ? UserPreferences current.
+    ].      ]. 
     scanner := Scanner for: line asString.
     scanner highlighter: self.
-    [
+    Error ignoreIn:[
         [ scanner nextToken ~~ #EOF ] whileTrue.
-    ] on: Error do:[
-
     ].
     ^ sourceText
 
     "Created: / 04-08-2013 / 00:26:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 05-12-2017 / 21:16:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !GroovySourceHighlighter methodsFor:'formatting-private'!