Method: RDoc::Markup::Parser#skip
- Defined in:
- lib/rdoc/markup/parser.rb
#skip(token_type, error = true) ⇒ Object
Skips the next token if its type is token_type
.
Optionally raises an error if the next token is not of the expected type.
477 478 479 480 481 482 483 |
# File 'lib/rdoc/markup/parser.rb', line 477 def skip token_type, error = true type, = get return unless type # end of stream return @current_token if token_type == type unget raise ParseError, "expected #{token_type} got #{@current_token.inspect}" if error end |