Java source highlughter refactoring.
authorJan Vrany <jan.vrany@fit.cvut.cz>
Wed, 25 Jun 2014 13:58:21 +0100
changeset 3126 4eaeba9fa910
parent 3125 012cc8eddb86
child 3150 ade0060d3c12
Java source highlughter refactoring. Split JavaSourceHighlighter into two classes - JavaSyntaxHighlighter (full parsing) and JavaLexicalHighlighter (lexical scanning only). The latter if faster. JavaSyntaxHighlighter bails out to lexical highlighting it full parsing would take too long to improve UX. However, sometimes even lexical highlighting is too slow.
JavaLanguage.st
Make.proto
abbrev.stc
bc.mak
experiments/Make.proto
experiments/bc.mak
experiments/experiments.rc
libjava.rc
stx_libjava.st
tools/JavaAbstractLexicalHighlighter.st
tools/JavaAbstractSourceHighlighter.st
tools/JavaLexicalHighlighter.st
tools/JavaSourceHighlighter.st
tools/JavaSyntaxHighlighter.st
tools/Make.proto
tools/Make.spec
tools/abbrev.stc
tools/bc.mak
tools/libInit.cc
tools/stx_libjava_tools.st
tools/tools.rc
--- a/JavaLanguage.st	Wed Jun 25 11:03:47 2014 +0100
+++ b/JavaLanguage.st	Wed Jun 25 13:58:21 2014 +0100
@@ -156,11 +156,11 @@
 
     "return nil by default"
 "/    ^nil
-    ^JavaSourceHighlighter
+    ^ JavaSyntaxHighlighter
 "/    ^ JavaSyntaxHighlighter_Old
 
     "Created: / 11-02-2012 / 18:11:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified: / 30-08-2013 / 01:11:43 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified (format): / 25-06-2014 / 11:51:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 toolboxClass
--- a/Make.proto	Wed Jun 25 11:03:47 2014 +0100
+++ b/Make.proto	Wed Jun 25 13:58:21 2014 +0100
@@ -144,8 +144,6 @@
 	cd ../libbasic2 && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
 	cd ../libbasic3 && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
 	cd ../libview && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
-	cd ../libview2 && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
-	cd ../goodies/sunit && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
 
 
 
--- a/abbrev.stc	Wed Jun 25 11:03:47 2014 +0100
+++ b/abbrev.stc	Wed Jun 25 13:58:21 2014 +0100
@@ -10,7 +10,6 @@
 JavaAnnotationDefault JavaAnnotationDefault stx:libjava 'Languages-Java-Annotations' 1
 JavaAnnotationDictionary JavaAnnotationDictionary stx:libjava 'Languages-Java-Annotations' 1
 JavaAnnotationValue JavaAnnotationValue stx:libjava 'Languages-Java-Reader-Support' 0
-JavaAntProjectResource JavaAntProjectResource stx:libjava 'Languages-Java-Tests' 2
 JavaArray JavaArray stx:libjava 'Languages-Java-Classes' 1
 JavaBooleanArray JavaBooleanArray stx:libjava 'Languages-Java-Support' 0
 JavaByte JavaByte stx:libjava 'Languages-Java-Support' 0
@@ -34,7 +33,6 @@
 JavaInnerClasses JavaInnerClasses stx:libjava 'Languages-Java-Support' 0
 JavaLanguage JavaLanguage stx:libjava 'Languages-Java-Support' 1
 JavaLibraries JavaLibraries stx:libjava 'Languages-Java-Support' 0
-JavaLibrariesResource JavaLibrariesResource stx:libjava 'Languages-Java-Tests' 1
 JavaLocalVariableTable JavaLocalVariableTable stx:libjava 'Languages-Java-Support' 0
 JavaLocalVariableTableEntry JavaLocalVariableTableEntry stx:libjava 'Languages-Java-Support' 0
 JavaLookup JavaLookup stx:libjava 'Languages-Java-Interop' 0
@@ -56,7 +54,6 @@
 JavaSocket JavaSocket stx:libjava 'Languages-Java-Support' 0
 JavaSourceCodeCache JavaSourceCodeCache stx:libjava 'Languages-Java-Support' 1
 JavaSourceFileWriter JavaSourceFileWriter stx:libjava 'Languages-Java-Support' 0
-JavaTestCaseProxy JavaTestCaseProxy stx:libjava 'Languages-Java-Tests-Proxies' 3
 JavaTestsLoader JavaTestsLoader stx:libjava 'Languages-Java-Tests' 0
 JavaTopView JavaTopView stx:libjava 'Languages-Java-Views-Support' 2
 JavaUnresolvedCompilationError JavaUnresolvedCompilationError stx:libjava 'Languages-Java-Support' 1
@@ -72,7 +69,6 @@
 SmalltalkAppletStub SmalltalkAppletStub stx:libjava 'Languages-Java-Views-Support' 0
 stx_libjava stx_libjava stx:libjava '* Projects & Packages *' 3
 GroovyMetaclass GroovyMetaclass stx:libjava 'Languages-Groovy-Classes' 0
-JUnitTestCaseProxy JUnitTestCaseProxy stx:libjava 'Languages-Java-Tests-Proxies' 3
 Java Java stx:libjava 'Languages-Java-Support' 0
 JavaAnnotationArrayValue JavaAnnotationArrayValue stx:libjava 'Languages-Java-Reader-Support' 0
 JavaAnnotationClassValue JavaAnnotationClassValue stx:libjava 'Languages-Java-Reader-Support' 0
@@ -94,7 +90,6 @@
 JavaFieldAnnotationContainer JavaFieldAnnotationContainer stx:libjava 'Languages-Java-Annotations' 1
 JavaFieldDescriptor JavaFieldDescriptor stx:libjava 'Languages-Java-Support' 0
 JavaFieldDescriptorWithUnionType JavaFieldDescriptorWithUnionType stx:libjava 'Languages-Java-Support' 0
-JavaInitializedResource JavaInitializedResource stx:libjava 'Languages-Java-Tests' 2
 JavaInvalidRefError JavaInvalidRefError stx:libjava 'Languages-Java-Support' 1
 JavaInvokeDynamic2 JavaInvokeDynamic2 stx:libjava 'Languages-Java-Reader-Support-new' 0
 JavaMethod JavaMethod stx:libjava 'Languages-Java-Classes' 0
@@ -105,7 +100,6 @@
 JavaMirror JavaMirror stx:libjava 'Languages-Java-Classes' 0
 JavaNativeMethodImpl_OpenJDK6 JavaNativeMethodImpl_OpenJDK6 stx:libjava 'Languages-Java-Support-Java 6' 0
 JavaStringRef2 JavaStringRef2 stx:libjava 'Languages-Java-Reader-Support-new' 0
-JavaTestsResource JavaTestsResource stx:libjava 'Languages-Java-Tests' 2
 JavaUnhandledExceptionError JavaUnhandledExceptionError stx:libjava 'Languages-Java-Support' 1
 JavaUnhandledThreadDeathError JavaUnhandledThreadDeathError stx:libjava 'Languages-Java-Support' 1
 JavaUnresolvedClassConstant JavaUnresolvedClassConstant stx:libjava 'Languages-Java-Reader-Support' 0
@@ -145,6 +139,8 @@
 JavaNativeMethod JavaNativeMethod stx:libjava 'Languages-Java-Classes' 0
 JavaNativeMethodImpl_OracleJDK8 JavaNativeMethodImpl_OracleJDK8 stx:libjava 'Languages-Java-Support-Java 8' 0
 GroovyEvaluatorTests GroovyEvaluatorTests stx:libjava 'Languages-Groovy-Tests' 1
+JUnitTestCaseProxy JUnitTestCaseProxy stx:libjava 'Languages-Java-Tests-Proxies' 3
+JavaAntProjectResource JavaAntProjectResource stx:libjava 'Languages-Java-Tests' 2
 JavaByteCodeDisassemblerTests JavaByteCodeDisassemblerTests stx:libjava 'Languages-Java-Tests' 1
 JavaByteCodeProcessorTests JavaByteCodeProcessorTests stx:libjava 'Languages-Java-Tests' 1
 JavaClassLoadingTests JavaClassLoadingTests stx:libjava 'Languages-Java-Tests-ClassLoading' 1
@@ -153,8 +149,10 @@
 JavaExceptionTests JavaExceptionTests stx:libjava 'Languages-Java-Tests' 1
 JavaFieldRefTests JavaFieldRefTests stx:libjava 'Languages-Java-Tests-RuntimeConstantPool' 1
 JavaFreshlyInitializedResource JavaFreshlyInitializedResource stx:libjava 'Languages-Java-Tests' 1
+JavaInitializedResource JavaInitializedResource stx:libjava 'Languages-Java-Tests' 2
 JavaInterfaceMethodRefTests JavaInterfaceMethodRefTests stx:libjava 'Languages-Java-Tests-RuntimeConstantPool' 1
 JavaJUnitTests JavaJUnitTests stx:libjava 'Languages-Java-Tests-Libraries' 1
+JavaLibrariesResource JavaLibrariesResource stx:libjava 'Languages-Java-Tests' 1
 JavaLookupResolutionAlgorithmTests JavaLookupResolutionAlgorithmTests stx:libjava 'Languages-Java-Tests-Interop' 1
 JavaLookupTests JavaLookupTests stx:libjava 'Languages-Java-Tests-Interop' 1
 JavaMethodRefTests JavaMethodRefTests stx:libjava 'Languages-Java-Tests-RuntimeConstantPool' 1
@@ -164,5 +162,7 @@
 JavaRefsAndConstantPoolTestCase JavaRefsAndConstantPoolTestCase stx:libjava 'Languages-Java-Tests-RuntimeConstantPool' 1
 JavaReleaseTests JavaReleaseTests stx:libjava 'Languages-Java-Tests' 1
 JavaRuntimeConstantPoolTests JavaRuntimeConstantPoolTests stx:libjava 'Languages-Java-Tests-RuntimeConstantPool' 1
+JavaTestCaseProxy JavaTestCaseProxy stx:libjava 'Languages-Java-Tests-Proxies' 3
+JavaTestsResource JavaTestsResource stx:libjava 'Languages-Java-Tests' 2
 JavaUTF8Tests JavaUTF8Tests stx:libjava 'Languages-Java-Tests' 1
 TestletTestCaseProxy TestletTestCaseProxy stx:libjava 'Languages-Java-Tests-Proxies' 3
--- a/bc.mak	Wed Jun 25 11:03:47 2014 +0100
+++ b/bc.mak	Wed Jun 25 13:58:21 2014 +0100
@@ -54,8 +54,6 @@
 	pushd ..\libbasic2 & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
 	pushd ..\libbasic3 & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
 	pushd ..\libview & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
-	pushd ..\libview2 & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
-	pushd ..\goodies\sunit & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
 
 
 
--- a/experiments/Make.proto	Wed Jun 25 11:03:47 2014 +0100
+++ b/experiments/Make.proto	Wed Jun 25 13:58:21 2014 +0100
@@ -137,8 +137,6 @@
 	cd ../../libbasic2 && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
 	cd ../../libbasic3 && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
 	cd ../../libview && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
-	cd ../../libview2 && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
-	cd ../../goodies/sunit && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
 	cd ../ && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
 
 
--- a/experiments/bc.mak	Wed Jun 25 11:03:47 2014 +0100
+++ b/experiments/bc.mak	Wed Jun 25 13:58:21 2014 +0100
@@ -54,8 +54,6 @@
 	pushd ..\..\libbasic2 & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
 	pushd ..\..\libbasic3 & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
 	pushd ..\..\libview & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
-	pushd ..\..\libview2 & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
-	pushd ..\..\goodies\sunit & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
 	pushd .. & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
 
 
--- a/experiments/experiments.rc	Wed Jun 25 11:03:47 2014 +0100
+++ b/experiments/experiments.rc	Wed Jun 25 13:58:21 2014 +0100
@@ -3,7 +3,7 @@
 // automagically generated from the projectDefinition: stx_libjava_experiments.
 //
 VS_VERSION_INFO VERSIONINFO
-  FILEVERSION     6,2,32767,32767
+  FILEVERSION     6,2,12886,12886
   PRODUCTVERSION  6,2,4,0
 #if (__BORLANDC__)
   FILEFLAGSMASK   VS_FF_DEBUG | VS_FF_PRERELEASE
@@ -20,12 +20,12 @@
     BEGIN
       VALUE "CompanyName", "eXept Software AG\0"
       VALUE "FileDescription", "Smalltalk/X Class library (LIB)\0"
-      VALUE "FileVersion", "6.2.32767.32767\0"
+      VALUE "FileVersion", "6.2.12886.12886\0"
       VALUE "InternalName", "stx:libjava/experiments\0"
       VALUE "LegalCopyright", "Copyright Claus Gittinger 1988-2014\nCopyright eXept Software AG 1998-2014\0"
       VALUE "ProductName", "Smalltalk/X\0"
       VALUE "ProductVersion", "6.2.4.0\0"
-      VALUE "ProductDate", "Thu, 12 Jun 2014 11:01:26 GMT\0"
+      VALUE "ProductDate", "Wed, 25 Jun 2014 12:45:30 GMT\0"
     END
 
   END
--- a/libjava.rc	Wed Jun 25 11:03:47 2014 +0100
+++ b/libjava.rc	Wed Jun 25 13:58:21 2014 +0100
@@ -3,7 +3,7 @@
 // automagically generated from the projectDefinition: stx_libjava.
 //
 VS_VERSION_INFO VERSIONINFO
-  FILEVERSION     6,2,32767,32767
+  FILEVERSION     6,2,12886,12886
   PRODUCTVERSION  6,2,4,0
 #if (__BORLANDC__)
   FILEFLAGSMASK   VS_FF_DEBUG | VS_FF_PRERELEASE
@@ -20,12 +20,12 @@
     BEGIN
       VALUE "CompanyName", "eXept Software AG & SWING Research Group\0"
       VALUE "FileDescription", "Java support for Smalltalk/X (LIB)\0"
-      VALUE "FileVersion", "6.2.32767.32767\0"
+      VALUE "FileVersion", "6.2.12886.12886\0"
       VALUE "InternalName", "stx:libjava\0"
       VALUE "LegalCopyright", "Copyright Claus Gittinger 1988-2011\nCopyright eXept Software AG 1998-2011\nCopyright Jan Vrany, Jan Kurs and Marcel Hlopko\n          SWING Research Group, Czech Technical University In Prague\0"
       VALUE "ProductName", "Smalltalk/X\0"
       VALUE "ProductVersion", "6.2.4.0\0"
-      VALUE "ProductDate", "Thu, 12 Jun 2014 11:01:20 GMT\0"
+      VALUE "ProductDate", "Wed, 25 Jun 2014 12:45:25 GMT\0"
     END
 
   END
--- a/stx_libjava.st	Wed Jun 25 11:03:47 2014 +0100
+++ b/stx_libjava.st	Wed Jun 25 13:58:21 2014 +0100
@@ -160,7 +160,6 @@
      by searching along the inheritance chain of all of my classes."
 
     ^ #(
-        #'stx:goodies/sunit'    "TestAsserter - superclass of JUnitTestCaseProxy "
         #'stx:libbasic'    "AbstractNumberVector - extended "
         #'stx:libbasic2'    "SignedIntegerArray - extended "
         #'stx:libbasic3'    "SystemEnvironment - superclass of JavaClassEnvironment "
@@ -176,6 +175,7 @@
      by searching all classes (and their packages) which are referenced by my classes."
 
     ^ #(
+        #'stx:goodies/sunit'    "TestSuite - referenced by JavaTestsLoader class>>buildSuiteFrom: "
         #'stx:libcomp'    "BlockNode - referenced by JavaNativeMethod>>numberOfArgs: "
         #'stx:libhtml'    "URL - referenced by JavaEmbeddedFrameView>>setupAppletFrameIn:initializeJava: "
         #'stx:libtool'    "DebugView - referenced by Java class>>flushClasses "
@@ -315,7 +315,6 @@
         JavaAnnotationDefault
         JavaAnnotationDictionary
         JavaAnnotationValue
-        (JavaAntProjectResource autoload)
         JavaArray
         JavaBooleanArray
         JavaByte
@@ -339,7 +338,6 @@
         JavaInnerClasses
         JavaLanguage
         JavaLibraries
-        (JavaLibrariesResource autoload)
         JavaLocalVariableTable
         JavaLocalVariableTableEntry
         JavaLookup
@@ -361,7 +359,6 @@
         JavaSocket
         JavaSourceCodeCache
         JavaSourceFileWriter
-        (JavaTestCaseProxy autoload)
         JavaTestsLoader
         JavaTopView
         JavaUnresolvedCompilationError
@@ -377,7 +374,6 @@
         SmalltalkAppletStub
         #'stx_libjava'
         GroovyMetaclass
-        (JUnitTestCaseProxy autoload)
         Java
         JavaAnnotationArrayValue
         JavaAnnotationClassValue
@@ -399,7 +395,6 @@
         JavaFieldAnnotationContainer
         JavaFieldDescriptor
         JavaFieldDescriptorWithUnionType
-        (JavaInitializedResource autoload)
         JavaInvalidRefError
         JavaInvokeDynamic2
         JavaMethod
@@ -410,7 +405,6 @@
         JavaMirror
         #'JavaNativeMethodImpl_OpenJDK6'
         JavaStringRef2
-        (JavaTestsResource autoload)
         JavaUnhandledExceptionError
         JavaUnhandledThreadDeathError
         JavaUnresolvedClassConstant
@@ -450,6 +444,8 @@
         JavaNativeMethod
         #'JavaNativeMethodImpl_OracleJDK8'
         (GroovyEvaluatorTests autoload)
+        (JUnitTestCaseProxy autoload)
+        (JavaAntProjectResource autoload)
         (JavaByteCodeDisassemblerTests autoload)
         (JavaByteCodeProcessorTests autoload)
         (JavaClassLoadingTests autoload)
@@ -458,8 +454,10 @@
         (JavaExceptionTests autoload)
         (JavaFieldRefTests autoload)
         (JavaFreshlyInitializedResource autoload)
+        (JavaInitializedResource autoload)
         (JavaInterfaceMethodRefTests autoload)
         (JavaJUnitTests autoload)
+        (JavaLibrariesResource autoload)
         (JavaLookupResolutionAlgorithmTests autoload)
         (JavaLookupTests autoload)
         (JavaMethodRefTests autoload)
@@ -469,6 +467,8 @@
         (JavaRefsAndConstantPoolTestCase autoload)
         (JavaReleaseTests autoload)
         (JavaRuntimeConstantPoolTests autoload)
+        (JavaTestCaseProxy autoload)
+        (JavaTestsResource autoload)
         (JavaUTF8Tests autoload)
         (TestletTestCaseProxy autoload)
     )
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/JavaAbstractLexicalHighlighter.st	Wed Jun 25 13:58:21 2014 +0100
@@ -0,0 +1,118 @@
+"{ Package: 'stx:libjava/tools' }"
+
+JavaAbstractSourceHighlighter subclass:#JavaAbstractLexicalHighlighter
+	instanceVariableNames:''
+	classVariableNames:''
+	poolDictionaries:''
+	category:'Languages-Java-Tools-Source'
+!
+
+!JavaAbstractLexicalHighlighter class methodsFor:'documentation'!
+
+documentation
+"
+    A syntax higlighter class that does only lexical highlighting (i.e., no parsing).
+    It is therefore faster than full parsing highlighters but also less accurate
+    and does not fill source index (so no navigation)
+
+    [author:]
+        Jan Vrany <jan.vrany@fit.cvut.cz>
+
+    [instance variables:]
+
+    [class variables:]
+
+    [see also:]
+
+"
+! !
+
+!JavaAbstractLexicalHighlighter class methodsFor:'queries'!
+
+isAbstract
+    "Return if this class is an abstract class.
+     True is returned here for myself only; false for subclasses.
+     Abstract subclasses must redefine again."
+
+    ^ self == JavaAbstractLexicalHighlighter.
+! !
+
+!JavaAbstractLexicalHighlighter methodsFor:'accessing-classes'!
+
+scannerClass
+    "Return a highlighting scanner class to use"
+
+    ^ self subclassResponsibility
+
+    "Created: / 25-06-2014 / 11:56:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!JavaAbstractLexicalHighlighter methodsFor:'formatting'!
+
+formatClassDefinition:source in:class
+    ^ self format: source
+
+    "Created: / 25-06-2014 / 12:51:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+formatMethod:mth source:source in:class using: prefs
+    ^ self format: source
+
+    "Created: / 25-06-2014 / 12:52:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+formatMethod:mthd source:newCode line: line number: lnr in:cls using:syntaxPreferences
+    | scanner |
+
+    line isEmptyOrNil ifTrue:[ ^  nil ].
+
+    sourceText := line asText.
+    preferences := syntaxPreferences.
+    preferences isNil ifTrue:[
+        preferences := UserPreferences current.
+    ]. 
+    scanner := self scannerClass for: line asString.
+    scanner highlighter: self.
+    [
+        [ scanner nextToken ~~ #EOF ] whileTrue.
+    ] on: Error do:[
+
+    ].
+    ^ sourceText
+
+    "Created: / 04-08-2013 / 00:26:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 25-06-2014 / 12:48:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!JavaAbstractLexicalHighlighter methodsFor:'formatting-private'!
+
+format: source
+    "Simple formatting based on lexical structure only"
+
+    | scanner token lastValue0 lastPosition0 |
+    preferences isNil ifTrue:[ 
+        preferences := UserPreferences current.
+    ].
+    sourceText := source asText.
+    scanner := self scannerClass for: source string.
+    scanner highlighter: self.
+    Error ignoreIn:[
+        [ (token := scanner nextToken) ~~ #EOF ] whileTrue:[
+            "/ Here, try to guess what's selector...
+            token == $( ifTrue:[
+                lastPosition0 == #Identifier ifTrue:[
+                    self markSelectorFrom: lastPosition0  to: lastPosition0 + lastValue0 size - 1.
+                ].
+            ].
+
+
+            lastValue0 := scanner tokenValue.
+            lastPosition0 := scanner tokenStartPosition.
+        ].
+    ].
+    ^ sourceText
+
+    "Created: / 03-10-2013 / 20:19:15 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 25-06-2014 / 12:02:12 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/JavaAbstractSourceHighlighter.st	Wed Jun 25 13:58:21 2014 +0100
@@ -0,0 +1,450 @@
+"{ Package: 'stx:libjava/tools' }"
+
+Object subclass:#JavaAbstractSourceHighlighter
+	instanceVariableNames:'preferences cachedStringEmphasis cachedStringColor sourceText
+		sourceIndex'
+	classVariableNames:''
+	poolDictionaries:''
+	category:'Languages-Java-Tools-Source'
+!
+
+!JavaAbstractSourceHighlighter class methodsFor:'formatting'!
+
+formatClass: javaClass
+
+    ^self new formatClassDefinition: javaClass source in: javaClass
+
+    "Created: / 15-12-2011 / 21:54:15 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+formatClassDefinition:source in:class
+
+    ^self new formatClassDefinition:source in:class
+
+    "Created: / 04-08-2011 / 23:44:52 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+formatClassDefinition:source in:class elementsInto: elements
+
+    ^self new formatClassDefinition:source in:class elementsInto: elements
+
+    "Created: / 04-08-2011 / 23:44:13 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+formatExpression:source in:class
+
+    ^self new formatExpression:source in:class
+
+    "Created: / 04-08-2011 / 23:45:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+formatExpression:source in:class elementsInto: elements
+
+    ^self new formatExpression:source in:class elementsInto: elements
+
+    "Created: / 04-08-2011 / 23:43:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+formatMethod:mth source:source in:class
+
+    ^self formatMethod: mth source: source in: class using: UserPreferences current
+
+    "Created: / 11-02-2012 / 18:18:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+formatMethod:mth source:source in:class using: preferences
+
+    ^self new formatMethod:mth source:source in:class using: preferences
+
+    "Created: / 04-08-2011 / 23:45:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+formatMethod:mth source:source in:class using: preferences elementsInto: elements
+
+    ^self new formatMethod:mth source:source in:class using: preferences elementsInto: elements
+
+    "Created: / 04-08-2011 / 23:42:54 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+formatMethod:mthd source:newCode line: line number: lnr in:cls using:syntaxPreferences
+    ^ self new formatMethod:mthd source:newCode line: line number: lnr in:cls using:syntaxPreferences
+
+    "Created: / 25-06-2014 / 12:50:03 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!JavaAbstractSourceHighlighter class methodsFor:'queries'!
+
+isAbstract
+    "Return if this class is an abstract class.
+     True is returned here for myself only; false for subclasses.
+     Abstract subclasses must redefine again."
+
+    ^ self == JavaAbstractSourceHighlighter.
+! !
+
+!JavaAbstractSourceHighlighter methodsFor:'formatting'!
+
+formatClassDefinition:arg1 in:arg2
+    "raise an error: must be redefined in concrete subclass(es)"
+
+    ^ self subclassResponsibility
+!
+
+formatClassDefinition:source in:class elementsInto: els
+
+    sourceIndex := els.
+    ^self formatClassDefinition:source in:class
+
+    "Created: / 04-08-2011 / 23:44:13 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+formatExpression:source in:class
+    ^ self format: source
+
+    "Created: / 04-08-2011 / 23:45:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 03-10-2013 / 20:19:35 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+formatExpression:source in:class elementsInto: els
+
+    sourceIndex := els.
+    ^self formatExpression:source in:class
+
+    "Created: / 04-08-2011 / 23:43:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+formatMethod:arg1 source:arg2 in:arg3 using:arg4
+    "raise an error: must be redefined in concrete subclass(es)"
+
+    ^ self subclassResponsibility
+!
+
+formatMethod:mth source:source in:class using: prefs elementsInto: els
+
+    preferences := prefs.
+    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>"
+!
+
+formatMethod:mthd source:newCode line: line number: lnr in:cls using:syntaxPreferences
+    ^ self subclassResponsibility
+
+    "Modified (comment): / 25-06-2014 / 12:49:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!JavaAbstractSourceHighlighter methodsFor:'syntax detection'!
+
+markArgumentIdentifierFrom:pos1 to:pos2
+    self 
+        markFrom:pos1 to:pos2 
+        withEmphasis:(preferences argumentIdentifierEmphasis) color:(preferences argumentIdentifierColor)
+!
+
+markBadIdentifierFrom:pos1 to:pos2
+    self 
+        markFrom:pos1 to:pos2 
+        withEmphasis:(preferences badIdentifierEmphasis) 
+        color:(preferences badIdentifierColor)
+!
+
+markClassVariableIdentifierFrom:pos1 to:pos2
+    self 
+        markFrom:pos1 to:pos2 
+        withEmphasis:(preferences classVariableIdentifierEmphasis) color:(preferences classVariableIdentifierColor)
+
+    "Modified: / 31.3.1998 / 18:02:14 / cg"
+!
+
+markCommentFrom:pos1 to:pos2
+    self 
+        markFrom:pos1 to:pos2 
+        withEmphasis:(preferences commentEmphasis) color:(preferences commentColor)
+!
+
+markConstantFrom:pos1 to:pos2
+    self 
+        markFrom:pos1 to:pos2 
+        withEmphasis:(preferences constantEmphasis) color:(preferences constantColor)
+!
+
+markFrom:pos1 to:pos2 withEmphasis:fontEmp color:clrIn
+    |e p2 clr|
+
+    clr := clrIn onDevice:Screen current.
+
+    clr = Color black ifTrue:[
+        e := fontEmp
+    ] ifFalse:[
+        fontEmp isNil ifTrue:[
+            e := (#color->clr)
+        ] ifFalse:[
+            e := Text addEmphasis:fontEmp to:(#color->clr).
+        ]
+    ].
+    (p2 := pos2) isNil ifTrue:[
+        p2 := sourceText size
+    ] ifFalse:[
+        p2 := p2 min:sourceText size
+    ].
+    sourceText emphasizeFrom:pos1 to:p2 with:e
+
+    "Created: / 31.3.1998 / 13:26:53 / cg"
+    "Modified: / 1.4.1998 / 12:51:56 / cg"
+!
+
+markFunctionNameFrom:pos1 to:pos2
+    self 
+        markFrom:pos1 to:pos2 
+        withEmphasis:(preferences methodSelectorEmphasis) color:(preferences methodSelectorColor)
+!
+
+markGlobalClassIdentifierFrom:pos1 to:pos2
+    self 
+        markFrom:pos1 to:pos2 
+        withEmphasis:(preferences globalClassIdentifierEmphasis) color:(preferences globalClassIdentifierColor)
+
+    "Modified: / 31.3.1998 / 18:02:14 / cg"
+    "Created: / 4.3.1999 / 12:53:02 / cg"
+!
+
+markGlobalIdentifierFrom:pos1 to:pos2
+    self 
+        markFrom:pos1 to:pos2 
+        withEmphasis:(preferences globalIdentifierEmphasis) color:(preferences globalIdentifierColor)
+
+    "Modified: / 31.3.1998 / 18:02:14 / cg"
+!
+
+markIdentifierFrom:pos1 to:pos2
+    self 
+        markFrom:pos1 to:pos2 
+        withEmphasis:(preferences identifierEmphasis) color:(preferences identifierColor)
+!
+
+markInstVarIdentifierFrom:pos1 to:pos2
+    self 
+        markFrom:pos1 to:pos2 
+        withEmphasis:(preferences instVarIdentifierEmphasis) color:(preferences instVarIdentifierColor)
+
+    "Created: / 16.4.1998 / 18:35:40 / cg"
+    "Modified: / 16.4.1998 / 18:37:30 / cg"
+!
+
+markKeyword:kw from:pos1 to:pos2
+    |em clr|
+
+    ( #( 'if' 'else'
+         'while'
+         'for'
+         'do'
+         'return'
+         'continue'
+         'break'
+    ) includes:kw) ifTrue:[
+        em := preferences controlFlowSelectorEmphasis. 
+        clr := preferences controlFlowSelectorColor.
+    ] ifFalse:[
+        em := preferences jsKeywordEmphasis.
+        clr := preferences jsKeywordColor.
+    ].
+    self 
+        markFrom:pos1 to:pos2 
+        withEmphasis:em color:clr
+
+    "Modified: / 19-05-2010 / 15:07:59 / cg"
+    "Modified: / 07-08-2013 / 00:28:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+markKeywordFlowFrom:pos1 to:pos2
+    self 
+        markFrom:pos1 to:pos2 
+        withEmphasis:preferences controlFlowSelectorEmphasis
+        color:preferences controlFlowSelectorColor
+
+    "Created: / 05-09-2013 / 03:09:15 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+markKeywordFrom:pos1 to:pos2
+    self 
+        markFrom:pos1 to:pos2 
+        withEmphasis:preferences jsKeywordEmphasis
+        color:preferences jsKeywordColor
+
+    "Created: / 05-09-2013 / 03:09:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+markLocalIdentifierFrom:pos1 to:pos2
+    self 
+        markFrom:pos1 to:pos2 
+        withEmphasis:(preferences localIdentifierEmphasis) color:(preferences localIdentifierColor)
+!
+
+markProblem: problem from:pos1 to:pos2
+    self 
+        markFrom:pos1 to:pos2 
+        withEmphasis:(preferences badIdentifierEmphasis) 
+        color:(preferences badIdentifierColor)
+
+    "Created: / 15-04-2013 / 22:23:30 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+markSelector:selectorString from:pos1 to:pos2 
+    | fg em |
+
+    fg := preferences selectorColor.
+    em := preferences selectorEmphasis.
+
+    self
+        markFrom:pos1 to:pos2 
+        withEmphasis:em color:fg
+
+    "Modified: / 04-10-2011 / 19:48:48 / cg"
+    "Modified: / 17-03-2012 / 13:26:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Created: / 17-03-2012 / 19:12:20 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+markSelector:selectorString from:pos1 to:pos2 receiverNode:aReceiverNodeOrNil numArgs:numArgs
+    |fg selectorSymbol check ok rec em currentEnvironment currentSuperclasses currentSubclasses classToCompileFor fullSelectorCheck|
+
+    fg := preferences selectorColor.
+    em := preferences selectorEmphasis.
+
+"/    (currentEnvironment notNil
+"/    and:[ (((currentEnvironment _localVariables ? #()) contains:[:local | local name = selectorString]) 
+"/          or:[((currentEnvironment _argVariables ? #()) contains:[:local | local name = selectorString])])
+"/    ])
+"/    ifTrue:[
+"/        "/ a local call
+"/    ] ifFalse:[
+"/        selectorSymbol := (self translatedSmalltalkSelectorFor:selectorString numArgs:numArgs) asSymbolIfInterned.
+"/        selectorSymbol isNil ifTrue:[
+"/            fg := Color red.
+"/        ] ifFalse:[
+"/            fullSelectorCheck == true ifTrue:[
+"/                aReceiverNodeOrNil notNil ifTrue:[
+"/                    check := [:cls | (cls includesSelector:selectorSymbol)
+"/                                     or:[cls class includesSelector:selectorSymbol]].
+"/
+"/                    ok := false.
+"/
+"/                    "/ limit search if possible
+"/                    (classToCompileFor notNil
+"/                     and:[aReceiverNodeOrNil isSelf or:[aReceiverNodeOrNil isSuper]]) ifTrue:[
+"/                        currentSuperclasses isNil ifTrue:[
+"/                            currentSuperclasses := classToCompileFor withAllSuperclasses.
+"/                        ].
+"/                        ok := currentSuperclasses contains:check.
+"/                        (ok not and:[aReceiverNodeOrNil isSelf]) ifTrue:[
+"/                            currentSubclasses isNil ifTrue:[
+"/                                currentSubclasses := classToCompileFor allSubclasses.
+"/                            ].
+"/                            ok := currentSubclasses contains:check.
+"/                        ].
+"/                    ] ifFalse:[
+"/                        aReceiverNodeOrNil isConstant ifTrue:[
+"/                            ok := aReceiverNodeOrNil evaluate class withAllSuperclasses contains:check.
+"/                        ] ifFalse:[
+"/                            (aReceiverNodeOrNil isGlobal 
+"/                            and:[(rec := aReceiverNodeOrNil evaluate) isBehavior]) ifTrue:[
+"/                                ok := rec class withAllSuperclasses contains:check.
+"/                            ] ifFalse:[
+"/                                ok := Smalltalk allClasses contains:check
+"/                            ]
+"/                        ]
+"/                    ].
+"/
+"/                    ok ifFalse:[
+"/                        em := preferences unimplementedSelectorEmphasis.
+"/                        fg := preferences unimplementedSelectorColor.
+"/                    ]
+"/                ]
+"/            ]
+"/        ].
+"/    ].
+    self
+        markFrom:pos1 to:pos2 
+        withEmphasis:em color:fg
+
+    "Modified: / 04-10-2011 / 19:48:48 / cg"
+    "Modified: / 17-03-2012 / 13:26:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+markSelectorFrom:pos1 to:pos2 
+    | fg em |
+
+    fg := preferences selectorColor.
+    em := preferences selectorEmphasis.
+
+    self
+        markFrom:pos1 to:pos2 
+        withEmphasis:em color:fg
+
+    "Created: / 11-09-2013 / 05:01:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+markSelfFrom:pos1 to:pos2
+    self 
+        markFrom:pos1 to:pos2 
+        withEmphasis:(preferences selfEmphasis) color:(preferences selfColor)
+!
+
+markStringFrom:pos1 to:pos2
+    self 
+        markFrom:pos1 to:pos2 
+        withEmphasis:(preferences stringEmphasis) color:(preferences stringColor)
+!
+
+markUnknownIdentifierFrom:pos1 to:pos2
+    self 
+        markFrom:pos1 to:pos2 
+        withEmphasis:(preferences unknownIdentifierEmphasis) color:(preferences unknownIdentifierColor)
+!
+
+markVariable:v from:pos to:endPos
+    "support for syntaxColoring"
+
+    |type globalValue nameSym|
+
+    type := v type.
+    (type == #BlockArg
+    or:[type == #MethodArg]) ifTrue:[
+        self markArgumentIdentifierFrom:pos to:endPos.
+        ^ self
+    ].
+    (type == #BlockVariable
+    or:[type == #MethodVariable]) ifTrue:[
+        self markLocalIdentifierFrom:pos to:endPos.
+        ^ self
+    ].
+    (type == #GlobalVariable) ifTrue:[
+        nameSym := v name asSymbolIfInterned.
+        (nameSym isNil 
+        or:[(Smalltalk includesKey:nameSym) not]) ifTrue:[
+            self markUnknownIdentifierFrom:pos to:endPos.
+            ^ self
+        ].
+        globalValue := Smalltalk at:nameSym ifAbsent:nil.
+        globalValue isBehavior ifTrue:[
+            self markGlobalClassIdentifierFrom:pos to:endPos.
+        ] ifFalse:[
+            self markGlobalIdentifierFrom:pos to:endPos.
+        ].
+        ^ self
+    ].
+    (type == #ClassVariable) ifTrue:[
+        self markClassVariableIdentifierFrom:pos to:endPos.
+        ^ self
+    ].
+    (type == #InstanceVariable) ifTrue:[
+        self markInstVarIdentifierFrom:pos to:endPos.
+        ^ self
+    ].
+
+    self markIdentifierFrom:pos to:endPos.
+
+    "Created: / 16.4.1998 / 18:49:34 / cg"
+    "Modified: / 4.3.1999 / 12:56:13 / cg"
+! !
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/JavaLexicalHighlighter.st	Wed Jun 25 13:58:21 2014 +0100
@@ -0,0 +1,138 @@
+"{ Package: 'stx:libjava/tools' }"
+
+JavaAbstractLexicalHighlighter subclass:#JavaLexicalHighlighter
+	instanceVariableNames:''
+	classVariableNames:''
+	poolDictionaries:''
+	category:'Languages-Java-Tools-Source'
+!
+
+JavaScanner subclass:#HighlightingScanner
+	instanceVariableNames:'buffer bufferFirst bufferLast highlighter'
+	classVariableNames:''
+	poolDictionaries:''
+	privateIn:JavaLexicalHighlighter
+!
+
+!JavaLexicalHighlighter methodsFor:'accessing-classes'!
+
+scannerClass
+    "Return a highlighting scanner class to use"
+
+    ^ HighlightingScanner
+
+    "Created: / 25-06-2014 / 11:57:59 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!JavaLexicalHighlighter::HighlightingScanner methodsFor:'accessing'!
+
+highlighter
+    ^ highlighter
+!
+
+highlighter:aJavaSyntaxHighlighter
+    highlighter := aJavaSyntaxHighlighter.
+! !
+
+!JavaLexicalHighlighter::HighlightingScanner methodsFor:'error handling'!
+
+syntaxError:aMessage position:position to:endPos
+    "a syntax error happened"
+
+    endPos notNil ifTrue:[
+        highlighter markBadIdentifierFrom:position to: endPos.
+    ]
+
+    "Created: / 13-04-2012 / 18:31:42 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!JavaLexicalHighlighter::HighlightingScanner methodsFor:'initialization'!
+
+initialize
+    "initialize the scanner"
+
+    super initialize.
+    saveComments := true.
+    buffer := Array new: 3.
+    bufferFirst := 1.
+    bufferLast := 0.
+
+    "Created: / 17-03-2012 / 00:02:42 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 01-09-2013 / 18:51:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!JavaLexicalHighlighter::HighlightingScanner methodsFor:'private'!
+
+checkForKeyword:string
+    | isKW |
+
+    isKW := super checkForKeyword:string.
+    isKW ifTrue:[
+        highlighter markKeyword:string from:tokenStartPosition + 1 to:tokenStartPosition + string size
+    ].
+    ^isKW
+
+    "Created: / 17-03-2012 / 00:15:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!JavaLexicalHighlighter::HighlightingScanner methodsFor:'reading next token'!
+
+nextToken
+    | t |
+
+    t := super nextToken.
+    t == #String ifTrue:[
+        highlighter markStringFrom:tokenStartPosition + 1 to: tokenEndPosition + 1.  
+    ] ifFalse:[
+    t == #Integer ifTrue:[
+        highlighter markConstantFrom:tokenStartPosition + 1 to: tokenEndPosition + 1.
+    ]].
+"/    bufferLast := (bufferLast \\ buffer size) + 1.
+"/    bufferLast == bufferFirst ifTrue:[
+"/        bufferFirst := (bufferFirst \\ buffer size) + 1.
+"/    ].
+"/    buffer at: bufferLast put: self token.
+"/    "/ Now, do a quick check for some common token sequences...not a full parsing,
+"/    "/ but helps a bit
+"/    ((bufferLast - bufferFirst) \\ 10) > 2 ifTrue:[
+"/        "/ Quick check for method call sequence...
+"/        t == $( ifTrue:[
+"/
+"/            ((buffer at:(bufferLast - 1) \\ buffer size) type == #Identifier
+"/                and:[(buffer at:(bufferLast - 2) \\ buffer size) type == $.
+"/                and:[(buffer at:(bufferLast - 1) \\ buffer size) value first isLowercase]])
+"/                ifTrue:[
+"/                    | nameToken |
+"/    
+"/                    nameToken := (buffer at:(bufferLast - 1) \\ buffer size).
+"/                    highlighter markSelector: nameToken value from: nameToken startPosition to: nameToken endPosition.
+"/                    ^ t
+"/                ].
+"/        ].
+"/        "/ Add more patterns here
+"/    ].
+
+    ^ t
+
+    "Created: / 14-05-1998 / 15:48:04 / cg"
+    "Modified: / 16-05-1998 / 19:12:29 / cg"
+    "Created: / 17-03-2012 / 19:15:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 03-10-2013 / 20:25:53 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+skipComment
+    super skipComment.
+    highlighter markCommentFrom:((tokenStartPosition + 1) max: 1) to: source position.
+    ^nil
+
+    "Created: / 17-03-2012 / 00:04:49 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+skipEOLComment
+    super skipEOLComment.
+    highlighter markCommentFrom:((tokenStartPosition - 1) max: 1) to: source position.
+    ^nil
+
+    "Created: / 17-03-2012 / 00:05:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
--- a/tools/JavaSourceHighlighter.st	Wed Jun 25 11:03:47 2014 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1121 +0,0 @@
-"
- COPYRIGHT (c) 1996-2011 by Claus Gittinger
-
- New code and modifications done at SWING Research Group [1]:
-
- COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko
-                            SWING Research Group, Czech Technical University in Prague
-
- This software is furnished under a license and may be used
- only in accordance with the terms of that license and with the
- inclusion of the above copyright notice.   This software may not
- be provided or otherwise made available to, or used by, any
- other person.  No title to or ownership of the software is
- hereby transferred.
-
- [1] Code written at SWING Research Group contains a signature
-     of one of the above copright owners. For exact set of such code,
-     see the differences between this version and version stx:libjava
-     as of 1.9.2010
-"
-"{ Package: 'stx:libjava/tools' }"
-
-Object subclass:#JavaSourceHighlighter
-	instanceVariableNames:'preferences cachedStringEmphasis cachedStringColor sourceText
-		sourceIndex'
-	classVariableNames:''
-	poolDictionaries:''
-	category:'Languages-Java-Tools-Source'
-!
-
-Object subclass:#Indexer
-	instanceVariableNames:'index types fields locals'
-	classVariableNames:''
-	poolDictionaries:''
-	privateIn:JavaSourceHighlighter
-!
-
-Object subclass:#Marker
-	instanceVariableNames:'highlighter'
-	classVariableNames:'MARK_KEYWORD MARK_NUMBER MARK_STRING MARK_CHARACTER MARK_COMMENT
-		MARK_JAVADOC MARK_KEYWORD_FLOW MARK_SELECTOR MARK_FIELD
-		MARK_FIELD_ASSIGNED MARK_LOCAL MARK_CLASS'
-	poolDictionaries:''
-	privateIn:JavaSourceHighlighter
-!
-
-JavaScanner subclass:#Scanner
-	instanceVariableNames:'buffer bufferFirst bufferLast highlighter'
-	classVariableNames:''
-	poolDictionaries:''
-	privateIn:JavaSourceHighlighter
-!
-
-!JavaSourceHighlighter class methodsFor:'documentation'!
-
-copyright
-"
- COPYRIGHT (c) 1996-2011 by Claus Gittinger
-
- New code and modifications done at SWING Research Group [1]:
-
- COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko
-                            SWING Research Group, Czech Technical University in Prague
-
- This software is furnished under a license and may be used
- only in accordance with the terms of that license and with the
- inclusion of the above copyright notice.   This software may not
- be provided or otherwise made available to, or used by, any
- other person.  No title to or ownership of the software is
- hereby transferred.
-
- [1] Code written at SWING Research Group contains a signature
-     of one of the above copright owners. For exact set of such code,
-     see the differences between this version and version stx:libjava
-     as of 1.9.2010
-
-"
-!
-
-documentation
-"
-    A syntax highligter for Java. This highlighter is SmallSense-aware and
-    supports incremental highlighting.
-
-    [author:]
-        Jan Vrany <jan.vrany@fit.cvut.cz>
-
-    [instance variables:]
-
-    [class variables:]
-
-    [see also:]
-
-"
-! !
-
-!JavaSourceHighlighter class methodsFor:'formatting'!
-
-_formatClassDefinition:newCode line: ln number: lnr in:cls
-    ^self new formatClassDefinition:newCode line: ln number: lnr in:cls.
-
-    "Created: / 21-09-2013 / 04:22:12 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-_formatMethod:mthd source:newCode line: ln number: lnr in:cls using:syntaxPreferences
-    ^ self new formatMethod:mthd source:newCode line: ln number: lnr in:cls using:syntaxPreferences
-
-    "Created: / 21-09-2013 / 04:22:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-formatClass: javaClass
-
-    ^self new formatClassDefinition: javaClass source in: javaClass
-
-    "Created: / 15-12-2011 / 21:54:15 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-formatClassDefinition:source in:class
-
-    ^self new formatClassDefinition:source in:class
-
-    "Created: / 04-08-2011 / 23:44:52 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-formatClassDefinition:source in:class elementsInto: elements
-
-    ^self new formatClassDefinition:source in:class elementsInto: elements
-
-    "Created: / 04-08-2011 / 23:44:13 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-formatExpression:source in:class
-
-    ^self new formatExpression:source in:class
-
-    "Created: / 04-08-2011 / 23:45:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-formatExpression:source in:class elementsInto: elements
-
-    ^self new formatExpression:source in:class elementsInto: elements
-
-    "Created: / 04-08-2011 / 23:43:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-formatMethod:mth source:source in:class
-
-    ^self formatMethod: mth source: source in: class using: UserPreferences current
-
-    "Created: / 11-02-2012 / 18:18:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-formatMethod:mth source:source in:class using: preferences
-
-    ^self new formatMethod:mth source:source in:class using: preferences
-
-    "Created: / 04-08-2011 / 23:45:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-formatMethod:mth source:source in:class using: preferences elementsInto: elements
-
-    ^self new formatMethod:mth source:source in:class using: preferences elementsInto: elements
-
-    "Created: / 04-08-2011 / 23:42:54 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-! !
-
-!JavaSourceHighlighter methodsFor:'formatting'!
-
-_formatClassDefinition:newCode line: line number: lnr in:cls
-    | scanner |
-
-    line isEmptyOrNil ifTrue:[ ^  nil ].
-
-    sourceText := line asText.
-    preferences isNil ifTrue:[
-        preferences := UserPreferences current.
-    ]. 
-    scanner := Scanner for: line asString.
-    scanner highlighter: self.
-    [
-        [ scanner nextToken ~~ #EOF ] whileTrue.
-    ] on: Error do:[
-
-    ].
-    ^ sourceText
-
-    "Created: / 21-09-2013 / 04:19:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-_formatMethod:mthd source:newCode line: line number: lnr in:cls using:syntaxPreferences
-    | scanner |
-
-    line isEmptyOrNil ifTrue:[ ^  nil ].
-
-    sourceText := line asText.
-    preferences := syntaxPreferences.
-    preferences isNil ifTrue:[
-        preferences := UserPreferences current.
-    ]. 
-    scanner := Scanner for: line asString.
-    scanner highlighter: self.
-    [
-        [ scanner nextToken ~~ #EOF ] whileTrue.
-    ] on: Error do:[
-
-    ].
-    ^ sourceText
-
-    "Created: / 21-09-2013 / 04:20:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-formatClassDefinition:source in:class
-
-
-    | marker cacheIt document sourceUnit parser tree resolve loader |
-
-    "Optimization - if full class source is to be formatted,
-     consult cache - when browsing the code or debugging, very 
-     often same same source is to be highlighted"
-
-    preferences isNil ifTrue:[
-        preferences := UserPreferences current.
-    ].
-
-    JavaVM booted ifFalse:[
-        ^ self format: source string.
-    ].
-
-    cacheIt := class notNil and: [class isBehavior and:[class theNonMetaclass isJavaClass]].
-    cacheIt ifTrue:[
-        document := JavaSourceDocument cachedDocumentFor: class theNonMetaclass.
-        document notNil ifTrue:[
-            (document sourceText notNil and:[document sourceText string = source]) ifTrue:[
-                (sourceIndex notNil and:[document sourceTreeIndex notNil]) ifTrue:[
-                     sourceIndex addAll: document sourceTreeIndex.
-                     sourceIndex tree:  document sourceTreeIndex tree.
-                     sourceIndex source: document sourceText.
-                ].
-                ^ document sourceText copy.
-            ].
-        ] ifFalse:[
-            document := JavaSourceDocument for: class theNonMetaclass.
-            (sourceIndex isNil and:[SmallSense::ParseTreeIndex notNil]) ifTrue:[
-                 sourceIndex := SmallSense::ParseTreeIndex new.
-            ].
-            JavaSourceDocument cachedDocumentFor: class theNonMetaclass put: document.  
-        ].
-    ].
-    marker := Marker new.
-    marker highlighter: self.
-
-    sourceText := source isText 
-                    ifTrue:[source copy] 
-                    ifFalse:[source asText].
-
-    self doLexicalHighlightingOnly ifTrue:[          
-        sourceText := self format: source string.
-    ] ifFalse:[
-
-        sourceUnit := (Java classForName:'stx.libjava.tools.Source') new.
-        sourceUnit setContents: source string.
-        JavaCompiler synchronized:[
-            parser := (Java classForName:'stx.libjava.tools.text.Highlighter') new.
-        ].
-        parser setMarker: marker.
-        (sourceIndex notNil and:[sourceIndex isKindOf: SmallSense::ParseTreeIndex]) ifTrue:[
-            | indexer |
-
-            indexer := Indexer new.
-            indexer index: sourceIndex.
-            parser setIndexer: indexer.
-
-        ].
-
-        "/ Following is support JImport expecco plugin. For classes loaded by
-        "/ JImport plugin, do not resolve classes. The LookupEnvironment cannot
-        "/ find them as they are not installed in class registry...
-        resolve := class isNil or:[ (loader := class theNonMetaclass classLoader isNil) or:[loader isJavaObject] ] .
-
-        tree := parser parse: sourceUnit diet: false resolve: resolve.
-        (sourceIndex notNil and:[sourceIndex isKindOf: SmallSense::ParseTreeIndex]) ifTrue:[
-            sourceIndex tree: tree. 
-            sourceIndex source: sourceText.
-        ].
-    ].
-
-    ^ cacheIt ifTrue:[
-        document sourceText: sourceText.
-        document sourceTreeIndex: sourceIndex.
-        sourceText copy
-    ] ifFalse:[
-        sourceText
-    ]
-
-    "Created: / 04-08-2011 / 23:44:52 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified: / 13-05-2014 / 23:45:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-formatClassDefinition:source in:class elementsInto: els
-
-    sourceIndex := els.
-    ^self formatClassDefinition:source in:class
-
-    "Created: / 04-08-2011 / 23:44:13 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-formatExpression:source in:class
-    ^ self format: source
-
-    "Created: / 04-08-2011 / 23:45:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified: / 03-10-2013 / 20:19:35 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-formatExpression:source in:class elementsInto: els
-
-    sourceIndex := els.
-    ^self formatExpression:source in:class
-
-    "Created: / 04-08-2011 / 23:43:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-formatMethod:mth source:source in:class using: prefs
-    preferences := prefs.
-    preferences isNil ifTrue:[
-        preferences := UserPreferences current.
-    ].
-
-    JavaMethod showFullSource ifTrue:[
-        ^self formatClassDefinition: source in: class
-    ].   
-
-    sourceText := source asText.
-
-    self doLexicalHighlightingOnly ifTrue:[
-        sourceText := self format: source
-    ] ifFalse:[
-        | document type parser marker nodes debug |
-
-        JavaVM booted ifFalse:[JavaVM boot].
-        document := JavaSourceDocument cachedDocumentFor: class theNonMetaclass.
-        document isNil ifTrue:[
-            document := JavaSourceDocument for: class theNonMetaclass.
-            JavaSourceDocument cachedDocumentFor: class theNonMetaclass put: document.  
-        ].
-
-
-        document resolve.
-        type := document sourceTreeForClass: class theNonMetaclass.
-        marker := Marker new.
-        marker highlighter: self. 
-        JavaCompiler synchronized:[
-            parser := (Java classForName:'stx.libjava.tools.text.Highlighter') new.
-        ].
-        parser setMarker: marker.
-
-        debug :=  false.
-        nodes := parser parseClassBodyDeclarations: source string unit: document sourceTree copy type: type copy resolve: debug.
-        debug ifTrue:[
-            nodes inspect.
-        ]
-    ].
-    ^ sourceText
-
-    "Created: / 04-08-2011 / 23:45:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified (format): / 26-11-2013 / 23:04:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-formatMethod:mth source:source in:class using: prefs elementsInto: els
-
-    preferences := prefs.
-    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>"
-!
-
-formatMethod:mthd source:newCode line: line number: lnr in:cls using:syntaxPreferences
-    | scanner |
-
-    line isEmptyOrNil ifTrue:[ ^  nil ].
-
-    sourceText := line asText.
-    preferences := syntaxPreferences.
-    preferences isNil ifTrue:[
-        preferences := UserPreferences current.
-    ]. 
-    scanner := Scanner for: line asString.
-    scanner highlighter: self.
-    [
-        [ scanner nextToken ~~ #EOF ] whileTrue.
-    ] on: Error do:[
-
-    ].
-    ^ sourceText
-
-    "Created: / 04-08-2013 / 00:26:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-! !
-
-!JavaSourceHighlighter methodsFor:'formatting-private'!
-
-format: source
-    "Simple formatting based on lexical structure only"
-
-    | scanner token lastToken0 lastToken1 lastValue0 lastValue1 lastPosition0 lastPosition1 |
-    sourceText := source asText.
-    scanner := Scanner for: source string.
-    scanner highlighter: self.
-    [
-        [ (token := scanner nextToken) ~~ #EOF ] whileTrue:[
-            "/ Here, try to guess what's selector...
-            token == $( ifTrue:[
-                lastPosition0 == #Identifier ifTrue:[
-                    self markSelectorFrom: lastPosition0  to: lastPosition0 + lastValue0 size - 1.
-                ].
-            ].
-
-            lastToken1 := lastToken0.
-            lastValue1 := lastValue0.
-            lastPosition1  := lastPosition0.
-
-            lastToken0 := token.
-            lastValue0 := scanner tokenValue.
-            lastPosition0 := scanner tokenStartPosition.
-        ].
-    ] on: Error do:[:ex|
-    ].   
-    ^ sourceText
-
-    "Created: / 03-10-2013 / 20:19:15 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-! !
-
-!JavaSourceHighlighter methodsFor:'queries'!
-
-doLexicalHighlightingOnly
-    "/ For now, in debugger always use lexical highlighting. Makes highlighter debugging easier"
-
-    | process wgroups |
-
-    process := Processor activeProcess.
-    wgroups := WindowGroup scheduledWindowGroups.
-    [ process notNil ] whileTrue:[
-        | groups wg application |
-        groups := wgroups select:[:wg | wg process == process ].
-        groups notEmpty ifTrue:[
-            wg := groups detect:[:wg | wg isModal] ifNone:nil.
-            wg isNil ifTrue:[
-                wg := groups anElement
-            ].
-            (wg mainView class == DebugView) ifTrue:[ ^ true ].
-            (wg mainView notNil and:[(application := wg mainView application) notNil]) ifTrue:[
-                application class == (Smalltalk at: #'JDI::DebuggerApplication') ifTrue:[ ^ true ].
-                application class == Tools::NewSystemBrowser ifTrue:[ ^ false ].
-            ]
-        ].
-        process := process parentProcess.                    
-    ].
-    ^ false
-
-    "Created: / 09-09-2013 / 02:25:39 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified: / 25-03-2014 / 13:32:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-! !
-
-!JavaSourceHighlighter methodsFor:'syntax detection'!
-
-markArgumentIdentifierFrom:pos1 to:pos2
-    self 
-        markFrom:pos1 to:pos2 
-        withEmphasis:(preferences argumentIdentifierEmphasis) color:(preferences argumentIdentifierColor)
-!
-
-markBadIdentifierFrom:pos1 to:pos2
-    self 
-        markFrom:pos1 to:pos2 
-        withEmphasis:(preferences badIdentifierEmphasis) 
-        color:(preferences badIdentifierColor)
-!
-
-markClassVariableIdentifierFrom:pos1 to:pos2
-    self 
-        markFrom:pos1 to:pos2 
-        withEmphasis:(preferences classVariableIdentifierEmphasis) color:(preferences classVariableIdentifierColor)
-
-    "Modified: / 31.3.1998 / 18:02:14 / cg"
-!
-
-markCommentFrom:pos1 to:pos2
-    self 
-        markFrom:pos1 to:pos2 
-        withEmphasis:(preferences commentEmphasis) color:(preferences commentColor)
-!
-
-markConstantFrom:pos1 to:pos2
-    self 
-        markFrom:pos1 to:pos2 
-        withEmphasis:(preferences constantEmphasis) color:(preferences constantColor)
-!
-
-markFrom:pos1 to:pos2 withEmphasis:fontEmp color:clrIn
-    |e p2 clr|
-
-    clr := clrIn onDevice:Screen current.
-
-    clr = Color black ifTrue:[
-        e := fontEmp
-    ] ifFalse:[
-        fontEmp isNil ifTrue:[
-            e := (#color->clr)
-        ] ifFalse:[
-            e := Text addEmphasis:fontEmp to:(#color->clr).
-        ]
-    ].
-    (p2 := pos2) isNil ifTrue:[
-        p2 := sourceText size
-    ] ifFalse:[
-        p2 := p2 min:sourceText size
-    ].
-    sourceText emphasizeFrom:pos1 to:p2 with:e
-
-    "Created: / 31.3.1998 / 13:26:53 / cg"
-    "Modified: / 1.4.1998 / 12:51:56 / cg"
-!
-
-markFunctionNameFrom:pos1 to:pos2
-    self 
-        markFrom:pos1 to:pos2 
-        withEmphasis:(preferences methodSelectorEmphasis) color:(preferences methodSelectorColor)
-!
-
-markGlobalClassIdentifierFrom:pos1 to:pos2
-    self 
-        markFrom:pos1 to:pos2 
-        withEmphasis:(preferences globalClassIdentifierEmphasis) color:(preferences globalClassIdentifierColor)
-
-    "Modified: / 31.3.1998 / 18:02:14 / cg"
-    "Created: / 4.3.1999 / 12:53:02 / cg"
-!
-
-markGlobalIdentifierFrom:pos1 to:pos2
-    self 
-        markFrom:pos1 to:pos2 
-        withEmphasis:(preferences globalIdentifierEmphasis) color:(preferences globalIdentifierColor)
-
-    "Modified: / 31.3.1998 / 18:02:14 / cg"
-!
-
-markIdentifierFrom:pos1 to:pos2
-    self 
-        markFrom:pos1 to:pos2 
-        withEmphasis:(preferences identifierEmphasis) color:(preferences identifierColor)
-!
-
-markInstVarIdentifierFrom:pos1 to:pos2
-    self 
-        markFrom:pos1 to:pos2 
-        withEmphasis:(preferences instVarIdentifierEmphasis) color:(preferences instVarIdentifierColor)
-
-    "Created: / 16.4.1998 / 18:35:40 / cg"
-    "Modified: / 16.4.1998 / 18:37:30 / cg"
-!
-
-markKeyword:kw from:pos1 to:pos2
-    |em clr|
-
-    ( #( 'if' 'else'
-         'while'
-         'for'
-         'do'
-         'return'
-         'continue'
-         'break'
-    ) includes:kw) ifTrue:[
-        em := preferences controlFlowSelectorEmphasis. 
-        clr := preferences controlFlowSelectorColor.
-    ] ifFalse:[
-        em := preferences jsKeywordEmphasis.
-        clr := preferences jsKeywordColor.
-    ].
-    self 
-        markFrom:pos1 to:pos2 
-        withEmphasis:em color:clr
-
-    "Modified: / 19-05-2010 / 15:07:59 / cg"
-    "Modified: / 07-08-2013 / 00:28:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-markKeywordFlowFrom:pos1 to:pos2
-    self 
-        markFrom:pos1 to:pos2 
-        withEmphasis:preferences controlFlowSelectorEmphasis
-        color:preferences controlFlowSelectorColor
-
-    "Created: / 05-09-2013 / 03:09:15 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-markKeywordFrom:pos1 to:pos2
-    self 
-        markFrom:pos1 to:pos2 
-        withEmphasis:preferences jsKeywordEmphasis
-        color:preferences jsKeywordColor
-
-    "Created: / 05-09-2013 / 03:09:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-markLocalIdentifierFrom:pos1 to:pos2
-    self 
-        markFrom:pos1 to:pos2 
-        withEmphasis:(preferences localIdentifierEmphasis) color:(preferences localIdentifierColor)
-!
-
-markProblem: problem from:pos1 to:pos2
-    self 
-        markFrom:pos1 to:pos2 
-        withEmphasis:(preferences badIdentifierEmphasis) 
-        color:(preferences badIdentifierColor)
-
-    "Created: / 15-04-2013 / 22:23:30 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-markSelector:selectorString from:pos1 to:pos2 
-    | fg em |
-
-    fg := preferences selectorColor.
-    em := preferences selectorEmphasis.
-
-    self
-        markFrom:pos1 to:pos2 
-        withEmphasis:em color:fg
-
-    "Modified: / 04-10-2011 / 19:48:48 / cg"
-    "Modified: / 17-03-2012 / 13:26:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Created: / 17-03-2012 / 19:12:20 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-markSelector:selectorString from:pos1 to:pos2 receiverNode:aReceiverNodeOrNil numArgs:numArgs
-    |fg selectorSymbol check ok rec em currentEnvironment currentSuperclasses currentSubclasses classToCompileFor fullSelectorCheck|
-
-    fg := preferences selectorColor.
-    em := preferences selectorEmphasis.
-
-"/    (currentEnvironment notNil
-"/    and:[ (((currentEnvironment _localVariables ? #()) contains:[:local | local name = selectorString]) 
-"/          or:[((currentEnvironment _argVariables ? #()) contains:[:local | local name = selectorString])])
-"/    ])
-"/    ifTrue:[
-"/        "/ a local call
-"/    ] ifFalse:[
-"/        selectorSymbol := (self translatedSmalltalkSelectorFor:selectorString numArgs:numArgs) asSymbolIfInterned.
-"/        selectorSymbol isNil ifTrue:[
-"/            fg := Color red.
-"/        ] ifFalse:[
-"/            fullSelectorCheck == true ifTrue:[
-"/                aReceiverNodeOrNil notNil ifTrue:[
-"/                    check := [:cls | (cls includesSelector:selectorSymbol)
-"/                                     or:[cls class includesSelector:selectorSymbol]].
-"/
-"/                    ok := false.
-"/
-"/                    "/ limit search if possible
-"/                    (classToCompileFor notNil
-"/                     and:[aReceiverNodeOrNil isSelf or:[aReceiverNodeOrNil isSuper]]) ifTrue:[
-"/                        currentSuperclasses isNil ifTrue:[
-"/                            currentSuperclasses := classToCompileFor withAllSuperclasses.
-"/                        ].
-"/                        ok := currentSuperclasses contains:check.
-"/                        (ok not and:[aReceiverNodeOrNil isSelf]) ifTrue:[
-"/                            currentSubclasses isNil ifTrue:[
-"/                                currentSubclasses := classToCompileFor allSubclasses.
-"/                            ].
-"/                            ok := currentSubclasses contains:check.
-"/                        ].
-"/                    ] ifFalse:[
-"/                        aReceiverNodeOrNil isConstant ifTrue:[
-"/                            ok := aReceiverNodeOrNil evaluate class withAllSuperclasses contains:check.
-"/                        ] ifFalse:[
-"/                            (aReceiverNodeOrNil isGlobal 
-"/                            and:[(rec := aReceiverNodeOrNil evaluate) isBehavior]) ifTrue:[
-"/                                ok := rec class withAllSuperclasses contains:check.
-"/                            ] ifFalse:[
-"/                                ok := Smalltalk allClasses contains:check
-"/                            ]
-"/                        ]
-"/                    ].
-"/
-"/                    ok ifFalse:[
-"/                        em := preferences unimplementedSelectorEmphasis.
-"/                        fg := preferences unimplementedSelectorColor.
-"/                    ]
-"/                ]
-"/            ]
-"/        ].
-"/    ].
-    self
-        markFrom:pos1 to:pos2 
-        withEmphasis:em color:fg
-
-    "Modified: / 04-10-2011 / 19:48:48 / cg"
-    "Modified: / 17-03-2012 / 13:26:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-markSelectorFrom:pos1 to:pos2 
-    | fg em |
-
-    fg := preferences selectorColor.
-    em := preferences selectorEmphasis.
-
-    self
-        markFrom:pos1 to:pos2 
-        withEmphasis:em color:fg
-
-    "Created: / 11-09-2013 / 05:01:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-markSelfFrom:pos1 to:pos2
-    self 
-        markFrom:pos1 to:pos2 
-        withEmphasis:(preferences selfEmphasis) color:(preferences selfColor)
-!
-
-markStringFrom:pos1 to:pos2
-    self 
-        markFrom:pos1 to:pos2 
-        withEmphasis:(preferences stringEmphasis) color:(preferences stringColor)
-!
-
-markUnknownIdentifierFrom:pos1 to:pos2
-    self 
-        markFrom:pos1 to:pos2 
-        withEmphasis:(preferences unknownIdentifierEmphasis) color:(preferences unknownIdentifierColor)
-!
-
-markVariable:v from:pos to:endPos
-    "support for syntaxColoring"
-
-    |type globalValue nameSym|
-
-    type := v type.
-    (type == #BlockArg
-    or:[type == #MethodArg]) ifTrue:[
-        self markArgumentIdentifierFrom:pos to:endPos.
-        ^ self
-    ].
-    (type == #BlockVariable
-    or:[type == #MethodVariable]) ifTrue:[
-        self markLocalIdentifierFrom:pos to:endPos.
-        ^ self
-    ].
-    (type == #GlobalVariable) ifTrue:[
-        nameSym := v name asSymbolIfInterned.
-        (nameSym isNil 
-        or:[(Smalltalk includesKey:nameSym) not]) ifTrue:[
-            self markUnknownIdentifierFrom:pos to:endPos.
-            ^ self
-        ].
-        globalValue := Smalltalk at:nameSym ifAbsent:nil.
-        globalValue isBehavior ifTrue:[
-            self markGlobalClassIdentifierFrom:pos to:endPos.
-        ] ifFalse:[
-            self markGlobalIdentifierFrom:pos to:endPos.
-        ].
-        ^ self
-    ].
-    (type == #ClassVariable) ifTrue:[
-        self markClassVariableIdentifierFrom:pos to:endPos.
-        ^ self
-    ].
-    (type == #InstanceVariable) ifTrue:[
-        self markInstVarIdentifierFrom:pos to:endPos.
-        ^ self
-    ].
-
-    self markIdentifierFrom:pos to:endPos.
-
-    "Created: / 16.4.1998 / 18:49:34 / cg"
-    "Modified: / 4.3.1999 / 12:56:13 / cg"
-! !
-
-!JavaSourceHighlighter::Indexer class methodsFor:'initialization'!
-
-initialize
-    "Invoked at system start or when the class is dynamically loaded."
-
-    self lookupObject: JavaLookup instance.
-
-
-    "/ please change as required (and remove this comment)
-
-    "Modified: / 17-09-2013 / 01:33:52 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-! !
-
-!JavaSourceHighlighter::Indexer methodsFor:'accessing'!
-
-index
-    ^ index
-!
-
-index:aParseTreeIndex
-    index := aParseTreeIndex.
-    types := Dictionary new.
-    fields := Dictionary new.
-    locals := Dictionary new.
-
-    "Modified: / 24-09-2013 / 02:32:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-! !
-
-!JavaSourceHighlighter::Indexer methodsFor:'indexing'!
-
-add: node from: start to: stop
-    | element |
-
-    index add: (element := index newElementFor: node).
-    element start: start + 1; stop: stop + 1.
-    ^ element
-
-    "Created: / 01-10-2013 / 10:30:53 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-addFieldDeclaration: node from: start to: stop
-    | element binding fname previous |
-
-    element := self add: node from: start to: stop.
-    binding := node binding.
-    binding notNil ifTrue:[
-        fname := (binding declaringClass compoundName asStringWith:$/) , '.' , binding name.
-        previous := fields at: fname ifAbsent: nil.
-        previous notNil ifTrue:[
-            previous next: element.
-        ].
-        fields at: fname put: element.
-    ].
-
-    "Created: / 01-10-2013 / 10:33:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified: / 08-10-2013 / 17:18:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-addLocalDeclaration: node from: start to: stop
-    | element fname previous |
-
-    element := self add: node from: start to: stop.
-    fname := node name.
-    previous := locals at: fname ifAbsent: nil.
-    previous notNil ifTrue:[
-        previous next: element.
-    ].
-    locals at: fname put: element.
-
-    "Created: / 01-10-2013 / 11:44:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-addMessageSend: node from: start to: stop
-    self add: node from: start to: stop
-
-    "Created: / 01-10-2013 / 10:30:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-addTypeReference: node from: start to: stop
-    | element tname previous |
-
-    element := self add: node from: start to: stop.
-    tname := node getTypeName asStringWith: $/.
-    previous := types at: tname ifAbsent: nil.
-    previous notNil ifTrue:[
-        previous next: element.
-    ].
-    types at: tname put: element.
-
-    "Created: / 01-10-2013 / 10:33:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-addVariableReference: node from: start to: stop
-    | element binding name previous |
-
-    element := self add: node from: start to: stop.
-    binding := node binding.
-    binding isNil ifTrue:[ ^ self ].
-    "/ ProblemBinding, treat is as a local
-    binding problemId ~~ 0 ifTrue:[
-        name := binding name.
-        previous := locals at: name ifAbsent: nil.
-        previous notNil ifTrue:[
-            previous next: element.
-        ].
-        locals at: name put: element.  
-        ^ self.              
-    ].
-    (binding kind bitAnd: 2r100) == 2r100 "TYPE" ifTrue:[
-        name := binding compoundName asStringWith: $/.
-        previous := types at: name ifAbsent: nil.
-        previous notNil ifTrue:[
-            previous next: element.
-        ].
-        types at: name put: element.   
-        ^ self.
-    ].
-
-    binding kind == 2r001 "FIELD" ifTrue:[
-        binding declaringClass isNil ifTrue:[
-            name := '???.' , binding name
-        ] ifFalse:[
-            name := (binding declaringClass compoundName asStringWith:$/) , '.' , binding name.
-        ].
-        previous := fields at: name ifAbsent: nil.
-        previous notNil ifTrue:[
-            previous next: element.
-        ].
-        fields at: name put: element.  
-        ^ self.
-    ].
-
-    binding kind == 2r010 "LOCAL" ifTrue:[
-        name := binding name.
-        previous := locals at: name ifAbsent: nil.
-        previous notNil ifTrue:[
-            previous next: element.
-        ].
-        locals at: name put: element.  
-        ^ self.   
-    ].
-
-    self error: 'Should not happen'
-
-    "Created: / 01-10-2013 / 10:33:30 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified: / 26-10-2013 / 21:27:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-methodEnter: node
-    locals := Dictionary new
-
-    "Created: / 01-10-2013 / 10:44:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-methodLeave: node
-
-    "Created: / 01-10-2013 / 10:44:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-! !
-
-!JavaSourceHighlighter::Marker class methodsFor:'initialization'!
-
-initialize
-    "Invoked at system start or when the class is dynamically loaded."
-
-    "
-    !!!! IMPORTANT !!!!!!
-    When changing / adding constants, make sure they
-    are in sync with those defined in Smaltalk
-    stx.libjava.tools.source.JavaSourceMarker !!!!!!
-    "
-
-    self lookupObject: JavaLookup instance.
-    
-    MARK_KEYWORD        := 1.
-    MARK_NUMBER         := 2.
-    MARK_STRING         := 3.
-    MARK_CHARACTER      := 4.
-    MARK_COMMENT        := 5.
-    MARK_JAVADOC        := 6.
-    MARK_KEYWORD_FLOW   := 7.
-    MARK_SELECTOR       := 8.
-    MARK_FIELD          := 9.
-    MARK_FIELD_ASSIGNED := 10.
-    MARK_LOCAL          := 11.
-    MARK_CLASS          := 12.
-
-    "Modified: / 11-09-2013 / 01:45:59 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-! !
-
-!JavaSourceHighlighter::Marker methodsFor:'accessing'!
-
-highlighter:aJavaSourceHighlighter
-    highlighter := aJavaSourceHighlighter.
-! !
-
-!JavaSourceHighlighter::Marker methodsFor:'syntax detection'!
-
-mark: kind from:pos1 to:pos2
-
-    kind == MARK_KEYWORD        ifTrue:[ ^ highlighter markKeywordFrom: pos1 + 1 to: pos2 + 1].
-    kind == MARK_KEYWORD_FLOW   ifTrue:[ ^ highlighter markKeywordFlowFrom: pos1 + 1 to: pos2 + 1 ].
-
-    kind == MARK_NUMBER         ifTrue:[ ^ highlighter markConstantFrom: pos1 + 1 to: pos2 + 1 ].
-    kind == MARK_STRING         ifTrue:[ ^ highlighter markConstantFrom: pos1 + 1 to: pos2 + 1 ].
-    kind == MARK_CHARACTER      ifTrue:[ ^ highlighter markConstantFrom: pos1 + 1 to: pos2 + 1 ].
-
-    kind == MARK_COMMENT        ifTrue:[ ^ highlighter markCommentFrom: pos1 + 1 to: pos2 + 1 ].
-    kind == MARK_JAVADOC        ifTrue:[ ^ highlighter markCommentFrom: pos1 + 1 to: pos2 + 1 ].
-
-    kind == MARK_SELECTOR      ifTrue:[ ^ highlighter markSelectorFrom: pos1 + 1 to: pos2 + 1 ].
-
-    "Created: / 05-09-2013 / 03:03:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified: / 11-09-2013 / 01:48:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-! !
-
-!JavaSourceHighlighter::Scanner methodsFor:'accessing'!
-
-highlighter
-    ^ highlighter
-!
-
-highlighter:aJavaSyntaxHighlighter
-    highlighter := aJavaSyntaxHighlighter.
-! !
-
-!JavaSourceHighlighter::Scanner methodsFor:'error handling'!
-
-syntaxError:aMessage position:position to:endPos
-    "a syntax error happened"
-
-    endPos notNil ifTrue:[
-        highlighter markBadIdentifierFrom:position to: endPos.
-    ]
-
-    "Created: / 13-04-2012 / 18:31:42 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-! !
-
-!JavaSourceHighlighter::Scanner methodsFor:'initialization'!
-
-initialize
-    "initialize the scanner"
-
-    super initialize.
-    saveComments := true.
-    buffer := Array new: 3.
-    bufferFirst := 1.
-    bufferLast := 0.
-
-    "Created: / 17-03-2012 / 00:02:42 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified: / 01-09-2013 / 18:51:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-! !
-
-!JavaSourceHighlighter::Scanner methodsFor:'private'!
-
-checkForKeyword:string
-    | isKW |
-
-    isKW := super checkForKeyword:string.
-    isKW ifTrue:[
-        highlighter markKeyword:string from:tokenStartPosition + 1 to:tokenStartPosition + string size
-    ].
-    ^isKW
-
-    "Created: / 17-03-2012 / 00:15:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-! !
-
-!JavaSourceHighlighter::Scanner methodsFor:'reading next token'!
-
-nextToken
-    | t |
-
-    t := super nextToken.
-    t == #String ifTrue:[
-        highlighter markStringFrom:tokenStartPosition + 1 to: tokenEndPosition + 1.  
-    ] ifFalse:[
-    t == #Integer ifTrue:[
-        highlighter markConstantFrom:tokenStartPosition + 1 to: tokenEndPosition + 1.
-    ]].
-"/    bufferLast := (bufferLast \\ buffer size) + 1.
-"/    bufferLast == bufferFirst ifTrue:[
-"/        bufferFirst := (bufferFirst \\ buffer size) + 1.
-"/    ].
-"/    buffer at: bufferLast put: self token.
-"/    "/ Now, do a quick check for some common token sequences...not a full parsing,
-"/    "/ but helps a bit
-"/    ((bufferLast - bufferFirst) \\ 10) > 2 ifTrue:[
-"/        "/ Quick check for method call sequence...
-"/        t == $( ifTrue:[
-"/
-"/            ((buffer at:(bufferLast - 1) \\ buffer size) type == #Identifier
-"/                and:[(buffer at:(bufferLast - 2) \\ buffer size) type == $.
-"/                and:[(buffer at:(bufferLast - 1) \\ buffer size) value first isLowercase]])
-"/                ifTrue:[
-"/                    | nameToken |
-"/    
-"/                    nameToken := (buffer at:(bufferLast - 1) \\ buffer size).
-"/                    highlighter markSelector: nameToken value from: nameToken startPosition to: nameToken endPosition.
-"/                    ^ t
-"/                ].
-"/        ].
-"/        "/ Add more patterns here
-"/    ].
-
-    ^ t
-
-    "Created: / 14-05-1998 / 15:48:04 / cg"
-    "Modified: / 16-05-1998 / 19:12:29 / cg"
-    "Created: / 17-03-2012 / 19:15:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified: / 03-10-2013 / 20:25:53 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-skipComment
-    super skipComment.
-    highlighter markCommentFrom:((tokenStartPosition + 1) max: 1) to: source position.
-    ^nil
-
-    "Created: / 17-03-2012 / 00:04:49 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-skipEOLComment
-    super skipEOLComment.
-    highlighter markCommentFrom:((tokenStartPosition - 1) max: 1) to: source position.
-    ^nil
-
-    "Created: / 17-03-2012 / 00:05:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-! !
-
-!JavaSourceHighlighter class methodsFor:'documentation'!
-
-version_CVS
-    ^ '$Header: /cvs/stx/stx/libjava/tools/JavaSyntaxHighlighter.st,v 1.2 2013-02-25 11:15:35 vrany Exp $'
-!
-
-version_HG
-
-    ^ '$Changeset: <not expanded> $'
-!
-
-version_SVN
-    ^ 'Id'
-! !
-
-
-JavaSourceHighlighter::Indexer initialize!
-JavaSourceHighlighter::Marker initialize!
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/JavaSyntaxHighlighter.st	Wed Jun 25 13:58:21 2014 +0100
@@ -0,0 +1,503 @@
+"
+ COPYRIGHT (c) 1996-2011 by Claus Gittinger
+
+ New code and modifications done at SWING Research Group [1]:
+
+ COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko
+                            SWING Research Group, Czech Technical University in Prague
+
+ This software is furnished under a license and may be used
+ only in accordance with the terms of that license and with the
+ inclusion of the above copyright notice.   This software may not
+ be provided or otherwise made available to, or used by, any
+ other person.  No title to or ownership of the software is
+ hereby transferred.
+
+ [1] Code written at SWING Research Group contains a signature
+     of one of the above copright owners. For exact set of such code,
+     see the differences between this version and version stx:libjava
+     as of 1.9.2010
+"
+"{ Package: 'stx:libjava/tools' }"
+
+JavaAbstractSourceHighlighter subclass:#JavaSyntaxHighlighter
+	instanceVariableNames:''
+	classVariableNames:''
+	poolDictionaries:''
+	category:'Languages-Java-Tools-Source'
+!
+
+Object subclass:#Indexer
+	instanceVariableNames:'index types fields locals'
+	classVariableNames:''
+	poolDictionaries:''
+	privateIn:JavaSyntaxHighlighter
+!
+
+Object subclass:#Marker
+	instanceVariableNames:'highlighter'
+	classVariableNames:'MARK_KEYWORD MARK_NUMBER MARK_STRING MARK_CHARACTER MARK_COMMENT
+		MARK_JAVADOC MARK_KEYWORD_FLOW MARK_SELECTOR MARK_FIELD
+		MARK_FIELD_ASSIGNED MARK_LOCAL MARK_CLASS'
+	poolDictionaries:''
+	privateIn:JavaSyntaxHighlighter
+!
+
+!JavaSyntaxHighlighter class methodsFor:'documentation'!
+
+copyright
+"
+ COPYRIGHT (c) 1996-2011 by Claus Gittinger
+
+ New code and modifications done at SWING Research Group [1]:
+
+ COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko
+                            SWING Research Group, Czech Technical University in Prague
+
+ This software is furnished under a license and may be used
+ only in accordance with the terms of that license and with the
+ inclusion of the above copyright notice.   This software may not
+ be provided or otherwise made available to, or used by, any
+ other person.  No title to or ownership of the software is
+ hereby transferred.
+
+ [1] Code written at SWING Research Group contains a signature
+     of one of the above copright owners. For exact set of such code,
+     see the differences between this version and version stx:libjava
+     as of 1.9.2010
+
+"
+!
+
+documentation
+"
+    A syntax highligter for Java. Unlike JavaLexicalHighlighter,
+    this one does full parsing (using eclipse compiler) so it is
+    slower (expecially when classes are not loader).
+
+    To avoid this initial lag, which is very annoying from UX point
+    of view, it temporarily bails out to lexical highlighting.
+
+    [author:]
+        Jan Vrany <jan.vrany@fit.cvut.cz>
+
+    [instance variables:]
+
+    [class variables:]
+
+    [see also:]
+
+"
+! !
+
+!JavaSyntaxHighlighter methodsFor:'formatting'!
+
+formatClassDefinition:source in:class
+    | marker cacheIt document sourceUnit parser tree resolve loader |
+
+    "Optimization - if full class source is to be formatted,
+     consult cache - when browsing the code or debugging, very 
+     often same same source is to be highlighted"
+
+    preferences isNil ifTrue:[
+        preferences := UserPreferences current.
+    ].
+    JavaVM booted ifFalse:[
+        ^ self format: source string.
+    ].
+
+    cacheIt := class notNil and: [class isBehavior and:[class theNonMetaclass isJavaClass]].
+    cacheIt ifTrue:[
+        document := JavaSourceDocument cachedDocumentFor: class theNonMetaclass.
+        document notNil ifTrue:[
+            (document sourceText notNil and:[document sourceText string = source]) ifTrue:[
+                (sourceIndex notNil and:[document sourceTreeIndex notNil]) ifTrue:[
+                     sourceIndex addAll: document sourceTreeIndex.
+                     sourceIndex tree:  document sourceTreeIndex tree.
+                     sourceIndex source: document sourceText.
+                ].
+                ^ document sourceText copy.
+            ].
+        ] ifFalse:[
+            document := JavaSourceDocument for: class theNonMetaclass.
+            (sourceIndex isNil and:[SmallSense::ParseTreeIndex notNil]) ifTrue:[
+                 sourceIndex := SmallSense::ParseTreeIndex new.
+            ].
+            JavaSourceDocument cachedDocumentFor: class theNonMetaclass put: document.  
+            ^ self format: source.
+        ].
+    ].
+    marker := Marker new.
+    marker highlighter: self.
+
+    sourceText := source isText 
+                    ifTrue:[source copy] 
+                    ifFalse:[source asText].
+
+    self doLexicalHighlightingOnly ifTrue:[          
+        sourceText := self format: source string.
+    ] ifFalse:[
+
+        sourceUnit := (Java classForName:'stx.libjava.tools.Source') new.
+        sourceUnit setContents: source string.
+        parser := (Java classForName:'stx.libjava.tools.text.Highlighter') new.
+        parser setMarker: marker.
+        (sourceIndex notNil and:[sourceIndex isKindOf: SmallSense::ParseTreeIndex]) ifTrue:[
+            | indexer |
+
+            indexer := Indexer new.
+            indexer index: sourceIndex.
+            parser setIndexer: indexer.
+        ].
+
+        "/ Following is support JImport expecco plugin. For classes loaded by
+        "/ JImport plugin, do not resolve classes. The LookupEnvironment cannot
+        "/ find them as they are not installed in class registry...
+        resolve := class isNil or:[ (loader := class theNonMetaclass classLoader isNil) or:[loader isJavaObject] ] .
+
+        tree := parser parse: sourceUnit diet: false resolve: resolve.
+        (sourceIndex notNil and:[sourceIndex isKindOf: SmallSense::ParseTreeIndex]) ifTrue:[
+            sourceIndex tree: tree. 
+            sourceIndex source: sourceText.
+        ].
+    ].
+
+    ^ cacheIt ifTrue:[
+        document sourceText: sourceText.
+        document sourceTreeIndex: sourceIndex.
+        sourceText copy
+    ] ifFalse:[
+        sourceText
+    ]
+
+    "Created: / 04-08-2011 / 23:44:52 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 25-06-2014 / 13:23:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+formatMethod:mth source:source in:class using: prefs
+    preferences := prefs.
+    preferences isNil ifTrue:[
+        preferences := UserPreferences current.
+    ].
+
+    JavaMethod showFullSource ifTrue:[
+        ^self formatClassDefinition: source in: class
+    ].   
+
+    sourceText := source asText.
+
+    self doLexicalHighlightingOnly ifTrue:[
+        sourceText := self format: source
+    ] ifFalse:[
+        | document type parser marker nodes debug |
+
+        JavaVM booted ifFalse:[JavaVM boot].
+        document := JavaSourceDocument cachedDocumentFor: class theNonMetaclass.
+        document isNil ifTrue:[
+            document := JavaSourceDocument for: class theNonMetaclass.
+            JavaSourceDocument cachedDocumentFor: class theNonMetaclass put: document.  
+        ].
+
+
+        document resolve.
+        type := document sourceTreeForClass: class theNonMetaclass.
+        marker := Marker new.
+        marker highlighter: self. 
+        JavaCompiler synchronized:[
+            parser := (Java classForName:'stx.libjava.tools.text.Highlighter') new.
+        ].
+        parser setMarker: marker.
+
+        debug :=  false.
+        nodes := parser parseClassBodyDeclarations: source string unit: document sourceTree copy type: type copy resolve: debug.
+        debug ifTrue:[
+            nodes inspect.
+        ]
+    ].
+    ^ sourceText
+
+    "Created: / 04-08-2011 / 23:45:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified (format): / 26-11-2013 / 23:04:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+formatMethod:mthd source:newCode line: line number: lnr in:cls using:syntaxPreferences
+
+    ^ JavaLexicalHighlighter formatMethod:mthd source:newCode line: line number: lnr in:cls using:syntaxPreferences
+
+    "Created: / 25-06-2014 / 12:49:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!JavaSyntaxHighlighter methodsFor:'formatting-private'!
+
+format: source
+    ^ JavaLexicalHighlighter new format: source
+
+    "Created: / 25-06-2014 / 11:56:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!JavaSyntaxHighlighter methodsFor:'queries'!
+
+doLexicalHighlightingOnly
+    "/ For now, in debugger always use lexical highlighting. Makes highlighter debugging easier"
+
+    | process wgroups |
+
+    process := Processor activeProcess.
+    wgroups := WindowGroup scheduledWindowGroups.
+    [ process notNil ] whileTrue:[
+        | groups wg application |
+        groups := wgroups select:[:wg | wg process == process ].
+        groups notEmpty ifTrue:[
+            wg := groups detect:[:wg | wg isModal] ifNone:nil.
+            wg isNil ifTrue:[
+                wg := groups anElement
+            ].
+            (wg mainView class == DebugView) ifTrue:[ ^ true ].
+            (wg mainView notNil and:[(application := wg mainView application) notNil]) ifTrue:[
+                application class == (Smalltalk at: #'JDI::DebuggerApplication') ifTrue:[ ^ true ].
+                application class == Tools::NewSystemBrowser ifTrue:[ ^ false ].
+            ]
+        ].
+        process := process parentProcess.                    
+    ].
+    ^ false
+
+    "Created: / 09-09-2013 / 02:25:39 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 25-03-2014 / 13:32:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!JavaSyntaxHighlighter::Indexer class methodsFor:'initialization'!
+
+initialize
+    "Invoked at system start or when the class is dynamically loaded."
+
+    self lookupObject: JavaLookup instance.
+
+
+    "/ please change as required (and remove this comment)
+
+    "Modified: / 17-09-2013 / 01:33:52 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+
+!JavaSyntaxHighlighter::Indexer methodsFor:'accessing'!
+
+index
+    ^ index
+!
+
+index:aParseTreeIndex
+    index := aParseTreeIndex.
+    types := Dictionary new.
+    fields := Dictionary new.
+    locals := Dictionary new.
+
+    "Modified: / 24-09-2013 / 02:32:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!JavaSyntaxHighlighter::Indexer methodsFor:'indexing'!
+
+add: node from: start to: stop
+    | element |
+
+    index add: (element := index newElementFor: node).
+    element start: start + 1; stop: stop + 1.
+    ^ element
+
+    "Created: / 01-10-2013 / 10:30:53 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+addFieldDeclaration: node from: start to: stop
+    | element binding fname previous |
+
+    element := self add: node from: start to: stop.
+    binding := node binding.
+    binding notNil ifTrue:[
+        fname := (binding declaringClass compoundName asStringWith:$/) , '.' , binding name.
+        previous := fields at: fname ifAbsent: nil.
+        previous notNil ifTrue:[
+            previous next: element.
+        ].
+        fields at: fname put: element.
+    ].
+
+    "Created: / 01-10-2013 / 10:33:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 08-10-2013 / 17:18:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+addLocalDeclaration: node from: start to: stop
+    | element fname previous |
+
+    element := self add: node from: start to: stop.
+    fname := node name.
+    previous := locals at: fname ifAbsent: nil.
+    previous notNil ifTrue:[
+        previous next: element.
+    ].
+    locals at: fname put: element.
+
+    "Created: / 01-10-2013 / 11:44:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+addMessageSend: node from: start to: stop
+    self add: node from: start to: stop
+
+    "Created: / 01-10-2013 / 10:30:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+addTypeReference: node from: start to: stop
+    | element tname previous |
+
+    element := self add: node from: start to: stop.
+    tname := node getTypeName asStringWith: $/.
+    previous := types at: tname ifAbsent: nil.
+    previous notNil ifTrue:[
+        previous next: element.
+    ].
+    types at: tname put: element.
+
+    "Created: / 01-10-2013 / 10:33:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+addVariableReference: node from: start to: stop
+    | element binding name previous |
+
+    element := self add: node from: start to: stop.
+    binding := node binding.
+    binding isNil ifTrue:[ ^ self ].
+    "/ ProblemBinding, treat is as a local
+    binding problemId ~~ 0 ifTrue:[
+        name := binding name.
+        previous := locals at: name ifAbsent: nil.
+        previous notNil ifTrue:[
+            previous next: element.
+        ].
+        locals at: name put: element.  
+        ^ self.              
+    ].
+    (binding kind bitAnd: 2r100) == 2r100 "TYPE" ifTrue:[
+        name := binding compoundName asStringWith: $/.
+        previous := types at: name ifAbsent: nil.
+        previous notNil ifTrue:[
+            previous next: element.
+        ].
+        types at: name put: element.   
+        ^ self.
+    ].
+
+    binding kind == 2r001 "FIELD" ifTrue:[
+        binding declaringClass isNil ifTrue:[
+            name := '???.' , binding name
+        ] ifFalse:[
+            name := (binding declaringClass compoundName asStringWith:$/) , '.' , binding name.
+        ].
+        previous := fields at: name ifAbsent: nil.
+        previous notNil ifTrue:[
+            previous next: element.
+        ].
+        fields at: name put: element.  
+        ^ self.
+    ].
+
+    binding kind == 2r010 "LOCAL" ifTrue:[
+        name := binding name.
+        previous := locals at: name ifAbsent: nil.
+        previous notNil ifTrue:[
+            previous next: element.
+        ].
+        locals at: name put: element.  
+        ^ self.   
+    ].
+
+    self error: 'Should not happen'
+
+    "Created: / 01-10-2013 / 10:33:30 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 26-10-2013 / 21:27:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+methodEnter: node
+    locals := Dictionary new
+
+    "Created: / 01-10-2013 / 10:44:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+methodLeave: node
+
+    "Created: / 01-10-2013 / 10:44:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!JavaSyntaxHighlighter::Marker class methodsFor:'initialization'!
+
+initialize
+    "Invoked at system start or when the class is dynamically loaded."
+
+    "
+    !!!! IMPORTANT !!!!!!
+    When changing / adding constants, make sure they
+    are in sync with those defined in Smaltalk
+    stx.libjava.tools.source.JavaSourceMarker !!!!!!
+    "
+
+    self lookupObject: JavaLookup instance.
+    
+    MARK_KEYWORD        := 1.
+    MARK_NUMBER         := 2.
+    MARK_STRING         := 3.
+    MARK_CHARACTER      := 4.
+    MARK_COMMENT        := 5.
+    MARK_JAVADOC        := 6.
+    MARK_KEYWORD_FLOW   := 7.
+    MARK_SELECTOR       := 8.
+    MARK_FIELD          := 9.
+    MARK_FIELD_ASSIGNED := 10.
+    MARK_LOCAL          := 11.
+    MARK_CLASS          := 12.
+
+    "Modified: / 11-09-2013 / 01:45:59 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+
+!JavaSyntaxHighlighter::Marker methodsFor:'accessing'!
+
+highlighter:aJavaSourceHighlighter
+    highlighter := aJavaSourceHighlighter.
+! !
+
+!JavaSyntaxHighlighter::Marker methodsFor:'syntax detection'!
+
+mark: kind from:pos1 to:pos2
+
+    kind == MARK_KEYWORD        ifTrue:[ ^ highlighter markKeywordFrom: pos1 + 1 to: pos2 + 1].
+    kind == MARK_KEYWORD_FLOW   ifTrue:[ ^ highlighter markKeywordFlowFrom: pos1 + 1 to: pos2 + 1 ].
+
+    kind == MARK_NUMBER         ifTrue:[ ^ highlighter markConstantFrom: pos1 + 1 to: pos2 + 1 ].
+    kind == MARK_STRING         ifTrue:[ ^ highlighter markConstantFrom: pos1 + 1 to: pos2 + 1 ].
+    kind == MARK_CHARACTER      ifTrue:[ ^ highlighter markConstantFrom: pos1 + 1 to: pos2 + 1 ].
+
+    kind == MARK_COMMENT        ifTrue:[ ^ highlighter markCommentFrom: pos1 + 1 to: pos2 + 1 ].
+    kind == MARK_JAVADOC        ifTrue:[ ^ highlighter markCommentFrom: pos1 + 1 to: pos2 + 1 ].
+
+    kind == MARK_SELECTOR      ifTrue:[ ^ highlighter markSelectorFrom: pos1 + 1 to: pos2 + 1 ].
+
+    "Created: / 05-09-2013 / 03:03:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 11-09-2013 / 01:48:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!JavaSyntaxHighlighter class methodsFor:'documentation'!
+
+version_CVS
+    ^ '$Header: /cvs/stx/stx/libjava/tools/JavaSyntaxHighlighter.st,v 1.2 2013-02-25 11:15:35 vrany Exp $'
+!
+
+version_HG
+
+    ^ '$Changeset: <not expanded> $'
+!
+
+version_SVN
+    ^ 'Id'
+! !
+
+
+JavaSyntaxHighlighter::Indexer initialize!
+JavaSyntaxHighlighter::Marker initialize!
--- a/tools/Make.proto	Wed Jun 25 11:03:47 2014 +0100
+++ b/tools/Make.proto	Wed Jun 25 13:58:21 2014 +0100
@@ -140,10 +140,9 @@
 	cd ../../libcomp && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
 	cd ../../libui && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
 	cd ../../libview && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
+	cd ../ && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
 	cd ../../libview2 && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
-	cd ../../goodies/sunit && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
 	cd ../../libwidg && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
-	cd ../ && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
 	cd ../../libwidg2 && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
 	cd ../../libtool && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
 
@@ -165,6 +164,7 @@
 
 
 # BEGINMAKEDEPEND --- do not remove this line; make depend needs it
+$(OUTDIR)JavaAbstractSourceHighlighter.$(O) JavaAbstractSourceHighlighter.$(H): JavaAbstractSourceHighlighter.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
 $(OUTDIR)JavaCodeBundleEditor.$(O) JavaCodeBundleEditor.$(H): JavaCodeBundleEditor.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(INCLUDE_TOP)/stx/libview2/ApplicationModel.$(H) $(INCLUDE_TOP)/stx/libview2/Model.$(H) $(INCLUDE_TOP)/stx/libwidg2/HierarchicalItem.$(H) $(STCHDR)
 $(OUTDIR)JavaCodeLibraryEditor.$(O) JavaCodeLibraryEditor.$(H): JavaCodeLibraryEditor.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(INCLUDE_TOP)/stx/libview2/ApplicationModel.$(H) $(INCLUDE_TOP)/stx/libview2/Model.$(H) $(INCLUDE_TOP)/stx/libview2/SimpleDialog.$(H) $(STCHDR)
 $(OUTDIR)JavaCompiler.$(O) JavaCompiler.$(H): JavaCompiler.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
@@ -181,9 +181,11 @@
 $(OUTDIR)JavaSourceRef.$(O) JavaSourceRef.$(H): JavaSourceRef.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
 $(OUTDIR)JavaToolbox.$(O) JavaToolbox.$(H): JavaToolbox.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(INCLUDE_TOP)/stx/libtool/Tools__Toolbox.$(H) $(STCHDR)
 $(OUTDIR)stx_libjava_tools.$(O) stx_libjava_tools.$(H): stx_libjava_tools.st $(INCLUDE_TOP)/stx/libbasic/LibraryDefinition.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(INCLUDE_TOP)/stx/libbasic/ProjectDefinition.$(H) $(STCHDR)
+$(OUTDIR)JavaAbstractLexicalHighlighter.$(O) JavaAbstractLexicalHighlighter.$(H): JavaAbstractLexicalHighlighter.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(INCLUDE_TOP)/stx/libjava/tools/JavaAbstractSourceHighlighter.$(H) $(STCHDR)
 $(OUTDIR)JavaScanner.$(O) JavaScanner.$(H): JavaScanner.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(INCLUDE_TOP)/stx/libjava/tools/JavaScannerBase.$(H) $(STCHDR)
+$(OUTDIR)JavaSyntaxHighlighter.$(O) JavaSyntaxHighlighter.$(H): JavaSyntaxHighlighter.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(INCLUDE_TOP)/stx/libjava/tools/JavaAbstractSourceHighlighter.$(H) $(STCHDR)
 $(OUTDIR)GroovyScanner.$(O) GroovyScanner.$(H): GroovyScanner.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(INCLUDE_TOP)/stx/libjava/tools/JavaScanner.$(H) $(INCLUDE_TOP)/stx/libjava/tools/JavaScannerBase.$(H) $(STCHDR)
-$(OUTDIR)JavaSourceHighlighter.$(O) JavaSourceHighlighter.$(H): JavaSourceHighlighter.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(INCLUDE_TOP)/stx/libjava/tools/JavaScanner.$(H) $(INCLUDE_TOP)/stx/libjava/tools/JavaScannerBase.$(H) $(STCHDR)
+$(OUTDIR)JavaLexicalHighlighter.$(O) JavaLexicalHighlighter.$(H): JavaLexicalHighlighter.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(INCLUDE_TOP)/stx/libjava/tools/JavaAbstractLexicalHighlighter.$(H) $(INCLUDE_TOP)/stx/libjava/tools/JavaAbstractSourceHighlighter.$(H) $(INCLUDE_TOP)/stx/libjava/tools/JavaScanner.$(H) $(INCLUDE_TOP)/stx/libjava/tools/JavaScannerBase.$(H) $(STCHDR)
 $(OUTDIR)GroovySourceHighlighter.$(O) GroovySourceHighlighter.$(H): GroovySourceHighlighter.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(INCLUDE_TOP)/stx/libjava/tools/GroovyScanner.$(H) $(INCLUDE_TOP)/stx/libjava/tools/JavaScanner.$(H) $(INCLUDE_TOP)/stx/libjava/tools/JavaScannerBase.$(H) $(STCHDR)
 $(OUTDIR)extensions.$(O): extensions.st $(INCLUDE_TOP)/stx/libbasic/ConfigurableFeatures.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(INCLUDE_TOP)/stx/libjava/JavaObject.$(H) $(INCLUDE_TOP)/stx/libtool/SystemBrowser.$(H) $(INCLUDE_TOP)/stx/libtool/Tools__NewSystemBrowser.$(H) $(INCLUDE_TOP)/stx/libview2/ApplicationModel.$(H) $(INCLUDE_TOP)/stx/libview2/Model.$(H) $(STCHDR)
 
--- a/tools/Make.spec	Wed Jun 25 11:03:47 2014 +0100
+++ b/tools/Make.spec	Wed Jun 25 13:58:21 2014 +0100
@@ -50,6 +50,7 @@
 STCWARNINGS=-warnNonStandard
 
 COMMON_CLASSES= \
+	JavaAbstractSourceHighlighter \
 	JavaCodeBundleEditor \
 	JavaCodeLibraryEditor \
 	JavaCompiler \
@@ -66,15 +67,18 @@
 	JavaSourceRef \
 	JavaToolbox \
 	stx_libjava_tools \
+	JavaAbstractLexicalHighlighter \
 	JavaScanner \
+	JavaSyntaxHighlighter \
 	GroovyScanner \
-	JavaSourceHighlighter \
+	JavaLexicalHighlighter \
 	GroovySourceHighlighter \
 
 
 
 
 COMMON_OBJS= \
+    $(OUTDIR_SLASH)JavaAbstractSourceHighlighter.$(O) \
     $(OUTDIR_SLASH)JavaCodeBundleEditor.$(O) \
     $(OUTDIR_SLASH)JavaCodeLibraryEditor.$(O) \
     $(OUTDIR_SLASH)JavaCompiler.$(O) \
@@ -91,9 +95,11 @@
     $(OUTDIR_SLASH)JavaSourceRef.$(O) \
     $(OUTDIR_SLASH)JavaToolbox.$(O) \
     $(OUTDIR_SLASH)stx_libjava_tools.$(O) \
+    $(OUTDIR_SLASH)JavaAbstractLexicalHighlighter.$(O) \
     $(OUTDIR_SLASH)JavaScanner.$(O) \
+    $(OUTDIR_SLASH)JavaSyntaxHighlighter.$(O) \
     $(OUTDIR_SLASH)GroovyScanner.$(O) \
-    $(OUTDIR_SLASH)JavaSourceHighlighter.$(O) \
+    $(OUTDIR_SLASH)JavaLexicalHighlighter.$(O) \
     $(OUTDIR_SLASH)GroovySourceHighlighter.$(O) \
     $(OUTDIR_SLASH)extensions.$(O) \
 
--- a/tools/abbrev.stc	Wed Jun 25 11:03:47 2014 +0100
+++ b/tools/abbrev.stc	Wed Jun 25 13:58:21 2014 +0100
@@ -1,6 +1,7 @@
 # automagically generated by the project definition
 # this file is needed for stc to be able to compile modules independently.
 # it provides information about a classes filename, category and especially namespace.
+JavaAbstractSourceHighlighter JavaAbstractSourceHighlighter stx:libjava/tools 'Languages-Java-Tools-Source' 0
 JavaCodeBundleEditor JavaCodeBundleEditor stx:libjava/tools 'Languages-Java-Tools' 1
 JavaCodeLibraryEditor JavaCodeLibraryEditor stx:libjava/tools 'Languages-Java-Tools' 1
 JavaCompiler JavaCompiler stx:libjava/tools 'Languages-Java-Support-Compiling' 0
@@ -17,8 +18,10 @@
 JavaSourceRef JavaSourceRef stx:libjava/tools 'Languages-Java-Tools-Source' 0
 JavaToolbox JavaToolbox stx:libjava/tools 'Languages-Java-Tools' 0
 stx_libjava_tools stx_libjava_tools stx:libjava/tools '* Projects & Packages *' 3
+JavaAbstractLexicalHighlighter JavaAbstractLexicalHighlighter stx:libjava/tools 'Languages-Java-Tools-Source' 0
 JavaScanner JavaScanner stx:libjava/tools 'Languages-Java-Parser' 3
+JavaSyntaxHighlighter JavaSyntaxHighlighter stx:libjava/tools 'Languages-Java-Tools-Source' 0
 GroovyScanner GroovyScanner stx:libjava/tools 'Languages-Groovy-Tools-Source' 3
-JavaSourceHighlighter JavaSourceHighlighter stx:libjava/tools 'Languages-Java-Tools-Source' 0
+JavaLexicalHighlighter JavaLexicalHighlighter stx:libjava/tools 'Languages-Java-Tools-Source' 0
 GroovySourceHighlighter GroovySourceHighlighter stx:libjava/tools 'Languages-Groovy-Tools-Source' 0
 JavaCompilerTests JavaCompilerTests stx:libjava/tools 'Languages-Java-Tests-Compiling' 1
--- a/tools/bc.mak	Wed Jun 25 11:03:47 2014 +0100
+++ b/tools/bc.mak	Wed Jun 25 13:58:21 2014 +0100
@@ -57,10 +57,9 @@
 	pushd ..\..\libcomp & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
 	pushd ..\..\libui & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
 	pushd ..\..\libview & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
+	pushd .. & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
 	pushd ..\..\libview2 & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
-	pushd ..\..\goodies\sunit & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
 	pushd ..\..\libwidg & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
-	pushd .. & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
 	pushd ..\..\libwidg2 & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
 	pushd ..\..\libtool & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
 
@@ -89,6 +88,7 @@
 
 
 # BEGINMAKEDEPEND --- do not remove this line; make depend needs it
+$(OUTDIR)JavaAbstractSourceHighlighter.$(O) JavaAbstractSourceHighlighter.$(H): JavaAbstractSourceHighlighter.st $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
 $(OUTDIR)JavaCodeBundleEditor.$(O) JavaCodeBundleEditor.$(H): JavaCodeBundleEditor.st $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(INCLUDE_TOP)\stx\libview2\ApplicationModel.$(H) $(INCLUDE_TOP)\stx\libview2\Model.$(H) $(INCLUDE_TOP)\stx\libwidg2\HierarchicalItem.$(H) $(STCHDR)
 $(OUTDIR)JavaCodeLibraryEditor.$(O) JavaCodeLibraryEditor.$(H): JavaCodeLibraryEditor.st $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(INCLUDE_TOP)\stx\libview2\ApplicationModel.$(H) $(INCLUDE_TOP)\stx\libview2\Model.$(H) $(INCLUDE_TOP)\stx\libview2\SimpleDialog.$(H) $(STCHDR)
 $(OUTDIR)JavaCompiler.$(O) JavaCompiler.$(H): JavaCompiler.st $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
@@ -105,9 +105,11 @@
 $(OUTDIR)JavaSourceRef.$(O) JavaSourceRef.$(H): JavaSourceRef.st $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
 $(OUTDIR)JavaToolbox.$(O) JavaToolbox.$(H): JavaToolbox.st $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(INCLUDE_TOP)\stx\libtool\Tools__Toolbox.$(H) $(STCHDR)
 $(OUTDIR)stx_libjava_tools.$(O) stx_libjava_tools.$(H): stx_libjava_tools.st $(INCLUDE_TOP)\stx\libbasic\LibraryDefinition.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(INCLUDE_TOP)\stx\libbasic\ProjectDefinition.$(H) $(STCHDR)
+$(OUTDIR)JavaAbstractLexicalHighlighter.$(O) JavaAbstractLexicalHighlighter.$(H): JavaAbstractLexicalHighlighter.st $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(INCLUDE_TOP)\stx\libjava\tools\JavaAbstractSourceHighlighter.$(H) $(STCHDR)
 $(OUTDIR)JavaScanner.$(O) JavaScanner.$(H): JavaScanner.st $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(INCLUDE_TOP)\stx\libjava\tools\JavaScannerBase.$(H) $(STCHDR)
+$(OUTDIR)JavaSyntaxHighlighter.$(O) JavaSyntaxHighlighter.$(H): JavaSyntaxHighlighter.st $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(INCLUDE_TOP)\stx\libjava\tools\JavaAbstractSourceHighlighter.$(H) $(STCHDR)
 $(OUTDIR)GroovyScanner.$(O) GroovyScanner.$(H): GroovyScanner.st $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(INCLUDE_TOP)\stx\libjava\tools\JavaScanner.$(H) $(INCLUDE_TOP)\stx\libjava\tools\JavaScannerBase.$(H) $(STCHDR)
-$(OUTDIR)JavaSourceHighlighter.$(O) JavaSourceHighlighter.$(H): JavaSourceHighlighter.st $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(INCLUDE_TOP)\stx\libjava\tools\JavaScanner.$(H) $(INCLUDE_TOP)\stx\libjava\tools\JavaScannerBase.$(H) $(STCHDR)
+$(OUTDIR)JavaLexicalHighlighter.$(O) JavaLexicalHighlighter.$(H): JavaLexicalHighlighter.st $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(INCLUDE_TOP)\stx\libjava\tools\JavaAbstractLexicalHighlighter.$(H) $(INCLUDE_TOP)\stx\libjava\tools\JavaAbstractSourceHighlighter.$(H) $(INCLUDE_TOP)\stx\libjava\tools\JavaScanner.$(H) $(INCLUDE_TOP)\stx\libjava\tools\JavaScannerBase.$(H) $(STCHDR)
 $(OUTDIR)GroovySourceHighlighter.$(O) GroovySourceHighlighter.$(H): GroovySourceHighlighter.st $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(INCLUDE_TOP)\stx\libjava\tools\GroovyScanner.$(H) $(INCLUDE_TOP)\stx\libjava\tools\JavaScanner.$(H) $(INCLUDE_TOP)\stx\libjava\tools\JavaScannerBase.$(H) $(STCHDR)
 $(OUTDIR)extensions.$(O): extensions.st $(INCLUDE_TOP)\stx\libbasic\ConfigurableFeatures.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(INCLUDE_TOP)\stx\libjava\JavaObject.$(H) $(INCLUDE_TOP)\stx\libtool\SystemBrowser.$(H) $(INCLUDE_TOP)\stx\libtool\Tools__NewSystemBrowser.$(H) $(INCLUDE_TOP)\stx\libview2\ApplicationModel.$(H) $(INCLUDE_TOP)\stx\libview2\Model.$(H) $(STCHDR)
 
--- a/tools/libInit.cc	Wed Jun 25 11:03:47 2014 +0100
+++ b/tools/libInit.cc	Wed Jun 25 13:58:21 2014 +0100
@@ -27,6 +27,7 @@
 void _libstx_libjava_tools_Init(pass, __pRT__, snd)
 OBJ snd; struct __vmData__ *__pRT__; {
 __BEGIN_PACKAGE2__("libstx_libjava_tools", _libstx_libjava_tools_Init, "stx:libjava/tools");
+_JavaAbstractSourceHighlighter_Init(pass,__pRT__,snd);
 _JavaCodeBundleEditor_Init(pass,__pRT__,snd);
 _JavaCodeLibraryEditor_Init(pass,__pRT__,snd);
 _JavaCompiler_Init(pass,__pRT__,snd);
@@ -43,9 +44,11 @@
 _JavaSourceRef_Init(pass,__pRT__,snd);
 _JavaToolbox_Init(pass,__pRT__,snd);
 _stx_137libjava_137tools_Init(pass,__pRT__,snd);
+_JavaAbstractLexicalHighlighter_Init(pass,__pRT__,snd);
 _JavaScanner_Init(pass,__pRT__,snd);
+_JavaSyntaxHighlighter_Init(pass,__pRT__,snd);
 _GroovyScanner_Init(pass,__pRT__,snd);
-_JavaSourceHighlighter_Init(pass,__pRT__,snd);
+_JavaLexicalHighlighter_Init(pass,__pRT__,snd);
 _GroovySourceHighlighter_Init(pass,__pRT__,snd);
 
 _stx_137libjava_137tools_extensions_Init(pass,__pRT__,snd);
--- a/tools/stx_libjava_tools.st	Wed Jun 25 11:03:47 2014 +0100
+++ b/tools/stx_libjava_tools.st	Wed Jun 25 13:58:21 2014 +0100
@@ -121,6 +121,7 @@
 
     ^ #(
         "<className> or (<className> attributes...) in load order"
+        JavaAbstractSourceHighlighter
         JavaCodeBundleEditor
         JavaCodeLibraryEditor
         JavaCompiler
@@ -137,9 +138,11 @@
         JavaSourceRef
         JavaToolbox
         #'stx_libjava_tools'
+        JavaAbstractLexicalHighlighter
         JavaScanner
+        JavaSyntaxHighlighter
         GroovyScanner
-        JavaSourceHighlighter
+        JavaLexicalHighlighter
         GroovySourceHighlighter
         (JavaCompilerTests autoload)
     )
--- a/tools/tools.rc	Wed Jun 25 11:03:47 2014 +0100
+++ b/tools/tools.rc	Wed Jun 25 13:58:21 2014 +0100
@@ -3,7 +3,7 @@
 // automagically generated from the projectDefinition: stx_libjava_tools.
 //
 VS_VERSION_INFO VERSIONINFO
-  FILEVERSION     6,2,32767,32767
+  FILEVERSION     6,2,12886,12886
   PRODUCTVERSION  6,2,4,0
 #if (__BORLANDC__)
   FILEFLAGSMASK   VS_FF_DEBUG | VS_FF_PRERELEASE
@@ -20,12 +20,12 @@
     BEGIN
       VALUE "CompanyName", "eXept Software AG\0"
       VALUE "FileDescription", "Smalltalk/X Class library (LIB)\0"
-      VALUE "FileVersion", "6.2.32767.32767\0"
+      VALUE "FileVersion", "6.2.12886.12886\0"
       VALUE "InternalName", "stx:libjava/tools\0"
       VALUE "LegalCopyright", "Copyright Claus Gittinger 1988-2011\nCopyright eXept Software AG 1998-2011\0"
       VALUE "ProductName", "Smalltalk/X\0"
       VALUE "ProductVersion", "6.2.4.0\0"
-      VALUE "ProductDate", "Thu, 12 Jun 2014 11:01:31 GMT\0"
+      VALUE "ProductDate", "Wed, 25 Jun 2014 12:45:34 GMT\0"
     END
 
   END