TokenKind
enumin packageklyn.code
public enum TokenKind
TokenKind

Classifies lexical tokens produced by Klyn code tokenizers.

TokenKind provides a rendering-independent vocabulary shared by syntax highlighters (terminal ANSI, GUI canvas, HTML documentation), source-code navigation tools, refactoring services, and code metrics scanners.

import klyn.code

kind = TokenKind.KEYWORD
assert kind.isKeywordLike()
assert not kind.isTrivia()
Methods
Modifier and Type Member Description
public isComment
isComment() as Boolean
Returns true when this token represents a line, block, or documentation comment.
public isIdentifierLike
isIdentifierLike() as Boolean
Returns true when this token represents a symbolic identifier (variable, type, declaration name, function call, property name, or built-in symbol).
public isKeywordLike
isKeywordLike() as Boolean
Returns true when this token is a language keyword, contextual query keyword, built-in type, or language constant.
public isLiteral
isLiteral() as Boolean
Returns true when this token belongs to a string, character, regex, numeric, or constant literal.
public isStringOrChar
isStringOrChar() as Boolean
Returns true when this token belongs to a string, character, escape, interpolation delimiter, or regular expression literal.
public isTrivia
isTrivia() as Boolean
Returns true when this token represents non-code trivia (whitespace or comments).