Class: CoderayHighlightScanner
- Inherits:
-
HighlightScanner
- Object
- HighlightScanner
- CoderayHighlightScanner
- Defined in:
- ext/ae-editor/ae-editor.rb
Instance Method Summary collapse
-
#highlight_tags(_row_begin, _code) ⇒ Object
end.
-
#initialize(_langs_conf) ⇒ CoderayHighlightScanner
constructor
A new instance of CoderayHighlightScanner.
Methods inherited from HighlightScanner
Constructor Details
#initialize(_langs_conf) ⇒ CoderayHighlightScanner
Returns a new instance of CoderayHighlightScanner.
3247 3248 3249 3250 |
# File 'ext/ae-editor/ae-editor.rb', line 3247 def initialize(_langs_conf) super(_langs_conf) require 'coderay' end |
Instance Method Details
#highlight_tags(_row_begin, _code) ⇒ Object
end
3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 |
# File 'ext/ae-editor/ae-editor.rb', line 3258 def (_row_begin,_code) super(_row_begin,_code) c_scanner = CodeRay::Scanners[@lang].new _code row=_row_begin col=0 = Hash.new c_scanner.tokens.each{|tok| #p tok if tok[1]==:space && tok[0].include?("\n") row+=tok[0].count("\n") begin_gap = tok[0].split("\n")[-1] if begin_gap && tok[0][-1..-1]!="\n" col = begin_gap.length else col = 0 end elsif !([:open,:close].include?(tok[0])&& tok[1].class==Symbol) toklength = tok[0].length t_begin="#{row}.#{col}" if tok[0].include?("\n") ar = tok[0].split row+=tok[0].count("\n") begin_gap = ar[-1] if begin_gap && tok[0][-1..-1]!="\n" col = begin_gap.length else col = 0 end else col+=toklength end t_end="#{row}.#{col}" if tok[1]!=:space [tok[1]] = [] if [tok[1]].nil? [tok[1]] << [t_begin,t_end] #Arcadia.console(self, 'msg'=>"#{tok[1]}=#{[t_begin,t_end]}", 'level'=>'error') #p [t_begin,t_end] end end } end |