diff options
author | Marius <mariausol@gmail.com> | 2011-10-03 15:00:13 +0300 |
---|---|---|
committer | Marius <mariausol@gmail.com> | 2011-10-03 15:00:13 +0300 |
commit | 070e1ac9465175c8b3674540c243882a3b3900b5 (patch) | |
tree | 076c007973da2d5589d56d5eb439858be972597a /context/data/scite/lexers/scite-context-lexer-lua.lua | |
parent | dac8b3d4c89eab191488cf107ada8c16570579cf (diff) | |
download | context-070e1ac9465175c8b3674540c243882a3b3900b5.tar.gz |
beta 2011.10.03 12:59
Diffstat (limited to 'context/data/scite/lexers/scite-context-lexer-lua.lua')
-rw-r--r-- | context/data/scite/lexers/scite-context-lexer-lua.lua | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/context/data/scite/lexers/scite-context-lexer-lua.lua b/context/data/scite/lexers/scite-context-lexer-lua.lua index 1b55be55f..e10f49ff3 100644 --- a/context/data/scite/lexers/scite-context-lexer-lua.lua +++ b/context/data/scite/lexers/scite-context-lexer-lua.lua @@ -16,7 +16,7 @@ local global = _G module(...) -local cldlexer = _M +local lualexer = _M _directives = { } -- communication channel @@ -83,7 +83,7 @@ local longcomment = Cmt(#('[[' + ('[' * C(P('=')^0) * '[')), function(input,ind return stop and stop + 1 or #input + 1 end) -local whitespace = cldlexer.WHITESPACE -- triggers states +local whitespace = lualexer.WHITESPACE -- triggers states local space = lexer.space -- S(" \n\r\t\f\v") local any = lexer.any @@ -147,9 +147,10 @@ _rules = { { 'constant', constant }, { 'identifier', identifier }, { 'string', string }, + { 'number', number }, { 'longcomment', longcomment }, { 'shortcomment', shortcomment }, - { 'number', number }, +-- { 'number', number }, { 'operator', operator }, { 'rest', rest }, } @@ -159,9 +160,10 @@ _tokenstyles = lexer.context.styleset _foldsymbols = { _patterns = { '%l+', - '[%({%)}%[%]]', + -- '[%({%)}%[%]]', + '[{}%[%]]', }, - ['keyword'] = { + ['keyword'] = { -- challenge: if=0 then=1 else=-1 elseif=-1 ['if'] = 1, ['end'] = -1, ['do'] = 1, @@ -176,7 +178,7 @@ _foldsymbols = { ['['] = 1, [']'] = -1, }, ['special'] = { - ['('] = 1, [')'] = -1, + -- ['('] = 1, [')'] = -1, ['{'] = 1, ['}'] = -1, }, } @@ -184,7 +186,7 @@ _foldsymbols = { -- embedded in tex: local cstoken = R("az","AZ","\127\255") + S("@!?_") -local csnametex = P("\\") * cstoken^1 +local texcsname = P("\\") * cstoken^1 local commentline = P('%') * (1-S("\n\r"))^0 local texcomment = token('comment', Cmt(commentline, function() return _directives.cld_inline end)) @@ -197,8 +199,9 @@ local texstring = token("quote", longthreestart) * token("string", longthreestring) * token("quote", longthreestop) --- local texcommand = token("user", csnametex) --- +-- local texcommand = token("user", texcsname) +local texcommand = token("warning", texcsname) + -- local texstring = token("quote", longthreestart) -- * (texcommand + token("string",P(1-texcommand-longthreestop)^1) - longthreestop)^0 -- we match long non-\cs sequences -- * token("quote", longthreestop) @@ -207,6 +210,7 @@ _rules_cld = { { 'whitespace', spacing }, { 'texstring', texstring }, { 'texcomment', texcomment }, + { 'texcommand', texcommand }, { 'keyword', keyword }, { 'function', builtin }, { 'csname', csname }, |