Class: CoderayHighlightScannerOld
- Inherits:
-
HighlightScanner
- Object
- HighlightScanner
- CoderayHighlightScannerOld
- Defined in:
- ext/ae-editor/ae-editor.rb
Instance Method Summary collapse
-
#highlight_tags(_row_begin, _code) ⇒ Object
end.
-
#initialize(_langs_conf) ⇒ CoderayHighlightScannerOld
constructor
A new instance of CoderayHighlightScannerOld.
Methods inherited from HighlightScanner
Constructor Details
#initialize(_langs_conf) ⇒ CoderayHighlightScannerOld
Returns a new instance of CoderayHighlightScannerOld.
4205 4206 4207 4208 |
# File 'ext/ae-editor/ae-editor.rb', line 4205 def initialize(_langs_conf) super(_langs_conf) require 'coderay' end |
Instance Method Details
#highlight_tags(_row_begin, _code) ⇒ Object
end
4216 4217 4218 4219 4220 4221 4222 4223 4224 4225 4226 4227 4228 4229 4230 4231 4232 4233 4234 4235 4236 4237 4238 4239 4240 4241 4242 4243 4244 4245 4246 4247 4248 4249 4250 4251 4252 4253 4254 4255 4256 4257 4258 |
# File 'ext/ae-editor/ae-editor.rb', line 4216 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 |