validate(self,
available_symbols,
succeed_at_dead_end=False)
| source code
|
Determine whether this content model can be satisfied using the
provided elements.
The general idea is to treat the transitions of the DFA as symbols in
an alphabet. For each such transition, a sequence of values is provided
to be associated with the transition. One transition is permitted for
each value associated with the symbol. The symbol (key)
None represents wildcard values.
If a path is found that uses every symbol in valid transitions and
ends in a final state, the return value is a pair consisting of the
unconsumed symbols and a sequence of term, value pairs that define the
acceptable path. If no valid path through the DFA can be taken,
None is returned.
- Parameters:
available_symbols - A map from leaf DFA terms to a sequence of values associated with
the term in a binding instance. The key None is
used to represent wildcard elements. If a key appears in this
map, it must have at least one value in its sequence.
succeed_at_dead_end - If True , states from which no transition can be made
are accepted as final states. This is used when processing
"all" model groups, where the content model for the
current alternative must succeed while retaining the symbols that
are needed for other alternatives.
|