syntax.Language
type pub LanguageA type describing a language, such as its file extensions and names.
Fields
name
let pub @name: StringThe identifier/primary name of the language.
This name should be a lowercase alphanumerical name, such that it's valid for e.g. HTML classes.
aliases
let pub @aliases: Array[String]Any aliases the language is available under as well.
builder
let pub @builder: fn (ref ByteArray) -> LexerA closure used for constructing a lexer.
The closure's argument is the ByteArray to turn into a token stream.
Note that the closure is expected to return a value typed as the Lexer
trait. This means you'll need to explicitly cast any lexer classes to the
trait using ... as Lexer.
Instance methods
lexer
Show source codeHide source code
fn pub mut lexer(bytes: ref ByteArray) -> Lexer {
@builder.call(bytes)
}fn pub mut lexer(bytes: ref ByteArray) -> LexerCreates a new Lexer that processes the given ByteArray.