class Tartrazine::DelegatingLexer

Overview

A lexer that takes two lexers as arguments. A root lexer and a language lexer. Everything is scalled using the language lexer, afterwards all Other tokens are lexed using the root lexer.

This is useful for things like template languages, where you have Jinja + HTML or Jinja + CSS and so on.

Defined in:

lexer.cr

Constructors

Instance Method Summary

Instance methods inherited from class Tartrazine::BaseLexer

config : {name: String, priority: Float64, case_insensitive: Bool, dot_all: Bool, not_multiline: Bool, ensure_nl: Bool} config, config=(config : NamedTuple(name: String, priority: Float64, case_insensitive: Bool, dot_all: Bool, not_multiline: Bool, ensure_nl: Bool)) config=, states : Hash(String, Tartrazine::State) states, states=(states : Hash(String, Tartrazine::State)) states=, tokenizer(text : String, secondary = false) : BaseTokenizer tokenizer

Constructor Detail

def self.new(language_lexer : BaseLexer, root_lexer : BaseLexer) #

[View source]

Instance Method Detail

def language_lexer : BaseLexer #

[View source]
def language_lexer=(language_lexer : BaseLexer) #

[View source]
def root_lexer : BaseLexer #

[View source]
def root_lexer=(root_lexer : BaseLexer) #

[View source]
def tokenizer(text : String, secondary = false) : DelegatingTokenizer #

[View source]