summaryrefslogtreecommitdiff
path: root/tex/context/base/s-syntax.mkii
blob: 6d1d59697ecdc2444f155322933ed7a499e2eb51 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
%D \module
%D   [      file=s-syntax, % was: s-syn-01,
%D        version=0000.00.00,
%D          title=\CONTEXT\ Style File,
%D       subtitle=Preliminary Syntax Stuff,
%D         author=Hans Hagen,
%D           date=\currentdate,
%D      copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
%C
%C This module is part of the \CONTEXT\ macro||package and is
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.

%D This is needed for the \METAFUN\ manual (this module was
%D called \type {p-syn-01} on my machine).

\unprotect

\def\Indent   #1{\ifvmode\noindent\hbox to 2em{\hss#1}\else#1\fi}
\def\Sugar    #1{\ifhmode\unskip\unskip\unskip\fi\kern.25em{#1}\kern.25em\ignorespaces}
\def\Something#1{\Sugar{\mathematics{\langle\hbox{#1}\rangle}}}
\def\Lbrace     {\Sugar{\tttf\leftargument}}
\def\Rbrace     {\Sugar{\tttf\rightargument}}
\def\Or         {\Sugar{\mathematics{\vert}}}
\def\Optional #1{\Sugar{\mathematics{[\hbox{#1}]}}}
\def\Means      {\Sugar{\mathematics{\rightarrow}}}
\def\Tex      #1{\Sugar{\type{#1}}}
\def\Literal  #1{\Sugar{\type{#1}}}
\def\Syntax   #1{\strut\kern-.25em{#1}\kern-.25em}
\def\Next       {\crlf\hbox to 2em{}\nobreak}
\def\Whatever #1{\Sugar{\mathematics{(\hbox{#1})}}}
\def\Quote    #1{\Sugar{\quote{#1}}}

\def\Or         {\Sugar{\Indent{\mathematics{\vert}}}}
\def\Means      {\Sugar{\Indent{\mathematics{\rightarrow}}}}

\def\StartSyntax
  {\goodbreak
   \startlines
   \catcode`\#=12
   \let\L \Literal
   \let\S \Something
   \def\FL##1{\color[darkred]{\L{##1}}}
   \def\FS##1{\S{\color[darkred]{##1}}}
   \let\M \Means
   \let\O \Or
   \let\Q \Quote
   \let\LB\Lbrace
   \let\RB\Rbrace}

\def\StopSyntax
  {\stoplines}

\protect \endinput