Files

Class Index [+]

Quicksearch

CodeRay::Scanners

Scanners

This module holds the Scanner class and its subclasses. For example, the Ruby scanner is named CodeRay::Scanners::Ruby can be found in coderay/scanners/ruby.

Scanner also provides methods and constants for the register mechanism and the [] method that returns the Scanner class belonging to the given lang.

See PluginHost.

Constants

HEREDOC_PATTERN
STRING_CONTENT_REGEXP

Private Instance Methods

reset_instance() click to toggle source
    # File lib/coderay/scanners/nitro_xhtml.rb, line 83
83:     def reset_instance
84:       super
85:       @html_scanner.reset
86:     end
scan_tokens(tokens, options) click to toggle source
     # File lib/coderay/scanners/nitro_xhtml.rb, line 88
 88:     def scan_tokens tokens, options
 89: 
 90:       until eos?
 91: 
 92:         if (match = scan_until(/(?=#{START_OF_RUBY})/) || scan_until(/\z/)) and not match.empty?
 93:           @html_scanner.tokenize match
 94: 
 95:         elsif match = scan(/#{NITRO_VALUE_BLOCK}/)
 96:           start_tag = match[0,2]
 97:           delimiter = CLOSING_PAREN[start_tag[1,1]]
 98:           end_tag = match[1,1] == delimiter ? delimiter : ''
 99:           tokens << [:open, :inline]
100:           tokens << [start_tag, :inline_delimiter]
101:           code = match[start_tag.size .. 1 - end_tag.size]
102:           @ruby_scanner.tokenize code
103:           tokens << [end_tag, :inline_delimiter] unless end_tag.empty?
104:           tokens << [:close, :inline]
105: 
106:         elsif match = scan(/#{NITRO_RUBY_BLOCK}/)
107:           start_tag = '<?r'
108:           end_tag = match[2,2] == '?>' ? '?>' : ''
109:           tokens << [:open, :inline]
110:           tokens << [start_tag, :inline_delimiter]
111:           code = match[start_tag.size .. -(end_tag.size)-1]
112:           @ruby_scanner.tokenize code
113:           tokens << [end_tag, :inline_delimiter] unless end_tag.empty?
114:           tokens << [:close, :inline]
115: 
116:         elsif entity = scan(/#{NITRO_ENTITY}/)
117:           tokens << [entity, :entity]
118:         
119:         elsif scan(/%/)
120:           tokens << [matched, :error]
121: 
122:         else
123:           raise_inspect 'else-case reached!', tokens
124:           
125:         end
126: 
127:       end
128: 
129:       tokens
130: 
131:     end
setup() click to toggle source
    # File lib/coderay/scanners/nitro_xhtml.rb, line 78
78:     def setup
79:       @ruby_scanner = CodeRay.scanner :ruby, :tokens => @tokens, :keep_tokens => true
80:       @html_scanner = CodeRay.scanner :html, :tokens => @tokens, :keep_tokens => true, :keep_state => true
81:     end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.