Object
Wraps the input string for parslet.
Returns how many chars remain in the input.
# File lib/parslet/source.rb, line 46 def chars_left @str.size - @pos end
Consumes n characters from the input, returning them as a slice of the input.
# File lib/parslet/source.rb, line 33 def consume(n) slice_str = @str.slice(@pos, n) slice = Parslet::Slice.new( slice_str, pos, @line_cache) @pos += slice_str.size return slice end
Returns a <line, column> tuple for the given position. If no position is given, line/column information is returned for the current position given by pos.
# File lib/parslet/source.rb, line 62 def line_and_column(position=nil) @line_cache.line_and_column(position || self.pos) end
Checks if the given pattern matches at the current input position.
@param pattern [Regexp, String] pattern to check for @return [Boolean] true if the pattern matches at pos
# File lib/parslet/source.rb, line 25 def matches?(pattern) @str.index(pattern, @pos) == @pos end
Generated with the Darkfish Rdoc Generator 2.