Trevixal API
    Preparing search index...

    Language definitions for createHighlighter. Each is a small set of rules rather than a grammar: enough to colour code correctly in an editor, without pulling a parser into the bundle.

    Rules are tried in order at each position, so the specific ones (comments, strings) must precede the general ones (identifiers).

    interface LanguageRule {
        className: string;
        followedBy?: RegExp;
        keywords?: ReadonlySet<string>;
        otherwise?: string;
        pattern: RegExp;
    }
    Index
    className: string
    followedBy?: RegExp

    The class only applies when the text right after the match matches this (also sticky). Kept out of pattern rather than written as a trailing lookahead so that the scanner still learns how long the lexeme was when the condition fails. A lookahead hides that, and the scanner then re-tries every rule at every offset inside the same word, which is quadratic on a long one.

    keywords?: ReadonlySet<string>

    When set, the match only counts as this token if the captured text is a keyword of the language, otherwise it falls through to otherwise.

    otherwise?: string
    pattern: RegExp

    Must be sticky (y); matched at the current position only.