Class: Rattler::Parsers::Disallow
- Inherits:
-
Predicate
- Object
- Util::Node
- Parser
- Predicate
- Rattler::Parsers::Disallow
- Defined in:
- lib/rattler/parsers/disallow.rb
Overview
Disallow
decorates a parser and succeeds if the decorated parser fails and vice versa.
Instance Method Summary collapse
-
#parse(scanner, rules, scope = {}) ⇒ Boolean
Succeed and return
true
if and only if decorated parser fails.
Methods inherited from Predicate
Methods included from Combining
Methods inherited from Parser
#&, #capturing?, #labeled?, #one_or_more, #optional, parsed, #skip, #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
Instance Method Details
#parse(scanner, rules, scope = {}) ⇒ Boolean
Succeed and return true
if and only if decorated parser fails. Never consumes any input.
23 24 25 26 27 28 |
# File 'lib/rattler/parsers/disallow.rb', line 23 def parse(scanner, rules, scope = {}) pos = scanner.pos result = !child.parse(scanner, rules, scope) scanner.pos = pos result end |