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.
3943 3944 3945 3946 |
# File 'ext/ae-editor/ae-editor.rb', line 3943 def initialize(_langs_conf) super(_langs_conf) require 'coderay' end |
Instance Method Details
#highlight_tags(_row_begin, _code) ⇒ Object
end
3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964 3965 3966 3967 3968 3969 3970 3971 3972 3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 3983 3984 3985 3986 3987 3988 3989 3990 3991 3992 3993 3994 3995 3996 |
# File 'ext/ae-editor/ae-editor.rb', line 3954 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 |