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.
3727 3728 3729 3730 |
# File 'ext/ae-editor/ae-editor.rb', line 3727 def initialize(_langs_conf) super(_langs_conf) require 'coderay' end |
Instance Method Details
#highlight_tags(_row_begin, _code) ⇒ Object
end
3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 3780 |
# File 'ext/ae-editor/ae-editor.rb', line 3738 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 |