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
False.
-
#capturing_decidable? ⇒ Boolean
True.
-
#parse(*args) ⇒ Boolean
If the decorated parser matches return
true
, otherwise return a false value. -
#skip ⇒ Skip
A new parser that skips over what this parser matches.
Methods included from Combining
Methods inherited from Parser
#&, #>>, #labeled?, #list, #one_or_more, #optional, #repeat, #semantic?, #sequence?, #variable_capture_count?, #with_ws, #zero_or_more, #|
Methods included from Runtime::ParserHelper
Methods inherited from Util::Node
#==, [], #[], #attrs, #can_equal?, #child, #children, #each, #empty?, #eql?, #initialize, #inspect, #method_missing, #name, #pretty_print, #pretty_print_cycle, #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
12 13 14 |
# File 'lib/rattler/parsers/skip.rb', line 12 def self.parsed(results, *_) #:nodoc: self[results.first] end |
Instance Method Details
#capturing? ⇒ Boolean
Returns false.
29 30 31 |
# File 'lib/rattler/parsers/skip.rb', line 29 def capturing? false end |
#capturing_decidable? ⇒ Boolean
Returns true.
35 36 37 |
# File 'lib/rattler/parsers/skip.rb', line 35 def capturing_decidable? true end |
#parse(*args) ⇒ Boolean
If the decorated parser matches return true
, otherwise return a false value.
23 24 25 |
# File 'lib/rattler/parsers/skip.rb', line 23 def parse(*args) child.parse(*args) && true end |
#skip ⇒ Skip
Returns a new parser that skips over what this parser matches.
40 41 42 |
# File 'lib/rattler/parsers/skip.rb', line 40 def skip self end |