Internals
Everything documented in this page is internal and subject to breaking changes.
These are provided here for those curious about how JuliaSyntaxHighlighting
works, and as a reference for contributors.
JuliaSyntaxHighlighting.MAX_PAREN_HIGHLIGHT_DEPTH — Constant
MAX_PAREN_HIGHLIGHT_DEPTHThe number of julia_rainbow_{paren,bracket_curly}_{n} faces
from HIGHLIGHT_FACES that can be cycled through.
JuliaSyntaxHighlighting.RAINBOW_DELIMITERS_ENABLED — Constant
RAINBOW_DELIMITERS_ENABLEDWhether to use julia_rainbow_{paren,bracket_curly}_{n} faces for
delimitors/parentheses ((), [], {}) as opposed to just using
julia_parentheses.
JuliaSyntaxHighlighting.UNMATCHED_DELIMITERS_ENABLED — Constant
UNMATCHED_DELIMITERS_ENABLEDWhether to apply the julia_unpaired_parentheses face to unpaired closing
parenthesis (), ], '}').
JuliaSyntaxHighlighting.SINGLETON_IDENTIFIERS — Constant
SINGLETON_IDENTIFIERSSymbols that represent identifiers known to be instances of a singleton type,
currently just Nothing and Missing.
JuliaSyntaxHighlighting.BUILTIN_FUNCTIONS — Constant
BUILTIN_FUNCTIONSA set of identifiers that are defined in Core and a Core.Builtin.
JuliaSyntaxHighlighting.OPERATOR_KINDS — Constant
OPERATOR_KINDSA set of known operator kind strings.
This is a workaround for operators that are classified as K"Identifier".
JuliaSyntaxHighlighting.HIGHLIGHT_FACES — Constant
HIGHLIGHT_FACESA list of name => Face(...) pairs that define the faces in
JuliaSyntaxHighlighting. These are registered during module initialisation.
JuliaSyntaxHighlighting.paren_type — Function
paren_type(k::Kind) -> (Int, Symbol)Return a pair of values giving the change in nesting depth
caused by the paren k (+1 or -1), as well as a symbol
indicating the kind of parenthesis:
(and)are aparen[and]are abracket{and}are acurly
Anything else is of type none, and produced a depth change of 0.
JuliaSyntaxHighlighting._hl_annotations — Function
_hl_annotations(content::AbstractString, ast::GreenNode)
-> Vector{@NamedTuple{region::UnitRange{Int}, label::Symbol, value::Symbol}}Generate a list of annotations for the given content and ast.
Each annotation takes the form of a @NamedTuple{region::UnitRange{Int}, label::Symbol, value::Symbol},
where the region indexes into content and the value is a julia_* face name.
This is a small wrapper around _hl_annotations! for convenience.
JuliaSyntaxHighlighting._hl_annotations! — Function
_hl_annotations!(highlights::Vector{@NamedTuple{region::UnitRange{Int}, label::Symbol, value::Symbol}},
lineage::GreenLineage, ctx::HighlightContext)Populate highlights with annotations for the given lineage and ctx,
where lineage is expected to be consistent with ctx.offset and ctx.lnode.