Did you know ... Search Documentation:
doc_modes.pl -- Analyse PlDoc mode declarations
PublicShow source

This module analyzes the formal part of the documentation of a predicate. The formal part is processed by read_term/3 using the operator declarations in this module.

- Jan Wielemaker
Source process_modes(+Lines:lines, +Module, +FilePos, -Modes:list, -Args:list(atom), -RestLines:lines) is det
Process the formal header lines (upto the first blank line), returning the remaining lines and the names of the arguments used in the various header lines.
FilePos- Term File:Line with the position of comment
Modes- List if mode(Head, Bindings) terms
Args- List of argument-names appearing in modes
Source compile_mode(+Mode, -Compiled) is det
Compile a PlDoc mode declararion into a term mode(Head, Determinism).
Mode- List if mode-terms. See process_modes/6.
Source mode(:Head, ?Det) is nondet
True if there is a mode-declaration for Head with Det.
Head- Callable term. Arguments are a mode-indicator followed by a type.
Det- One of unknown, det, semidet, or nondet.
Source is_mode(@Head) is semidet
True if Head is a valid mode-term.
Source mode_indicator(?Ind:atom) is nondet
Our defined argument-mode indicators
Source modes_to_predicate_indicators(+Modes:list, -PI:list) is det
Create a list of predicate indicators represented by Modes. Each predicate indicator is of the form atom/integer for normal predicates or atom//integer for DCG rules.
Modes- Mode-list as produced by process_modes/5
PI- List of Name/Arity or Name//Arity without duplicates
Source compile_clause(:Term, +FilePos) is det
Add a clause to the compiled program. Unlike assert/1, this associates the clause with the given source-location, makes it static code and removes the clause if the file is reloaded. Finally, as we create clauses one-by-one, we define our predicates as discontiguous.
Term- Clause-term
FilePos- Term of the form File:Line, where File is a canonical filename.