Class: Rattler::Parsers::Skip
- Inherits:
-
Parser
- Object
- Util::Node
- Parser
- Rattler::Parsers::Skip
- Includes:
- Combining
- Defined in:
- lib/rattler/parsers/skip.rb
Overview
Skip
decorates a parser to skip over what it matches without capturing the results
Class Method Summary collapse
Instance Method Summary collapse
-
#capturing? ⇒ Boolean
Always
false
. -
#parse(scanner, rules, scope = {}) ⇒ Boolean
If the decorated parser matches return
true
, otherwise return a false value. -
#skip ⇒ Object
A new parser that skips over what this parser matches.
Methods included from Combining
Methods inherited from Parser
#&, #labeled?, #one_or_more, #optional, #variable_capture_count?, #with_ws, #zero_or_more, #|
Methods inherited from Util::Node
#==, [], #[], #attrs, #can_equal?, #child, #children, #each, #empty?, #eql?, #initialize, #inspect, #method_missing, #name, #respond_to?, #same_contents?, #to_graphviz, #with_attrs, #with_attrs!, #with_children
Constructor Details
This class inherits a constructor from Rattler::Util::Node
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Rattler::Util::Node
Class Method Details
.parsed(results, *_) ⇒ Object
19 20 21 |
# File 'lib/rattler/parsers/skip.rb', line 19 def self.parsed(results, *_) #:nodoc: self[results.first] end |
Instance Method Details
#capturing? ⇒ Boolean
Always false
36 37 38 |
# File 'lib/rattler/parsers/skip.rb', line 36 def capturing? false end |
#parse(scanner, rules, scope = {}) ⇒ Boolean
If the decorated parser matches return true
, otherwise return a false value.
30 31 32 |
# File 'lib/rattler/parsers/skip.rb', line 30 def parse(scanner, rules, scope = {}) child.parse(scanner, rules, scope) && true end |
#skip ⇒ Object
Returns a new parser that skips over what this parser matches.
41 42 43 |
# File 'lib/rattler/parsers/skip.rb', line 41 def skip self end |