Class: Rattler::Parsers::Eof

Inherits:
Parser show all
Includes:
Atomic, Singleton
Defined in:
lib/rattler/parsers/eof.rb

Overview

Eof succeeds if there is no more input to parse.

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Atomic

#with_ws

Methods inherited from Parser

#&, #>>, #capturing_decidable?, #labeled?, #list, #one_or_more, #optional, #repeat, #semantic?, #sequence?, #skip, #variable_capture_count?, #with_ws, #zero_or_more, #|

Methods included from Runtime::ParserHelper

#select_captures

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

.[]Eof

Return the singleton instance of Eof

Returns:

  • (Eof)

    the singleton instance



14
15
16
# File 'lib/rattler/parsers/eof.rb', line 14

def self.[]()
  self.instance
end

.parsed(*_) ⇒ Object



19
20
21
# File 'lib/rattler/parsers/eof.rb', line 19

def self.parsed(*_) #:nodoc:
  self.instance
end

Instance Method Details

#capturing?Object

Returns true if the parser returns parse results on success, or false if the parser simply returns true on success.

Returns:

  • true if the parser returns parse results on success, or false if the parser simply returns true on success



33
34
35
# File 'lib/rattler/parsers/eof.rb', line 33

def capturing?
  false
end

#parse(scanner, *_) ⇒ Boolean

Return true if there is no more input to parse

Parameters:

  • scanner (StringScanner)

    the scanner for the current parse

  • rules (RuleSet)

    the grammar rules being used for the current parse

  • scope (ParserScope)

    the scope of captured results

Returns:

  • (Boolean)

    true if there is no more input to parse



28
29
30
# File 'lib/rattler/parsers/eof.rb', line 28

def parse(scanner, *_)
  scanner.eos?
end