Search results

There are no results.

syntax.Language

class pub Language

A type describing a language, such as its file extensions and names.

Fields

name

let pub @name: String

The 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) -> Lexer

A 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 code
Hide source code
fn pub mut lexer(bytes: ref ByteArray) -> Lexer {
  @builder.call(bytes)
}
fn pub mut lexer(bytes: ref ByteArray) -> Lexer

Creates a new Lexer that processes the given ByteArray.