module

Hwaro::Content::Processors::CustomLexers

Class methods

digest

Content digest of the grammars the current build registered; "" when none. Folded into the build-cache config hash and the body memo fingerprint, so a grammar edit re-highlights every page.

Source

Instance methods

apply(config : Models::Config) : String

Register this build's grammars (replacing the previous build's — serve rebuilds in one process) and return their digest. Called once per build from the Initialize phase, before rendering.

Source
custom?(lang : String) : Bool
Source
files(dir : String) : Array(String)

The grammar files in dir, sorted for a deterministic load order.

Source
scan(dir : String) : Tuple(Array(Grammar), Array(Tuple(String, String)), String)

Parse every grammar in dir. Returns the grammars to register, a {path, message} problem for each file that did not load (or lost a name to an earlier file, or has a defect that only bites mid-tokenization, see Tartrazine.hwaro_parse_custom_lexer), and a digest of the loaded files' bytes ("" when none loaded). Each file is read once, and a read failure is a problem like a parse failure — build and doctor both report exactly this list.

Source

Nested types