Core Lenses

These lenses are of general use (e.g. recursion).

class pylens.core_lenses.Forward(recursion_limit=100, **options)

Allows forward declaration of a lens, which may be bound later, primarily to allow for lens recursion. Based on the idea used in pyparsing, since we must define variables before we use them, unless we use some python interpreter pre-processing.

class pylens.core_lenses.Until(lens, include_lens=False, **options)

Match anything up until the specified lens. This is useful for lazy parsing, but not the be overused (e.g. chaining can be bad: Until(“X”) + Until(“Y”)!).

# TODO: Could parse lens but not include in stored string.

Arguments:
include_lens - Set to true if the specified lens should also be consumed.

Previous topic

Base Lenses

Next topic

Utility Lenses

This Page