Matches a string of characters.
Example:
str('foo') # matches 'foo'
Call back visitors visit_str method. See parslet/export for an example.
# File lib/parslet/atoms/visitor.rb, line 15 def accept(visitor) visitor.visit_str(str) end
# File lib/parslet/atoms/str.rb, line 33 def to_s_inner(prec) "'#{str}'" end
# File lib/parslet/atoms/str.rb, line 20 def try(source, context) return succ(source.consume(@len)) if source.matches?(str) # Failures: return context.err(self, source, @error_msgs[:premature]) if source.chars_left<@len error_pos = source.pos return context.err_at( self, source, [@error_msgs[:failed], source.consume(@len)], error_pos) end
Generated with the Darkfish Rdoc Generator 2.