From 5ee86a080221db05e1dc12c361959e7d2fc5366b Mon Sep 17 00:00:00 2001 From: Marius Date: Tue, 29 Nov 2011 20:00:15 +0200 Subject: beta 2011.11.29 18:47 --- context/data/scite/lexers/scite-context-lexer-lua.lua | 11 ++++++++++- context/data/scite/lexers/scite-context-lexer-tex.lua | 8 +++++--- context/data/scite/lexers/scite-context-lexer.lua | 6 ++---- context/data/scite/lexers/themes/scite-context-theme.lua | 1 + 4 files changed, 18 insertions(+), 8 deletions(-) (limited to 'context/data/scite') diff --git a/context/data/scite/lexers/scite-context-lexer-lua.lua b/context/data/scite/lexers/scite-context-lexer-lua.lua index bb1a6c1d9..278c6d72f 100644 --- a/context/data/scite/lexers/scite-context-lexer-lua.lua +++ b/context/data/scite/lexers/scite-context-lexer-lua.lua @@ -24,7 +24,7 @@ _directives = { } -- communication channel -- this will be eextended local keywords = { - 'and', 'break', 'do', 'else', 'elseif', 'end', 'false', 'for', 'function', + 'and', 'break', 'do', 'else', 'elseif', 'end', 'false', 'for', 'function', -- 'goto', 'if', 'in', 'local', 'nil', 'not', 'or', 'repeat', 'return', 'then', 'true', 'until', 'while', } @@ -144,6 +144,13 @@ local operator = token("special", P('..') + P('~=') + S('+-*/%^#=<>;:,.{}[] local optionalspace = spacing^0 local hasargument = #S("{(") +local gotokeyword = token("keyword", P("goto")) + * spacing + * token("grouping",validword) +local gotolabel = token("keyword", P("::")) + * token("grouping",validword) + * token("keyword", P("::")) + local keyword = token("keyword", exact_match(keywords )) local builtin = token("plain", exact_match(functions)) local constant = token("data", exact_match(constants)) @@ -159,12 +166,14 @@ _rules = { { 'function', builtin }, { 'csname', csname }, { 'constant', constant }, + { 'goto', gotokeyword }, { 'identifier', identifier }, { 'string', string }, { 'number', number }, { 'longcomment', longcomment }, { 'shortcomment', shortcomment }, -- { 'number', number }, + { 'label', gotolabel }, { 'operator', operator }, { 'rest', rest }, } diff --git a/context/data/scite/lexers/scite-context-lexer-tex.lua b/context/data/scite/lexers/scite-context-lexer-tex.lua index 4fdf80869..850704b20 100644 --- a/context/data/scite/lexers/scite-context-lexer-tex.lua +++ b/context/data/scite/lexers/scite-context-lexer-tex.lua @@ -86,9 +86,11 @@ do -- todo: only once, store in global if definitions then local function add(data) for k, v in next, data do - primitives[#primitives+1] = v - if normal then - primitives[#primitives+1] = "normal" .. v + if v ~= "/" then + primitives[#primitives+1] = v + if normal then + primitives[#primitives+1] = "normal" .. v + end end end end diff --git a/context/data/scite/lexers/scite-context-lexer.lua b/context/data/scite/lexers/scite-context-lexer.lua index f1c9bc9bd..d9d5782fb 100644 --- a/context/data/scite/lexers/scite-context-lexer.lua +++ b/context/data/scite/lexers/scite-context-lexer.lua @@ -132,8 +132,6 @@ function context.word_match(words,word_chars,case_insensitive) end end --- nicer (todo: utf): - local idtoken = R("az","AZ","\127\255","__") local digit = R("09") local sign = S("+-") @@ -185,7 +183,7 @@ function context.exact_match(words,word_chars,case_insensitive) list[lower(words[i])] = true end return Cmt(pattern^1, function(_,i,s) - return list[lower(s)] -- and i + return list[lower(s)] -- and i or nil end) else local list = { } @@ -193,7 +191,7 @@ function context.exact_match(words,word_chars,case_insensitive) list[words[i]] = true end return Cmt(pattern^1, function(_,i,s) - return list[s] -- and i + return list[s] -- and i or nil end) end end diff --git a/context/data/scite/lexers/themes/scite-context-theme.lua b/context/data/scite/lexers/themes/scite-context-theme.lua index ce959e721..5840d47ff 100644 --- a/context/data/scite/lexers/themes/scite-context-theme.lua +++ b/context/data/scite/lexers/themes/scite-context-theme.lua @@ -111,6 +111,7 @@ lexer.context.styles = { ["preamble"] = style_comment, ["embedded"] = style { fore = colors.black, bold = true }, ["grouping"] = style { fore = colors.red }, + ["label"] = style { fore = colors.red, bold = true }, ["primitive"] = style_keyword, ["plain"] = style { fore = colors.dark, bold = true }, ["user"] = style { fore = colors.green }, -- cgit v1.2.3