Class: Language::Atom::Absent
Instance Method Summary
collapse
#<<, #>>, #absent, #aka, #any, #ignore, #inspect, #maybe, #repeat, #rule, #str, #then, #|
Constructor Details
#initialize(parent: nil) ⇒ Absent
116
117
118
|
# File 'lib/language/atom.rb', line 116
def initialize(parent: nil)
@parent = parent
end
|
Instance Method Details
#parse(parser) ⇒ Object
120
121
122
123
124
125
126
127
128
129
130
131
132
|
# File 'lib/language/atom.rb', line 120
def parse(parser)
clone =
Parser.new(
root: self,
input: parser.input,
cursor: parser.cursor,
buffer: parser.buffer
)
@parent.parse(clone) if @parent
rescue Parser::Interuption
else
raise Parser::Interuption.new(parser, self)
end
|
#to_s ⇒ Object
134
135
136
|
# File 'lib/language/atom.rb', line 134
def to_s
@parent ? "(#{@parent}).absent" : "absent"
end
|