5.9.2 Tests Related to Source Information
These tests provide access to source related information. The
file
and line
tests will fail if no source information is
present. The parent_clause
and parent_pred
tests are
available for interpreted code only, they will fail in
compiled code.
file(
File)
- The current goal is invoked from a file whose absolute name is
File.
line(
File,
Line)
- The current goal is invoked from line Line, from within a file
whose absolute name is File.
line(
Line)
- The current goal is invoked from line Line.
parent_clause(
Cl)
- The current goal is invoked from clause Cl.
parent_clause(
Cl,
Sel)
- The current goal is invoked from clause Cl and within its body it
is pointed to by the subterm selector Sel.
parent_clause(
Cl,
Sel,
I)
- The current goal is invoked from clause Cl, it is pointed to by
the subterm selector Sel within its body, and it is the Ith
goal within it. The goals in the body are counted following their
textual occurrence.
parent_pred(
Pred)
- The current goal is invoked from predicate Pred.
parent_pred(
Pred,
N)
- The current goal is invoked from predicate Pred, clause number
N.
The parent_pred
tests match their first argument against
the functor of the parent predicate in the same way as
the pred
test does, see the notes in the previous section
(Goal Tests).
Send feedback on this subject.