diff options
Diffstat (limited to 'context/data')
-rw-r--r-- | context/data/scite/lexers/data/scite-context-data-context.lua | 4 | ||||
-rw-r--r-- | context/data/scite/lexers/scite-context-lexer-cld.lua | 162 | ||||
-rw-r--r-- | context/data/scite/lexers/scite-context-lexer-lua.lua | 219 | ||||
-rw-r--r-- | context/data/scite/lexers/scite-context-lexer-tex.lua | 197 | ||||
-rw-r--r-- | context/data/scite/metapost.properties | 2 | ||||
-rw-r--r-- | context/data/scite/scite-context-data-context.properties | 66 | ||||
-rw-r--r-- | context/data/scite/scite-context-external.properties | 14 | ||||
-rw-r--r-- | context/data/scite/scite-context-internal.properties | 10 | ||||
-rw-r--r-- | context/data/scite/scite-context-readme.tex | 50 | ||||
-rw-r--r-- | context/data/scite/scite-context.properties | 215 | ||||
-rw-r--r-- | context/data/scite/tex.properties | 2 |
11 files changed, 638 insertions, 303 deletions
diff --git a/context/data/scite/lexers/data/scite-context-data-context.lua b/context/data/scite/lexers/data/scite-context-data-context.lua index ba7500e01..4142d2a29 100644 --- a/context/data/scite/lexers/data/scite-context-data-context.lua +++ b/context/data/scite/lexers/data/scite-context-data-context.lua @@ -1,4 +1,4 @@ return { - ["constants"]={ "zerocount", "minusone", "minustwo", "plusone", "plustwo", "plusthree", "plusfour", "plusfive", "plussix", "plusseven", "pluseight", "plusnine", "plusten", "plussixteen", "plushundred", "plusthousand", "plustenthousand", "plustwentythousand", "medcard", "maxcard", "zeropoint", "onepoint", "onebasepoint", "maxdimen", "scaledpoint", "thousandpoint", "points", "zeroskip", "pluscxxvii", "pluscxxviii", "pluscclv", "pluscclvi", "endoflinetoken", "outputnewlinechar", "emptytoks", "empty", "undefined", "voidbox", "emptybox", "emptyvbox", "emptyhbox", "bigskipamount", "medskipamount", "smallskipamount", "fmtname", "fmtversion", "texengine", "texenginename", "texengineversion", "luatexengine", "pdftexengine", "xetexengine", "unknownengine", "etexversion", "pdftexversion", "xetexversion", "xetexrevision", "activecatcode", "bgroup", "egroup", "endline", "attributeunsetvalue", "uprotationangle", "rightrotatioangle", "downrotatioangle", "leftrotatioangle" }, - ["helpers"]={ "newcount", "newdimen", "newskip", "newmuskip", "newbox", "newtoks", "newread", "newwrite", "newmarks", "newinsert", "newattribute", "newif", "newlanguage", "newfamily", "newfam", "newhelp", "htdp", "unvoidbox", "scratchcounter", "globalscratchcounter", "scratchdimen", "globalscratchdimen", "scratchskip", "globalscratchskip", "scratchmuskip", "globalscratchmuskip", "scratchtoks", "globalscratchtoks", "scratchbox", "globalscratchbox", "scratchwidth", "scratchheight", "scratchdepth", "scratchcounterone", "scratchcountertwo", "scratchcounterthree", "scratchdimenone", "scratchdimentwo", "scratchdimenthree", "scratchskipone", "scratchskiptwo", "scratchskipthree", "scratchmuskipone", "scratchmuskiptwo", "scratchmuskipthree", "scratchtoksone", "scratchtokstwo", "scratchtoksthree", "scratchboxone", "scratchboxtwo", "scratchboxthree", "doif", "doifnot", "doifelse", "doifinset", "doifnotinset", "doifinsetelse", "doifnextcharelse", "doifnextoptionalelse", "doifnextparenthesiselse", "doiffastoptionalcheckelse", "doifundefinedelse", "doifdefinedelse", "doifundefined", "doifdefined", "doifelsevalue", "doifvalue", "doifnotvalue", "doifnothing", "doifsomething", "doifelsenothing", "doifsomethingelse", "doifvaluenothing", "doifvaluesomething", "doifelsevaluenothing", "doifdimensionelse", "doifnumberelse", "doifcommonelse", "doifcommon", "doifnotcommon", "doifinstring", "doifnotinstring", "doifinstringelse", "tracingall", "tracingnone", "loggingall", "appendtoks", "prependtoks", "appendtotoks", "prependtotoks", "endgraf", "empty", "null", "space", "obeyspaces", "obeylines", "normalspace", "executeifdefined", "singleexpandafter", "doubleexpandafter", "tripleexpandafter", "dontleavehmode", "wait", "writestatus", "define", "redefine", "setmeasure", "setemeasure", "setgmeasure", "setxmeasure", "definemeasure", "measure", "getvalue", "setvalue", "setevalue", "setgvalue", "setxvalue", "letvalue", "letgvalue", "resetvalue", "undefinevalue", "ignorevalue", "setuvalue", "setuevalue", "setugvalue", "setuxvalue", "globallet", "glet", "getparameters", "geteparameters", "getgparameters", "getxparameters", "forgetparameters", "processcommalist", "processcommacommand", "quitcommalist", "quitprevcommalist", "processaction", "processallactions", "processfirstactioninset", "processallactionsinset", "startsetups", "stopsetups", "startxmlsetups", "stopxmlsetups", "starttexdefinition", "stoptexdefinition", "starttexcode", "stoptexcode", "unexpanded", "expanded", "startexpanded", "stopexpanded", "protected", "protect", "unprotect", "firstofoneargument", "firstoftwoarguments", "secondoftwoarguments", "firstofthreearguments", "secondofthreearguments", "thirdofthreearguments", "firstoffourarguments", "secondoffourarguments", "thirdoffourarguments", "fourthoffourarguments", "firstoffivearguments", "secondoffivearguments", "thirdoffivearguments", "fourthoffivearguments", "fifthoffivearguments", "firstofsixarguments", "secondofsixarguments", "thirdofsixarguments", "fourthofsixarguments", "fifthofsixarguments", "sixthofsixarguments", "gobbleoneargument", "gobbletwoarguments", "gobblethreearguments", "gobblefourarguments", "gobblefivearguments", "gobblesixarguments", "gobblesevenarguments", "gobbleeightarguments", "gobbleninearguments", "gobbletenarguments", "gobbleoneoptional", "gobbletwooptionals", "gobblethreeoptionals", "gobblefouroptionals", "gobblefiveoptionals", "dorecurse", "doloop", "exitloop", "dostepwiserecurse", "recurselevel", "recursedepth", "newconstant", "setnewconstant", "newconditional", "settrue", "setfalse", "dosingleempty", "dodoubleempty", "dotripleempty", "doquadrupleempty", "doquintupleempty", "dosixtupleempty", "doseventupleempty", "dosinglegroupempty", "dodoublegroupempty", "dotriplegroupempty", "doquadruplegroupempty", "doquintuplegroupempty", "nopdfcompression", "maximumpdfcompression", "normalpdfcompression", "modulonumber", "dividenumber", "getfirstcharacter", "doiffirstcharelse" }, + ["constants"]={ "zerocount", "minusone", "minustwo", "plusone", "plustwo", "plusthree", "plusfour", "plusfive", "plussix", "plusseven", "pluseight", "plusnine", "plusten", "plussixteen", "plushundred", "plusthousand", "plustenthousand", "plustwentythousand", "medcard", "maxcard", "zeropoint", "onepoint", "onebasepoint", "maxdimen", "scaledpoint", "thousandpoint", "points", "zeroskip", "pluscxxvii", "pluscxxviii", "pluscclv", "pluscclvi", "endoflinetoken", "outputnewlinechar", "emptytoks", "empty", "undefined", "voidbox", "emptybox", "emptyvbox", "emptyhbox", "bigskipamount", "medskipamount", "smallskipamount", "fmtname", "fmtversion", "texengine", "texenginename", "texengineversion", "luatexengine", "pdftexengine", "xetexengine", "unknownengine", "etexversion", "pdftexversion", "xetexversion", "xetexrevision", "activecatcode", "bgroup", "egroup", "endline", "attributeunsetvalue", "uprotationangle", "rightrotatioangle", "downrotatioangle", "leftrotatioangle", "startmode", "stopmode", "startnotmode", "stopnotmode", "doifmode", "doifmodeelse", "doifnotmode", "startenvironment", "stopenvironment", "environment", "startcomponent", "stopcomponent", "component", "startproduct", "stopproduct", "product", "startproject", "stopproject", "project", "starttext", "stoptext" }, + ["helpers"]={ "startsetups", "stopsetups", "startxmlsetups", "stopxmlsetups", "starttexdefinition", "stoptexdefinition", "starttexcode", "stoptexcode", "newcount", "newdimen", "newskip", "newmuskip", "newbox", "newtoks", "newread", "newwrite", "newmarks", "newinsert", "newattribute", "newif", "newlanguage", "newfamily", "newfam", "newhelp", "htdp", "unvoidbox", "scratchcounter", "globalscratchcounter", "scratchdimen", "globalscratchdimen", "scratchskip", "globalscratchskip", "scratchmuskip", "globalscratchmuskip", "scratchtoks", "globalscratchtoks", "scratchbox", "globalscratchbox", "scratchwidth", "scratchheight", "scratchdepth", "scratchcounterone", "scratchcountertwo", "scratchcounterthree", "scratchdimenone", "scratchdimentwo", "scratchdimenthree", "scratchskipone", "scratchskiptwo", "scratchskipthree", "scratchmuskipone", "scratchmuskiptwo", "scratchmuskipthree", "scratchtoksone", "scratchtokstwo", "scratchtoksthree", "scratchboxone", "scratchboxtwo", "scratchboxthree", "doif", "doifnot", "doifelse", "doifinset", "doifnotinset", "doifinsetelse", "doifnextcharelse", "doifnextoptionalelse", "doifnextparenthesiselse", "doiffastoptionalcheckelse", "doifundefinedelse", "doifdefinedelse", "doifundefined", "doifdefined", "doifelsevalue", "doifvalue", "doifnotvalue", "doifnothing", "doifsomething", "doifelsenothing", "doifsomethingelse", "doifvaluenothing", "doifvaluesomething", "doifelsevaluenothing", "doifdimensionelse", "doifnumberelse", "doifcommonelse", "doifcommon", "doifnotcommon", "doifinstring", "doifnotinstring", "doifinstringelse", "tracingall", "tracingnone", "loggingall", "appendtoks", "prependtoks", "appendtotoks", "prependtotoks", "endgraf", "empty", "null", "space", "obeyspaces", "obeylines", "normalspace", "executeifdefined", "singleexpandafter", "doubleexpandafter", "tripleexpandafter", "dontleavehmode", "wait", "writestatus", "define", "redefine", "setmeasure", "setemeasure", "setgmeasure", "setxmeasure", "definemeasure", "measure", "getvalue", "setvalue", "setevalue", "setgvalue", "setxvalue", "letvalue", "letgvalue", "resetvalue", "undefinevalue", "ignorevalue", "setuvalue", "setuevalue", "setugvalue", "setuxvalue", "globallet", "glet", "getparameters", "geteparameters", "getgparameters", "getxparameters", "forgetparameters", "processcommalist", "processcommacommand", "quitcommalist", "quitprevcommalist", "processaction", "processallactions", "processfirstactioninset", "processallactionsinset", "unexpanded", "expanded", "startexpanded", "stopexpanded", "protected", "protect", "unprotect", "firstofoneargument", "firstoftwoarguments", "secondoftwoarguments", "firstofthreearguments", "secondofthreearguments", "thirdofthreearguments", "firstoffourarguments", "secondoffourarguments", "thirdoffourarguments", "fourthoffourarguments", "firstoffivearguments", "secondoffivearguments", "thirdoffivearguments", "fourthoffivearguments", "fifthoffivearguments", "firstofsixarguments", "secondofsixarguments", "thirdofsixarguments", "fourthofsixarguments", "fifthofsixarguments", "sixthofsixarguments", "gobbleoneargument", "gobbletwoarguments", "gobblethreearguments", "gobblefourarguments", "gobblefivearguments", "gobblesixarguments", "gobblesevenarguments", "gobbleeightarguments", "gobbleninearguments", "gobbletenarguments", "gobbleoneoptional", "gobbletwooptionals", "gobblethreeoptionals", "gobblefouroptionals", "gobblefiveoptionals", "dorecurse", "doloop", "exitloop", "dostepwiserecurse", "recurselevel", "recursedepth", "newconstant", "setnewconstant", "newconditional", "settrue", "setfalse", "dosingleempty", "dodoubleempty", "dotripleempty", "doquadrupleempty", "doquintupleempty", "dosixtupleempty", "doseventupleempty", "dosinglegroupempty", "dodoublegroupempty", "dotriplegroupempty", "doquadruplegroupempty", "doquintuplegroupempty", "nopdfcompression", "maximumpdfcompression", "normalpdfcompression", "modulonumber", "dividenumber", "getfirstcharacter", "doiffirstcharelse" }, }
\ No newline at end of file diff --git a/context/data/scite/lexers/scite-context-lexer-cld.lua b/context/data/scite/lexers/scite-context-lexer-cld.lua index 1abc55f91..632a7672c 100644 --- a/context/data/scite/lexers/scite-context-lexer-cld.lua +++ b/context/data/scite/lexers/scite-context-lexer-cld.lua @@ -6,166 +6,14 @@ local info = { license = "see context related readme files", } --- Adapted from lua.lua by Mitchell who based it on a lexer by Peter Odding. - local lexer = lexer -local token, style, colors, exact_match, no_style = lexer.token, lexer.style, lexer.colors, lexer.exact_match, lexer.style_nothing -local P, R, S, C, Cg, Cb, Cs, Cmt = lpeg.P, lpeg.R, lpeg.S, lpeg.C, lpeg.Cg, lpeg.Cb, lpeg.Cs, lpeg.Cmt -local match, find = string.match, string.find -local global = _G module(...) -local cldlexer = _M - -local keywords = { - 'and', 'break', 'do', 'else', 'elseif', 'end', 'false', 'for', 'function', - 'if', 'in', 'local', 'nil', 'not', 'or', 'repeat', 'return', 'then', 'true', - 'until', 'while', -} - -local functions = { - 'assert', 'collectgarbage', 'dofile', 'error', 'getfenv', 'getmetatable', - 'ipairs', 'load', 'loadfile', 'loadstring', 'module', 'next', 'pairs', - 'pcall', 'print', 'rawequal', 'rawget', 'rawset', 'require', 'setfenv', - 'setmetatable', 'tonumber', 'tostring', 'type', 'unpack', 'xpcall', -} - -local constants = { - '_G', '_VERSION', -} - -local csnames = { - "context", - "metafun", -} - -local level = nil -local setlevel = function(_,i,s) level = s return i end - -local equals = P("=")^0 - -local longonestart = P("[[") -local longonestop = P("]]") -local longonestring = (1-longonestop)^0 - -local longtwostart = P('[') * Cmt(equals,setlevel) * P('[') -local longtwostop = P(']') * equals * P(']') - -local longtwostring = P(function(input,index) - if level then - local sentinel = ']' .. level .. ']' - local _, stop = find(input,sentinel,index,true) - return stop and stop + 1 - #sentinel or #input + 1 - end -end) - --- local longtwostart = P("[") * Cg(equals, "init") * P("[") --- local longtwostop = P("]") * C(equals) * P("]") --- local longtwocheck = Cmt(longtwostop * Cb("init"), function(s,i,a,b) return a == b end) --- local longtwostring = (P(1) - longtwocheck)^0 - -local longcomment = Cmt(#('[[' + ('[' * P('=')^0 * '[')), function(input,index) - local level = match(input,'^%[(=*)%[',index) - level = "==" - if level then - local _, stop = find(input,']' .. level .. ']',index,true) - return stop and stop + 1 or #input + 1 - end -end) +local cldlexer = lexer.load('scite-context-lexer-lua') -local longcomment = Cmt(#('[[' + ('[' * C(P('=')^0) * '[')), function(input,index,level) - local _, stop = find(input,']' .. level .. ']',index,true) - return stop and stop + 1 or #input + 1 -end) +_rules = cldlexer._rules_cld +_tokenstyles = cldlexer._tokenstyles +_foldsymbols = cldlexer._foldsymbols -local whitespace = cldlexer.WHITESPACE -- triggers states - -local space = lexer.space -- S(" \n\r\t\f\v") -local any = lexer.any - -local squote = P("'") -local dquote = P('"') -local escaped = P("\\") * P(1) -local dashes = P('--') - -local spacing = token(whitespace, space^1) -local rest = token("default", any) - -local shortcomment = dashes * lexer.nonnewline^0 -local longcomment = dashes * longcomment -local comment = token("comment", longcomment + shortcomment) - -local shortstring = token("quote", squote) - * token("string", (escaped + (1-squote))^0 ) - * token("quote", squote) - + token("quote", dquote) - * token("string", (escaped + (1-dquote))^0 ) - * token("quote", dquote) - -local longstring = token("quote", longonestart) - * token("string", longonestring) - * token("quote", longonestop) - + token("quote", longtwostart) - * token("string", longtwostring) - * token("quote", longtwostop) - -local string = shortstring - + longstring - -local integer = P('-')^-1 * (lexer.hex_num + lexer.dec_num) -local number = token("number", lexer.float + integer) - -local word = R('AZ','az','__','\127\255') * (lexer.alnum + '_')^0 -local identifier = token("default", word) - -local operator = token("special", P('~=') + S('+-*/%^#=<>;:,.{}[]()')) -- maybe split of {}[]() - -local keyword = token("keyword", exact_match(keywords)) -local builtin = token("plain", exact_match(functions)) -local constant = token("data", exact_match(constants)) -local csname = token("user", exact_match(csnames)) * ( - spacing^0 * #S("{(") - + ( spacing^0 * token("special", P(".")) * spacing^0 * token("csname",word) )^1 - ) - -_rules = { - { 'whitespace', spacing }, - { 'keyword', keyword }, - { 'function', builtin }, - { 'csname', csname }, - { 'constant', constant }, - { 'identifier', identifier }, - { 'string', string }, - { 'comment', comment }, - { 'number', number }, - { 'operator', operator }, - { 'rest', rest }, -} - -_tokenstyles = lexer.context.styleset - -_foldsymbols = { - _patterns = { - '%l+', - '[%({%)}%[%]]', - }, - ['keyword'] = { - ['if'] = 1, - ['end'] = -1, - ['do'] = 1, - ['function'] = 1, - ['repeat'] = 1, - ['until'] = -1, - }, - ['comment'] = { - ['['] = 1, [']'] = -1, - }, - ['quote'] = { -- to be tested - ['['] = 1, [']'] = -1, - }, - ['special'] = { - ['('] = 1, [')'] = -1, - ['{'] = 1, ['}'] = -1, - }, -} +_directives = cldlexer._directives diff --git a/context/data/scite/lexers/scite-context-lexer-lua.lua b/context/data/scite/lexers/scite-context-lexer-lua.lua new file mode 100644 index 000000000..2a0f48026 --- /dev/null +++ b/context/data/scite/lexers/scite-context-lexer-lua.lua @@ -0,0 +1,219 @@ +local info = { + version = 1.002, + comment = "scintilla lpeg lexer for cld/lua", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files", +} + +-- Adapted from lua.lua by Mitchell who based it on a lexer by Peter Odding. + +local lexer = lexer +local token, style, colors, exact_match, no_style = lexer.token, lexer.style, lexer.colors, lexer.exact_match, lexer.style_nothing +local P, R, S, C, Cg, Cb, Cs, Cmt = lpeg.P, lpeg.R, lpeg.S, lpeg.C, lpeg.Cg, lpeg.Cb, lpeg.Cs, lpeg.Cmt +local match, find = string.match, string.find +local global = _G + +module(...) + +local cldlexer = _M + +_directives = { } -- communication channel + +local keywords = { + 'and', 'break', 'do', 'else', 'elseif', 'end', 'false', 'for', 'function', + 'if', 'in', 'local', 'nil', 'not', 'or', 'repeat', 'return', 'then', 'true', + 'until', 'while', +} + +local functions = { + 'assert', 'collectgarbage', 'dofile', 'error', 'getfenv', 'getmetatable', + 'ipairs', 'load', 'loadfile', 'loadstring', 'module', 'next', 'pairs', + 'pcall', 'print', 'rawequal', 'rawget', 'rawset', 'require', 'setfenv', + 'setmetatable', 'tonumber', 'tostring', 'type', 'unpack', 'xpcall', +} + +local constants = { + '_G', '_VERSION', '_M', +} + +local csnames = { -- todo: option + "context", + "metafun", +} + +local level = nil +local setlevel = function(_,i,s) level = s return i end + +local equals = P("=")^0 + +local longonestart = P("[[") +local longonestop = P("]]") +local longonestring = (1-longonestop)^0 + +local longtwostart = P('[') * Cmt(equals,setlevel) * P('[') +local longtwostop = P(']') * equals * P(']') + +local longtwostring = P(function(input,index) + if level then + local sentinel = ']' .. level .. ']' + local _, stop = find(input,sentinel,index,true) + return stop and stop + 1 - #sentinel or #input + 1 + end +end) + +-- local longtwostart = P("[") * Cg(equals, "init") * P("[") +-- local longtwostop = P("]") * C(equals) * P("]") +-- local longtwocheck = Cmt(longtwostop * Cb("init"), function(s,i,a,b) return a == b end) +-- local longtwostring = (P(1) - longtwocheck)^0 + +local longcomment = Cmt(#('[[' + ('[' * P('=')^0 * '[')), function(input,index) + local level = match(input,'^%[(=*)%[',index) + level = "==" + if level then + local _, stop = find(input,']' .. level .. ']',index,true) + return stop and stop + 1 or #input + 1 + end +end) + +local longcomment = Cmt(#('[[' + ('[' * C(P('=')^0) * '[')), function(input,index,level) + local _, stop = find(input,']' .. level .. ']',index,true) + return stop and stop + 1 or #input + 1 +end) + +local whitespace = cldlexer.WHITESPACE -- triggers states + +local space = lexer.space -- S(" \n\r\t\f\v") +local any = lexer.any + +local squote = P("'") +local dquote = P('"') +local escaped = P("\\") * P(1) +local dashes = P('--') + +local spacing = token(whitespace, space^1) +local rest = token("default", any) + +local shortcomment = token("comment", dashes * lexer.nonnewline^0) +local longcomment = token("comment", dashes * longcomment) + +local shortstring = token("quote", dquote) + * token("string", (escaped + (1-dquote))^0 ) + * token("quote", dquote) + + token("quote", squote) + * token("string", (escaped + (1-squote))^0 ) + * token("quote", squote) + +local longstring = token("quote", longonestart) + * token("string", longonestring) + * token("quote", longonestop) + + token("quote", longtwostart) + * token("string", longtwostring) + * token("quote", longtwostop) + +local string = shortstring + + longstring + +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 + +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 {}[]() + +local optionalspace = spacing^0 +local hasargument = #S("{(") + +local keyword = token("keyword", exact_match(keywords )) +local builtin = token("plain", exact_match(functions)) +local constant = token("data", exact_match(constants)) +local csname = token("user", exact_match(csnames )) + * ( + optionalspace * hasargument + + ( optionalspace * token("special", P(".")) * optionalspace * token("user", validword) )^1 + ) + +_rules = { + { 'whitespace', spacing }, + { 'keyword', keyword }, + { 'function', builtin }, + { 'csname', csname }, + { 'constant', constant }, + { 'identifier', identifier }, + { 'string', string }, + { 'longcomment', longcomment }, + { 'shortcomment', shortcomment }, + { 'number', number }, + { 'operator', operator }, + { 'rest', rest }, +} + +_tokenstyles = lexer.context.styleset + +_foldsymbols = { + _patterns = { + '%l+', + '[%({%)}%[%]]', + }, + ['keyword'] = { + ['if'] = 1, + ['end'] = -1, + ['do'] = 1, + ['function'] = 1, + ['repeat'] = 1, + ['until'] = -1, + }, + ['comment'] = { + ['['] = 1, [']'] = -1, + }, + ['quote'] = { -- to be tested + ['['] = 1, [']'] = -1, + }, + ['special'] = { + ['('] = 1, [')'] = -1, + ['{'] = 1, ['}'] = -1, + }, +} + +-- embedded in tex: + +local cstoken = R("az","AZ","\127\255") + S("@!?_") +local csnametex = P("\\") * cstoken^1 +local commentline = P('%') * (1-S("\n\r"))^0 + +local texcomment = token('comment', Cmt(commentline, function() return _directives.cld_inline end)) + +local longthreestart = P("\\!!bs") +local longthreestop = P("\\!!es") +local longthreestring = (1-longthreestop)^0 + +local texstring = token("quote", longthreestart) + * token("string", longthreestring) + * token("quote", longthreestop) + +-- local texcommand = token("user", csnametex) +-- +-- local texstring = token("quote", longthreestart) +-- * (texcommand + token("string",P(1-texcommand-longthreestop)^1) - longthreestop)^0 -- we match long non-\cs sequences +-- * token("quote", longthreestop) + +_rules_cld = { + { 'whitespace', spacing }, + { 'texstring', texstring }, + { 'texcomment', texcomment }, + { 'keyword', keyword }, + { 'function', builtin }, + { 'csname', csname }, + { 'constant', constant }, + { 'identifier', identifier }, + { 'string', string }, + { 'longcomment', longcomment }, + { 'shortcomment', shortcomment }, -- should not be used inline so best signal it as comment (otherwise complex state till end of inline) + { 'number', number }, + { '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 01000657b..dac3ada63 100644 --- a/context/data/scite/lexers/scite-context-lexer-tex.lua +++ b/context/data/scite/lexers/scite-context-lexer-tex.lua @@ -42,6 +42,8 @@ local find, match = string.find, string.match module(...) local contextlexer = _M +local cldlexer = lexer.load('scite-context-lexer-cld') +local mpslexer = lexer.load('scite-context-lexer-mps') local basepath = lexer.context and lexer.context.path or _LEXERHOME @@ -158,62 +160,172 @@ end) -- end -- end) +-- experiment: keep space with whatever ... less tables + +local commentline = P('%') * (1-S("\n\r"))^0 +local endline = S("\n\r")^1 + local whitespace = contextlexer.WHITESPACE -- triggers states local space = lexer.space -- S(" \n\r\t\f\v") local any = lexer.any -local spacing = token(whitespace, space^1) -local rest = token('default', any) -local preamble = token('preamble', knownpreamble) -local comment = token('comment', P('%') * (1-S("\n\r"))^0) -local command = token('command', P('\\') * knowncommand) -local constant = token('data', P('\\') * exact_match(constants)) -local helper = token('plain', P('\\') * exact_match(helpers)) -local primitive = token('primitive', P('\\') * exact_match(primitives)) -local ifprimitive = token('primitive', P('\\if') * cstoken^1) -local csname = token('user', P('\\') * (cstoken^1 + P(1))) -local grouping = token('grouping', S("{$}")) -- maybe also \bgroup \egroup \begingroup \endgroup -local special = token('special', S("#()[]<>=\"")) -local extra = token('extra', S("`~%^&_-+/\'|")) - -local text = token('default', cstoken^1 ) +local p_spacing = space^1 +local p_rest = any + +local p_preamble = knownpreamble +local p_comment = commentline +local p_command = P('\\') * knowncommand +local p_constant = P('\\') * exact_match(constants) +local p_helper = P('\\') * exact_match(helpers) +local p_primitive = P('\\') * exact_match(primitives) +local p_ifprimitive = P('\\if') * cstoken^1 +local p_csname = P('\\') * (cstoken^1 + P(1)) +local p_grouping = S("{$}") +local p_special = S("#()[]<>=\"") +local p_extra = S("`~%^&_-+/\'|") +local p_text = cstoken^1 + +-- keep key pressed at end-of syst-aux.mkiv: +-- +-- 0 : 15 sec +-- 1 : 13 sec +-- 2 : 10 sec +-- +-- the problem is that quite some style subtables get generated so collapsing ranges helps + +local option = 1 + +if option == 1 then + + p_comment = p_comment^1 + p_grouping = p_grouping^1 + p_special = p_special^1 + p_extra = p_extra^1 + p_text = p_text^1 + + p_command = p_command^1 + p_constant = p_constant^1 + p_helper = p_helper^1 + p_primitive = p_primitive^1 + p_ifprimitive = p_ifprimitive^1 + +elseif option == 2 then + + local included = space^0 + + p_comment = (p_comment * included)^1 + p_grouping = (p_grouping * included)^1 + p_special = (p_special * included)^1 + p_extra = (p_extra * included)^1 + p_text = (p_text * included)^1 + + p_command = (p_command * included)^1 + p_constant = (p_constant * included)^1 + p_helper = (p_helper * included)^1 + p_primitive = (p_primitive * included)^1 + p_ifprimitive = (p_ifprimitive * included)^1 + +end + +local spacing = token(whitespace, p_spacing ) + +local rest = token('default', p_rest ) +local preamble = token('preamble', p_preamble ) +local comment = token('comment', p_comment ) +local command = token('command', p_command ) +local constant = token('data', p_constant ) +local helper = token('plain', p_helper ) +local primitive = token('primitive', p_primitive ) +local ifprimitive = token('primitive', p_ifprimitive) +local csname = token('user', p_csname ) +local grouping = token('grouping', p_grouping ) +local special = token('special', p_special ) +local extra = token('extra', p_extra ) +local text = token('default', p_text ) ----- startluacode = token("grouping", P("\\startluacode")) ----- stopluacode = token("grouping", P("\\stopluacode")) -local luastatus = nil +local luastatus = false +local luatag = nil +local lualevel = 0 + +local function startdisplaylua(_,i,s) + luatag = s + luastatus = "display" + cldlexer._directives.cld_inline = false + return true +end + +local function stopdisplaylua(_,i,s) + local ok = luatag == s + if ok then + luastatus = false + end + return ok +end + +local function startinlinelua(_,i,s) + if luastatus == "display" then + return false + elseif not luastatus then + luastatus = "inline" + cldlexer._directives.cld_inline = true + lualevel = 1 + return true + else + lualevel = lualevel + 1 + return true + end +end + +local function stopinlinelua_b(_,i,s) -- { + if luastatus == "display" then + return false + elseif luastatus == "inline" then + lualevel = lualevel + 1 + return false + else + return true + end +end + +local function stopinlinelua_e(_,i,s) -- } + if luastatus == "display" then + return false + elseif luastatus == "inline" then + lualevel = lualevel - 1 + local ok = lualevel <= 0 + if ok then + luastatus = false + end + return ok + else + return true + end +end + local luaenvironment = P("luacode") -local inlinelua = P("\\ctx") * ( P("lua") + P("command") ) - + P("\\cldcontext") +local inlinelua = P("\\") * ( + P("ctx") * ( P("lua") + P("command") ) + + P("cldcontext") + ) -local startlua = P("\\start") * Cmt(luaenvironment,function(_,i,s) luastatus = s return true end) - + inlinelua - * space^0 - * Cmt(P("{"),function(_,i,s) luastatus = "}" return true end) -local stoplua = P("\\stop") * Cmt(luaenvironment,function(_,i,s) return luastatus == s end) - + Cmt(P("}"),function(_,i,s) return luastatus == "}" end) +local startlua = P("\\start") * Cmt(luaenvironment,startdisplaylua) + + inlinelua * space^0 * Cmt(P("{"),startinlinelua) + +local stoplua = P("\\stop") * Cmt(luaenvironment,stopdisplaylua) + + Cmt(P("{"),stopinlinelua_b) + + Cmt(P("}"),stopinlinelua_e) local startluacode = token("embedded", startlua) local stopluacode = token("embedded", stoplua) --- local metafunenvironment = P("useMPgraphic") --- + P("reusableMPgraphic") --- + P("uniqueMPgraphic") --- + P("MPcode") --- + P("MPpage") --- + P("MPinclusions") --- + P("MPextensions") --- + P("MPgraphic") - local metafunenvironment = ( P("use") + P("reusable") + P("unique") ) * ("MPgraphic") + P("MP") * ( P("code")+ P("page") + P("inclusions") + P("extensions") + P("graphic") ) --- local metafunstatus = nil -- this does not work, as the status gets lost in an embedded lexer --- local startmetafun = P("\\start") * Cmt(metafunenvironment,function(_,i,s) metafunstatus = s return true end) --- local stopmetafun = P("\\stop") * Cmt(metafunenvironment,function(_,i,s) return metafunstatus == s end) - local startmetafun = P("\\start") * metafunenvironment local stopmetafun = P("\\stop") * metafunenvironment @@ -226,9 +338,6 @@ local metafunarguments = (spacing^0 * openargument * argumentcontent * clo local startmetafuncode = token("embedded", startmetafun) * metafunarguments local stopmetafuncode = token("embedded", stopmetafun) -local cldlexer = lexer.load('scite-context-lexer-cld') -local mpslexer = lexer.load('scite-context-lexer-mps') - lexer.embed_lexer(contextlexer, cldlexer, startluacode, stopluacode) lexer.embed_lexer(contextlexer, mpslexer, startmetafuncode, stopmetafuncode) @@ -238,24 +347,18 @@ lexer.embed_lexer(contextlexer, mpslexer, startmetafuncode, stopmetafuncode) _rules = { { "whitespace", spacing }, { "preamble", preamble }, - { "text", text }, - { "comment", comment }, - { "constant", constant }, { "helper", helper }, { "command", command }, - { "ifprimitive", ifprimitive }, { "primitive", primitive }, + { "ifprimitive", ifprimitive }, { "csname", csname }, - -- { "whatever", specialword }, -- not yet, crashes - { "grouping", grouping }, { "special", special }, { "extra", extra }, - { "rest", rest }, } diff --git a/context/data/scite/metapost.properties b/context/data/scite/metapost.properties index 2141f5f4c..fe89b65eb 100644 --- a/context/data/scite/metapost.properties +++ b/context/data/scite/metapost.properties @@ -1 +1 @@ -import scite-metapost.properties +import scite-metapost diff --git a/context/data/scite/scite-context-data-context.properties b/context/data/scite/scite-context-data-context.properties index d67729651..4d352d708 100644 --- a/context/data/scite/scite-context-data-context.properties +++ b/context/data/scite/scite-context-data-context.properties @@ -1,34 +1,34 @@ keywordclass.context.helpers=\ -newcount newdimen newskip newmuskip \ -newbox newtoks newread newwrite newmarks \ -newinsert newattribute newif newlanguage newfamily \ -newfam newhelp htdp unvoidbox scratchcounter \ -globalscratchcounter scratchdimen globalscratchdimen scratchskip globalscratchskip \ -scratchmuskip globalscratchmuskip scratchtoks globalscratchtoks scratchbox \ -globalscratchbox scratchwidth scratchheight scratchdepth scratchcounterone \ -scratchcountertwo scratchcounterthree scratchdimenone scratchdimentwo scratchdimenthree \ -scratchskipone scratchskiptwo scratchskipthree scratchmuskipone scratchmuskiptwo \ -scratchmuskipthree scratchtoksone scratchtokstwo scratchtoksthree scratchboxone \ -scratchboxtwo scratchboxthree doif doifnot doifelse \ -doifinset doifnotinset doifinsetelse doifnextcharelse doifnextoptionalelse \ -doifnextparenthesiselse doiffastoptionalcheckelse doifundefinedelse doifdefinedelse doifundefined \ -doifdefined doifelsevalue doifvalue doifnotvalue doifnothing \ -doifsomething doifelsenothing doifsomethingelse doifvaluenothing doifvaluesomething \ -doifelsevaluenothing doifdimensionelse doifnumberelse doifcommonelse doifcommon \ -doifnotcommon doifinstring doifnotinstring doifinstringelse tracingall \ -tracingnone loggingall appendtoks prependtoks appendtotoks \ -prependtotoks endgraf empty null space \ -obeyspaces obeylines normalspace executeifdefined singleexpandafter \ -doubleexpandafter tripleexpandafter dontleavehmode wait writestatus \ -define redefine setmeasure setemeasure setgmeasure \ -setxmeasure definemeasure measure getvalue setvalue \ -setevalue setgvalue setxvalue letvalue letgvalue \ -resetvalue undefinevalue ignorevalue setuvalue setuevalue \ -setugvalue setuxvalue globallet glet getparameters \ -geteparameters getgparameters getxparameters forgetparameters processcommalist \ -processcommacommand quitcommalist quitprevcommalist processaction processallactions \ -processfirstactioninset processallactionsinset startsetups stopsetups startxmlsetups \ -stopxmlsetups starttexdefinition stoptexdefinition starttexcode stoptexcode \ +startsetups stopsetups startxmlsetups stopxmlsetups \ +starttexdefinition stoptexdefinition starttexcode stoptexcode newcount \ +newdimen newskip newmuskip newbox newtoks \ +newread newwrite newmarks newinsert newattribute \ +newif newlanguage newfamily newfam newhelp \ +htdp unvoidbox scratchcounter globalscratchcounter scratchdimen \ +globalscratchdimen scratchskip globalscratchskip scratchmuskip globalscratchmuskip \ +scratchtoks globalscratchtoks scratchbox globalscratchbox scratchwidth \ +scratchheight scratchdepth scratchcounterone scratchcountertwo scratchcounterthree \ +scratchdimenone scratchdimentwo scratchdimenthree scratchskipone scratchskiptwo \ +scratchskipthree scratchmuskipone scratchmuskiptwo scratchmuskipthree scratchtoksone \ +scratchtokstwo scratchtoksthree scratchboxone scratchboxtwo scratchboxthree \ +doif doifnot doifelse doifinset doifnotinset \ +doifinsetelse doifnextcharelse doifnextoptionalelse doifnextparenthesiselse doiffastoptionalcheckelse \ +doifundefinedelse doifdefinedelse doifundefined doifdefined doifelsevalue \ +doifvalue doifnotvalue doifnothing doifsomething doifelsenothing \ +doifsomethingelse doifvaluenothing doifvaluesomething doifelsevaluenothing doifdimensionelse \ +doifnumberelse doifcommonelse doifcommon doifnotcommon doifinstring \ +doifnotinstring doifinstringelse tracingall tracingnone loggingall \ +appendtoks prependtoks appendtotoks prependtotoks endgraf \ +empty null space obeyspaces obeylines \ +normalspace executeifdefined singleexpandafter doubleexpandafter tripleexpandafter \ +dontleavehmode wait writestatus define redefine \ +setmeasure setemeasure setgmeasure setxmeasure definemeasure \ +measure getvalue setvalue setevalue setgvalue \ +setxvalue letvalue letgvalue resetvalue undefinevalue \ +ignorevalue setuvalue setuevalue setugvalue setuxvalue \ +globallet glet getparameters geteparameters getgparameters \ +getxparameters forgetparameters processcommalist processcommacommand quitcommalist \ +quitprevcommalist processaction processallactions processfirstactioninset processallactionsinset \ unexpanded expanded startexpanded stopexpanded protected \ protect unprotect firstofoneargument firstoftwoarguments secondoftwoarguments \ firstofthreearguments secondofthreearguments thirdofthreearguments firstoffourarguments secondoffourarguments \ @@ -59,5 +59,9 @@ fmtname fmtversion texengine texenginename texengineversion \ luatexengine pdftexengine xetexengine unknownengine etexversion \ pdftexversion xetexversion xetexrevision activecatcode bgroup \ egroup endline attributeunsetvalue uprotationangle rightrotatioangle \ -downrotatioangle leftrotatioangle +downrotatioangle leftrotatioangle startmode stopmode startnotmode \ +stopnotmode doifmode doifmodeelse doifnotmode startenvironment \ +stopenvironment environment startcomponent stopcomponent component \ +startproduct stopproduct product startproject stopproject \ +project starttext stoptext diff --git a/context/data/scite/scite-context-external.properties b/context/data/scite/scite-context-external.properties index 7396e8b63..5cb0e8f98 100644 --- a/context/data/scite/scite-context-external.properties +++ b/context/data/scite/scite-context-external.properties @@ -16,11 +16,13 @@ if PLAT_GTK lexer.*.lpeg=lpeg +# an xml lexer will also be provided + lexer.$(file.patterns.metapost)=lpeg_scite-context-lexer-mps lexer.$(file.patterns.metafun)=lpeg_scite-context-lexer-mps lexer.$(file.patterns.context)=lpeg_scite-context-lexer-tex lexer.$(file.patterns.tex)=lpeg_scite-context-lexer-tex -lexer.$(file.patterns.lua)=lpeg_scite-context-lexer-cld +lexer.$(file.patterns.lua)=lpeg_scite-context-lexer-lua lexer.$(file.patterns.xml)=lpeg_xml comment.block.lpeg_scite-context-lexer-tex=% @@ -29,11 +31,17 @@ comment.block.at.line.start.lpeg_scite-context-lexer-tex=1 comment.block.lpeg_scite-context-lexer-mps=% comment.block.at.line.start.lpeg_scite-context-lexer-mps=1 +comment.block.lpeg_scite-context-lexer-lua=-- +comment.block.at.line.start.lpeg_scite-context-lexer-lua=1 + comment.block.lpeg_scite-context-lexer-cld=-- comment.block.at.line.start.lpeg_scite-context-lexer-cld=1 comment.block.lpeg_props=# comment.block.at.line.start.lpeg_props=1 -style.*.34=bold -style.*.35=bold +#~ style.*.34=bold +#~ style.*.35=bold + +style.*.34=$(styles.bracelight) +style.*.35=$(styles.bracebad) diff --git a/context/data/scite/scite-context-internal.properties b/context/data/scite/scite-context-internal.properties index fe86260d9..92806b8e2 100644 --- a/context/data/scite/scite-context-internal.properties +++ b/context/data/scite/scite-context-internal.properties @@ -12,14 +12,17 @@ import scite-context-data-metapost import scite-context-data-metafun keywordclass.metapost.all=$(keywordclass.metapost.tex) $(keywordclass.metapost.plain) $(keywordclass.metapost.primitives) -keywordclass.metafun.all=$(keywordclass.metapost.constants) $(keywordclass.metapost.helpers) +keywordclass.metafun.all=$(keywordclass.metafun.constants) $(keywordclass.metafun.helpers) keywords.$(file.patterns.metafun)=$(keywordclass.metapost.all) -keywords2.$(file.patterns.metafun)=$(keywordclass.metafun.all) +keywords2.$(file.patterns.metafun)=$(keywordclass.metapost.all) $(keywordclass.metafun.all) lexer.metapost.interface.default=2 lexer.metapost.comment.process=0 +lexer.$(file.patterns.metapost)=metapost +lexer.$(file.patterns.metafun)=metapost + # Metapost: comments comment.block.metapost=% @@ -74,3 +77,6 @@ lexer.context.interface.default=0 lexer.context.use.keywords=1 lexer.context.comment.process=0 lexer.context.auto.if=1 + +lexer.$(file.patterns.context)=tex +lexer.$(file.patterns.tex)=tex diff --git a/context/data/scite/scite-context-readme.tex b/context/data/scite/scite-context-readme.tex index a5d2ab084..3a6d673c5 100644 --- a/context/data/scite/scite-context-readme.tex +++ b/context/data/scite/scite-context-readme.tex @@ -1,5 +1,7 @@ \starttext +\subject{Installing Scite} + Scite has built-in lexers as well as external lpeg based ones. We can use both but for the external lexers some more work is needed to get them running. As they are more advanced it's worth the @@ -20,18 +22,54 @@ code.google.com/p/scintilla On windows you need to copy the \type {lexers} subfolder to the \type {wscite} folder. For Linux the place depends on the distribution. +\subject{Extending Scite} + In the \CONTEXT\ distribution you find the relevant files in: \starttyping <contextroot>/tex/texmf-context/context/data/scite \stoptyping +The easy way is to copy all the files in that path to the path where +the global properties files lives + +\starttyping +SciteGlobal.properties +\stoptyping + +At the end of that file (on windows it is in the path where the Scite +binary) you then add a line to the end: + +\starttyping +import scite-context-user +\stoptyping + +You need to restart Scite in order to see if things work out as expected. + +Disabling the external lexer in a recent Scite is somewhat tricky. In that +case the end of that file looks like: + +\starttyping +imports.exclude=scite-context-external +import * +import scite-context-user +\stoptyping + +In any case you need to make sure that the user file is loaded last. + +\subject{An alternative approach} + +If for some reason you prefer not to mess with property files in the main +Scite path, you can follow a different route and selectively copy files to +places. + The following files are needed for the lpeg based lexer: \starttyping lexers/scite-context-lexer.lua lexers/scite-context-lexer-tex.lua lexers/scite-context-lexer-mps.lua +lexers/scite-context-lexer-lua.lua lexers/scite-context-lexer-cld.lua lexers/context/data/scite-context-data-tex.lua @@ -62,8 +100,14 @@ files to the same path where the loading is defined: \starttyping scite-context.properties +scite-context-internal.properties +scite-context-external.properties + scite-pragma.properties +scite-tex.properties +scite-metapost.properties + scite-context-data-tex.properties scite-context-data-context.properties scite-context-data-interfaces.properties @@ -72,8 +116,6 @@ scite-context-data-metafun.properties scite-ctx.properties scite-ctx-context.properties -scite-ctx-context-internal.properties -scite-ctx-context-external.properties scite-ctx-example.properties \stoptyping @@ -101,6 +143,8 @@ SciTEUser.properties Of course the pragma import is optional. You can comment either the internal or external variant but there is no reason not to keep them both. +\subject{Spell checking} + If you want to have spellchecking, you need have files with correct words on each line. The first line of a file determines the language: @@ -120,6 +164,8 @@ This file is searched on the the path determined by the environment variable: CTXSPELLPATH \stoptyping +\subject{Interface selection} + In a similar fashion you can drive the interface checking: \starttyping diff --git a/context/data/scite/scite-context.properties b/context/data/scite/scite-context.properties index a958eb842..03df9fb75 100644 --- a/context/data/scite/scite-context.properties +++ b/context/data/scite/scite-context.properties @@ -326,28 +326,69 @@ font.embedded.base=$(font.monospace) font.embedded.comment=$(font.monospace) font.vbs=$(font.monospace) -# Editor: colors - -color.back.linepanel=back:#A7A7A7 -color.back.textpanel=back:#CFCFCF -color.back.logpanel=back:#EFEFEF -color.back.selection=#F7F7F7 - -color.fore.red=fore:#7F0000 -color.fore.green=fore:#007F00 -color.fore.blue=fore:#00007F -color.fore.cyan=fore:#007F7F -color.fore.magenta=fore:#7F007F -color.fore.yellow=fore:#7F7F00 +# colors and styles + +colors.red=#7F0000 +colors.green=#007F00 +colors.blue=#00007F +colors.cyan=#007F7F +colors.magenta=#7F007F +colors.yellow=#7F7F00 + +colors.white=#FFFFFF +colors.light= #CFCFCF +colors.grey= #808080 +colors.dark= #4F4F4F +colors.black= #000000 +colors.selection=#F7F7F7 +colors.logpanel=#E7E7E7 +colors.textpanel=#CFCFCF +colors.linepanel=#A7A7A7 +colors.tippanel=#444444 +colors.right=#0000FF +colors.wrong=#FF0000 + +colors.teal=$(colors.cyan) +colors.purple=$(colors.magenta) + +styles.default=fore:$(colors.black),back:$(colors.textpanel),$(font.base) +styles.nothing= + +styles.number=fore:$(colors.cyan) +styles.comment=fore:$(colors.yellow) +styles.string=fore:$(colors.magenta) +styles.keyword=fore:$(colors.blue),bold + +styles.char=fore:$(colors.magenta) +styles.class=fore:$(colors.black),bold +styles.constant=fore:$(colors.cyan),bold +styles.definition=fore:$(colors.black),bold +styles.error=fore:$(colors.red) +styles.function=fore:$(colors.black),bold +styles.operator=fore:$(colors.blue) +styles.preproc=fore:$(colors.yellow),bold +styles.tag=fore:$(colors.cyan) +styles.type=fore:$(colors.blue) +styles.variable=fore:$(colors.black) +styles.identifier=$(styles.nothing) + +styles.linenumber=back:$(colors.linepanel) +styles.bracelight=fore:$(colors.orange),bold +styles.bracebad=fore:$(colors.orange),bold +styles.indentguide=fore:$(colors.linepanel),back:$(colors.white) +styles.calltip=fore:$(colors.white),back:$(colors.tippanel) +styles.controlchar=$(styles.nothing) + +# end of colors and styles # Editor: color schemes caret.width=3 -style.*.32=$(font.base),$(color.back.textpanel) -style.*.33=$(font.base),$(color.back.linepanel) +style.*.32=$(font.base),back:$(colors.textpanel) +style.*.33=$(font.base),back:$(colors.linepanel) -style.errorlist.32=$(font.errorfont),$(color.back.logpanel) +style.errorlist.32=$(font.errorfont),back:$(colors.logpanel) selection.back=#000000 @@ -407,7 +448,9 @@ find.files=*.tex *.xml *.mp if PLAT_WIN find.command=fgrep -n $(find.what) $(find.files) -source.files=$(file.patterns.context);$(file.patterns.metafun);$(file.patterns.example);*.pl;*.rb +# todo: + +source.files=$(file.patterns.context);$(file.patterns.metafun);$(file.patterns.example);*.pl;*.rb;*.lua # Editor: printing @@ -443,27 +486,27 @@ autocomplete.choose.single=0 # Logging -style.errorlist.32=$(font.errorfont),$(color.back.logpanel) +style.errorlist.32=$(font.errorfont),back:$(colors.logpanel) # Default -style.errorlist.0=fore:#000000 -style.errorlist.1=$(color.fore.red) -style.errorlist.2=$(color.fore.red) -style.errorlist.3=$(color.fore.red) -style.errorlist.4=$(color.fore.green) -style.errorlist.5=$(color.fore.red) -style.errorlist.6=$(color.fore.red) -style.errorlist.7=$(color.fore.red) -style.errorlist.8=$(color.fore.red) -style.errorlist.9=$(color.fore.red) -style.errorlist.10=$(color.fore.green) -style.errorlist.11=$(color.fore.blue) -style.errorlist.12=$(color.fore.cyan) -style.errorlist.13=$(color.fore.red) -style.errorlist.14=$(color.fore.red) -style.errorlist.15=$(color.fore.red) -style.errorlist.16=$(color.fore.red) +style.errorlist.0=fore:$(colors.black) +style.errorlist.1=fore:$(colors.red) +style.errorlist.2=fore:$(colors.red) +style.errorlist.3=fore:$(colors.red) +style.errorlist.4=fore:$(colors.green) +style.errorlist.5=fore:$(colors.red) +style.errorlist.6=fore:$(colors.red) +style.errorlist.7=fore:$(colors.red) +style.errorlist.8=fore:$(colors.red) +style.errorlist.9=fore:$(colors.red) +style.errorlist.10=fore:$(colors.green) +style.errorlist.11=fore:$(colors.blue) +style.errorlist.12=fore:$(colors.cyan) +style.errorlist.13=fore:$(colors.red) +style.errorlist.14=fore:$(colors.red) +style.errorlist.15=fore:$(colors.red) +style.errorlist.16=fore:$(colors.red) # Metapost: patterns @@ -490,25 +533,83 @@ command.7.$(file.patterns.metafun)= command.8.$(file.patterns.metafun)= command.9.$(file.patterns.metafun)= -# Metapost: highlighting - -style.metapost.0=fore:#3F3F3F -style.metapost.1=fore:#007F7F -style.metapost.2=fore:#7F0000 -style.metapost.3=fore:#7F7F00 -style.metapost.4=fore:#007F00 -style.metapost.5=fore:#000000 -style.metapost.6=fore:#007F00,italics -style.metapost.34=fore:#00007F -style.metapost.35=fore:#7F007F - -# Context: highlighting - -style.context.0=fore:#3F3F3F -style.context.1=fore:#007F7F -style.context.2=fore:#7F0000 -style.context.3=fore:#7F7F00 -style.context.4=fore:#007F00 - -style.context.34=fore:#00007F -style.context.35=fore:#7F007F +# Shared highlighting + +styles.context.default=$(styles.nothing) +styles.context.number=$(styles.number) +styles.context.comment=$(styles.comment) +styles.context.keyword=$(styles.keyword) +styles.context.string=$(styles.string) + +styles.context.command=fore:$(colors.green),bold +styles.context.preamble=$(styles.comment) +styles.context.embedded=fore:$(colors.black),bold +styles.context.grouping=fore:$(colors.red) +styles.context.primitive=$(styles.keyword) +styles.context.plain=fore:$(colors.dark),bold +styles.context.user=fore:$(colors.green) +styles.context.data=$(styles.constant) +styles.context.special=fore:$(colors.blue) +styles.context.extra=fore:$(colors.yellow) +styles.context.quote=fore:$(colors.blue),bold + +# Metapost highlighting + +style.metapost.0=$(styles.context.default) +style.metapost.1=$(styles.context.special) +style.metapost.2=$(styles.context.grouping) +style.metapost.3=$(styles.context.comment) +style.metapost.4=$(styles.context.keyword) +style.metapost.5=$(styles.context.default) +style.metapost.6=$(styles.context.plain) +style.metapost.34=$(styles.bracelight) +style.metapost.35=$(styles.bracebad) + +# TeX highlighting + +style.tex.0=$(styles.context.default) +style.tex.1=$(styles.context.special) +style.tex.2=$(styles.context.grouping) +style.tex.3=$(styles.context.comment) +style.tex.4=$(styles.context.user) +style.tex.34=$(styles.bracelight) +style.tex.35=$(styles.bracebad) + +# style.tex.* : external styling happens elsewhere +# style.mps.* : external styling happens elsewhere +# style.cls.* : external styling happens elsewhere + +# Lua highlighting: +# +# might change as we change the cld lexer + +comment.block.lua=-- +comment.block.at.line.start.lua=1 + +# braces.lua.style=10 + +style.lua.32=$(styles.context.default) +style.lua.0=$(styles.context.default) +style.lua.1=$(styles.context.comment) +style.lua.2=$(styles.context.comment) +style.lua.3=$(styles.context.comment) +style.lua.4=$(styles.context.number) +style.lua.5=$(styles.context.keyword) +style.lua.6=$(styles.context.string) +style.lua.7=$(styles.context.string) +style.lua.8=$(styles.context.comment) +style.lua.9=$(styles.context.default) +style.lua.10=$(styles.context.special) +style.lua.11=$(styles.context.default) +style.lua.12=$(styles.context.default) +style.lua.13=$(styles.context.default) +style.lua.14=$(styles.context.default) +style.lua.15=$(styles.context.default) +style.lua.16=$(styles.context.default) +style.lua.17=$(styles.context.default) +style.lua.18=$(styles.context.default) +style.lua.19=$(styles.context.default) +style.lua.20=$(styles.context.default) + +style.context.34=$(styles.bracelight) +style.context.35=$(styles.bracebad) diff --git a/context/data/scite/tex.properties b/context/data/scite/tex.properties index e31e7e69b..3fbad41cb 100644 --- a/context/data/scite/tex.properties +++ b/context/data/scite/tex.properties @@ -1 +1 @@ -import scite-context-tex.properties +import scite-tex |