The target module¶
A Target describes where to go.
In a lexicon rule, you can specify destinations using integers or lexicons.
A Target generalizes this in two values/attributes:
pop is zero or a negative integer, determining how many lexicons to
pop off the current state/context.
push is a list of zero or more lexicons, determining which lexicons to
add to the current state.
You can sort of “add” targets using a TargetFactory, which can create single Target objects combining multiple targets in once.
Used by the
lexerto describe lexicon changes.
A negative integer or 0, describing how many lexicons to leave.
A list of zero or more Lexicons to enter.
Maintains a current target and allows you to store changes.
Call get() to get the final Target, and to reset the factory’s internal state.
Add a Target to this factory.
Return the current
Returns None if there is nothing to pop and push. After this the current target is reset.
Enter one or more lexicon(s).
Pop off one (or more) lexicon(s).
Create a Target of a rule.