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)
Term | - Any Prolog term including a variable). |
TermPos | - The detailed layout of the term, for example
from using read_term(Term, subterm_positions(TermPos) . |
existence_error(matching_rule, Subterm)
if a subterm of Term
is inconsistent with the corresponding part of TermPos.