Class: Packrat::RegexpLiteral
Instance Attribute Summary
#hidden
Instance Method Summary
collapse
#to_packrat_grammar_element
Constructor Details
Returns a new instance of RegexpLiteral.
50
51
52
|
# File 'lib/packrat/grammar.rb', line 50
def initialize(re)
@re = re
end
|
Instance Method Details
#inspect ⇒ Object
53
|
# File 'lib/packrat/grammar.rb', line 53
def inspect; @re.inspect; end
|
#parse(parser) ⇒ Object
530
531
532
533
534
|
# File 'lib/packrat/grammar.rb', line 530
def parse(parser)
oldpos = parser.pos
len = parser.skip(@re)
len ? parser.lexeme(oldpos, len) : false
end
|