Module: Parser::Lexer::Explanation
- Defined in:
- lib/parser/lexer/explanation.rb
Instance Method Summary collapse
-
#advance_and_explain ⇒ Object
Like #advance, but also pretty-print the token and its position in the stream to ‘stdout`.
Instance Method Details
#advance_and_explain ⇒ Object
Like #advance, but also pretty-print the token and its position in the stream to ‘stdout`.
7 8 9 10 11 12 13 14 15 |
# File 'lib/parser/lexer/explanation.rb', line 7 def advance_and_explain type, (val, range) = advance puts decorate(range, "\e[0;32m#{type} #{val.inspect}\e[0m", "#{state.to_s.ljust(10)} #{@cond} #{@cmdarg}\e[0m") [ type, [val, range] ] end |