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.
3272 3273 3274 3275 |
# File 'ext/ae-editor/ae-editor.rb', line 3272 def initialize(_langs_conf) super(_langs_conf) require 'coderay' end |
Instance Method Details
#highlight_tags(_row_begin, _code) ⇒ Object
end
3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 |
# File 'ext/ae-editor/ae-editor.rb', line 3283 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 |