tools/JavaSourceHighlighter.st
branchdevelopment
changeset 2717 16564a7101b8
parent 2716 1cca77810e04
child 2718 b3fe904a2fc7
--- a/tools/JavaSourceHighlighter.st	Sat Sep 07 02:17:02 2013 +0100
+++ b/tools/JavaSourceHighlighter.st	Mon Sep 09 01:27:53 2013 +0100
@@ -213,11 +213,24 @@
 !
 
 formatMethod:mth source:source in:class using: prefs
+    | scanner |
 
     preferences := prefs.
-    ^ self format: source kind: #start in: class
+    preferences isNil ifTrue:[
+        preferences := UserPreferences current.
+    ].
+    sourceText := source asText.
+    scanner := Scanner for: source string.
+    scanner highlighter: self.
+    [
+        [ scanner nextToken ~~ #EOF ] whileTrue.
+    ] on: Error do:[:ex|
+        ex
+    ].
+    ^ sourceText
 
     "Created: / 04-08-2011 / 23:45:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 07-09-2013 / 19:32:45 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 formatMethod:mth source:source in:class using: prefs elementsInto: els
@@ -266,13 +279,13 @@
     ].
     cacheIt := kind == #start and: [class notNil].
     cacheIt ifTrue:[
-        document := JavaSourceDocument cachedDocumentFor: class.
+        document := JavaSourceDocument cachedDocumentFor: class theNonMetaclass.
         document notNil ifTrue:[
             (document sourceText notNil and:[document sourceText string = source]) ifTrue:[
-                document sourceText copy.
+                ^ document sourceText copy.
             ].
         ].
-        document := JavaSourceDocument for: class.
+        document := JavaSourceDocument for: class theNonMetaclass.
     ].
     marker := Marker new.
     marker highlighter: self.
@@ -299,14 +312,14 @@
 
     ^ cacheIt ifTrue:[
         document sourceText: sourceText.
-        JavaSourceDocument cachedDocumentFor: class put: document.
+        JavaSourceDocument cachedDocumentFor: class theNonMetaclass put: document.
         sourceText copy
     ] ifFalse:[
         sourceText
     ]
 
     "Created: / 17-03-2012 / 14:02:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified: / 06-09-2013 / 23:00:49 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 08-09-2013 / 23:01:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !JavaSourceHighlighter methodsFor:'syntax detection'!