summaryrefslogtreecommitdiff
path: root/context/data/scite/lexers/scite-context-lexer-lua.lua
diff options
context:
space:
mode:
authorMarius <mariausol@gmail.com>2012-04-20 00:40:13 +0300
committerMarius <mariausol@gmail.com>2012-04-20 00:40:13 +0300
commit959400a677b3eb6ff6513a750be6dde943e62c36 (patch)
tree91e6f0884f2b018acd879276f1c976440b7c835b /context/data/scite/lexers/scite-context-lexer-lua.lua
parent0756a263c41de5279fef717c5b9cca9909308c3a (diff)
downloadcontext-959400a677b3eb6ff6513a750be6dde943e62c36.tar.gz
beta 2012.04.19 23:18
Diffstat (limited to 'context/data/scite/lexers/scite-context-lexer-lua.lua')
-rw-r--r--context/data/scite/lexers/scite-context-lexer-lua.lua20
1 files changed, 15 insertions, 5 deletions
diff --git a/context/data/scite/lexers/scite-context-lexer-lua.lua b/context/data/scite/lexers/scite-context-lexer-lua.lua
index 473e45bb2..4f48fb2a5 100644
--- a/context/data/scite/lexers/scite-context-lexer-lua.lua
+++ b/context/data/scite/lexers/scite-context-lexer-lua.lua
@@ -15,9 +15,11 @@ local match, find = string.match, string.find
local setmetatable = setmetatable
-- beware: all multiline is messy, so even if it's no lexer, it should be an embedded lexer
+-- we probably could use a local whitespace variant but this is cleaner
-local lualexer = { _NAME = "lua" }
+local lualexer = { _NAME = "lua", _FILENAME = "scite-context-lexer-lua" }
local whitespace = lexer.WHITESPACE
+local context = lexer.context
local stringlexer = lexer.load("scite-context-lexer-lua-longstring")
@@ -129,7 +131,7 @@ local string = shortstring
lexer.embed_lexer(lualexer, stringlexer, token("quote",longtwostart), token("string",longtwostring_body) * token("quote",longtwostring_end))
-local integer = P('-')^-1 * (lexer.hex_num + lexer.dec_num)
+local integer = P("-")^-1 * (lexer.hex_num + lexer.dec_num)
local number = token("number", lexer.float + integer)
-- officially 127-255 are ok but not utf so useless
@@ -138,7 +140,11 @@ local validword = R("AZ","az","__") * R("AZ","az","__","09")^0
local identifier = token("default",validword)
-local operator = token("special", P('..') + P('~=') + S('+-*/%^#=<>;:,.{}[]()')) -- maybe split off {}[]()
+----- operator = token("special", P('..') + P('~=') + S('+-*/%^#=<>;:,.{}[]()')) -- maybe split off {}[]()
+----- operator = token("special", S('+-*/%^#=<>;:,{}[]()') + P('..') + P('.') + P('~=') ) -- maybe split off {}[]()
+local operator = token("special", S('+-*/%^#=<>;:,{}[]().') + P('~=') )
+
+local structure = token("special", S('{}[]()'))
local optionalspace = spacing^0
local hasargument = #S("{(")
@@ -162,6 +168,7 @@ local csname = token("user", exact_match(csnames ))
lualexer._rules = {
{ 'whitespace', spacing },
{ 'keyword', keyword },
+ -- { 'structure', structure },
{ 'function', builtin },
{ 'csname', csname },
{ 'constant', constant },
@@ -177,11 +184,13 @@ lualexer._rules = {
{ 'rest', rest },
}
-lualexer._tokenstyles = lexer.context.styleset
+lualexer._tokenstyles = context.styleset
lualexer._foldsymbols = {
_patterns = {
- '%l+',
+ -- '%l+', -- costly
+ -- '%l%l+',
+ '[a-z][a-z]+',
-- '[%({%)}%[%]]',
'[{}%[%]]',
},
@@ -238,6 +247,7 @@ lualexer._rules_cld = {
{ 'texstring', texstring },
{ 'texcomment', texcomment },
{ 'texcommand', texcommand },
+ -- { 'structure', structure },
{ 'keyword', keyword },
{ 'function', builtin },
{ 'csname', csname },