| Class | CodeRay::Scanners::ERB |
| In: |
lib/coderay/scanners/erb.rb
|
| Parent: | Scanner |
| KINDS_NOT_LOC | = | HTML::KINDS_NOT_LOC |
# File lib/coderay/scanners/erb.rb, line 38
38: def reset_instance
39: super
40: @html_scanner.reset
41: end
# File lib/coderay/scanners/erb.rb, line 43
43: def scan_tokens encoder, options
44:
45: until eos?
46:
47: if (match = scan_until(/(?=#{START_OF_ERB})/o) || scan_rest) and not match.empty?
48: @html_scanner.tokenize match, :tokens => encoder
49:
50: elsif match = scan(/#{ERB_RUBY_BLOCK}/o)
51: start_tag = self[1]
52: code = self[2]
53: end_tag = self[3]
54:
55: encoder.begin_group :inline
56: encoder.text_token start_tag, :inline_delimiter
57:
58: if start_tag == '<%#'
59: encoder.text_token code, :comment
60: else
61: @ruby_scanner.tokenize code, :tokens => encoder
62: end unless code.empty?
63:
64: encoder.text_token end_tag, :inline_delimiter unless end_tag.empty?
65: encoder.end_group :inline
66:
67: else
68: raise_inspect 'else-case reached!', encoder
69:
70: end
71:
72: end
73:
74: encoder
75:
76: end