Skip to main content

module util::Highlight

rascal-0.40.16

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

Usage

import util::Highlight;

Dependencies

import ParseTree;
import String;

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 t)

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 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 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)