Class | Parslet::Atoms::Context |
In: |
lib/parslet/atoms/context.rb
|
Parent: | Object |
Helper class that implements a transient cache that maps position and parslet object to results. This is used for memoization in the packrat style.
Also, error reporter is stored here and error reporting happens through this class. This makes the reporting pluggable.
captures | [R] |
Returns the current captures made on the input (see
Parslet::Atoms::Base#capture). Use as follows:
context.captures[:foobar] # => returns capture :foobar |
Caches a parse answer for obj at source.pos. Applying the same parslet at one position of input always yields the same result, unless the input has changed.
We need the entire source here so we can ask for how many characters were consumed by a successful parse. Imitation of such a parse must advance the input pos by the same amount of bytes.