Highlighter

A token and syntax highlighter.

Constructors

this
this(TagMap tags, CompilationContext cc)

Constructs a TokenHighlighter object.

Members

Functions

highlightSyntax
void highlightSyntax(cstring filePath, bool printHTML, bool opt_printLines)
void highlightSyntax(Module modul, bool printHTML, bool opt_printLines)

Highlights the syntax in a source file.

highlightTokens
cstring highlightTokens(cstring text, cstring filePath, out uint lines)

Highlights tokens in a string.

highlightTokens
void highlightTokens(Token[] tokens, bool skipWS = false)
void highlightTokens(ref CharArray buffer, Token[] tokens, bool skipWS = false)

Highlights the tokens from begin to end (both included).

highlightTokens
void highlightTokens(cstring filePath, bool opt_printLines)

Highlights all tokens of a source file.

print
void print(cstring s)

Writes s to the buffer.

print
void print(char c)

Writes c to the buffer.

printToken
void printToken(Token* token)

Prints a token to the stream 'print'.

printf
void printf(cstring format, ...)

Writes arguments formatted to the buffer.

takeText
char[] takeText()

Empties the buffer and returns its contents.

Static functions

scanEscapeSequences
cstring scanEscapeSequences(cstring text, cstring fmt)

Highlights escape sequences inside a text. Also escapes XML characters.

Variables

buffer
CharArray buffer;

Buffer that receives the text.

cc
CompilationContext cc;

The compilation context.

tags
TagMap tags;

Which tag map to use.

Meta