PublicShow sourceprolog_format.pl -- Analyse format specifications

This library parses the format specification used by format/1, format/2 and format/3. The parsed specification can be used to validate the consistency of the format string and the provided arguments. For example:

?- format_types('~d bottles of beer', Types).
Types = [integer].
author
- Michael Hendricks
See also
- http://www.swi-prolog.org/pack/list?p=format_spec
To be done
- The current implementation does not support format_predicate/2.
Source format_spec(+Format, -Spec:list) is semidet
Parse a format string. Each element of Spec is one of the following:
text(Text)
Text sent to the output as is
escape(Num, Colon, Action)
A format escape. Num represents the optional numeric portion of an esape. Colon represents the optional colon in an escape. Action is an atom representing the action to be take by this escape.
Source format_spec(-Spec)//
DCG for parsing format strings. It doesn't yet generate format strings from a spec. See format_spec/2 for details.
Source format_types(+Format:text, -Types:list) is det
True when Format requires an argument list with terms of the type specified by Types. The length of this list is the number of arguments required. Each value of Types is a type as described by error:has_type/2.