Tools__LintHighlighter.st
branchjv
changeset 12128 a7ff7d66ee85
parent 12125 0c49a3b13e43
child 12141 f95099b6b5f7
--- a/Tools__LintHighlighter.st	Sun Jan 29 18:58:38 2012 +0000
+++ b/Tools__LintHighlighter.st	Mon Jan 30 17:49:41 2012 +0000
@@ -1,18 +1,48 @@
+"
+ COPYRIGHT (c) 2006 by eXept Software AG
+              All Rights Reserved
+
+ 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.
+"
 "{ Package: 'stx:libtool' }"
 
 "{ NameSpace: Tools }"
 
 Object subclass:#LintHighlighter
-	instanceVariableNames:'rules formattingMethod emphasisError emphasisInformation
-		emphasisWarning'
+	instanceVariableNames:'rules annotations formattingMethod emphasisError
+		emphasisInformation emphasisWarning'
 	classVariableNames:''
 	poolDictionaries:''
 	category:'Interface-Lint'
 !
 
+!LintHighlighter class methodsFor:'documentation'!
+
+copyright
+"
+ COPYRIGHT (c) 2006 by eXept Software AG
+              All Rights Reserved
+
+ 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.
+"
+! !
 
 !LintHighlighter methodsFor:'accessing'!
 
+annotations
+    ^ annotations
+!
+
 rules
     ^ rules
 !
@@ -123,6 +153,7 @@
 
 format: text
 
+    annotations := SortedCollection new.
     rules ? #() do:[:rule|
         self format: text rule: rule
     ].
@@ -133,10 +164,10 @@
 
 format: text rule: rule
 
-    | string emphasis |
+    | string |
 
     string := text asString.
-    emphasis := self emphasisForSeverity: rule severity.
+
 
     rule result isParseTreeEnvironment ifTrue:[
         formattingMethod ifTrue:[
@@ -147,8 +178,7 @@
                 interval := nil.
             ].
             interval notNil ifTrue:[
-                text emphasisFrom: interval first to: interval last 
-                         add: emphasis.            
+                self mark: text from: interval first to: interval last for: rule.
             ]
         ].
     ] ifFalse:[
@@ -163,8 +193,7 @@
                 i := string findString: search startingAt: i.
                 i ~~ 0
             ] whileTrue:[
-                text emphasisFrom: i to: i + search size - 1 
-                     add: emphasis.
+                self mark: text from: i to: (i + search size - 1) for: rule.
                 i := i + search size + 1.
             ]
             
@@ -175,12 +204,29 @@
     "Created: / 04-08-2011 / 23:55:50 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
+!LintHighlighter methodsFor:'markup'!
+
+mark: text from: start to: end for: rule
+    | emphasis |
+
+    emphasis := self emphasisForSeverity: rule severity.
+    text emphasisFrom: start to: end add: emphasis.     
+    annotations add:
+        (LintAnnotation from: start to: end rule: rule)
+
+    "Created: / 30-01-2012 / 15:30:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
 !LintHighlighter class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libtool/Tools__LintHighlighter.st,v 1.3 2012/01/27 21:18:06 vrany Exp $'
+    ^ '$Id: Tools__LintHighlighter.st 7854 2012-01-30 17:49:41Z vranyj1 $'
 !
 
 version_CVS
     ^ '§Header: /cvs/stx/stx/libtool/Tools__LintHighlighter.st,v 1.3 2012/01/27 21:18:06 vrany Exp §'
+!
+
+version_SVN
+    ^ '$Id: Tools__LintHighlighter.st 7854 2012-01-30 17:49:41Z vranyj1 $'
 ! !