Class: CSS::Selectors::AnBParser::Impl

Inherits:
Object
  • Object
show all
Includes:
TokenCursor
Defined in:
lib/css/selectors/anb_parser.rb

Constant Summary

Constants included from TokenCursor

TokenCursor::EOF_TOKEN

Instance Method Summary collapse

Methods included from TokenCursor

#consume, #eof?, #init_cursor, #parse_error!, #peek, #peek_token, #skip_whitespace

Constructor Details

#initialize(tokens) ⇒ Impl

Returns a new instance of Impl.



20
21
22
# File 'lib/css/selectors/anb_parser.rb', line 20

def initialize(tokens)
  init_cursor(tokens)
end

Instance Method Details

#parseObject



24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/css/selectors/anb_parser.rb', line 24

def parse
  skip_whitespace

  result = parse_value

  skip_whitespace

  unless peek.type == :eof
    raise ParseError, "trailing tokens in AnB: #{peek.type}"
  end

  result
end