Check that a Term has an appropriate TermPos layout. An incorrect
TermPos results in either failure of this predicate or an error.
If a position in TermPos is a variable, the validation of the
corresponding part of Term succeeds. This matches the
term_expansion/4 treats "unknown" layout information. If part of a
TermPos is given, then all its "from" and "to" information must be
specified; for example, string_position(X,Y)
is an error but
string_position(0,5)
succeeds. The position values are checked for
being plausible -- e.g., string_position(5,0)
will fail.
This should always succeed:
read_term(Term, [subterm_positions(TermPos)]),
valid_term_position(Term, TermPos)
- Arguments:
-
Term | - Any Prolog term including a variable). |
TermPos | - The detailed layout of the term, for example
from using read_term(Term, subterm_positions(TermPos) . |
- Errors
- -
existence_error(matching_rule, Subterm)
if a subterm of Term
is inconsistent with the corresponding part of TermPos.
- See also
- - read_term/2, read_term/3, term_string/3
- - expand_term/4, term_expansion/4, expand_goal/4, expand_term/4
- - clause_info/4, clause_info/5
- - unify_clause_hook/5