Did you know ... Search Documentation:
Pack dcg_util -- prolog/dcg_util.pl
PublicShow source
 at_least(N:nonneg, :Dcg)//
Like at_least//3 but discards the matches.
 at_least(N:nonneg, :Dcg, Matches:list)//
Consumes at least N matches of Dcg. Dcg is called with one extra parameter which should be bound to a representation of what Dcg parsed. After N matches, it consumes as many more matches as possible.
 exactly(N:nonneg, :Dcg)//
Like exactly//3 but discards the matches.
 exactly(N:nonneg, :Dcg, Matches:list)//
Consumes exactly N matches of Dcg. Dcg is called with one extra parameter which should be bound to a representation of what Dcg parsed.
 generous(:Goal, Matches:list)//
Consume as few matches of Goal as possible. Goal is called with one extra argument which should be bound to a representation of what Dcg parsed.
 greedy(:Dcg)//
Like greedy//2 but discards the matches.
 greedy(:Dcg, Matches:list)//
Like generous//2 but consumes as many matches as possible. Gives back matches on backtracking.
 list(:ElemDcg, :SeparatorDcg, Elems:list)//
Describes a list in which the elements match ElemDcg and the separators match SeparatorDcg. Elems is the list of elements found. The set of patterns matched by ElemDcg and SeparatorDcg should be disjoint. ElemDcg is called with one extra argument. SeparatorDcg is called without any extra arguments.

On backtracking, gives back elements and their associated separators. Always matches at least one element (without a trailing separator).

 followed_by(:Dcg)//
True if Dcg would match. Consumes nothing.
 eos//
Matches the end of string position.
 when_generating(:Goal)//
Call Goal when the DCG operates in generator mode. Otherwise, it's a noop.
 when_parsing(:Goal)//
Call Goal when the DCG operates in parsing mode. Otherwise, it's a noop.
 parsing// is semidet
True if the DCG is operating as a parser. Specifically, the DCG list is not a variable.