Did you know ... Search Documentation:
Pack refactor -- prolog/fix_termpos.pl
PublicShow source
 term_innerpos(OFrom, OTo, InnerFrom, InnerTo)
Contains the inner positions of a term, that exclude comments and some extra parenthesis.
 fix_termpos(@TermPos) is det
Applies fix_subtermpos recursivelly and extends the boundaries of the first term position from the first comment up to just before the ending dot.

Due to performance concerns, this predicate makes a destructive assignment in the TermPos argument, but preserve the extra positions in the term_innerpos/4 predicate.

See also
- fix_subtermpos/1
 fix_subtermpos(@TermPos) is det
Takes a subterm position, as returned by the subterm_positions option of read_term/2 and increases its precision, avoiding some minor mistmatches with the text, that for a refactoring tool is instrumental. This method also ensures that the minimal required parenthesis enclosing a term are contained in its scope, widening the positions 1 and 2 of the given term position specifier. The current implementation is aware of comments and extra parenthesis, asserting such information in term_innerpos/4 facts.
To be done
- This implementation have performance issues, needs optimization.