class Mint::SemanticTokenizer

Defined in:

semantic_tokenizer.cr

Constant Summary

TOKEN_MAP = {Ast::TypeVariable => TokenType::TypeParameter, Ast::Variable => TokenType::Variable, Ast::Comment => TokenType::Comment, Ast::StringLiteral => TokenType::String, Ast::RegexpLiteral => TokenType::Regexp, Ast::NumberLiteral => TokenType::Number, Ast::TypeId => TokenType::Type}

This represents which token types are used for which node.

TOKEN_TYPES = TokenType.names.map!(&.camelcase(lower: true))

Class Method Summary

Instance Method Summary

Class Method Detail

def self.highlight(path : String, html : Bool = false) #

[View source]
def self.tokenize(ast : Ast) #

[View source]

Instance Method Detail

def add(from : Int32, to : Int32, type : TokenType) #

[View source]
def add(node : Ast::Node, type : TokenType) #

[View source]
def cache : Set(Mint::Ast::Node) #

We keep a cache of all tokenized nodes to avoid duplications


[View source]
def tokenize(ast : Ast) #

[View source]
def tokenize(nodes : Array(Ast::Node)) #

[View source]
def tokenize(node : Ast::CssDefinition) #

[View source]
def tokenize(node : Ast::ArrayAccess) #

[View source]
def tokenize(node : Ast::HtmlElement) #

[View source]
def tokenize(node : Ast::HtmlComponent) #

[View source]
def tokenize(node : Ast::Node | Nil) #

[View source]

This is where the resulting tokens are stored.


[View source]