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.
3785 3786 3787 3788 |
# File 'ext/ae-editor/ae-editor.rb', line 3785 def initialize(_langs_conf) super(_langs_conf) require 'coderay' end |
Instance Method Details
#highlight_tags(_row_begin, _code) ⇒ Object
3790 3791 3792 3793 3794 3795 3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 |
# File 'ext/ae-editor/ae-editor.rb', line 3790 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 #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, :begin_group,:end_group].include?(tok[0])&& tok[1].class==Symbol) toklength = tok[0].length t_begin="#{row}.#{col}" if tok[0].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 |