1
0
Fork 0
assert-gooder/lua_lang.lua

66 lines
2.2 KiB
Lua

local Lexer = assert(require((... and select('1', ...):match('.+%.') or '')..'Lexer'), '[assert-gooder]: Could not load vital library: Lexer')
return Lexer {
{ 'and', 'AND' },
{ 'break', 'BREAK' },
{ 'do', 'DO' },
{ 'else', 'ELSE' },
{ 'elseif', 'ELSEIF' },
{ 'end', 'END' },
{ 'for', 'FOR' },
{ 'function', 'FUNCTION' },
{ 'if', 'IF' },
{ 'in', 'IN' },
{ 'local', 'LOCAL' },
{ 'not', 'NOT' },
{ 'or', 'OR' },
{ 'repeat', 'REPEAT' },
{ 'return', 'RETURN' },
{ 'then', 'THEN' },
{ 'until', 'UNTIL' },
{ 'while', 'WHILE' },
{ '%+', 'PLUS' },
{ '%-', 'MINUS' },
{ '%*', 'TIMES' },
{ '%/', 'DIVIDE' },
{ '%%', 'MODULO' },
{ '%^', 'CARET' },
{ '%#', 'HASHTAG' },
{ '%==', 'EQ' },
{ '%~=', 'NEQ' },
{ '%<=', 'LEQ' },
{ '%>=', 'GEQ' },
{ '%<', 'LE' },
{ '%>', 'GT' },
{ '%=', 'ASSIGN' },
{ '%(', 'LPAR' },
{ '%)', 'RPAR' },
{ '%{', 'LBRACE' },
{ '%}', 'RBRACE' },
{ '%;', 'SEMICOLON' },
{ '%,', 'COMMA' },
{ '%.%.', 'CONCAT' },
{ '%.%.%.', 'VARARG' },
--
{ 'false', 'FALSE' },
{ 'true', 'TRUE' },
{ 'nil', 'NIL' },
{ '%[', 'LBRACK' },
{ '%]', 'RBRACK' },
{ '%:', 'COLON' },
{ '%.', 'DOT' },
--
{ '%d+%.?%d*', 'NUMBER' },
{ '%d*%.?%d+', 'NUMBER' },
{ '[_a-zA-Z\128-\255][_a-zA-Z0-9\128-\255]*', 'IDENTIFIER' },
{ '\".-\"', 'STRING' },
{ '\'.-\'', 'STRING' },
{ '%[%[.-%]%]', 'STRING' },
{ '%-%-.-\n', Lexer.CONTINUE },
{ '%-%-%[%[.-%]%]', Lexer.CONTINUE },
{ '%s+', Lexer.CONTINUE },
}