nabi_syntax
Tokenizer and HTML highlighter for Nabi and NABION: keywords, types,
strings (f-string holes as code, nested; raw strings), chars, numbers,
comments, attributes and macros. r#name is an identifier, never a
keyword. The classes follow grammars/classes.nabion, the table the
TextMate grammars in grammars/ are tested against.
Structs
TokenSource
pub struct TokenA slice of the source. Concatenating the text of all tokens gives
the source back.
Enums
KindSource
pub enum KindWhat a token is. Text is everything else (identifiers, raw
identifiers, labels, operators, punctuation, whitespace).
A macro call
name!or a meta template token@name.The CSS class
highlight_*puts on the token's<span>:k,t,s,n,c,a,m, or""forText(not wrapped).
Functions
tokensSource
pub fn tokens(src: str) -> List<Token> Tokens of Nabi source.
tokens_nabionSource
pub fn tokens_nabion(src: str) -> List<Token> Tokens of NABION source: as Nabi, but only true / false / none
are keywords and a name before : is a field.
highlight_nabiSource
pub fn highlight_nabi(src: str) -> str Nabi source as HTML: tokens as <span class=".."> (see
Kind::class), & / < / > escaped. Goes inside <pre><code>.
highlight_nabionSource
pub fn highlight_nabion(src: str) -> str NABION source as HTML, as highlight_nabi.
to_htmlSource
pub fn to_html(toks: List<Token>) -> str Tokens as HTML, as highlight_nabi.