Tools__LintHighlighter.st
branchjv
changeset 12141 f95099b6b5f7
parent 12128 a7ff7d66ee85
child 12170 6c9c4b7981ee
--- a/Tools__LintHighlighter.st	Thu Feb 02 20:14:48 2012 +0000
+++ b/Tools__LintHighlighter.st	Fri Feb 03 10:54:40 2012 +0000
@@ -153,35 +153,39 @@
 
 format: text
 
-    annotations := SortedCollection new.
-    rules ? #() do:[:rule|
-        self format: text rule: rule
-    ].
+    | tree |
+    tree := RBParser parseMethod: text string onError:[:error :pos| ^ text ].
+    self format: text tree: tree.
     ^text
 
     "Created: / 04-08-2011 / 23:51:28 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
-format: text rule: rule
+format: text tree: tree
+
+    annotations := SortedCollection new.
+    rules ? #() do:[:rule|
+        self format: text tree: tree rule: rule
+    ].
+    ^text
+
+    "Created: / 02-02-2012 / 23:32:50 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+format: text tree: tree rule: rule
 
     | string |
 
-    string := text asString.
-
-
+    string := text string.
     rule result isParseTreeEnvironment ifTrue:[
         formattingMethod ifTrue:[
-            | interval |
-            [
-                interval := rule result selectionIntervalFor: string.
-            ] on: Error do:[
-                interval := nil.
+            rule result selectionIntervalsForSource: string tree: tree do: [:interval|
+                interval notNil ifTrue:[
+                    self mark: text from: interval first to: interval last for: rule.
+                ]
             ].
-            interval notNil ifTrue:[
-                self mark: text from: interval first to: interval last for: rule.
-            ]
         ].
-    ] ifFalse:[
+    ] ifFalse: [
         | searches |
 
         searches := rule result searchStrings asSet.
@@ -201,7 +205,7 @@
         ]
     ]
 
-    "Created: / 04-08-2011 / 23:55:50 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Created: / 03-02-2012 / 10:39:43 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !LintHighlighter methodsFor:'markup'!
@@ -220,7 +224,7 @@
 !LintHighlighter class methodsFor:'documentation'!
 
 version
-    ^ '$Id: Tools__LintHighlighter.st 7854 2012-01-30 17:49:41Z vranyj1 $'
+    ^ '$Id: Tools__LintHighlighter.st 7868 2012-02-03 10:54:40Z vranyj1 $'
 !
 
 version_CVS
@@ -228,5 +232,5 @@
 !
 
 version_SVN
-    ^ '$Id: Tools__LintHighlighter.st 7854 2012-01-30 17:49:41Z vranyj1 $'
+    ^ '$Id: Tools__LintHighlighter.st 7868 2012-02-03 10:54:40Z vranyj1 $'
 ! !