In Files

Parent

Files

Treetop::Runtime::CompiledParser

Public Instance Methods

failure_message(color) click to toggle source
    # File lib/less/ext.rb, line 4
 4:       def failure_message color
 5:         o = color ? Mutter.new.clear : lambda {|i, *args| i }
 6:         return nil unless (tf = terminal_failures) && tf.size > 0
 7:         msg = "on line #{failure_line}: expected " + (
 8:           tf.size == 1 ?
 9:             o[tf[0].expected_string, :yellow] :
10:             "one of #{o[tf.map {|f| f.expected_string }.uniq * ' ', :yellow]}"
11:         )
12:         f = input[failure_index]
13:         got = case f
14:           when "\n" then o['\n',  :cyan]
15:           when nil  then o["EOF", :cyan]
16:           when ' '  then o["white-space", :cyan]
17:           else           o[f.chr, :yellow]
18:         end
19:         msg += " got #{got} after:\n\n#{input[index...failure_index]}\n"
20:       end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.