memorize

Function memorize 

Source
pub fn memorize<L: LexIt + Clone, T: Clone>(
    state: &mut ParserState<'_, L>,
    memo: &Memo<Cursor, T>,
    parser: impl FnOnce(&mut ParserState<'_, L>) -> Result<T, Error>,
) -> Result<T, Error>
Expand description

The “Packrat” memoization for a parser.

It ensures that parsing the same position in the source code only occurs once, by recording the results of parsing. The memoization is distinguished by the position itself, so different parsing processes should have their own memos.