Class: Rattler::Parsers::Predicate
- Inherits:
-
Parser
- Object
- Util::Node
- Parser
- Rattler::Parsers::Predicate
- Includes:
- Combining
- Defined in:
- lib/rattler/parsers/predicate.rb
Overview
A Predicate
is a parser that either succeeds or fails and never consumes any input or captures any parse results.
Class Method Summary collapse
Instance Method Summary collapse
-
#capturing? ⇒ Boolean
true
if the parser returns parse results on success, orfalse
if the parser simply returnstrue
on success. -
#capturing_decidable? ⇒ Boolean
true
if it can be determined statically whether the parser returns parse results on success.
Methods included from Combining
Methods inherited from Parser
#&, #>>, #labeled?, #list, #one_or_more, #optional, #repeat, #semantic?, #sequence?, #skip, #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
11 12 13 |
# File 'lib/rattler/parsers/predicate.rb', line 11 def self.parsed(results, *_) #:nodoc: self[results.first] end |
Instance Method Details
#capturing? ⇒ Boolean
Returns true
if the parser returns parse results on success, or false
if the parser simply returns true
on success.
16 17 18 |
# File 'lib/rattler/parsers/predicate.rb', line 16 def capturing? false end |
#capturing_decidable? ⇒ Boolean
true
if it can be determined statically whether the parser returns parse results on success
21 22 23 |
# File 'lib/rattler/parsers/predicate.rb', line 21 def capturing_decidable? true end |