Matches a special kind of regular expression that only ever matches one character at a time. Useful members of this family are: character ranges, \w, \d, \r, \n, ...
Example:
match('[a-z]') # matches a-z match('\s') # like regexps: matches space characters
Call back visitors visit_re method. See parslet/export for an example.
# File lib/parslet/atoms/visitor.rb, line 77 def accept(visitor) visitor.visit_re(match) end
# File lib/parslet/atoms/re.rb, line 34 def to_s_inner(prec) match.inspect[1..-2] end
# File lib/parslet/atoms/re.rb, line 23 def try(source, context, consume_all) return succ(source.consume(1)) if source.matches?(@re) # No string could be read return context.err(self, source, @error_msgs[:premature]) if source.chars_left < 1 # No match return context.err(self, source, @error_msgs[:failed]) end
Generated with the Darkfish Rdoc Generator 2.