Class: JMESPath::Parser Private
- Inherits:
-
Object
- Object
- JMESPath::Parser
- Defined in:
- lib/jmespath/parser.rb
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Constant Summary collapse
- AFTER_DOT =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
Set.new([ :identifier, # foo.bar :quoted_identifier, # foo."bar" :star, # foo.* :lbrace, # foo[1] :lbracket, # foo{a: 0} :function, # foo.*.to_string(@) :filter, # foo.[?bar==10] ])
- CURRENT_NODE =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
Nodes::Current.new
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Parser
constructor
private
A new instance of Parser.
- #method_missing(method_name, *args) ⇒ Object private
- #parse(expression) ⇒ Object private
Constructor Details
#initialize(options = {}) ⇒ Parser
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Parser.
21 22 23 |
# File 'lib/jmespath/parser.rb', line 21 def initialize( = {}) @lexer = [:lexer] || Lexer.new() end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *args) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
37 38 39 40 41 42 43 |
# File 'lib/jmespath/parser.rb', line 37 def method_missing(method_name, *args) if matches = method_name.match(/^(nud_|led_)(.*)/) raise Errors::SyntaxError, "unexpected token #{matches[2]}" else super end end |
Instance Method Details
#parse(expression) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
26 27 28 29 30 31 32 33 34 |
# File 'lib/jmespath/parser.rb', line 26 def parse(expression) stream = TokenStream.new(expression, @lexer.tokenize(expression)) result = expr(stream) if stream.token.type != :eof raise Errors::SyntaxError, "expected :eof got #{stream.token.type}" else result end end |