% language=us runpath=texruns:manuals/luametafun

% eoclip: no postscript possible yet
%
% mpprocset mpxbreak

% make native:
%
% **

% iteratorindex deltaiteratorindex

% path expression -> path

% undraw unfill etc can go

\usemodule[syntax]

\startcomponent luametafun-syntax

\environment luametafun-style

% \showframe

\startchapter[title={\METAPOST\ syntax}]

% \startsection[title={Syntax diagrams}]

The following syntax diagrams are similar to the diagrams in the \METAPOST\
manual but also describe the additional primitives in the libraries that come
with \LUATEX\ and more important \LUAMETATEX, because there the repertoire has
been extended considerably. The \mathematics {\rightarrow} represents \quote
{means} and the \mathematics {\vert} symbol stands for \quote {or}.

The diagrams describe the hard coded \METAPOST\ syntax as well as most of the
macros and variables defined in the plain \METAPOST\ format that belongs to the
core of the system. We also cover the extensions that \LUAMETATEX\ provides. The
diagrams also include most of the fundamental \METAFUN\ and \LUAMETAFUN\
commands. We have omitted the \METAPOST\ and \METAFONT\ commands that make no
sense any more or are irrelevant for common usage. Specific, more high level,
commands are discussed in the \METAFUN\ and \LUAMETAFUN\ manuals. There we also
discuss preferred color and transparency directives. In \LUAMETAFUN\ the more
configurable commands are in the \type{lmt_} namespace.

\start \switchtobodyfont[8pt] % small]

% setproperty
% everyjob
% maketext
% quote
% bytema see end
% void

\StartSyntax
\S {atom}
    \M \S {variable} \S {argument}
    \O \S {number or fraction}
    \O \S {internal variable}
    \O \( \S {expression} \)
    \O \L {begingroup} \S {statement list} \S {expression} \L {endgroup}
    \O \S {nullary op}
    \O \L {btex} \S {typesetting command} \L {etex}
    \O \S {pseudo function}
\StopSyntax

\StartSyntax
\S {primary}
    \M \S {atom}
    \O \( \S {numeric expression} \L{,} \S {numeric expression} \)
    \O \( \S {numeric expression} \L{,} \S {numeric expression} \L{,} \S {numeric expression} \)
    \O \( \S {numeric expression} \L{,} \S {numeric expression} \L{,} \S {numeric expression} \L{,} \S {numeric expression} \)
    \O \S {of operator} \S {expression} \L {of} \S {primary}
    \O \S {numeric expression} \S {expression} \FL {along} \S {path expression}
    \O \S {numeric expression} \S {expression} \FL {on} \S {path expression}
    \O \S {unary op} \S {primary}
    \O \L {str} \S {suffix}
    \O \L{z} \S {suffix}
    \O \S {numeric atom} \[ \S {expression} \L{,} \S {expression} \]
    \O \S {scalar multiplication op} \S {primary}
    \O \S {color expression} \FL {shadedinto} \S {color expression}
    \O \S {picture expression} \FL {asgroup} \S {string expression}
    \O \S {picture expression} \FL {onlayer} \S {string expression}
    \O \S {path operator} \S {primary}
\StopSyntax

\StartSyntax
\S {secondary}
    \M \S {primary}
    \O \S {secondary} \S {primary binop} \S {primary}
    \O \S {secondary} \S {transformer}
\StopSyntax

\StartSyntax
\S {tertiary}
    \M \S {secondary}
    \O \S {tertiary} \S {secondary binop} \S {secondary}
\StopSyntax

\StartSyntax
\S {subexpression}
    \M \S {tertiary}
    \O \S {path expression} \S {path join} \S {path knot}
\StopSyntax

\StartSyntax
\S {expression}
    \M \S {subexpression}
    \O \S {expression} \S {tertiary binop} \S {tertiary}
    \O \S {path subexpression} \S {direction specifier}
    \O \S {path subexpression} \S {continuation specifier}
    \O \S {path subexpression} \S {path join} \S {cycle specifier}
\StopSyntax

\StartSyntax
\S {string expression}
    \M \( \L {"} \L {,} \L {'} \) \S {string} \( \L {"} \L {,} \L {'} \)
\StopSyntax

\StartSyntax
\S {cycle specifier}
    \M \L {cycle} \O \FL {nocycle} \O \FL {recycle}
\StopSyntax

\StartSyntax
\S {continuation specifier}
    \M \FL {xabsolute} \O \FL {yabsolute} \O \FL {xyabsolute}
    \O \FL {xrelative} \O \FL {yrelative} \O \FL {xrelative}
\StopSyntax

\StartSyntax
\S {path knot}
    \M \S {tertiary}
\StopSyntax

\StartSyntax
\S {path join}
    \M \L{--} \O \L{---}
    \O \S {direction specifier} \S {basic path join} \S {direction specifier}
\StopSyntax

\StartSyntax
\S {direction specifier}
    \M \S {empty}
    \O \{ \L {curl} \S {numeric expression} \}
    \O \{ \S {pair expression} \}
    \O \{ \S {numeric expression} \L {,} \S {numeric expression} \}
\StopSyntax

\StartSyntax
\S {basic path join}
    \M \L {..}
    \O \L {...}
    \O \L {..} \S {tension} \L {..}
    %O \L {..} \S {tension} \L {..} % check what got lost here
    \O \L {..} \S {controls} \L {..}
    \O \L {..} \L {firstcontrol}  \S {pair primary}
    \O \L {..} \L {secondcontrol} \S {pair primary}
\StopSyntax

\StartSyntax % atleast added
\S {tension}
    \M \L {tension} \S {numeric primary}
    \O \L {tension} \L {atleast} \S {numeric primary}
    \O \L {tension} \S {numeric primary} \L {and} \S {numeric primary}
\StopSyntax

\StartSyntax
\S {controls}
    \M controls \S {pair primary}
    \O controls \S {pair primary} \L {and} \S {pair primary}
\StopSyntax

\StartSyntax
\S {argument}
    \M \S {symbolic token}
\StopSyntax

\StartSyntax
\S {number or fraction}
    \M \S {number} \L {/} \S {number}
    \O \S {number} \Q{not followed by} \L {/} \S {number}
\StopSyntax

\StartSyntax
\S {scalar multiplication op}
    \M \L {+} \O \L {-}
    \O \S {number or fraction} \Q{not followed by} \S {add op} \S {number}
\StopSyntax

\StartSyntax
\S {transformer}
    \M \L  {rotated}               \S {numeric primary}
    \O \L  {scaled}                \S {numeric primary} %
    \O \L  {xscaled}               \S {numeric primary} %
    \O \L  {yscaled}               \S {numeric primary}
    \O \L  {zscaled}               \S {pair primary} %
    \O \L  {xyscaled}              \S {numeric or pair primary}
    \O \L  {shifted}               \S {pair primary} %
    \O \L  {xshifted}              \S {numeric primary} %
    \O \L  {yshifted}              \S {numeric primary}
    \O \L  {slanted}               \S {numeric primary}
    \O \L  {transformed}           \S {transform primary}
    \O \FL {reflectedabout}        \( \S {pair expression} \L {,} \S {pair expression} \)
    \O \FL {mirroredabout}         \S {pair expression}
    \O \FL {rotatedaround}         \( \S {pair expression} \L {,} \S {numeric expression} \)
    \O \FL {xsized}                \S {numeric primary} \O \FL {ysized} \S {numeric primary} \O \FL {xysized} \S {numeric or pair primary}
    \O \FL {blownup}               \S {numeric or pair primary}
    \O \FL {enlarged}              \S {numeric or pair primary}
    \O \FL {leftenlarged}          \S {numeric primary} \O \FL {llenlarged} \S {numeric primary} \O \FL {llmoved} \S {numeric primary}
    \O \FL {rightenlarged}         \S {numeric primary} \O \FL {lrenlarged} \S {numeric primary} \O \FL {lrmoved} \S {numeric primary}
    \O \FL {topenlarged}           \S {numeric primary} \O \FL {urenlarged} \S {numeric primary} \O \FL {urmoved} \S {numeric primary}
    \O \FL {bottomenlarged}        \S {numeric primary} \O \FL {ulenlarged} \S {numeric primary} \O \FL {ulmoved} \S {numeric primary}
    \O \FL {xstretched}            \S {numeric primary} \O \FL {ystretched} \S {numeric primary} \O \FL {stretched} \S {numeric or pair primary}
    \O \FL {shortened}             \S {numeric or pair primary}
    \O \FL {enlonged}              \S {numeric or pair primary}
    \O \FL {crossed}               \S {numeric primary}
    \O \FL {paralelled}            \S {numeric primary}
    \O \FL {enveloped}             \S {numeric primary}
    \O \FL {scrutinized}           \S {numeric primary}
    \O \FL {recycled}              \S {numeric primary}
    \O \FL {smoothcornered}        \S {numeric primary}
    \O \FL {maxsmoothcornered}     \S {numeric primary}
    \O \FL {paralleled}            \S {numeric primary}
    \O \FL {randomized}            \S {numeric or pair or color primary}
    \O \FL {randomizedcontrols}    \S {numeric or pair}
    \O \FL {randomrotatedcontrols} \S {numeric or pair}
    \O \FL {snapped}               \S {numeric or pair primary}
    \O \FL {cornered}              \S {numeric or pair}
    \O \FL {peepholed}             \S {path expression}
    \O \FL {smoothed}              \S {numeric or pair}
    \O \FL {squeezed}              \S {numeric or pair primary}
    \O \FL {superellipsed}         \S {numeric primary}
    \O \FL {randomshifted}         \S {numeric or pair primary}
    \O \FL {uncolored}             \S {color primary}
    \O \FL {softened}              \S {numeric or color primary}
    \O \FL {asgroup}               \S {string primary}
    \O \FL {gobbled}               \S {primary}
    %
    \O \FL {insideof}              \S {path expression}
    \O \FL {outsideof}             \S {path expression}
    \O \FL {crossingunder}         \S {path expression}
    \O \FL {closedcurve}           \S {path or pair expression}
    \O \FL {closedlines}           \S {path or pair expression}
    %
    \O \L  {bytemapscaled}         \S {numeric primary}
\StopSyntax

\StartSyntax
\S {numeric or pair primary}
    \M \S {numeric primary}
    \O \S {pair primary}
\StopSyntax

\StartSyntax
\S {numeric or pair or color primary}
    \M \S {numeric primary}
    \O \S {pair primary}
    \O \S {color primary}
\StopSyntax

\StartSyntax
\S {numeric or color primary}
    \M \S {numeric primary}
    \O \S {color primary}
\StopSyntax

\StartSyntax
\S {nullary op}
    \M \L  {false} \O \L {true}
    \O \L  {normaldeviate}
    \O \L  {nullpen} \O \L {nullpicture} \O \L {pencircle}
    \O \L  {pathpoint} \O \L {pathpostcontrol} \O \L {pathprecontrol} \O \L {pathxpart} \O \L {pathypart}
    \O \L  {pathfirst} \O \L {pathlast} \O \L  {pathindex} \O \L {pathlastindex} \O \L {pathlength} \O \L {pathstate}
    \O \L  {pathdirection} \O \L {pathunitdirection}
  % \O \FL {pathxypart}
    \O \L  {lastx} \O \L {lasty} \O \L {lastxy} \O \L {previousx} \O \L {previousy} \O \L {previousxy}
    \O \FL {whatever}
    \O \L  {readstring}
    \O \L  {mpversion}
\StopSyntax

% \O \FL {round}    % todo
% \O \FL {textual}  % gone
% \L {uncycle} \O

% split per argument type, now we have duplicates

\StartSyntax
\S {unary op}
    \M \S  {type}
    \O \L  {ASCII}
    \O \FL {byte}
    \O \FL {acos} \O \FL {acosh} \O \FL {acosd} \O \FL {asin} \O \FL {asinh} \O \FL {asind} \O \FL {atan} \O \FL {atand} \O \L {cosd}
    \O \FL {cos} \O \FL {cotd} \O \FL {cosh} \O \FL {sin} \O \L {sind} \O \FL {sinh} \O \FL {tan} \O \FL {tand} \O \FL {cot}
    \O \FL {inverse} \O \FL {inv} \O \FL {invcos} \O \FL {invsin} \O \FL {invtan}
    \O \FL {sqr} \O \L {sqrt} \O \FL {pow} \O \FL {exp} \O \L {mexp} \O \L {mlog} \O \FL {ln} \O \FL {log} \O \L {uniformdeviate}
    \O \FL {abs} \O \L {odd} \O \L {floor} \O \FL {ceiling} \O \FL {round}
    \O \FL {dir} \O \L {angle} \O \L {length} \O \L {nolength} \O \L {arclength} \O \L {segments}
    \O \FL {bbox} \O \FL {bbwidth} \O \FL {bbheight}
    \O \FL {bot} \O \FL {lft} \O \FL {rt} \O \FL {top} \O \FL {center}
    \O \FL {colordecimals} \O \L {decimal} \O \FL {ddecimal} \O \FL {dddecimal} \O \FL {ddddecimal} \O \FL {condition}
    \O \FL {tostring} \O \FL {topair} \O \FL {quote} \O \FL {quotation}
    \O \FL {boundingbox} \O \FL {outerboundingbox} \O \FL {innerboundingbox} \O \FL {bbox}
    \O \FL {colorpart} \O {fontpart} \O \L {pathpart} \O \L {penpart} \O \FL {textpart} \O \L {dashpart}
    \O \L  {redpart} \O \L {greenpart} \O \L {bluepart} \O \L {greypart} \O \FL {graypart}
    \O \L  {cyanpart} \O \L {magentapart} \O \L {yellowpart} \O \L {blackpart}
    \O \L  {postscriptpart} \O \L {prescriptpart} \O \L {stackingpart}
    \O \L  {clipped} \O \L {bounded} \O \L {stroked} \O \L {filled}
    \O \FL {punked} \O \FL {paralleled} \O {convexed}
    \O \FL {leftboundary} \O \FL {rightboundary} \O \FL {topboundary} \O \FL {bottomboundary}
%   \O \FL {leftpath} \O \FL {rightpath}
    \O \L  {xpart} \O \L {xxpart} \O \L {xypart} \O \L {ypart} \O \L {yxpart} \O \L {yypart}
    \O \L  {zpart} \O \L {wpart}
    \O \L  {xrange} \O {yrange}
    \O \L  {oct} \O \L {hex}
    \O \FL {colortype}
    \O \FL {grayed} \O \FL {greyed}
    \O \L  {llcorner} \O \L {lrcorner} \O \L {ulcorner} \O \L {urcorner} \O \L {corners}
    \O \L  {not} \O \L {known} \O \L {unknown}
    \O \FL {blackcolor} \O \FL {whitecolor} \O \L {colormodel}
    \O \L  {char} \O \FL {fontsize}
    \O \L  {cycle} \O \L {nocycle} \O \L {recycle}
    \O \L  {reverse} \O \L {uncontrolled} \O \FL {prunesingularities}
    \O \L  {makepath} \O \L {makepen} \O \L {makenep}
    \O \FL {unitvector}
    \O \L  {turningnumber}
    \O \FL {circularpath} \O \FL {squarepath} \O \FL {linearpath}
    \O \L  {deltapoint} \O \FL {deltapostscontrol} \O \L {deltaprecontrol} \O \L {deltadirection} \O \L {deltaunitdirection} \O \FL {deltapointarclength}
    \O \L  {centerof} \O \L {centerofmass} \O \L {singularity} \O \FL {counterclockwise}
    \O \L  {knownnormalize} \O \L {knownnorm}
    \O \FL {xnormalized} \O \FL {ynormalized} \O \FL {xynormalized}
    % maybe pseudo functions:
    \O \FL {area}
    \O \FL {inverted}
    \O \FL {simplified}
    \O \FL {unspiked}
    \O \FL {laddered}
    \O \FL {mirrored}
    \O \FL {curved}
    \O \FL {smoothened}
\StopSyntax

% gone: \O \L {outer} \O \L {inner}

\StartSyntax
\S {type}
    \M \L {boolean} \O \L {numeric} \O \L {pair} \O \L {path}
    \O \L {pen} \O \L {nep} \O \L {picture} \O \L {string} \O \L {transform}
    \O \L {color} \O \L {cmykcolor} \O \FL {greycolor} \O \FL {graycolor}\O \L {rgbcolor}
    \O \FL {property}\O \FL {transparency}
\StopSyntax

\StartSyntax
\S {primary binop}
    \M \L  {*} \O {^} \O \L {/} \O \L {**} \O \L {and}
    \O \FL {dotprod} \O \FL {crossprod} \O \FL {div} \O \FL {infont} \O \FL {mod}
\StopSyntax

\StartSyntax
\S {secondary binop}
    \M \L  {+} \O \L {-} \O \L {++} \O \L {+-+} \O \L {or}
    \O \FL {intersectionpoint} \O \L {intersectiontimes} \O \L {intersectiontimeslist}
    \O \L  {knowncrossprod} \O \L {knowndiv} \O \L {knowndotprod} \O \FL {knowndotmod}
\StopSyntax

\StartSyntax
\S {tertiary binop}
    \M \L  {&} \O \L {&&} \O \L {&&&} \O \L {&&&&}
    \O \L  {<} \O \L {<=} \O \L {<>} \O \L {=} \O \L {>} \O \L {>=}
    \O \FL {~} \O \FL {~~} \O \FL {~~~}
    \O \FL {cutafter} \O \FL {cutafterfirst} \O \FL {curafterlast}
    \O \FL {cutbefore} \O \FL {cutbeforefirst} \O \FL {cutbeforelast}
    \O \FL {cutends} \O \FL {softjoin}
\StopSyntax

% hm \O \FL {takepower}

\StartSyntax
\S {of operator}
    \M \L {arctime} \O \L {arcpoint}  \O \L {arcpointlist}
    \O \L {direction} \O \L {directiontime} \O \FL {directionpoint}
    \O \L {penoffset} \O \L {point} \O \L {segment}
    \O \L {postcontrol} \O \L {precontrol} \O \L {subpath} \O \L {subarclength} \O \L {substring}
    \O \L {boundingpath} \O \FL {enveloppe}
    \O \L {bytefound} \O \L {bytemapbounds} \O \L {bytepath} \O \L {bytevalue}
\StopSyntax

\StartSyntax
\S {path operator}
    \M \L {firstpoint} %
    \O \L {firstprecontrol} %
    \O \L {firstpostcontrol}
    \O \L {firstdirection} %
    \O \L {firstunitdirection}
    \O \L {lastpoint} %
    \O \L {lastprecontrol} %
    \O \L {lastpostcontrol} %
    \O \L {lastdirection} %
    \O \L {lastunitdirection}
\StopSyntax

\StartSyntax
\S {variable}
    \M \S {predefined numeric variable}
    \O \S {predefined path variable}
    \O \S {predefined picture variable}
    \O \S {predefined transform variable}
    \O \S {predefined pair variable}
    \O \S {predefined pen variable}
    \O \S {predefined string variable}
    \O \S {predefined dashpattern}
    \O \S {predefined rgbcolor variable}
    \O \S {predefined macro}
    \O \S {tag} \S {suffix}
\StopSyntax

\StartSyntax
\S {predefined numeric variable}
    \M \FL {nothing yet}
\StopSyntax

\StartSyntax
\S {predefined picture variable}
    \M \FL {blankpicture}
    \O \FL {currentpicture}
\StopSyntax

\StartSyntax
\S {predefined transform variable}
    \M \FL {identity} \O \FL {currenttransform}
\StopSyntax

\StartSyntax
\S {predefined path variable}
    \M \FL {originpath}
    \O \FL {fullcircle} \O \FL {fullsquare} \O \FL {fulldiamond} \O \FL {fulltriangle}
    \O \FL {unitcircle} \O \FL {unitsquare} \O \FL {unitdiamond} \O \FL {unittriangle}
    \O \FL {halfcircle} \O \FL {quartercircle}
    \O \FL {llcircle} \O \FL {lrcircle} \O \FL {urcircle} \O \FL {ulcircle}
    \O \FL {bcircle} \O \FL {tcircle} \O \FL {lcircle} \O \FL {rcircle}
    \O \FL {triangle}
    \O \FL {righttriangle} \O \FL {uptriangle} \O \FL {lefttriangle} \O \FL {downtriangle}
    \O \FL {lltriangle} \O \FL {lrtriangle} \O \FL {urtriangle} \O \FL {ultriangle}
    \O \FL {cuttings}
\StopSyntax

\StartSyntax
\S {predefined pair variable}
    \M \FL {right} \O \FL {up} \O \FL {left} \O \FL {down}
    \M \FL {shadedright} \O \FL {shadedup} \O \FL {shadedleft} \O \FL {shadeddown}
\StopSyntax

\StartSyntax
\S {predefined pen variable}
    \M \FL {pensquare} \O \FL {penrazor} \O \FL {penspec}
    \O \FL {currentpen}
\StopSyntax

\StartSyntax
\S {predefined string variable}
    \M \FL {EOF}
    \O \FL {CRLF} \O \FL {crlf}
    \O \FL {DQUOTE} \O \FL {dquote} \O \FL {ditto}
    \O \FL {SPACE} \O \FL {space}
    \O \FL {PERCENT} \O \FL {percent}
    \O \FL {defaultfont}
    \O \L  {extra_beginfig} \O \L {extra_endfig}
    \O \FL {pathconnectors}
\StopSyntax

\StartSyntax
\S {predefined dashpattern}
    \M \FL {evenly} \O \FL {oddly} \O \FL {withdots}
\StopSyntax

\StartSyntax
\S {predefined rgbcolor variable}
    \M \FL {red}  \O \FL {green}   \O \FL {blue}   \O \FL {white}
    \O \FL {cyan} \O \FL {magenta} \O \FL {yellow} \O \FL {black}
    \O \FL {background}
    \O \FL {basiccolors}
\StopSyntax

\StartSyntax
\S {predefined macro}
    \M \FL {shipit} \O \FL {bye}
    \O \FL {resetdrawoptions}
    \O \FL {visualizepaths} \O \FL {naturalizepaths}
\StopSyntax

\StartSyntax
\S {suffix}
    \M \S {empty}
    \O \S {suffix} \S {subscript}
    \O \S {suffix} \S {tag}
    \O \S {suffix parameter}
\StopSyntax

\StartSyntax
\S {subscript}
    \M \S {number}
    \O \[ \S {numeric expression} \]
\StopSyntax

%     \O \FL {outputformat} \O \FL {outputtemplate} \O \O \FL {prologues}

\StartSyntax
\S {internal variable}
    \M \FL {ahangle} \O \FL {ahlength}
    \O \FL {bboxmargin} \O \FL {labeloffset}
    \O \L  {charcode} \O \L {charht} \O \L {chardp} \O \L {charwd} \O \L {charic}
    \O \L  {defaultcolormodel} \O \L {defaultzeroangle} \O \FL {defaultpen} \O \FL {defaultscale}
    \O \L  {linecap} \O \L {linejoin} \O \L {miterlimit}
    \O \L  {intersectionprecision} \O \L {jointolerance}
    \O \L  {lessdigits} \O \L {numberprecision} \O \L {numbersystem}
    \O \L  {showstopping} \L {pausing}
    \O \L  {overloadmode} \O \L {jobname}
    \O \L  {tracingoutput} \O \L {tracingcapsules} \O \L {tracingchoices} \O \L {tracingcommands} \O \L {tracingequations}
    \O \FL {tracinglostchars}  \O \L {tracingmacros} \O \L {tracingonline} \O \L {tracingrestores} \O \L {tracingspecs}
    \O \L  {tracingstats} \O \L {tracingtitles} \O \L {tracingdependencies}
    \O \L  {truecorners} \O \L {warningcheck}
    \O \FL {dotlabeldiam}
    \O \L  {day} \O \L {month} \O \L {year} \O \L {hour} \O \L {minute}  \O \L {time}
    \O \FL {mm} \O \FL {pt} \O \FL {dd} \O \FL {bp} \O \FL {cm} \O \FL {pc} \O \FL {cc} \O \FL {in}
    \O \FL {butt} \O \FL {rounded} \O \FL {squared} \O \FL {mitered} \O \FL {beveled}
    \O \FL {pi} \O \FL {radian} \O \FL {eps} \O \FL {epsilon}
    \O \FL {nocolormodel} \O \FL {greycolormodel} \O \FL {graycolormodel} \O \FL {rgbcolormodel} \O \FL {cmykcolormodel}
  % \O \FL {shadefactor}
    \O \FL {textextoffset}
    \O \FL {maxdimensions}
    \O \L  {pruneoptions}
    \O \L  {restoreclipcolor}
    \O \FL {textscriptmode}
    \O \FL {textscriptmode}
    \O \L  {stacking}
    \O \FL {infinity}
    \O \FL {charscale}
    \O \FL {metapostversion}
    \O \FL {normaltransparent} \O \FL {multiplytransparent} \O \FL {screentransparent} \O \FL {overlaytransparent}
    \O \FL {softlighttransparent} \O \FL {hardlighttransparent} \O \FL {colordodgetransparent} \O \FL {colorburntransparent}
    \O \FL {darkentransparent} \O \FL {lightentransparent} \O \FL {differencetransparent} \O \FL {exclusiontransparent}
    \O \FL {huetransparent} \O \FL {saturationtransparent} \O \FL {colortransparent} \O \FL {luminositytransparent}
    \O \S  {symbolic token defined by \L {newinternal}}
    \O \FL {ahangle} \O \FL {ahlength}
    \O \FL {bboxmargin}
    \O \L  {pen_bot} \O \L {pen_top} \O \L {pen_lft} \O \L {pen_rt}
    \O \L  {join_radius}
    \O \FL {crossingscale} \O \FL {crossingoption}
\StopSyntax

\StartSyntax
\S {pseudo function}
    \M \FL {min}              \( \S {expression list} \)%
    \O \FL {max}              \( \S {expression list} \)
    \O \FL {incr}             \( \S {numeric variable} \)%
    \O \FL {decr}             \( \S {numeric variable} \)
    \O \FL {dashpattern}      \( \S {on/off list} \)
    \O \FL {interpath}        \( \S {numeric expression} \L {,} \S {path expression} \L {,} \S {path expression} \)
    \O \FL {interpolated}     \( \S {numeric expression} \L {,} \S {path expression} \L {,} \S {path expression} \)
    \O \FL {buildcycle}       \( \S {path expression list} \)
    \O \FL {thelabel}         \S {label suffix} \( \S {expression} \L {,} \S {pair expression} \)
    \O \FL {thefreelabel}     \( \S {expression}\L {,} \S {pair expression} \L {,} \S {pair expression} \)
    \O \FL {anglebetween}     \( \S {path expression} \L {,} \S {path expression} \L {,} \S {expression} \)
    \O \FL {flex}             \( \S {text} \)
    \O \FL {hide}             \( \S {text} \)
    \O \FL {gobble}           \S {primary}
    \O \FL {clearit}
    \O \FL {clearpen}
    \O \FL {clearxy}
    \O \FL {pointarrow}       \( \S {path expression} \L {,} \S {numeric or pair primary} \L {,} \S {numeric expression} \)
    \O \FL {centerarrow}      \( \S {path expression} \L {,} \S {numeric or pair primary} \L {,} \S {numeric expression} \)
    \O \FL {leftarrow}        \( \S {path expression} \L {,} \S {numeric or pair primary} \L {,} \S {numeric expression} \)
    \O \FL {rightarrow}       \( \S {path expression} \L {,} \S {numeric or pair primary} \L {,} \S {numeric expression} \)
    \O \FL {paired}           \( \S {numeric or pair} \)%
    \O \FL {tripled}          \( \S {numeric or color} \)
    \O \FL {remappedcolor}    \( \S {color expression} \)
    \O \FL {superellipse}     \( \S {numeric primary} \L {,} \S {numeric primary} \L {,} \S {numeric primary} \L {,} \L {numeric primary} \L {,} \N  \L {numeric primary} \)
    \O \FL {roundedsquare}    \( \S {numeric primary} \L {,} \S {numeric primary} \L {,} \S {numeric primary} \)
    \O \FL {roundedsquarexy}  \( \S {numeric primary} \L {,} \S {numeric primary} \L {,} \S {numeric primary} \)
    \O \FL {tensecircle}      \( \S {numeric primary} \L {,} \S {numeric primary} \L {,} \S {numeric primary} \L {,} \S {numeric primary} \)
    \O \FL {tensepath}        \S {path primary}
    \O \FL {sortedpath}       \S {path primary}
    \O \FL {uniquepath}       \S {path primary}
    \O \FL {(constructed)function}%
                             \( \S {string expression} \)%
                             \( \S {string primary} \L {,} \S {string primary} \L {,} \S {numeric primary} \L {,}
                             \N \S {numeric primary} \L {,} \S {numeric primary} \)
    \O \FL {straightfunction} \( \S {string primary} \L {,} \S {string primary} \L {,} \S {numeric primary} \L {,} \S {numeric primary} \L {,}
                             \N \S {numeric primary} \)
    \O \FL {curvedfunction}   \( \S {string primary} \L {,} \S {string primary} \L {,} \S {numeric primary} \L {,} \S {numeric primary} \L {,}
                             \N \S {numeric primary} \)
   %\O \FL {punkedfunction}   \( \S {string primary} \L {,} \S {string primary} \L {,} \S {numeric primary} \L {,} \S {numeric primary} \L {,} \S {numeric primary} \)
   %\O \FL {tightfunction}    \( \S {string primary} \L {,} \S {string primary} \L {,} \S {numeric primary} \L {,} \S {numeric primary} \L {,} \S {numeric primary} \)
    \O \FL {constructedpairs} \( \S {string expression} \) \( \S {pair array} \)
    \O \FL {straightpairs}    \( \S {pair array} \)
    \O \FL {curvedpairs}      \( \S {pair array} \)
   %\O \FL {punkedpairs}      \( \S {pair array} \)
   %\O \FL {tightpairs}       \( \S {pair array} \)
    \O \FL {constructedpath}  \( \S {string expression} \) \( \S {text} \)
    \O \FL {straightpath}     \( \S {text} \)
    \O \FL {curvedpath}       \( \S {text} \)
   %\O \FL {punkedpath}       \( \S {text} \)
   %\O \FL {tightpath}        \( \S {text} \)
    \O \FL {epsed}            \S {numeric primary}
    \O \FL {arrowhead}        \S {path primary}
    \O \FL {arrowpath}        \S {path primary}
    \O \FL {midarrowhead}     \S {path primary}
    %
    \O \FL {infinite}         \S {path primary}
    %
    \O \FL {tolist}           \( \S {pair array} \) \( \S {text} \)
    \O \FL {topath}           \( \S {pair array} \) \( \S {text} \)
    \O \FL {tocycle}          \( \S {pair array} \) \( \S {text} \)
    \O \FL {pencilled}        \( \S {path expression} \) \( \S {pen expression} \)
\StopSyntax

\StartSyntax
\S {color expression}
    \M \S {basic color expression}
    \O \S {string primary}
    \O \FL {namedcolor} \( \S {string primary} \)
    \O \FL {spotcolor} \( \S {string primary} \L {,} \S {basic color expression} \)
    \O \FL {multitonecolor} \( \S {string primary} \L {,} \S {basic color expression list} \)
\StopSyntax

\StartSyntax
\S {basic color expression}
    \M \S {rgb color expression}
    \O \S {cmyk color expression}
    \O \S {gray color expression}
    \O \S {string expression}
\StopSyntax

\StartSyntax
\S {basic color expression list}
    \M \S {basic color expression}
    \O \S {basic color expression list} \L {,} \S {basic color expression}
\StopSyntax

\StartSyntax
\S {rgb color expression}
    \M \S\( \S {numeric primary} \L {,} \S {numeric primary} \L {,} \S {numeric primary} \S\)
\StopSyntax

\StartSyntax
\S {cmyk color expression}
    \M \S\( \S {numeric primary} \L {,} \S {numeric primary} \L {,} \S {numeric primary} \L {,} \S {numeric primary} \S\)
\StopSyntax

\StartSyntax
\S {gray color expression}
    \M \S\( \S {numeric primary} \S\)
    \O \S {numeric primary}
\StopSyntax

\StartSyntax
\S {path expression list}
    \M \S {path expression}
    \O \S {path expression list} \L {,} \S {path expression}
\StopSyntax

\StartSyntax
\S {on/off list}
    \M \S {on/off list} \S {on/off clause}
    \O \S {on/off clause}
\StopSyntax

\StartSyntax
\S {on/off clause}
    \M \FL {on} \S {numeric tertiary}
    \O \FL {off} \S {numeric tertiary}
\StopSyntax

\StartSyntax
\S {boolean expression}   \M \S {expression}
\S {cmyk expression}      \M \S {expression}
\S {color expression}     \M \S {expression}
\S {numeric atom}         \M \S {atom}
\S {numeric expression}   \M \S {expression}
\S {numeric primary}      \M \S {primary}
\S {numeric tertiary}     \M \S {tertiary}
\S {numeric variable}     \M \S {variable} \O \S {internal variable}
\S {pair expression}      \M \S {expression}
\S {pair primary}         \M \S {primary}
\S {path expression}      \M \S {expression}
\S {path subexpression}   \M \S {subexpression}
\S {pen expression}       \M \S {expression}
\S {picture expression}   \M \S {expression}
\S {picture variable}     \M \S {variable}
\S {rgb expression}       \M \S {expression}
\S {string expression}    \M \S {expression}
\S {suffix parameter}     \M \S {parameter}
\S {transform primary}    \M \S {primary}
\StopSyntax

\StartSyntax
\S {program}
    \M \S {statement list} \L {end}
\StopSyntax

\StartSyntax
\S {statement list}
    \M \S {empty}
    \O \S {statement list} \L {;} \S {statement}
\StopSyntax

\StartSyntax
\S {statement}
    \M \S {empty}
    \O \S {equation}
    \O \S {assignment}
    \O \S {declaration}
    \O \S {macro definition}
    \O \S {compound}
    \O \S {pseudo procedure}
    \O \S {command}
\StopSyntax

\StartSyntax
\S {compound}
    \M \L {begingroup} \S {statement list} \L {endgroup}
    \O \FL {beginfig} \( \S {numeric expression} \) \L {;} \S {statement list} \S {;} \FL {endfig}
    \O \FL {beginglyph} \( \S {glyph property list} \) \L {;} \S {statement list} \S {;} \FL {endglyph}
    \O \L {image builder} \( \S {statement list} \)
\StopSyntax

\StartSyntax
\S {image builder}
    \M {image} \O \FL {decorated} \O \FL {redecorated} \O \FL {undecorated}
\StopSyntax

\StartSyntax
\S {glyph property list}
    \M \S {numeric expression} \L {,} \S {numeric expression} \L {,} \S {numeric expression} \L {,} \S {numeric expression}
\StopSyntax

\StartSyntax
\S {equation}
    \M \S {expression} \L {=} \S {right-hand side}
\StopSyntax

\StartSyntax
\S {assignment}
    \M \S {variable}          \L {:=} \S {right-hand side}
    \O \S {internal variable} \L {:=} \S {right-hand side}
\StopSyntax

\StartSyntax
\S {right-and side}
    \M \S {expression}
    \O \S {equation}
    \O \S {assignment}
\StopSyntax

\StartSyntax
\S {declaration}
    \M \S {type} \S {declaration list}
\StopSyntax

\StartSyntax
\S {declaration list}
    \M \S {generic variable}
    \O \S {declaration list} \L {,} \S {generic variable}
\StopSyntax

\StartSyntax
\S {generic variable}
    \M \S {symbolic token} \S {generic suffix}
\StopSyntax

\StartSyntax
\S {generic suffix}
    \M \S {empty}
    \O \S {generic suffix} \S {tag}
    \O \S {generic suffix} \L {[]}
\StopSyntax

\StartSyntax
\S {macro definition}
    \M \S {macro heading} \L {=} \S {replacement text} \L {enddef}
\StopSyntax

\StartSyntax
\S {macro heading}
    \M \L {def}        \S {symbolic token} \S {delimited part} \S {undelimited part}
    \O \L {vardef}     \S {generic variable} \S {delimited part} \S {undelimited part}
    \O \L {vardef}     \S {generic variable} \L {@#} \S {delimited part} \S {undelimited part}
    \O \S {binary def} \S {parameter} \S {symbolic token} \S {parameter}
\StopSyntax

\StartSyntax
\S {delimited part}
    \M \S {empty}
    \O \S {delimited part} \( \S {parameter type} \S {parameter tokens} \)
\StopSyntax

\StartSyntax
\S {parameter type}
    \M \L {expr}
    \O \L {suffix}
    \O \L {text}
\StopSyntax

\StartSyntax
\S {parameter tokens}
    \M \S {parameter}
    \O \S {parameter tokens} \L {,} \S {parameter}
\StopSyntax

\StartSyntax
\S {parameter}
    \M \S {symbolic token}
\StopSyntax

\StartSyntax
\S {undelimited part}
    \M \S {empty}
    \O \S {parameter type} \S {parameter}
    \O \S {precedence level} \S {parameter}
    \O \L {expr} \S {parameter} \L {of} \S {parameter}
\StopSyntax

\StartSyntax
\S {precedence level}
    \M \L {primary}
    \O \L {secondary}
    \O \L {tertiary}
\StopSyntax

\StartSyntax
\S {binary def}
    \M \S {primarydef}
    \O \S {secondarydef}
    \O \S {tertiarydef}
\StopSyntax

\StartSyntax
\S {pseudo procedure}
    \M \FL {drawoptions}  \( \S {option list} \)
    \O \FL {label}        \S {label suffix} \( \S {expression} \L {,} \S {pair expression} \)
    \O \FL {thelabel}     \S {label suffix} \( \S {expression} \L {,} \S {pair expression} \)
    \O \FL {dotlabel}     \S {label suffix} \( \S {expression} \L {,} \S {pair expression} \)
    \O \FL {makelabel}    \S {makelabel}
    \O \FL {labels}       \S {label suffix} \( \S {point number list} \)
    \O \FL {dotlabels}    \S {label suffix} \( \S {point number list} \)
    \O \FL {textext}      \S {label suffix} \( \S {expression} \)
    \O \FL {infotext}     \S {label suffix} \( \S {expression}, \S {numeric expression} \)
    \O \FL {thetextext}   \S {label suffix} \( \S {expression}, \S {pair expression} \)
    \O \FL {rawtextext}   \( \S {expression} \)
    \O \FL {verbatim}     \S {string expression}
    \O \FL {freelabel}    \( \S {expression} \L {,} \S {pair expression} \L {,} \S {pair expression} \)
    \O \FL {freedotlabel} \( \S {expression} \L {,} \S {pair expression} \L {,} \S {pair expression} \)
    \O \FL {remapcolor}   \( \S {color expression} \L {,} \S {color expression} \)
    \O \FL {resetcolormap}
    \O \FL {recolor}      \S {picture expression}
    \O \FL {bitmapimage}  \( \S {numeric primary} \L {,} \S {numeric primary} \L {,} \S {string primary} \)
    \O \FL {pushboundingbox} \O \FL {popboundingbox}
    \O \FL {pushcurrentpicture} \O \FL {popcurrentpicture}
    \O \FL {externalfigure} \S {string expression} \S {transformer}
    \O \FL {loadfigure} \S {string expression} \FL {number} \S {numeric expression} \S {transformer}
    \O \FL {properties}
    \O \FL {anchored} \S {label suffix} \( \S {expression} \L {,} \S {pair expression} \)
\StopSyntax

\StartSyntax
\S {point number list}
    \M \S {suffix} \O \S {point number list} \L {,} \S {suffix}
\StopSyntax

\StartSyntax
\S {label suffix}
    \M \S {empty}
    \O \FL {lft} \O \FL {rt}\O \FL {top} \O \FL {bot} \O \FL {ulft} \O \FL {urt}%
       \O \FL {llft} \O \FL {lrt} \O \FL {raw} \O \FL {origin}
\StopSyntax

% readfrom is unary
% fummy \FL {special} \S {string expression}
% \O \S {special command}

\StartSyntax
\S {command}
    \M \L  {clip}        \S {picture variable} \L {to} \S {path expression}
    \O \L  {interim}     \S {internal variable} \L {:=} \S {right-hand side}
    \O \L  {let}         \S {symbolic token} \L {=} \S {symbolic token}
    \O \FL {pickup}      \S {expression}
    \O \L  {randomseed}  \L {:=} \S {numeric expression}
    \O \L  {maxknotpool} \L {:=} \S {numeric expression}
    \O \L  {save}        \S {symbolic token list}
    \O \L  {delimiters}  \S {character} \S {character}
    \O \L  {setbounds}   \S {picture variable} \L {to} \S {path expression}
    \O \L  {setgroup}    \S {picture variable} \L {to} \S {path expression}
    \O \L  {shipout}     \S {picture expression}
    \O \L  {endinput}
    \O \L  {input}       \S {string expression}
    \O \L  {expandafter}
    \O \S  {addto command}
    \O \S  {drawing command}
    \O \S  {font metric command}
    \O \S  {newinternal command}
    \O \S  {message command}
    \O \S  {mode command}
    \O \S  {show command}
    \O \S  {tracing command}
    \O \S  {scantokens} \S {string expression}
    \O \FL {defineshade} \S {symbolic token} \S {shading expression}
    \O \L  {write} \S {string expression} \L {to} \S {string expression}
    \O \L  {readfrom} \S {string expression}
    \O \L  {closefrom} \S {string expression}
    \O \FL {readfile} \S {string expression}
    \O \L  {readstring}
    \O \L  {restoreclipcolor}
    \O \FL {savepen}
    \O \L  {runscript} \( \S {string expression} \L {,} \S {numeric primary} \)
    \O \FL {relax}
    \O \FL {pushcurrentpicture}
    \O \FL {popcurrentpicture}
\StopSyntax

\StartSyntax
\S {show command}
    \M \L {show}             \S {expression list}
    \O \L {showvariable}     \S {symbolic token list}
    \O \L {showtoken}        \S {symbolic token list}
    \O \L {showdependencies}
    \O \L {showstats}
\StopSyntax

\StartSyntax
\S {symbolic token list}
    \M \S {symbolic token}
    \O \S {symbolic token} \L {,} \S {symbolic token list}
\StopSyntax

\StartSyntax
\S {expression list}
    \M \S {expression}
    \O \S {expression list} \L {,} \S {expression}
\StopSyntax

\StartSyntax
\S {addto command}
    \M \L {addto} \S {picture variable} \L {also}       \S {picture expression} \S {option list}
    \O \L {addto} \S {picture variable} \L {contour}    \S {path expression} \S {option list}
    \O \L {addto} \S {picture variable} \L {doublepath} \S {path expression} \S {option list}
\StopSyntax

\StartSyntax
\S {option list}
    \M \S {empty}
    \O \S {drawing option} \S {option list}
\StopSyntax

\StartSyntax
\S {drawing option}
    \M \L  {withcolor}             \S {color expression} %
    \O \FL {withgrey}              \S {numeric expression} %
    \O \FL {withgray}              \S {numeric expression}
    \O \L  {withrgbcolor}          \S {rgb expression} %
    \O \L  {withcmykcolor}         \S {cmyk expression} %
    \O \L  {withgreyscale}         \S {numeric expression}
    \O \L  {withcurvature}         \S {numeric expression}
    \O \L  {withlinecap}           \S {numeric expression}
    \O \L  {withlinejoin}          \S {numeric expression}
    \O \L  {withmiterlimit}        \S {numeric expression}
    \O \L  {withmesh}              \S {numeric expression}
    \O \L  {withbytemap}           \S {numeric expression}
    \O \L  {withstacking}          \S {numeric expression}
    \O \L  {withoutcolor}
    \O \L  {withnothing}
    \O \L  {withprescript}         \S {string expression} %
    \O \L  {withpostscript}        \S {string expression} %
    \O \L  {withnestedprescript}   \S {string expression} %
    \O \L  {withnestedpostscript}  \S {string expression}
    \O \L  {withpen}               \S {pen expression}
    \O \L  {dashed}                \S {picture expression}
    \O \FL {undashed}
    \O \FL {withdashes}            \S {numeric expression}
    \O \FL {withshade}             \S {numeric expression} \O \FL {shaded} \S {shading expression}
    \O \FL {withproperties}        \S {property primary}
    \O \FL {withtransparency}      \S {pair primary}
    \O \FL {withbytemask}          \S {numeric expression} %
    \O \FL {withbytemasked}        \S {numeric expression} %
    \O \FL {withbyteexpansion}     \S {numeric expression}
    \O \FL {withtransparency}      \( \S {numeric expression} \S {,} \S {numeric expression} \)
    \O \FL {withopacity}           \S {numeric expression}
    \O \S  {shading expression}
    \O \FL {onlayer}               \S {string expression}
    \O \FL {withmask}              \S {string expression}
    \O \FL {withtolerance}         \S {numeric expression}
    \O \FL {withnamedstacking}     \S {todo}
    \O \FL {withannotation}        \S {todo}
    \O \FL {withbytemask}          \S {numeric expression}
    \O \FL {withbytemasked}        \S {numeric expression}
    \O \FL {withbyteexpansion}     \S {numeric expression}
    \O \FL {withreduction}         \S {todo}
    \O \FL {withpalette}           \S {todo}
    \O \FL {withproperties}        \S {todo}
    \O \FL {withpattern}           \S {picture expression}
\StopSyntax

%     \O \FL {withlinearshade}   \(%
%         \S {path expression}   \L {,}%
%         \S {path expression}   \L {,}%
%         \S {color expression}  \L {,}%
%         \S {color expression}  \)
%     \O \FL {withcircularshade} \(%
%         \S {path ex}    \L {,}%
%         \S {path ex}    \L {,}%
%         \S {numeric ex} \L {,}%
%         \S {numeric ex} \L {,}%
%         \S {color ex}   \L {,}%
%         \S {color ex}   \)

\StartSyntax
\S {property expression}
  \M \( {drawing option} \)
\StopSyntax

\StartSyntax
\S {shading expression}
    \M \FL {withshademethod}             \L {string expression}
    \O \FL {withshadefactor}             \L {numeric expression}
    \O \FL {withshadedomain}             \L {pair expression}
    \O \FL {withshadevector}             \L {pair expression}
    \O \FL {withshaderadius}             \L {pair expression}
    \O \FL {withshadeorigin}             \L {pair expression}
    \O \FL {withshadecolors}             \( \S {color expression} \L {,} \S {color expression} \)
    \O \FL {withshadecenter}             \L {pair expression}
    \O \FL {withshadecenterone}          \L {pair expression}
    \O \FL {withshadecentertwo}          \L {pair expression}
    \O \FL {withshadedirection}          \L {pair expression}
    \O \FL {withshadestep}               \L {numeric expression}
    \O \FL {withshadecenterfraction}     \L {numeric expression}
    \O \FL {withshadecenteronefraction}  \L {numeric expression}
    \O \FL {withshadecentertwofraction}  \L {numeric expression}
    \O \FL {withshaderadiusfraction}     \L {numeric expression}
    \O \FL {withshademethod}             \L {numeric expression}
    \O \FL {withshadetransform}          (todo)
    \O \FL {withshadetransformation}     (todo)
    \O \FL {withshadefraction}           \L {numeric expression}
    \O \FL {withshadecolors}             (todo)
\StopSyntax

\StartSyntax
\S {drawing command}
    \M \FL {draw} \S {picture expression} \S {option list}
    \O \S  {fill type} \S {path expression} \S {option list}
\StopSyntax

\StartSyntax
\S {fill type}
    \M \FL {fill} \O \FL {unfill} \O \FL {refill}
    \O \FL {draw} \O \FL {undraw} \O \FL {redraw}
    \O \FL {filldraw} \O \FL {drawfill} \O \FL {undrawfill} \O \FL {unfilldraw}
    \O \FL {nofill} \O \FL {fillup} \O \FL {nodraw} \O \FL {dodraw} \O \FL {dofill}
    \O \FL {eofill} \O \FL {eofillup} \O \FL {eoclip} \O \FL {enfill}
    \O \FL {drawdot}
    \O \FL {drawarrow} \O \FL {drawdblarrow} \O \FL {drawdoublearrows}
    \O \FL {cutdraw}
    \O \FL {visualizer}
    \O \FL {normaldraw} \O \FL {normalfill}
\StopSyntax

\StartSyntax
\S {visualizer}
    \M \FL {drawboundary} \O \FL {drawboundingbox} \O \FL {drawboundoptions}
    \O \FL {drawcontrollines} \O \FL {drawcontroloptions} \O \FL {drawcontrolpoints}
    \O \FL {drawlabeloptions} \O \FL {drawlineoptions} \O \FL {drawoptions}
    \O \FL {draworigin} \O \FL {draworiginoptions}
    \O \FL {drawpath} \O \FL {drawpathonly} \O \FL {drawholepath} \O \FL {drawpathoptions}
    \O \FL {drawpoint} \O \FL {drawpointlabels} \O \FL {drawpointoptions}
    \O \FL {drawpoints} \O \FL {drawwholepath} \O \FL {drawboundingbox}
    \O \FL {visualizeddraw} \O \FL {visualizedfill}
\StopSyntax

\StartSyntax
\S {newinternal command}
    \M \L {newinternal} \S {internal type} \S {symbolic token list}
    \O \S {newinternal} \S {symbolic token list}
\StopSyntax

% gone    \O \FL {filenametemplate} \S {string expression}

\StartSyntax
\S {message command}
    \M \L  {errhelp}          \S {string expression}
    \O \L  {errmessage}       \S {string expression}
    \O \L  {message}          \S {automatic string expression}
    \O \FL {report}          \S {automatic string expression}
\StopSyntax

%     \O \FL {interact}

\StartSyntax
\S {mode command}
    \M \L {batchmode}
    \O \L {nonstopmode}
    \O \L {scrollmode}
    \O \L {errorstopmode}
    \O \L {silentmode}
\StopSyntax

% \StartSyntax
% \S {special command}
%     \M \FL {fontmapfile}    \S {string expression}
%     \O \FL {fontmapline}    \S {string expression}
%     \O \FL {special}        \S {string expression}
%     \O \L {input}          \S {string expression}
%     \O \FL {prologues}      \S {numeric expression}
%     \O \FL {outputtemplate} \S {string expression}
%     \O \FL {outputformat}   \S {string expression}
% \StopSyntax

\StartSyntax
\S {tracing command}
    \M \FL {tracingall}
    \O \FL {loggingall}
    \O \FL {tracingnone}
\StopSyntax

\StartSyntax
\S {if test}
    \M \L {if} \S {boolean expression} \L {:} \S {balanced tokens} \S {alternatives} \L {fi}
\StopSyntax

\StartSyntax
\S {alternatives}
    \M \S  {empty}
    \O \L  {else} \L {:} \S {balanced tokens}
    \O \L  {elseif} \S {boolean expression} \S {:} \S {balanced tokens} \S {alternatives}
    \O \FL {exit} \O \L {exitif} \S {boolean expression} \O \FL {exitunless} \S {boolean expression}
    \O \FL {break}
\StopSyntax

\StartSyntax
\S {loop}
    \M \S {loop header} \L {:} \S {loop text} \L {endfor}
\StopSyntax

\StartSyntax
\S {loop header}
    \M \L {for} \S {symbolic token} \L {=} \S {progression}
    \O \L {for} \S {symbolic token} \L {=} \S {for list}
    \O \L {for} \S {symbolic token} \L {within} \( \S {picture expression} \S {,} \S {path expression} \)
    \O \L {forsuffixes} \S {symbolic token} \L {=} \S {suffix list}
    \O \L {forever}
\StopSyntax

\StartSyntax
\S {progression}
    \M \S  {numeric expression} \FL {upto} \S {numeric expression}
    \O \S  {numeric expression} \FL {downto} \S {numeric expression}
    \O \S  {numeric expression} \L {step} \S {numeric expression} \L {until} \S {numeric expression}
    \O \FL {range} \S {numeric expression} \FL {thru} \S {numeric expression}
\StopSyntax

\StartSyntax
\S {for list}
    \M \S {expression}
    \O \S {for list} \L {,} \S {expression}
\StopSyntax

\StartSyntax
\S {suffix list}
    \M \S {suffix}
    \O \S {suffix list} \L {,} \S {suffix}
\StopSyntax

% anchor this somewhere

\StartSyntax
\S {bytemap operations}
    \M \L {clipbytemap} (todo)
    \O \L {copybytemap} (todo)
    \O \L {newbytemap} (todo)
    \O \L {reducebytemap} (todo)
    \O \L {resetbytemap} (todo)
    \O \L {resetbytemaps} (todo)
    \O \L {setbyte} (todo)
    \O \L {setbytemap} (todo)
    \O \L {setbytemapoffset} (todo)
    \O \L {setbytemapoptions} (todo)
\StopSyntax

\page

\StartSyntax
\S {property setters}
    \M \FL {primitive} \O \FL {permanent} \O \FL {immutable} \O \FL {frozen} \O \FL {mutable}
\StopSyntax

\stop

% \page

% \stopsection

% listsize
% copylist
% sortlist
% shapedlist
% listtocurves
% listtolines

% newcolor     list
% newrgbcolor  list
% newcmykcolor list
% newnumeric   list
% newboolean   list
% newtransform list
% newpath      list
% newpicture   list
% newstring    list
% newpair      list

% vardef utfchr(expr s) = runscript mfid_utfchr s enddef ; % number
% vardef utfnum(expr s) = runscript mfid_utfnum s enddef ; % str
% vardef utflen(expr s) = runscript mfid_utflen s enddef ; % str
% vardef utfsub(text t) = runscript mfid_utfsub t enddef ; % str, first, (optional) last

% innerenlarged =
% outerenlarged =

% interact     = % sets up to make "show" commands stop
% erase text t =

% rcomponent expr p
% gcomponent expr p
% bcomponent expr p
% ccomponent expr p
% mcomponent expr p
% ycomponent expr p
% kcomponent expr p

% labtorgb(expr l, a, b)
% xyztorgb(expr x, y, z)
% lchtorgb(expr l, c, h)
% hsvtorgb(expr h, s, v)
% hwbtorgb(expr h, w, b)

% processpath (expr p) (text pp) : commented in manual, maybe not that useful

\stopchapter

\stopcomponent

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

./mp-tool.mpxl   4672: vardef hasreducedcurvature(expr p,i,tolerance) =
./mp-tool.mpxl   4684: vardef reducedpath(expr target) =
./mp-tool.mpxl   4792: vardef reducedenvelope(expr target) =

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

./mp-tool.mpxl   1621: vardef perpendicular expr t of p =
./mp-tool.mpxl   4939: vardef totalarea(expr p) =
./mp-tool.mpxl   1343: vardef rotation(expr i, n) =

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

./mp-base.mpxl    360: vardef center primary p =

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

./mp-tool.mpxl   1771: vardef drawarrowpath expr p =
./mp-tool.mpxl   1781: vardef arrowheadonpath (expr p, s) =
./mp-tool.mpxl   1788: def resetarrows =
./mp-tool.mpxl   2082: vardef arrowpath expr p =
./mp-tool.mpxl   2307: vardef pointarrow (expr pat, loc, len, off) =
./mp-tool.mpxl   2319: def rightarrow  (expr pat,tim,len) = pointarrow(pat,tim,len,-len) enddef ;
./mp-tool.mpxl   2320: def leftarrow   (expr pat,tim,len) = pointarrow(pat,tim,len,+len) enddef ;
./mp-tool.mpxl   2321: def centerarrow (expr pat,tim,len) = pointarrow(pat,tim,len,   0) enddef ;

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

./mp-figs.mpxl     20: def registerfigure(expr name,width,height) =
./mp-figs.mpxl     28: vardef figuresize(expr name) =
./mp-figs.mpxl     35: vardef figurewidth(expr name) =
./mp-figs.mpxl     39: vardef figureheight(expr name) =
./mp-figs.mpxl     45: def naturalfigure(expr name) =
./mp-mlib.mpxl   1149: vardef externalfigure primary filename =
./mp-mlib.mpxl   1161: def figure primary filename =

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

./mp-func.mpxl     42: def function            = mfun_function     enddef ; % let doesn't work here
./mp-func.mpxl     43: def constructedfunction = mfun_function     enddef ;
./mp-func.mpxl     44: def straightfunction    = mfun_function (1) enddef ;
./mp-func.mpxl     45: def curvedfunction      = mfun_function (2) enddef ;

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

./mp-luas.mpxl     27: def newscriptindex suffix t = newinternal t ; immutable t ; enddef ;
./mp-luas.mpxl     31: def scriptindex = runscript mfid_scriptindex enddef ;
./mp-luas.mpxl     96: def luacall = mlib_luas_luacall enddef ; % why no let
./mp-luas.mpxl     98: vardef lualist@#(text t) = mlib_luas_lualist(str @#)(t) enddef ;
./mp-luas.mpxl    102: vardef lua@#(text t) =

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

./mp-mlib.mpxl   1502: def withpatternscale primary s = hide (mfun_pattern_s := paired s ;) enddef ;
./mp-mlib.mpxl   1503: def withpatternfloat primary s = hide (mfun_pattern_f := s ;) enddef ;

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

./mp-mlib.mpxl    229: vardef rawmadetext =
./mp-mlib.mpxl    250: vardef validtexbox(expr category, name) =
./mp-mlib.mpxl    262: vardef rawtexbox(expr category, name) =
./mp-mlib.mpxl    285: vardef fontsize expr name =
./mp-mlib.mpxl    373: vardef installlabel@# (expr type, x, y, offset) =
./mp-mlib.mpxl    459: vardef onetimetextext@#(expr p) = % no draw here
./mp-mlib.mpxl    470: vardef rawfmttext(text t) =
./mp-mlib.mpxl    490: vardef thefmttext@#(text t) =
./mp-mlib.mpxl    504: vardef fmttext@#(text t) = % no draw here
./mp-mlib.mpxl    510: vardef onetimefmttext@#(text t) = % no draw here
./mp-mlib.mpxl    517: vardef thetexbox@#(expr category, name, z) =
./mp-mlib.mpxl    526: vardef texbox@#(expr category, name) = % no draw here
./mp-mlib.mpxl    540: vardef theoffset@#(expr z) =
./mp-mlib.mpxl    554: vardef thelabel@#(expr p,z) =
./mp-mlib.mpxl   1798: vardef strfmt(expr f, x) = "\MPgraphformat{" & escaped_format(f) & "}{" & mfun_tagged_string(x) & "}" enddef ;
./mp-mlib.mpxl   1799: vardef varfmt(expr f, x) = "\MPformatted{"   & escaped_format(f) & "}{" & mfun_tagged_string(x) & "}" enddef ;
./mp-mlib.mpxl   1801: vardef format@#   (expr f, x) = textext@#(strfmt(f, x)) enddef ;
./mp-mlib.mpxl   1802: vardef formatted@#(expr f, x) = textext@#(varfmt(f, x)) enddef ;
% ./mp-lmtx.mpxl   2344: vardef registercomposedglyph (expr u) (suffix snippets) =
% ./mp-lmtx.mpxl   2367: vardef composeglyph (suffix snippets) =
./mp-lmtx.mpxl   2391: vardef rawmaptext(expr s) =

./mp-tool.mpxl   4057: vardef infotext@#(expr txt, ysize) =

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

./mp-tool.mpxl   4478: tertiarydef p sortedintersectiontimes q =
./mp-tool.mpxl   4482: tertiarydef p intersectionpath q =
./mp-tool.mpxl   4498: tertiarydef p firstintersectionpath q =
./mp-tool.mpxl   4512: tertiarydef p secondintersectionpath q =
./mp-tool.mpxl   4516: vardef intersectionsfound expr p =
./mp-tool.mpxl   4577: vardef selfintersectiontimeslist expr p =

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

./mp-tool.mpxl    508: def undashed =
./mp-tool.mpxl   4611: vardef dashing (expr pth, shp, stp) =

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

./mp-lmtx.mpxl   3188: vardef downsamplebytemap(expr source, target, n) =
./mp-lmtx.mpxl   3192: vardef downgradebytemap(expr source, target, n) =
./mp-lmtx.mpxl   3200: vardef bytemap primary n =
./mp-mlib.mpxl   2034: vardef loadbytemapfromfile(expr index, filename) =
./mp-mlib.mpxl   2038: vardef loadbytemap(expr index, filename) =

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

./mp-base.mpxl    426: def takepower expr y of x =
./mp-base.mpxl    759: def undrawdot  expr z = drawdot  z withcolor background enddef ;

./mp-lmtx.mpxl    978: vardef meshed(expr pth, box, stp) =

./mp-lmtx.mpxl   3229: vardef outlineposition (expr n) =
./mp-lmtx.mpxl   3233: vardef outlinedimensions =

./mp-luas.mpxl    135: def    resolvedcolor = runscript mfid_resolvedcolor enddef ;
./mp-luas.mpxl    144: vardef texmode    (expr s) = runscript mfid_mode       s enddef ;
./mp-luas.mpxl    145: vardef systemmode (expr s) = runscript mfid_systemmode s enddef ;
./mp-luas.mpxl    158: vardef isarray   suffix a = runscript mfid_isarray  (str a) enddef ;
./mp-luas.mpxl    159: vardef prefix    suffix a = runscript mfid_prefix   (str a) enddef ;
./mp-luas.mpxl    160: vardef dimension suffix a = runscript mfid_dimension(str a) enddef ;
./mp-luas.mpxl    162: vardef isobject  expr p = if picture p : runscript mfid_isobject prescriptpart p else : false fi enddef ;
./mp-luas.mpxl    261: def    inpath            = = 1 step 1 until runscript mfid_path_lengthof   enddef ;
./mp-luas.mpxl    262: vardef pointof primary i =                  runscript mfid_path_pointof  i enddef ;
./mp-luas.mpxl    263: vardef leftof  primary i =                  runscript mfid_path_leftof   i enddef ;
./mp-luas.mpxl    264: vardef rightof primary i =                  runscript mfid_path_rightof  i enddef ;
./mp-luas.mpxl    370: def    definecolor = runscript mfid_definecolor ; enddef ; % the semicolon prevents lookahead

% ./mp-luas.mpxl    380: def showproperty  = runscript mfid_showproperty  enddef ;
% ./mp-luas.mpxl    381: def showhashentry = runscript mfid_showhashentry enddef ;
% ./mp-misc.mpxl     24: def showenvelope(expr pth, psh) =
% ./mp-misc.mpxl     72: vardef showreducedenvelope(expr pth, psh, pthtxt, pshtxt) =

./mp-mlib.mpxl    173: def keepcached =
./mp-mlib.mpxl    178: def notcached =

./mp-mlib.mpxl    570: vardef anchored@#(expr p, z) = % beware: no "+ mfun_laboff@#" here (never!)
./mp-mlib.mpxl    580: primarydef s infont name = % nasty hack
./mp-mlib.mpxl    906: primarydef a shadedinto b = % withcolor red shadedinto green
./mp-mlib.mpxl    913: primarydef p withshade sc =
./mp-mlib.mpxl   1174: def register (expr tag, width, height, offset) =

% ./mp-mlib.mpxl   1307: def outlinetexttopath (text o, p, n) =
% ./mp-mlib.mpxl   1314: def filloutlinetext (expr o) =
% ./mp-mlib.mpxl   1331: def drawoutlinetext (expr o) =
% ./mp-mlib.mpxl   1340: vardef outlinetext@# (expr t) text rest =

./mp-mlib.mpxl   1376: vardef checkedbounds(expr llx,lly,urx,ury) =
./mp-mlib.mpxl   1387: vardef checkbounds(expr llx,lly,urx,ury) =

./mp-mlib.mpxl   1391: vardef strut(expr ht,dp) =
./mp-mlib.mpxl   1395: vardef rule(expr wd,ht,dp) =

./mp-mlib.mpxl   1410: vardef verbatim(expr s) =

./mp-mlib.mpxl   1427: vardef bitmapimage(expr xresolution, yresolution, data) =

./mp-mlib.mpxl   1448: vardef properties(text t) =

./mp-mlib.mpxl   1568: def autoalign(expr n) =
./mp-mlib.mpxl   1850: def comment expr str =
./mp-mlib.mpxl   1883: vardef uniquelist(suffix list) =
./mp-mlib.mpxl   1923: def repeatablerandom = runscript mfid_repeatablerandom enddef ;

./mp-mlib.mpxl   1929: def registerluminositygroup (expr name) (text t) =
./mp-mlib.mpxl   1943: def applyluminositygroup (expr name) (text t) =
./mp-mlib.mpxl   1957: def luminositygroup (text a) (text b) =
./mp-mlib.mpxl   1964: def luminosityshade (expr p) (text a) (text b) =

./mp-mlib.mpxl   1978: primarydef p hascurvature c = runscript mfid_hascurvature (p) (c) enddef ;

./mp-mlib.mpxl   1984: def setbackendoption = runscript mfid_setbackendoption enddef ;

./mp-mlib.mpxl   1990: def namedstacking expr str = runscript mfid_namedstacking str enddef ;

./mp-mlib.mpxl   2048: def meshcontour(expr name, kind) = runscript mfid_meshcontour name kind ; enddef ; % just combine with the next one
./mp-mlib.mpxl   2050: vardef meshexperiment(expr name, kind) =

./mp-tool.mpxl    173: vardef colorlike(text c) text v = % colorlike(a) b, c, d ;
./mp-tool.mpxl    204: vardef colordecimals primary c =
./mp-tool.mpxl    216: vardef colordecimalslist(text t) =

./mp-tool.mpxl    326: def pushboundingbox text p =
./mp-tool.mpxl    331: def popboundingbox text p =
./mp-tool.mpxl    408: vardef boundingradius primary p =
./mp-tool.mpxl    424: vardef boundingcircle primary p =
./mp-tool.mpxl    428: vardef boundingpoint@#(expr p) =

./mp-tool.mpxl    502: primarydef a zmod b = (-((b/2 - a) mod b) + b/2) enddef ;

./mp-tool.mpxl    731: secondarydef p anglestriped s =
./mp-tool.mpxl    736: secondarydef p numberstriped s =
./mp-tool.mpxl    764: vardef hatch(expr p, a, d) =

./mp-tool.mpxl   1126: secondarydef p peepholed q =

./mp-tool.mpxl   1195: def resolvedcolor(expr s) =
./mp-tool.mpxl   1233: vardef colortype expr c =

./mp-tool.mpxl   1256: vardef complementary expr c =
./mp-tool.mpxl   1265: vardef complemented expr c =

./mp-tool.mpxl   1617: def istextext(expr p) =

./mp-tool.mpxl   1696: def saveoptions =

./mp-tool.mpxl   1977: def visualizeddraw expr c =
./mp-tool.mpxl   1981: def visualizedfill expr c =
./mp-tool.mpxl   2005: def detaileddraw expr c =
./mp-tool.mpxl   2019: def visualizepaths =
./mp-tool.mpxl   2024: def detailpaths =
./mp-tool.mpxl   2028: def naturalizepaths =

./mp-tool.mpxl   2364: vardef thefreelabel (expr asked_text, asked_location, asked_origin) =
./mp-tool.mpxl   2377: vardef freelabel (expr asked_text, asked_location, asked_origin) =
./mp-tool.mpxl   2381: vardef freedotlabel (expr asked_text, asked_location, asked_origin) =

./mp-tool.mpxl   2398: vardef anglebetween (expr a, b, s) = % path path string

./mp-tool.mpxl   2467: vardef penpoint expr pnt of p =

./mp-tool.mpxl   2477: vardef colorcircle (expr size, red, green, blue) = % might move

./mp-tool.mpxl   2568: vardef grayed primary p =
./mp-tool.mpxl   2648: def condition primary b = if b : "true" else : "false" fi enddef ;
./mp-tool.mpxl   2749: def remapcolors =
./mp-tool.mpxl   2755: def normalcolors =
./mp-tool.mpxl   2759: def resetcolormap =
./mp-tool.mpxl   2770: def remapcolor(expr old, new) =
./mp-tool.mpxl   2774: def remappedcolor(expr c) =

% ./mp-tool.mpxl   2788: def retext  suffix p = p := mfun_repathed (3,p) enddef ;
% ./mp-tool.mpxl   2789: def untext  suffix p = p := mfun_repathed (4,p) enddef ;
% ./mp-tool.mpxl   2799: def restroke  suffix p = p := mfun_repathed (21,p) enddef ; % keep attributes
% ./mp-tool.mpxl   2800: def reprocess suffix p = p := mfun_repathed (22,p) enddef ; % no attributes

./mp-tool.mpxl   3152: def dowithpath (expr p, lw, lc, bc) =
./mp-tool.mpxl   3311: vardef center primary p =
./mp-tool.mpxl   3317: vardef rangepath (expr p, d, a) =
./mp-tool.mpxl   3329: vardef straightpath (expr a, b, method) =
./mp-tool.mpxl   3373: def addbackground text t =
./mp-tool.mpxl   3499: vardef phantom (text t) = % to be checked
./mp-tool.mpxl   3563: vardef area expr p = % kind of useless so it can be dropped

./mp-tool.mpxl   3859: vardef listsize(suffix list) =
./mp-tool.mpxl   3868: vardef listlast(suffix list) =
./mp-tool.mpxl   3913: vardef sortlist(suffix list)(text what) =
./mp-tool.mpxl   3935: vardef uniquelist(suffix list) =
./mp-tool.mpxl   3939: vardef copylist(suffix list, target) =

./mp-tool.mpxl   3948: vardef listtolines(suffix list) =
./mp-tool.mpxl   3952: vardef listtocurves(suffix list) =

./mp-tool.mpxl   3960: vardef shapedlist(suffix p) = % takes a list of paths

./mp-tool.mpxl   4006: def loadmodule expr name = % no vardef
./mp-tool.mpxl   4014: def loadfile  (expr filename) =       scantokens("input " & filename)   enddef ;
./mp-tool.mpxl   4015: def loadimage (expr filename) = image(scantokens("input " & filename);) enddef ;

./mp-tool.mpxl   4021: def drawpathwithpoints expr p =

./mp-tool.mpxl   4218: vardef pensilled(expr p, q) =

./mp-tool.mpxl   4231: vardef tolist(suffix l)(text t) =
./mp-tool.mpxl   4256: vardef topath(suffix p)(text t) =
./mp-tool.mpxl   4265: vardef tocycle(suffix p)(text t) =

./mp-tool.mpxl   4396: vardef hatched(expr o) primary c =

./mp-tool.mpxl   4600: vardef starring(expr e) =

./mp-tool.mpxl   4630: vardef arc(expr from_angle, to_angle) =

./mp-tool.mpxl   4962: tertiarydef p penstroked s =
./mp-tool.mpxl   4982: vardef nepstroke (expr N) text F =
./mp-base.mpxl    859: vardef penpos@#(expr b,d) =
./mp-base.mpxl    865: def penstroke text t =
./mp-base.mpxl    988: vardef penlabels@#(text t) =

