Class: Language::Atom::Ignore

Inherits:
Language::Atom show all
Defined in:
lib/language/atom/ignore.rb

Instance Method Summary collapse

Methods inherited from Language::Atom

#<<, #>>, #absent, #aka, #any, #ignore, #inspect, #maybe, #repeat, #str, #then, #|

Constructor Details

#initialize(parent:) ⇒ Ignore

Returns a new instance of Ignore.



6
7
8
# File 'lib/language/atom/ignore.rb', line 6

def initialize(parent:)
  @parent = parent
end

Instance Method Details

#parse(parser) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/language/atom/ignore.rb', line 10

def parse(parser)
  clone =
    Parser.new(
      root: self,
      input: parser.input,
      cursor: parser.cursor,
      buffer: parser.buffer
    )
  @parent.parse(clone)
  parser.cursor = clone.cursor
end

#to_sObject



22
23
24
# File 'lib/language/atom/ignore.rb', line 22

def to_s
  "#{@parent}.ignore"
end