summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/base/buff-imp-mp.lua
diff options
context:
space:
mode:
authorMojca Miklavec <mojca.miklavec@gmail.com>2012-05-14 17:38:55 +0000
committerMojca Miklavec <mojca.miklavec@gmail.com>2012-05-14 17:38:55 +0000
commit15995e10bfc68edf79970c4ea4fbb6678566c46e (patch)
tree2de7ca2a83f2d37ef043ad7429a5cb945bb79ddb /Master/texmf-dist/tex/context/base/buff-imp-mp.lua
parentc9a39f716f1e5ec820ed3aab2c9aef25c5a9d730 (diff)
ConTeXt 2012.05.14 16:00
git-svn-id: svn://tug.org/texlive/trunk@26371 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/context/base/buff-imp-mp.lua')
-rw-r--r--Master/texmf-dist/tex/context/base/buff-imp-mp.lua115
1 files changed, 24 insertions, 91 deletions
diff --git a/Master/texmf-dist/tex/context/base/buff-imp-mp.lua b/Master/texmf-dist/tex/context/base/buff-imp-mp.lua
index 6b8a2653661..f219df79753 100644
--- a/Master/texmf-dist/tex/context/base/buff-imp-mp.lua
+++ b/Master/texmf-dist/tex/context/base/buff-imp-mp.lua
@@ -6,98 +6,15 @@ if not modules then modules = { } end modules ['buff-imp-mp'] = {
license = "see context related readme files"
}
-local P, S, V, patterns = lpeg.P, lpeg.S, lpeg.V, lpeg.patterns
-
-local primitives = table.tohash {
- 'charcode', 'day', 'linecap', 'linejoin', 'miterlimit', 'month', 'pausing',
- 'prologues', 'showstopping', 'time', 'tracingcapsules', 'tracingchoices',
- 'tracingcommands', 'tracingequations', 'tracinglostchars',
- 'tracingmacros', 'tracingonline', 'tracingoutput', 'tracingrestores',
- 'tracingspecs', 'tracingstats', 'tracingtitles', 'truecorners',
- 'warningcheck', 'year', 'mpprocset',
- 'false', 'nullpicture', 'pencircle', 'true',
- 'and', 'angle', 'arclength', 'arctime', 'ASCII', 'bluepart', 'boolean', 'bot',
- 'char', 'color', 'cosd', 'cycle', 'decimal', 'directiontime', 'floor', 'fontsize',
- 'greenpart', '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', 'redpart', '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', 'epxr', 'suffix', 'text', 'primary', 'secondary',
- 'tertiary', 'primarydef', 'secondarydef', 'tertiarydef', 'top', 'bottom',
- 'ulft', 'urt', 'llft', 'lrt', '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',
- 'end', 'btex', 'etex', 'verbatimtex'
-}
-
-local plain = table.tohash {
- 'ahangle', 'ahlength', 'bboxmargin', 'defaultpen', 'defaultscale',
- 'labeloffset', 'background', 'currentpen', 'currentpicture', 'cuttings',
- 'defaultfont', 'extra_beginfig', 'extra_endfig',
- 'beveled', 'black', 'blue', 'bp', 'butt', 'cc', 'cm', 'dd', 'ditto', 'down', 'epsilon',
- 'evenly', 'fullcircle', 'green', 'halfcircle', 'identity', 'in', 'infinity', 'left',
- 'mitered', 'mm', 'origin', 'pensquare', 'pt', 'quartercircle', 'red', 'right',
- 'rounded', 'squared', 'unitsquare', 'up', 'white', 'withdots',
- 'abs', 'bbox', 'ceiling', 'center', 'cutafter', 'cutbefore', 'dir',
- 'directionpoint', 'div', 'dotprod', 'intersectionpoint', 'inverse', 'mod', 'lft',
- 'round', 'rt', 'unitvector', 'whatever',
- 'cutdraw', 'draw', 'drawarrow', 'drawdblarrow', 'fill', 'filldraw', 'drawdot',
- 'loggingall', 'pickup', 'tracingall', 'tracingnone', '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',
- 'font_extra_space'
-}
+-- Now that we also use lpeg lexers in scite, we can share the keywords
+-- so we have moved the keyword lists to mult-mps.lua. Don't confuse the
+-- scite lexers with the ones we use here. Of course all those lexers
+-- boil down to doing similar things, but here we need more control over
+-- the rendering and have a different way of nesting. It is no coincidence
+-- that the coloring looks similar: both are derived from earlier lexing (in
+-- texedit, mkii and the c++ scite lexer).
-local metafun = table.tohash {
- 'unitcircle', 'fulldiamond', 'unitdiamond',
- 'halfcircle', 'quartercircle',
- 'llcircle', 'lrcircle', 'urcircle', 'ulcircle',
- 'tcircle', 'bcircle', 'lcircle', 'rcircle',
- 'lltriangle', 'lrtriangle', 'urtriangle', 'ultriangle',
- 'smoothed', 'cornered', 'superellipsed', 'randomized', 'squeezed',
- 'punked', 'curved', 'unspiked', 'simplified', 'blownup', 'stretched',
- 'paralled', 'enlonged', 'shortened',
- 'enlarged', 'leftenlarged', 'topenlarged', 'rightenlarged', 'bottomenlarged',
- 'llenlarged', 'lrenlarged', 'urenlarged', 'ulenlarged',
- 'llmoved', 'lrmoved', 'urmoved', 'ulmoved',
- 'boundingbox', 'innerboundingbox', 'outerboundingbox',
- 'bottomboundary', 'leftboundary', 'topboundary', 'rightboundary',
- 'xsized', 'ysized', 'xysized',
- 'cmyk', 'transparent', 'withshade', 'spotcolor',
- 'drawfill', 'undrawfill',
- 'inverted', 'uncolored', 'softened', 'grayed',
- 'textext', 'graphictext',
- 'loadfigure', 'externalfigure'
-}
+local P, S, V, patterns = lpeg.P, lpeg.S, lpeg.V, lpeg.patterns
local context = context
local verbatim = context.verbatim
@@ -116,7 +33,23 @@ local MetapostSnippetNamePlain = verbatim.MetapostSnippetNamePlain
local MetapostSnippetNameMetafun = verbatim.MetapostSnippetNameMetafun
local MetapostSnippetName = verbatim.MetapostSnippetName
+local primitives, plain, metafun
+
+local function initialize()
+ local mps = dofile(resolvers.findfile("mult-mps.lua","tex")) or {
+ primitives = { },
+ plain = { },
+ metafun = { },
+ }
+ primitives = table.tohash(mps.primitives)
+ plain = table.tohash(mps.plain)
+ metafun = table.tohash(mps.metafun)
+end
+
local function visualizename(s)
+ if not primitives then
+ initialize()
+ end
if primitives[s] then
MetapostSnippetNamePrimitive(s)
elseif plain[s] then