151 |
151 |
152 !LintHighlighter methodsFor:'formatting-private'! |
152 !LintHighlighter methodsFor:'formatting-private'! |
153 |
153 |
154 format: text |
154 format: text |
155 |
155 |
|
156 | tree | |
|
157 tree := RBParser parseMethod: text string onError:[:error :pos| ^ text ]. |
|
158 self format: text tree: tree. |
|
159 ^text |
|
160 |
|
161 "Created: / 04-08-2011 / 23:51:28 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
162 ! |
|
163 |
|
164 format: text tree: tree |
|
165 |
156 annotations := SortedCollection new. |
166 annotations := SortedCollection new. |
157 rules ? #() do:[:rule| |
167 rules ? #() do:[:rule| |
158 self format: text rule: rule |
168 self format: text tree: tree rule: rule |
159 ]. |
169 ]. |
160 ^text |
170 ^text |
161 |
171 |
162 "Created: / 04-08-2011 / 23:51:28 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
172 "Created: / 02-02-2012 / 23:32:50 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
163 ! |
173 ! |
164 |
174 |
165 format: text rule: rule |
175 format: text tree: tree rule: rule |
166 |
176 |
167 | string | |
177 | string | |
168 |
178 |
169 string := text asString. |
179 string := text string. |
170 |
|
171 |
|
172 rule result isParseTreeEnvironment ifTrue:[ |
180 rule result isParseTreeEnvironment ifTrue:[ |
173 formattingMethod ifTrue:[ |
181 formattingMethod ifTrue:[ |
174 | interval | |
182 rule result selectionIntervalsForSource: string tree: tree do: [:interval| |
175 [ |
183 interval notNil ifTrue:[ |
176 interval := rule result selectionIntervalFor: string. |
184 self mark: text from: interval first to: interval last for: rule. |
177 ] on: Error do:[ |
185 ] |
178 interval := nil. |
|
179 ]. |
186 ]. |
180 interval notNil ifTrue:[ |
|
181 self mark: text from: interval first to: interval last for: rule. |
|
182 ] |
|
183 ]. |
187 ]. |
184 ] ifFalse:[ |
188 ] ifFalse: [ |
185 | searches | |
189 | searches | |
186 |
190 |
187 searches := rule result searchStrings asSet. |
191 searches := rule result searchStrings asSet. |
188 |
192 |
189 searches do:[:search| |
193 searches do:[:search| |
218 ! ! |
222 ! ! |
219 |
223 |
220 !LintHighlighter class methodsFor:'documentation'! |
224 !LintHighlighter class methodsFor:'documentation'! |
221 |
225 |
222 version |
226 version |
223 ^ '$Id: Tools__LintHighlighter.st 7854 2012-01-30 17:49:41Z vranyj1 $' |
227 ^ '$Id: Tools__LintHighlighter.st 7868 2012-02-03 10:54:40Z vranyj1 $' |
224 ! |
228 ! |
225 |
229 |
226 version_CVS |
230 version_CVS |
227 ^ '§Header: /cvs/stx/stx/libtool/Tools__LintHighlighter.st,v 1.3 2012/01/27 21:18:06 vrany Exp §' |
231 ^ '§Header: /cvs/stx/stx/libtool/Tools__LintHighlighter.st,v 1.3 2012/01/27 21:18:06 vrany Exp §' |
228 ! |
232 ! |
229 |
233 |
230 version_SVN |
234 version_SVN |
231 ^ '$Id: Tools__LintHighlighter.st 7854 2012-01-30 17:49:41Z vranyj1 $' |
235 ^ '$Id: Tools__LintHighlighter.st 7868 2012-02-03 10:54:40Z vranyj1 $' |
232 ! ! |
236 ! ! |