Class: Rattler::Parsers::Eof
- Inherits:
-
Predicate
- Object
- Util::Node
- Parser
- Predicate
- Rattler::Parsers::Eof
- Includes:
- Singleton
- Defined in:
- lib/rattler/parsers/eof.rb
Overview
Eof
succeeds if there is no more input to parse.
Class Method Summary collapse
-
.[] ⇒ Eof
Return the singleton instance of
Eof
. - .parsed(*_) ⇒ Object
Instance Method Summary collapse
-
#parse(scanner, rules, labeled = {}) ⇒ Object
Return
true
if there is no more input to parse. -
#with_ws(ws) ⇒ Parser
Return a new parser that uses
ws
to skip whitespace before matching.
Methods inherited from Predicate
Methods inherited from Parser
#&, #capturing?, #labeled?, #one_or_more, #optional, #skip, #variable_capture_count?, #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
.[] ⇒ Eof
Return the singleton instance of Eof
23 24 25 |
# File 'lib/rattler/parsers/eof.rb', line 23 def self.[]() self.instance end |
.parsed(*_) ⇒ Object
28 29 30 |
# File 'lib/rattler/parsers/eof.rb', line 28 def self.parsed(*_) #:nodoc: self.instance end |
Instance Method Details
#parse(scanner, rules, labeled = {}) ⇒ Object
Return true
if there is no more input to parse
37 38 39 |
# File 'lib/rattler/parsers/eof.rb', line 37 def parse(scanner, rules, labeled = {}) scanner.eos? end |
#with_ws(ws) ⇒ Parser
Return a new parser that uses ws
to skip whitespace before matching.
45 46 47 |
# File 'lib/rattler/parsers/eof.rb', line 45 def with_ws(ws) Skip[ws] & self end |