Class: Packrat::Maybe
Instance Attribute Summary
#hidden
Instance Method Summary
collapse
#to_packrat_grammar_element
Constructor Details
#initialize(sub) ⇒ Maybe
Returns a new instance of Maybe.
224
225
226
|
# File 'lib/packrat/grammar.rb', line 224
def initialize(sub)
@sub = sub.to_packrat_grammar_element
end
|
Instance Method Details
#inspect ⇒ Object
231
232
233
|
# File 'lib/packrat/grammar.rb', line 231
def inspect
"(#{@sub.inspect})?"
end
|
#parse(parser) ⇒ Object
227
228
229
230
|
# File 'lib/packrat/grammar.rb', line 227
def parse(parser)
res = @sub.parse(parser)
false == res ? nil : res
end
|