Scintillua: Update lexer for Lua 5.2

This commit is contained in:
Robert Gieseke 2013-02-02 20:09:43 +01:00
parent 5ec921484b
commit 72ceaae73b

View File

@ -3,9 +3,9 @@
local l = lexer local l = lexer
local token, word_match = l.token, l.word_match local token, word_match = l.token, l.word_match
local P, S, R = l.lpeg.P, l.lpeg.S, l.lpeg.R local P, S, R = lpeg.P, lpeg.S, lpeg.R
module(...) local M = { _NAME = 'moonscript' }
-- Whitespace. -- Whitespace.
local ws = token(l.WHITESPACE, l.space^1) local ws = token(l.WHITESPACE, l.space^1)
@ -41,7 +41,7 @@ local keyword = token(l.KEYWORD, word_match {
'using', 'switch', 'when', 'using', 'switch', 'when',
}) })
local special = token("special", word_match { "true", "false", "nil" }) local special = token("special", word_match { "true", "false", "nil" })
-- Functions. -- Functions.
local builtin = token(l.FUNCTION, word_match({ local builtin = token(l.FUNCTION, word_match({
@ -92,7 +92,7 @@ local proper_ident = token("proper_ident", R("AZ") * l.word)
local tbl_key = token("tbl_key", l.word * ":" + ":" * l.word ) local tbl_key = token("tbl_key", l.word * ":" + ":" * l.word )
_rules = { M._rules = {
{ 'whitespace', ws }, { 'whitespace', ws },
{ 'error', err }, { 'error', err },
{ 'self', self_var }, { 'self', self_var },
@ -112,7 +112,7 @@ _rules = {
local style_special = { fore = l.colors.light_blue } local style_special = { fore = l.colors.light_blue }
local style_fndef = { fore = l.colors.green } local style_fndef = { fore = l.colors.green }
_tokenstyles = { M._tokenstyles = {
{ 'self_ref', style_special }, { 'self_ref', style_special },
{ 'proper_ident', l.style_class }, { 'proper_ident', l.style_class },
{ 'fndef', style_fndef }, { 'fndef', style_fndef },
@ -120,3 +120,5 @@ _tokenstyles = {
{ 'special', style_special }, { 'special', style_special },
{ 'tbl_key', { fore = l.colors.red } }, { 'tbl_key', { fore = l.colors.red } },
} }
return M