Skip to main content

module util::Highlight

rascal-Not specified

Maps parse trees to highlighting markup in ANSI, HTML or LaTeX format.

Usage​

import util::Highlight;

Dependencies​

import ParseTree;
import String;
import IO;

function toHTMLStyle​

Styles for span classes generated by To H T ML

str toHTMLStyle()

function toHTML​

Yields the characters of a parse tree as the original input sentence in a ... block, but with spans for highlighted segments in HTML

str toHTML(Tree input, bool withStyle=false)

function toLaTeX​

Yields the characters of a parse tree as the original input sentence but using macros to wrap to-be-highlighted areas.

str toLaTeX(Tree t)

function toANSI​

Unparse a parse tree to unicode characters, wrapping certain substrings with ANSI codes for highlighting.

str toANSI(Tree t, bool underlineAmbiguity=false, int tabSize=4)

function isKeyword​

Encodes when to highlight a literal as a keyword category

bool isKeyword(str s)