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, #rule, #str, #then, #|

Constructor Details

#initialize(parent: nil) ⇒ Ignore

Returns a new instance of Ignore.



140
141
142
# File 'lib/language/atom.rb', line 140

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

Instance Method Details

#parse(parser) ⇒ Object



144
145
146
147
148
149
150
151
152
153
154
# File 'lib/language/atom.rb', line 144

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

#to_sObject



156
157
158
# File 'lib/language/atom.rb', line 156

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