Class: JsonPath::Parser::Core
- Inherits:
-
Parslet::Parser
- Object
- Parslet::Parser
- JsonPath::Parser::Core
- Defined in:
- lib/json_path/parser/core.rb
Direct Known Subclasses
Instance Method Summary collapse
- #any_unless(parser) ⇒ Object
- #any_until(parser, prefix_name = nil) ⇒ Object
- #many(parser) ⇒ Object
- #many_separated(parser, separator_parser) ⇒ Object
- #some(parser) ⇒ Object
- #some_separated(parser, separator_parser) ⇒ Object
- #symbol(string) ⇒ Object
Instance Method Details
#any_unless(parser) ⇒ Object
53 54 55 |
# File 'lib/json_path/parser/core.rb', line 53 def any_unless parser parser.absent? >> any end |
#any_until(parser, prefix_name = nil) ⇒ Object
57 58 59 60 61 |
# File 'lib/json_path/parser/core.rb', line 57 def any_until parser, prefix_name=nil prefix_parser = some(any_unless(parser)) prefix_parser = prefix_parser.as(prefix_name) if prefix_name.present? prefix_parser end |
#many(parser) ⇒ Object
11 12 13 |
# File 'lib/json_path/parser/core.rb', line 11 def many parser parser.repeat end |
#many_separated(parser, separator_parser) ⇒ Object
45 46 47 |
# File 'lib/json_path/parser/core.rb', line 45 def many_separated parser, separator_parser some_separated(parser, separator_parser).maybe end |
#some(parser) ⇒ Object
15 16 17 |
# File 'lib/json_path/parser/core.rb', line 15 def some parser parser.repeat 1 end |
#some_separated(parser, separator_parser) ⇒ Object
49 50 51 |
# File 'lib/json_path/parser/core.rb', line 49 def some_separated parser, separator_parser parser >> many(separator_parser >> parser) end |
#symbol(string) ⇒ Object
41 42 43 |
# File 'lib/json_path/parser/core.rb', line 41 def symbol string token(str(string)) end |