class KotlinLexer

Defined in:

minilexers/kotlin.cr

Constant Summary

ANNOTATIONS = {"@field" => :FIELD, "@property" => :PROPERTY, "@get" => :GET, "@set" => :SET, "@receiver" => :RECEIVER, "@param" => :PARAM, "@setparam" => :SETPARAM, "@delegate" => :DELEGATE}
KEYWORDS = {"file" => :FILE, "package" => :PACKAGE, "import" => :IMPORT, "class" => :CLASS, "interface" => :INTERFACE, "fun" => :FUN, "object" => :OBJECT, "val" => :VAL, "var" => :VAR, "typealias" => :TYPE_ALIAS, "constructor" => :CONSTRUCTOR, "by" => :BY, "companion" => :COMPANION, "init" => :INIT, "this" => :THIS, "super" => :SUPER, "typeof" => :TYPEOF, "where" => :WHERE, "if" => :IF, "else" => :ELSE, "when" => :WHEN, "try" => :TRY, "catch" => :CATCH, "finally" => :FINALLY, "for" => :FOR, "do" => :DO, "while" => :WHILE, "throw" => :THROW, "return" => :RETURN, "continue" => :CONTINUE, "break" => :BREAK, "as" => :AS, "is" => :IS, "in" => :IN, "out" => :OUT, "public" => :PUBLIC, "private" => :PRIVATE, "protected" => :PROTECTED, "internal" => :INTERNAL, "enum" => :ENUM, "sealed" => :SEALED, "annotation" => :ANNOTATION, "data" => :DATA, "inner" => :INNER, "tailrec" => :TAILREC, "operator" => :OPERATOR, "inline" => :INLINE, "infix" => :INFIX, "external" => :EXTERNAL, "suspend" => :SUSPEND, "override" => :OVERRIDE, "abstract" => :ABSTRACT, "final" => :FINAL, "open" => :OPEN, "const" => :CONST, "lateinit" => :LATEINIT, "vararg" => :VARARG, "noinline" => :NOINLINE, "crossinline" => :CROSSINLINE, "reified" => :REIFIED}
OPERATORS = {'+' => :ADD, '-' => :SUB, '*' => :MULT, '/' => :DIV, '%' => :MOD, '=' => :ASSIGN, "==" => :EQUAL, "!=" => :NOTEQUAL, '>' => :RANGLE, '<' => :LANGLE, ">=" => :GE, "<=" => :LE, "&&" => :AND, "||" => :OR, '!' => :BANG, "++" => :INC, "--" => :DEC, "+=" => :ADD_ASSIGN, "-=" => :SUB_ASSIGN, "*=" => :MUL_ASSIGN, "/=" => :DIV_ASSIGN, "%=" => :MOD_ASSIGN, '&' => :BITAND, '|' => :BITOR, '^' => :CARET, '~' => :TILDE, "->" => :ARROW, "=>" => :DOUBLE_ARROW, "?:" => :ELVIS}
PUNCTUATION = {'.' => :DOT, ',' => :COMMA, '(' => :LPAREN, ')' => :RPAREN, '{' => :LCURL, '}' => :RCURL, '[' => :LSQUARE, ']' => :RSQUARE, ';' => :SEMI, ':' => :COLON, '?' => :QUESTION}

Constructors

Instance Method Summary

Instance methods inherited from class MiniLexer

<<(t : Tuple(Symbol, String))
<<(t : Tuple(Symbol, Char))
<<(t : Tuple(Symbol, Char | String))
<<
, find(token_type : Symbol) : Array(Token) find, line : Int line, mode : Symbol mode, mode=(mode : Symbol)
mode=(mode : Symbol)
mode=
, tokenize(input : String) : Array(Token) tokenize, tokenize_logic(input : String) : Array(Token) tokenize_logic, tokens : Array(Token) tokens, tokens=(tokens : Array(Token)) tokens=, trace trace

Constructor methods inherited from class MiniLexer

new new

Constructor Detail

def self.new #

[View source]

Instance Method Detail

def match_other #

[View source]
def tokenize(input : String) : Array(Token) #

[View source]
def tokenize_logic(input : String) : Array(Token) #

[View source]