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.paren_typeFunction
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 a paren
  • [ and ] are a bracket
  • { and } are a curly

Anything else is of type none, and produced a depth change of 0.

source
JuliaSyntaxHighlighting._hl_annotationsFunction
_hl_annotations(content::AbstractString, ast::GreenNode)
  -> Vector{@NamedTuple{region::UnitRange{Int}, label::Symbol, value::Any}}

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::Any}, where the region indexes into content and the value is a julia_* face name.

This is a small wrapper around _hl_annotations! for convenience.

source
JuliaSyntaxHighlighting._hl_annotations!Function
_hl_annotations!(highlights::Vector{@NamedTuple{region::UnitRange{Int}, label::Symbol, value::Any}},
                 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.

source