diff options
author | Marius <mariausol@gmail.com> | 2011-11-24 17:20:15 +0200 |
---|---|---|
committer | Marius <mariausol@gmail.com> | 2011-11-24 17:20:15 +0200 |
commit | b0b3f63745dbcd338e4ce549c2f8c4427998ffcf (patch) | |
tree | 9bf20816667adef0f781f7a6cfccd8e61f1a7a7b /context/data | |
parent | ae4e7c1b2b58b4b089b5eff6e8f41371a309a538 (diff) | |
download | context-b0b3f63745dbcd338e4ce549c2f8c4427998ffcf.tar.gz |
beta 2011.11.24 15:52
Diffstat (limited to 'context/data')
8 files changed, 158 insertions, 93 deletions
diff --git a/context/data/scite/lexers/data/scite-context-data-metafun.lua b/context/data/scite/lexers/data/scite-context-data-metafun.lua index 8bca17228..f8f91d609 100644 --- a/context/data/scite/lexers/data/scite-context-data-metafun.lua +++ b/context/data/scite/lexers/data/scite-context-data-metafun.lua @@ -1,4 +1,4 @@ return { - ["commands"]={ "sqr", "log", "ln", "exp", "inv", "pow", "pi", "radian", "tand", "cotd", "sin", "cos", "tan", "cot", "atan", "asin", "acos", "invsin", "invcos", "acosh", "asinh", "sinh", "cosh", "paired", "tripled", "unitcircle", "fulldiamond", "unitdiamond", "fullsquare", "llcircle", "lrcircle", "urcircle", "ulcircle", "tcircle", "bcircle", "lcircle", "rcircle", "lltriangle", "lrtriangle", "urtriangle", "ultriangle", "smoothed", "cornered", "superellipsed", "randomized", "squeezed", "enlonged", "shortened", "punked", "curved", "unspiked", "simplified", "blownup", "stretched", "enlarged", "leftenlarged", "topenlarged", "rightenlarged", "bottomenlarged", "crossed", "laddered", "randomshifted", "interpolated", "paralleled", "cutends", "peepholed", "llenlarged", "lrenlarged", "urenlarged", "ulenlarged", "llmoved", "lrmoved", "urmoved", "ulmoved", "rightarrow", "leftarrow", "centerarrow", "boundingbox", "innerboundingbox", "outerboundingbox", "pushboundingbox", "popboundingbox", "bottomboundary", "leftboundary", "topboundary", "rightboundary", "xsized", "ysized", "xysized", "sized", "xyscaled", "intersection_point", "intersection_found", "penpoint", "bbwidth", "bbheight", "withshade", "withlinearshading", "withcircularshading", "withfromshadecolor", "withtoshadecolor", "withshading", "shadedinto", "withcircularshade", "withlinearshade", "cmyk", "spotcolor", "multitonecolor", "namedcolor", "drawfill", "undrawfill", "inverted", "uncolored", "softened", "grayed", "greyed", "onlayer", "along", "graphictext", "loadfigure", "externalfigure", "withmask", "figure", "register", "bitmapimage", "colordecimals", "ddecimal", "dddecimal", "ddddecimal", "textext", "thetextext", "rawtextext", "textextoffset", "verbatim", "thelabel", "label", "transparent", "withtransparency", "infont", "set_linear_vector", "linear_shade", "define_linear_shade", "define_circular_linear_shade", "define_sampled_linear_shade", "set_circular_vector", "circular_shade", "define_circular_shade", "define_circular_linear_shade", "define_sampled_circular_shade", "space", "CRLF", "grayscale", "greyscale", "withgray", "withgrey", "colorpart", "readfile", "clearxy", "unitvector", "center", "epsed", "anchored", "originpath", "infinite", "break", "xstretched", "ystretched", "snapped", "pathconnectors", "function", "constructedpath", "constructedpairs", "punkedfunction", "curvedfunction", "tightfunction", "punkedpath", "curvedpath", "tightpath", "punkedpairs", "curvedpairs", "tightpairs", "evenly", "oddly", "drawboundary" }, + ["commands"]={ "sqr", "log", "ln", "exp", "inv", "pow", "pi", "radian", "tand", "cotd", "sin", "cos", "tan", "cot", "atan", "asin", "acos", "invsin", "invcos", "acosh", "asinh", "sinh", "cosh", "paired", "tripled", "unitcircle", "fulldiamond", "unitdiamond", "fullsquare", "llcircle", "lrcircle", "urcircle", "ulcircle", "tcircle", "bcircle", "lcircle", "rcircle", "lltriangle", "lrtriangle", "urtriangle", "ultriangle", "smoothed", "cornered", "superellipsed", "randomized", "squeezed", "enlonged", "shortened", "punked", "curved", "unspiked", "simplified", "blownup", "stretched", "enlarged", "leftenlarged", "topenlarged", "rightenlarged", "bottomenlarged", "crossed", "laddered", "randomshifted", "interpolated", "paralleled", "cutends", "peepholed", "llenlarged", "lrenlarged", "urenlarged", "ulenlarged", "llmoved", "lrmoved", "urmoved", "ulmoved", "rightarrow", "leftarrow", "centerarrow", "boundingbox", "innerboundingbox", "outerboundingbox", "pushboundingbox", "popboundingbox", "bottomboundary", "leftboundary", "topboundary", "rightboundary", "xsized", "ysized", "xysized", "sized", "xyscaled", "intersection_point", "intersection_found", "penpoint", "bbwidth", "bbheight", "withshade", "withlinearshading", "withcircularshading", "withfromshadecolor", "withtoshadecolor", "withshading", "shadedinto", "withcircularshade", "withlinearshade", "cmyk", "spotcolor", "multitonecolor", "namedcolor", "drawfill", "undrawfill", "inverted", "uncolored", "softened", "grayed", "greyed", "onlayer", "along", "graphictext", "loadfigure", "externalfigure", "withmask", "figure", "register", "bitmapimage", "colordecimals", "ddecimal", "dddecimal", "ddddecimal", "textext", "thetextext", "rawtextext", "textextoffset", "verbatim", "thelabel", "label", "transparent", "withtransparency", "infont", "set_linear_vector", "linear_shade", "define_linear_shade", "define_circular_linear_shade", "define_sampled_linear_shade", "set_circular_vector", "circular_shade", "define_circular_shade", "define_circular_linear_shade", "define_sampled_circular_shade", "space", "CRLF", "grayscale", "greyscale", "withgray", "withgrey", "colorpart", "readfile", "clearxy", "unitvector", "center", "epsed", "anchored", "originpath", "infinite", "break", "xstretched", "ystretched", "snapped", "pathconnectors", "function", "constructedpath", "constructedpairs", "punkedfunction", "curvedfunction", "tightfunction", "punkedpath", "curvedpath", "tightpath", "punkedpairs", "curvedpairs", "tightpairs", "evenly", "oddly", "normalfill", "normaldraw", "visualizepaths", "naturalizepaths", "drawboundary", "drawwholepath", "visualizeddraw", "visualizedfill", "draworigin", "drawboundingbox", "drawpath", "drawpoint", "drawpoints", "drawcontrolpoints", "drawcontrollines", "drawpointlabels", "drawlineoptions", "drawpointoptions", "drawcontroloptions", "drawlabeloptions", "draworiginoptions", "drawboundoptions", "drawpathoptions", "resetdrawoptions" }, ["internals"]={ "nocolormodel", "greycolormodel", "graycolormodel", "rgbcolormodel", "cmykcolormodel", "shadefactor", "textextoffset", "normaltransparent", "multiplytransparent", "screentransparent", "overlaytransparent", "softlighttransparent", "hardlighttransparent", "colordodgetransparent", "colorburntransparent", "darkentransparent", "lightentransparent", "differencetransparent", "exclusiontransparent", "huetransparent", "saturationtransparent", "colortransparent", "luminositytransparent" }, }
\ No newline at end of file diff --git a/context/data/scite/lexers/data/scite-context-data-metapost.lua b/context/data/scite/lexers/data/scite-context-data-metapost.lua index 95899fa90..d3c199089 100644 --- a/context/data/scite/lexers/data/scite-context-data-metapost.lua +++ b/context/data/scite/lexers/data/scite-context-data-metapost.lua @@ -1,7 +1,7 @@ return { - ["commands"]={ "arrowhead", "currentpen", "currentpicture", "cuttings", "defaultfont", "extra_beginfig", "extra_endfig", "ditto", "EOF", "down", "evenly", "fullcircle", "halfcircle", "identity", "in", "left", "origin", "pensquare", "quartercircle", "right", "unitsquare", "up", "withdots", "abs", "bbox", "ceiling", "center", "cutafter", "cutbefore", "dir", "directionpoint", "div", "dotprod", "intersectionpoint", "inverse", "mod", "round", "unitvector", "whatever", "cutdraw", "draw", "drawarrow", "drawdblarrow", "fill", "filldraw", "drawdot", "loggingall", "interact", "tracingall", "tracingnone", "pickup", "undraw", "unfill", "unfilldraw", "buildcycle", "dashpattern", "decr", "dotlabel", "dotlabels", "drawoptions", "incr", "label", "labels", "max", "min", "thelabel", "z", "beginchar", "blacker", "capsule_end", "change_width", "define_blacker_pixels", "define_corrected_pixels", "define_good_x_pixels", "define_good_y_pixels", "define_horizontal_corrected_pixels", "define_pixels", "define_whole_blacker_pixels", "define_whole_pixels", "define_whole_vertical_blacker_pixels", "define_whole_vertical_pixels", "endchar", "extra_beginchar", "extra_endchar", "extra_setup", "font_coding_scheme", "clearxy", "clearit", "clearpen", "shipit", "font_extra_space", "exitunless", "relax", "hide", "gobble", "gobbled", "stop", "blankpicture", "counterclockwise", "tensepath", "takepower", "direction", "softjoin", "makelabel", "rotatedabout", "flex", "superellipse", "erase", "image", "nullpen", "savepen", "clearpen", "penpos", "penlabels", "range", "numtok", "thru", "z", "laboff", "bye", "red", "green", "blue", "cyan", "magenta", "yellow", "black", "white", "background", "graypart", "graycolor", "mm", "pt", "dd", "bp", "cm", "pc", "cc", "in" }, + ["commands"]={ "beginfig", "endfig", "rotatedaround", "reflectedabout", "arrowhead", "currentpen", "currentpicture", "cuttings", "defaultfont", "extra_beginfig", "extra_endfig", "ditto", "EOF", "down", "evenly", "fullcircle", "halfcircle", "identity", "in", "left", "origin", "pensquare", "quartercircle", "right", "unitsquare", "up", "withdots", "abs", "bbox", "ceiling", "center", "cutafter", "cutbefore", "dir", "directionpoint", "div", "dotprod", "intersectionpoint", "inverse", "mod", "round", "unitvector", "whatever", "cutdraw", "draw", "drawarrow", "drawdblarrow", "fill", "filldraw", "drawdot", "loggingall", "interact", "tracingall", "tracingnone", "pickup", "undraw", "unfill", "unfilldraw", "buildcycle", "dashpattern", "decr", "dotlabel", "dotlabels", "drawoptions", "incr", "label", "labels", "max", "min", "thelabel", "z", "beginchar", "blacker", "capsule_end", "change_width", "define_blacker_pixels", "define_corrected_pixels", "define_good_x_pixels", "define_good_y_pixels", "define_horizontal_corrected_pixels", "define_pixels", "define_whole_blacker_pixels", "define_whole_pixels", "define_whole_vertical_blacker_pixels", "define_whole_vertical_pixels", "endchar", "extra_beginchar", "extra_endchar", "extra_setup", "font_coding_scheme", "clearxy", "clearit", "clearpen", "shipit", "font_extra_space", "exitunless", "relax", "hide", "gobble", "gobbled", "stop", "blankpicture", "counterclockwise", "tensepath", "takepower", "direction", "softjoin", "makelabel", "rotatedabout", "flex", "superellipse", "erase", "image", "nullpen", "savepen", "clearpen", "penpos", "penlabels", "range", "numtok", "thru", "z", "laboff", "bye", "red", "green", "blue", "cyan", "magenta", "yellow", "black", "white", "background", "graypart", "graycolor", "mm", "pt", "dd", "bp", "cm", "pc", "cc", "in" }, ["internals"]={ "mitered", "rounded", "beveled", "butt", "squared", "eps", "epsilon", "infinity", "bboxmargin", "ahlength", "ahangle", "labeloffset", "dotlabeldiam", "defaultpen", "defaultscale", "join_radius", "pen_lft", "pen_rt", "pen_top", "pen_bot" }, - ["primitives"]={ "charcode", "day", "linecap", "linejoin", "miterlimit", "month", "pausing", "prologues", "showstopping", "time", "tracingcapsules", "tracingchoices", "mpprocset", "tracingcommands", "tracingequations", "tracinglostchars", "tracingmacros", "tracingonline", "tracingoutput", "tracingrestores", "tracingspecs", "tracingstats", "tracingtitles", "truecorners", "warningcheck", "year", "false", "nullpicture", "pencircle", "true", "and", "angle", "arclength", "arctime", "ASCII", "boolean", "bot", "char", "color", "cosd", "cycle", "decimal", "directiontime", "floor", "fontsize", "hex", "infont", "intersectiontimes", "known", "length", "llcorner", "lrcorner", "makepath", "makepen", "mexp", "mlog", "normaldeviate", "not", "numeric", "oct", "odd", "or", "path", "pair", "pen", "penoffset", "picture", "point", "postcontrol", "precontrol", "reverse", "rotated", "scaled", "shifted", "sind", "slanted", "sqrt", "str", "string", "subpath", "substring", "transform", "transformed", "ulcorner", "uniformdeviate", "unknown", "urcorner", "xpart", "xscaled", "xxpart", "xypart", "ypart", "yscaled", "yxpart", "yypart", "zscaled", "addto", "clip", "input", "interim", "let", "newinternal", "save", "setbounds", "shipout", "show", "showdependencies", "showtoken", "showvariable", "special", "begingroup", "endgroup", "of", "curl", "tension", "and", "controls", "reflectedabout", "rotatedaround", "interpath", "on", "off", "beginfig", "endfig", "def", "vardef", "enddef", "expr", "suffix", "text", "primary", "secondary", "tertiary", "primarydef", "secondarydef", "tertiarydef", "randomseed", "also", "contour", "doublepath", "withcolor", "withpen", "dashed", "if", "else", "elseif", "fi", "for", "endfor", "forever", "exitif", "forsuffixes", "downto", "upto", "step", "until", "charlist", "extensible", "fontdimen", "headerbyte", "kern", "ligtable", "boundarychar", "chardp", "charext", "charht", "charic", "charwd", "designsize", "fontmaking", "charexists", "cullit", "currenttransform", "gfcorners", "grayfont", "hround", "imagerules", "lowres_fix", "nodisplays", "notransforms", "openit", "displaying", "currentwindow", "screen_rows", "screen_cols", "pixels_per_inch", "cull", "display", "openwindow", "numspecial", "totalweight", "autorounding", "fillin", "proofing", "tracingpens", "xoffset", "chardx", "granularity", "smoothing", "turningcheck", "yoffset", "chardy", "hppp", "tracingedges", "vppp", "extra_beginfig", "extra_endfig", "mpxbreak", "endinput", "message", "delimiters", "turningnumber", "errmessage", "readstring", "scantokens", "end", "outer", "inner", "write", "to", "readfrom", "withprescript", "withpostscript", "top", "bot", "lft", "rt", "ulft", "urt", "llft", "lrt", "redpart", "greenpart", "bluepart", "cyanpart", "magentapart", "yellowpart", "blackpart", "greypart", "rgbcolor", "cmykcolor", "greycolor", "graycolor", "colormodel", "graypart", "expandafter" }, + ["primitives"]={ "charcode", "day", "linecap", "linejoin", "miterlimit", "month", "pausing", "prologues", "showstopping", "time", "tracingcapsules", "tracingchoices", "mpprocset", "tracingcommands", "tracingequations", "tracinglostchars", "tracingmacros", "tracingonline", "tracingoutput", "tracingrestores", "tracingspecs", "tracingstats", "tracingtitles", "truecorners", "warningcheck", "year", "false", "nullpicture", "pencircle", "true", "and", "angle", "arclength", "arctime", "ASCII", "boolean", "bot", "char", "color", "cosd", "cycle", "decimal", "directiontime", "floor", "fontsize", "hex", "infont", "intersectiontimes", "known", "length", "llcorner", "lrcorner", "makepath", "makepen", "mexp", "mlog", "normaldeviate", "not", "numeric", "oct", "odd", "or", "path", "pair", "pen", "penoffset", "picture", "point", "postcontrol", "precontrol", "reverse", "rotated", "scaled", "shifted", "sind", "slanted", "sqrt", "str", "string", "subpath", "substring", "transform", "transformed", "ulcorner", "uniformdeviate", "unknown", "urcorner", "xpart", "xscaled", "xxpart", "xypart", "ypart", "yscaled", "yxpart", "yypart", "zscaled", "addto", "clip", "input", "interim", "let", "newinternal", "save", "setbounds", "shipout", "show", "showdependencies", "showtoken", "showvariable", "special", "begingroup", "endgroup", "of", "curl", "tension", "and", "controls", "interpath", "on", "off", "def", "vardef", "enddef", "expr", "suffix", "text", "primary", "secondary", "tertiary", "primarydef", "secondarydef", "tertiarydef", "randomseed", "also", "contour", "doublepath", "withcolor", "withpen", "dashed", "if", "else", "elseif", "fi", "for", "endfor", "forever", "exitif", "forsuffixes", "downto", "upto", "step", "until", "charlist", "extensible", "fontdimen", "headerbyte", "kern", "ligtable", "boundarychar", "chardp", "charext", "charht", "charic", "charwd", "designsize", "fontmaking", "charexists", "cullit", "currenttransform", "gfcorners", "grayfont", "hround", "imagerules", "lowres_fix", "nodisplays", "notransforms", "openit", "displaying", "currentwindow", "screen_rows", "screen_cols", "pixels_per_inch", "cull", "display", "openwindow", "numspecial", "totalweight", "autorounding", "fillin", "proofing", "tracingpens", "xoffset", "chardx", "granularity", "smoothing", "turningcheck", "yoffset", "chardy", "hppp", "tracingedges", "vppp", "extra_beginfig", "extra_endfig", "mpxbreak", "endinput", "message", "delimiters", "turningnumber", "errmessage", "readstring", "scantokens", "end", "outer", "inner", "write", "to", "readfrom", "withprescript", "withpostscript", "top", "bot", "lft", "rt", "ulft", "urt", "llft", "lrt", "redpart", "greenpart", "bluepart", "cyanpart", "magentapart", "yellowpart", "blackpart", "greypart", "rgbcolor", "cmykcolor", "greycolor", "graycolor", "colormodel", "graypart", "expandafter" }, ["shortcuts"]={ "..", "...", "--", "---", "&" }, ["tex"]={ "btex", "etex", "verbatimtex" }, }
\ No newline at end of file diff --git a/context/data/scite/lexers/scite-context-lexer-lua-longstring.lua b/context/data/scite/lexers/scite-context-lexer-lua-longstring.lua new file mode 100644 index 000000000..dd58dfe3b --- /dev/null +++ b/context/data/scite/lexers/scite-context-lexer-lua-longstring.lua @@ -0,0 +1,22 @@ +local lexer = lexer +local token = lexer.token +local P = lpeg.P + +module(...) + +local stringlexer = _M + +local whitespace = stringlexer.WHITESPACE -- triggers states + +local space = lexer.space +local nospace = 1 - space + +local p_spaces = token(whitespace, space ^1) +local p_string = token("string", nospace^1) + +_rules = { + { "whitespace", p_spaces }, + { "string", p_string }, +} + +_tokenstyles = lexer.context.styleset diff --git a/context/data/scite/lexers/scite-context-lexer-lua.lua b/context/data/scite/lexers/scite-context-lexer-lua.lua index a9006e44f..bb1a6c1d9 100644 --- a/context/data/scite/lexers/scite-context-lexer-lua.lua +++ b/context/data/scite/lexers/scite-context-lexer-lua.lua @@ -10,6 +10,7 @@ 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 setmetatable = setmetatable local global = _G -- beware: all multiline is messy, so even if it's no lexer, it should be an embedded lexer @@ -61,30 +62,32 @@ local longonestring = (1-longonestop)^0 local longtwostart = P('[') * Cmt(equals,setlevel) * P('[') local longtwostop = P(']') * equals * P(']') +local sentinels = { } setmetatable(sentinels, { __index = function(t,k) local v = "]" .. k .. "]" t[k] = v return v end }) + local longtwostring = P(function(input,index) if level then - local sentinel = ']' .. level .. ']' + -- local sentinel = ']' .. level .. ']' + local sentinel = sentinels[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) + local longtwostring_body = longtwostring + + local longtwostring_end = P(function(input,index) + if level then + -- local sentinel = ']' .. level .. ']' + local sentinel = sentinels[level] + local _, stop = find(input,sentinel,index,true) + return stop and stop + 1 or #input + 1 + end + end) + +local longcomment = Cmt(#('[[' + ('[' * C(equals) * '[')), function(input,index,level) + -- local sentinel = ']' .. level .. ']' + local sentinel = sentinels[level] + local _, stop = find(input,sentinel,index,true) return stop and stop + 1 or #input + 1 end) @@ -105,7 +108,7 @@ local shortcomment = token("comment", dashes * lexer.nonnewline^0) local longcomment = token("comment", dashes * longcomment) -- fails on very long string with \ at end of lines (needs embedded lexer) --- and also on newline before " but it makes no sense to waste tiem on it +-- and also on newline before " but it makes no sense to waste time on it local shortstring = token("quote", dquote) * token("string", (escaped + (1-dquote))^0) @@ -122,7 +125,10 @@ local longstring = token("quote", longonestart) * token("quote", longtwostop) local string = shortstring - + longstring +-- + longstring + + local longstringlexer = lexer.load("scite-context-lexer-lua-longstring") + lexer.embed_lexer(lualexer, longstringlexer, token("quote",longtwostart), token("string",longtwostring_body) * token("quote",longtwostring_end)) local integer = P('-')^-1 * (lexer.hex_num + lexer.dec_num) local number = token("number", lexer.float + integer) diff --git a/context/data/scite/lexers/scite-context-lexer-mps.lua b/context/data/scite/lexers/scite-context-lexer-mps.lua index 02273ad04..22338b351 100644 --- a/context/data/scite/lexers/scite-context-lexer-mps.lua +++ b/context/data/scite/lexers/scite-context-lexer-mps.lua @@ -14,29 +14,53 @@ local type = type module(...) -local metafunlexer = _M +local metafunlexer = _M -local context = lexer.context +local context = lexer.context -local metafunhelpers = { } -local metafunconstants = { } -local plaincommands = { } -local primitivecommands = { } +local metapostprimitives = { } +local metapostinternals = { } +local metapostshortcuts = { } +local metapostcommands = { } + +local metafuninternals = { } +local metafunshortcuts = { } +local metafuncommands = { } + +local mergedshortcuts = { } +local mergedinternals = { } do local definitions = context.loaddefinitions("scite-context-data-metapost") if definitions then - plaincommands = definitions.plain or { } - primitivecommands = definitions.primitives or { } + metapostprimitives = definitions.primitives or { } + metapostinternals = definitions.internals or { } + metapostshortcuts = definitions.shortcuts or { } + metapostcommands = definitions.commands or { } end local definitions = context.loaddefinitions("scite-context-data-metafun") if definitions then - metafunhelpers = definitions.helpers or { } - metafunconstants = definitions.constants or { } + metafuninternals = definitions.internals or { } + metafunshortcuts = definitions.shortcuts or { } + metafuncommands = definitions.commands or { } + end + + for i=1,#metapostshortcuts do + mergedshortcuts[#mergedshortcuts+1] = metapostshortcuts[i] + end + for i=1,#metafunshortcuts do + mergedshortcuts[#mergedshortcuts+1] = metafunshortcuts[i] + end + + for i=1,#metapostinternals do + mergedinternals[#mergedinternals+1] = metapostinternals[i] + end + for i=1,#metafuninternals do + mergedinternals[#mergedinternals+1] = metafuninternals[i] end end @@ -57,13 +81,17 @@ local cstokentex = R("az","AZ","\127\255") + S("@!?_") local spacing = token(whitespace, space^1) local rest = token('default', any) local comment = token('comment', P('%') * (1-S("\n\r"))^0) -local constant = token('data', exact_match(metafunconstants)) -local helper = token('command', exact_match(metafunhelpers)) -local plain = token('plain', exact_match(plaincommands)) +local internal = token('reserved', exact_match(mergedshortcuts,false)) +local shortcut = token('data', exact_match(mergedinternals)) +local helper = token('command', exact_match(metafuncommands)) +local plain = token('plain', exact_match(metapostcommands)) local quoted = token('quote', dquote) * token('string', P(1-dquote)^0) * token('quote', dquote) -local primitive = token('primitive', exact_match(primitivecommands)) +local texstuff = token('quote', P("btex ") + P("verbatimtex ")) + * token('string', P(1-P(" etex"))^0) + * token('quote', P(" etex")) +local primitive = token('primitive', exact_match(metapostprimitives)) local identifier = token('default', cstoken^1) local number = token('number', number) local grouping = token('grouping', S("()[]{}")) -- can be an option @@ -74,10 +102,12 @@ local extra = token('extra', S("`~%^&_-+*/\'|\\")) _rules = { { 'whitespace', spacing }, { 'comment', comment }, - { 'constant', constant }, + { 'internal', internal }, + { 'shortcut', shortcut }, { 'helper', helper }, { 'plain', plain }, { 'primitive', primitive }, + { 'texstuff', texstuff }, { 'identifier', identifier }, { 'number', number }, { 'quoted', quoted }, diff --git a/context/data/scite/lexers/themes/scite-context-theme.lua b/context/data/scite/lexers/themes/scite-context-theme.lua index f8554971d..ce959e721 100644 --- a/context/data/scite/lexers/themes/scite-context-theme.lua +++ b/context/data/scite/lexers/themes/scite-context-theme.lua @@ -71,6 +71,7 @@ style_string = style { fore = colors.magenta } style_keyword = style { fore = colors.blue, bold = true } style_char = style { fore = colors.magenta } +style_reserved = style { fore = colors.magenta, bold = true } style_class = style { fore = colors.black, bold = true } style_constant = style { fore = colors.cyan, bold = true } style_definition = style { fore = colors.black, bold = true } @@ -104,6 +105,7 @@ lexer.context.styles = { ["comment"] = style_comment, ["keyword"] = style_keyword, ["string"] = style_string, + ["reserved"] = style_reserved, ["command"] = style { fore = colors.green, bold = true }, ["preamble"] = style_comment, diff --git a/context/data/scite/scite-context-data-metafun.properties b/context/data/scite/scite-context-data-metafun.properties index b8098c9b1..4beb70265 100644 --- a/context/data/scite/scite-context-data-metafun.properties +++ b/context/data/scite/scite-context-data-metafun.properties @@ -42,5 +42,10 @@ center epsed anchored originpath infinite \ break xstretched ystretched snapped pathconnectors \ function constructedpath constructedpairs punkedfunction curvedfunction \ tightfunction punkedpath curvedpath tightpath punkedpairs \ -curvedpairs tightpairs evenly oddly drawboundary +curvedpairs tightpairs evenly oddly normalfill \ +normaldraw visualizepaths naturalizepaths drawboundary drawwholepath \ +visualizeddraw visualizedfill draworigin drawboundingbox drawpath \ +drawpoint drawpoints drawcontrolpoints drawcontrollines drawpointlabels \ +drawlineoptions drawpointoptions drawcontroloptions drawlabeloptions draworiginoptions \ +drawboundoptions drawpathoptions resetdrawoptions diff --git a/context/data/scite/scite-context-data-metapost.properties b/context/data/scite/scite-context-data-metapost.properties index 71387bab7..d2027c956 100644 --- a/context/data/scite/scite-context-data-metapost.properties +++ b/context/data/scite/scite-context-data-metapost.properties @@ -22,63 +22,63 @@ yypart zscaled addto clip input \ interim let newinternal save setbounds \ shipout show showdependencies showtoken showvariable \ special begingroup endgroup of curl \ -tension and controls reflectedabout rotatedaround \ -interpath on off beginfig endfig \ -def vardef enddef expr suffix \ -text primary secondary tertiary primarydef \ -secondarydef tertiarydef randomseed also contour \ -doublepath withcolor withpen dashed if \ -else elseif fi for endfor \ -forever exitif forsuffixes downto upto \ -step until charlist extensible fontdimen \ -headerbyte kern ligtable boundarychar chardp \ -charext charht charic charwd designsize \ -fontmaking charexists cullit currenttransform gfcorners \ -grayfont hround imagerules lowres_fix nodisplays \ -notransforms openit displaying currentwindow screen_rows \ -screen_cols pixels_per_inch cull display openwindow \ -numspecial totalweight autorounding fillin proofing \ -tracingpens xoffset chardx granularity smoothing \ -turningcheck yoffset chardy hppp tracingedges \ -vppp extra_beginfig extra_endfig mpxbreak endinput \ -message delimiters turningnumber errmessage readstring \ -scantokens end outer inner write \ -to readfrom withprescript withpostscript top \ -bot lft rt ulft urt \ -llft lrt redpart greenpart bluepart \ -cyanpart magentapart yellowpart blackpart greypart \ -rgbcolor cmykcolor greycolor graycolor colormodel \ -graypart expandafter +tension and controls interpath on \ +off def vardef enddef expr \ +suffix text primary secondary tertiary \ +primarydef secondarydef tertiarydef randomseed also \ +contour doublepath withcolor withpen dashed \ +if else elseif fi for \ +endfor forever exitif forsuffixes downto \ +upto step until charlist extensible \ +fontdimen headerbyte kern ligtable boundarychar \ +chardp charext charht charic charwd \ +designsize fontmaking charexists cullit currenttransform \ +gfcorners grayfont hround imagerules lowres_fix \ +nodisplays notransforms openit displaying currentwindow \ +screen_rows screen_cols pixels_per_inch cull display \ +openwindow numspecial totalweight autorounding fillin \ +proofing tracingpens xoffset chardx granularity \ +smoothing turningcheck yoffset chardy hppp \ +tracingedges vppp extra_beginfig extra_endfig mpxbreak \ +endinput message delimiters turningnumber errmessage \ +readstring scantokens end outer inner \ +write to readfrom withprescript withpostscript \ +top bot lft rt ulft \ +urt llft lrt redpart greenpart \ +bluepart cyanpart magentapart yellowpart blackpart \ +greypart rgbcolor cmykcolor greycolor graycolor \ +colormodel graypart expandafter keywordclass.metapost.commands=\ -arrowhead currentpen currentpicture cuttings \ -defaultfont extra_beginfig extra_endfig ditto EOF \ -down evenly fullcircle halfcircle identity \ -in left origin pensquare quartercircle \ -right unitsquare up withdots abs \ -bbox ceiling center cutafter cutbefore \ -dir directionpoint div dotprod intersectionpoint \ -inverse mod round unitvector whatever \ -cutdraw draw drawarrow drawdblarrow fill \ -filldraw drawdot loggingall interact tracingall \ -tracingnone pickup undraw unfill unfilldraw \ -buildcycle dashpattern decr dotlabel dotlabels \ -drawoptions incr label labels max \ -min thelabel z beginchar blacker \ -capsule_end change_width define_blacker_pixels define_corrected_pixels define_good_x_pixels \ -define_good_y_pixels define_horizontal_corrected_pixels define_pixels define_whole_blacker_pixels define_whole_pixels \ -define_whole_vertical_blacker_pixels define_whole_vertical_pixels endchar extra_beginchar extra_endchar \ -extra_setup font_coding_scheme clearxy clearit clearpen \ -shipit font_extra_space exitunless relax hide \ -gobble gobbled stop blankpicture counterclockwise \ -tensepath takepower direction softjoin makelabel \ -rotatedabout flex superellipse erase image \ -nullpen savepen clearpen penpos penlabels \ -range numtok thru z laboff \ -bye red green blue cyan \ -magenta yellow black white background \ -graypart graycolor mm pt dd \ -bp cm pc cc in +beginfig endfig rotatedaround reflectedabout \ +arrowhead currentpen currentpicture cuttings defaultfont \ +extra_beginfig extra_endfig ditto EOF down \ +evenly fullcircle halfcircle identity in \ +left origin pensquare quartercircle right \ +unitsquare up withdots abs bbox \ +ceiling center cutafter cutbefore dir \ +directionpoint div dotprod intersectionpoint inverse \ +mod round unitvector whatever cutdraw \ +draw drawarrow drawdblarrow fill filldraw \ +drawdot loggingall interact tracingall tracingnone \ +pickup undraw unfill unfilldraw buildcycle \ +dashpattern decr dotlabel dotlabels drawoptions \ +incr label labels max min \ +thelabel z beginchar blacker capsule_end \ +change_width define_blacker_pixels define_corrected_pixels define_good_x_pixels define_good_y_pixels \ +define_horizontal_corrected_pixels define_pixels define_whole_blacker_pixels define_whole_pixels define_whole_vertical_blacker_pixels \ +define_whole_vertical_pixels endchar extra_beginchar extra_endchar extra_setup \ +font_coding_scheme clearxy clearit clearpen shipit \ +font_extra_space exitunless relax hide gobble \ +gobbled stop blankpicture counterclockwise tensepath \ +takepower direction softjoin makelabel rotatedabout \ +flex superellipse erase image nullpen \ +savepen clearpen penpos penlabels range \ +numtok thru z laboff bye \ +red green blue cyan magenta \ +yellow black white background graypart \ +graycolor mm pt dd bp \ +cm pc cc in keywordclass.metapost.tex=\ btex etex verbatimtex |