Class: Language::Atom::Ignore

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

Instance Method Summary collapse

Methods inherited from Language::Atom

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

Constructor Details

#initialize(parent: nil) ⇒ Ignore

Returns a new instance of Ignore.



126
127
128
# File 'lib/language/atom.rb', line 126

def initialize(parent: nil)
  @parent = parent
end

Instance Method Details

#parse(parser) ⇒ Object



130
131
132
133
134
135
136
137
138
139
140
# File 'lib/language/atom.rb', line 130

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



142
143
144
# File 'lib/language/atom.rb', line 142

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