class ComponentEmbeddedRuby::Parser::Base
Attributes
token_reader[R]
Public Class Methods
new(token_reader)
click to toggle source
# File lib/component_embedded_ruby/parser/base.rb, line 6 def initialize(token_reader) @token_reader = token_reader end
Private Instance Methods
current_token()
click to toggle source
# File lib/component_embedded_ruby/parser/base.rb, line 14 def current_token token_reader.current_token end
expect(type)
click to toggle source
# File lib/component_embedded_ruby/parser/base.rb, line 22 def expect(type) token = current_token raise UnexpectedTokenError.new(type, current_token) if token.type != type token_reader.next token end
expect_any(*types, expected_message:)
click to toggle source
# File lib/component_embedded_ruby/parser/base.rb, line 30 def expect_any(*types, expected_message:) token = current_token raise UnexpectedTokenError.new(expected_message, token) unless types.include?(token.type) token_reader.next token end
peek_token()
click to toggle source
# File lib/component_embedded_ruby/parser/base.rb, line 18 def peek_token token_reader.peek_token end