Did you know ... Search Documentation:
prolog_colour.pl -- Prolog syntax colouring support.
PublicShow source

This module defines reusable code to colourise Prolog source.

To be done
- : The one-term version
Source prolog_colourise_stream(+Stream, +SourceID, :ColourItem) is det
Determine colour fragments for the data on Stream. SourceID is the canonical identifier of the input as known to the cross-referencer, i.e., as created using xref_source(SourceID).

ColourItem is a closure that is called for each identified fragment with three additional arguments:

  • The syntactical category
  • Start position (character offset) of the fragment
  • Length of the fragment (in characters).
Source prolog_colourise_query(+Query:string, +SourceId, :ColourItem)
Colourise a query, to be executed in the context of SourceId.
Arguments:
SourceId- Execute Query in the context of the cross-referenced environment SourceID.
Source prolog_colourise_term(+Stream, +SourceID, :ColourItem, +Options)
Colourise the next term on Stream. Unlike prolog_colourise_stream/3, this predicate assumes it is reading a single term rather than the entire stream. This implies that it cannot adjust syntax according to directives that preceed it.

Options:

subterm_positions(-TermPos)
Return complete term-layout. If an error is read, this is a term error_position(StartClause, EndClause, ErrorPos)
Source goal_classification(+Goal, -Class)[multifile]
Multifile hookable classification for non-local goals.
Source vararg_goal_classification(+Name, +Arity, -Class) is semidet[multifile]
Multifile hookable classification for vararg predicates.
Source syntax_colour(?Class, ?Attributes) is nondet
True when a range classified Class must be coloured using Attributes. Attributes is a list of:
  • colour(ColourName)
  • background(ColourName)
  • bold(Boolean)
  • underline(Boolean)

Attributes may be the empty list. This is used for cases where -for example- a menu is associated with the fragment. If syntax_colour/2 fails, no fragment is created for the region.

Undocumented predicates

The following predicates are exported, but not or incorrectly documented.

Source syntax_message(Arg1, Arg2, Arg3)