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
-
#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.
4001 4002 4003 4004 |
# File 'ext/ae-editor/ae-editor.rb', line 4001 def initialize(_langs_conf) super(_langs_conf) require 'coderay' end |
Instance Method Details
#highlight_tags(_row_begin, _code) ⇒ Object
4006 4007 4008 4009 4010 4011 4012 4013 4014 4015 4016 4017 4018 4019 4020 4021 4022 4023 4024 4025 4026 4027 4028 4029 4030 4031 4032 4033 4034 4035 4036 4037 4038 4039 4040 4041 4042 4043 4044 4045 4046 4047 4048 4049 4050 4051 4052 4053 4054 4055 4056 4057 4058 |
# File 'ext/ae-editor/ae-editor.rb', line 4006 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{|t| #p tok if @i.nil? @tok = [] @tok << t @i = 1 next else @tok << t @i = nil end tok = @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, :begin_group,:end_group].include?(tok[0])&& tok[1].class==Symbol) toklength = tok[0].length t_begin="#{row}.#{col}" if tok[0].include?("\n") #if tok[0].to_s.include?("\n") ar = tok[0].split("\n") 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 |