Trait Language

Source
pub trait Language {
    // Required methods
    fn name(&self) -> String;
    fn init(&self, x: &mut LexerContext) -> Result<(), Error>;

    // Provided method
    fn names(&self) -> Vec<String> { ... }
}
Expand description

A language implementation for Highlighter.

Required Methods§

Source

fn name(&self) -> String

Returns the name of the programming language.

Source

fn init(&self, x: &mut LexerContext) -> Result<(), Error>

Initializes the programming language.

Provided Methods§

Source

fn names(&self) -> Vec<String>

Returns all of the aliases of the programming language.

For example:

vec!["js".to_owned(), "javascript".to_owned(), "jscript".to_owned(), "es".to_owned(), "ecmascript".to_owned()];

Implementors§