class Mint::SemanticTokenizer

Defined in:

semantic_tokenizer.cr

Constant Summary

TOKEN_MAP = {Ast::TypeVariable => TokenType::TypeParameter, Ast::Comment => TokenType::Comment, Ast::RegexpLiteral => TokenType::Regexp, Ast::NumberLiteral => TokenType::Number, Ast::Id => TokenType::Type}

This represents which token types are used for which node.

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

This is used by the language server.

Class Method Summary

Instance Method Summary

Class Method Detail

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

Highlights the file.


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

Returns the tokenized version of the AST.


[View source]
def self.tokenize_with_lines(ast : Ast) : Array(Array(Item)) #

Returns the tokenized version of the AST where the lines contain their respective tokens.


[View source]

Instance Method Detail

def add(from : Parser::Location, to : Parser::Location, 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(nodes : Array(Ast::Node)) #

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

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

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

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

[View source]
def tokenize(node : Ast::StringLiteral | Ast::HereDocument) #

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

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

[View source]

This is where the resulting tokens are stored.


[View source]