summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/base/mkiv/catc-ctx.mkiv
blob: c86201a780ba6353f76c1f4c94dd32ab1805f151 (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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
%D \module
%D   [       file=catc-cys,
%D        version=2006.09.18,
%D          title=\CONTEXT\ Catcode Macros,
%D       subtitle=Extra Tables,
%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 We prefer to define relevant catcode tables in this file instead
%D of everywhere around.

\ifdefined \ctxcatcodes \else \newcatcodetable \ctxcatcodes \fi
\ifdefined \prtcatcodes \else \newcatcodetable \prtcatcodes \fi
\ifdefined \txtcatcodes \else \newcatcodetable \txtcatcodes \fi
%ifdefined \mthcatcodes \else \newcatcodetable \mthcatcodes \fi % math, not used, too tricky
\ifdefined \tpacatcodes \else \newcatcodetable \tpacatcodes \fi % { }
\ifdefined \tpbcatcodes \else \newcatcodetable \tpbcatcodes \fi % < >

\setnewconstant \doublecommentsignal "10FF25 %% < 110000 (last valid range)

\startcatcodetable \ctxcatcodes
    \catcode\tabasciicode       \spacecatcode
    \catcode\endoflineasciicode \endoflinecatcode
    \catcode\formfeedasciicode  \endoflinecatcode
    \catcode\spaceasciicode     \spacecatcode
    \catcode\endoffileasciicode \ignorecatcode
  % \catcode\circumflexasciicode\superscriptcatcode
  % \catcode\underscoreasciicode\subscriptcatcode
  % \catcode\ampersandasciicode \alignmentcatcode
    \catcode\underscoreasciicode\othercatcode
    \catcode\circumflexasciicode\othercatcode
    \catcode\ampersandasciicode \othercatcode
    \catcode\backslashasciicode \escapecatcode
    \catcode\leftbraceasciicode \begingroupcatcode
    \catcode\rightbraceasciicode\endgroupcatcode
    \catcode\dollarasciicode    \mathshiftcatcode
    \catcode\hashasciicode      \parametercatcode
    \catcode\commentasciicode   \commentcatcode
    \catcode\tildeasciicode     \activecatcode
    \catcode\barasciicode       \activecatcode
\stopcatcodetable

\startcatcodetable \prtcatcodes
    \catcode\tabasciicode            \spacecatcode
    \catcode\endoflineasciicode      \endoflinecatcode
    \catcode\formfeedasciicode       \endoflinecatcode
    \catcode\spaceasciicode          \spacecatcode
    \catcode\endoffileasciicode      \ignorecatcode
    \catcode\circumflexasciicode     \superscriptcatcode     % candidate
    \catcode\underscoreasciicode     \lettercatcode
    \catcode\ampersandasciicode      \alignmentcatcode
%   \catcode\colonasciicode          \lettercatcode          % candidate
    \catcode\backslashasciicode      \escapecatcode
    \catcode\leftbraceasciicode      \begingroupcatcode
    \catcode\rightbraceasciicode     \endgroupcatcode
    \catcode\dollarasciicode         \mathshiftcatcode
    \catcode\hashasciicode           \parametercatcode
    \catcode\commentasciicode        \commentcatcode
    \catcode\atsignasciicode         \lettercatcode
    \catcode\exclamationmarkasciicode\lettercatcode
    \catcode\questionmarkasciicode   \lettercatcode
    \catcode\tildeasciicode          \activecatcode
    \catcode\barasciicode            \activecatcode
\stopcatcodetable

%startcatcodetable \mthcatcodes
%   \catcode\tabasciicode       \spacecatcode
%   \catcode\endoflineasciicode \endoflinecatcode
%  %\catcode\newlineasciicode   \spacecatcode
%   \catcode\formfeedasciicode  \endoflinecatcode
%   \catcode\spaceasciicode     \spacecatcode
%   \catcode\endoffileasciicode \ignorecatcode
%   \catcode\circumflexasciicode\superscriptcatcode
%   \catcode\underscoreasciicode\subscriptcatcode
%   \catcode\ampersandasciicode \alignmentcatcode
%   \catcode\backslashasciicode \escapecatcode
%   \catcode\leftbraceasciicode \begingroupcatcode
%   \catcode\rightbraceasciicode\endgroupcatcode
%   \catcode\dollarasciicode    \mathshiftcatcode
%   \catcode\hashasciicode      \parametercatcode
%   \catcode\commentasciicode   \commentcatcode
%  %\catcode\tildeasciicode     \activecatcode
%  %\catcode\barasciicode       \activecatcode
%stopcatcodetable

\startcatcodetable \tpacatcodes
    \catcode\tabasciicode       \othercatcode
    \catcode\endoflineasciicode \othercatcode
    \catcode\formfeedasciicode  \othercatcode
    \catcode\spaceasciicode     \othercatcode
    \catcode\endoffileasciicode \othercatcode
    \catcode\leftbraceasciicode \begingroupcatcode
    \catcode\rightbraceasciicode\endgroupcatcode
\stopcatcodetable

\startcatcodetable \tpbcatcodes
    \catcode\tabasciicode       \othercatcode
    \catcode\endoflineasciicode \othercatcode
    \catcode\formfeedasciicode  \othercatcode
    \catcode\spaceasciicode     \othercatcode
    \catcode\endoffileasciicode \othercatcode
    \catcode\lessthanasciicode  \begingroupcatcode
    \catcode\morethanasciicode  \endgroupcatcode
\stopcatcodetable

\startcatcodetable \txtcatcodes
    \catcode\tabasciicode       \spacecatcode
    \catcode\endoflineasciicode \endoflinecatcode
    \catcode\formfeedasciicode  \endoflinecatcode
    \catcode\spaceasciicode     \spacecatcode
    \catcode\endoffileasciicode \ignorecatcode
    \catcode\backslashasciicode \escapecatcode
    \catcode\leftbraceasciicode \begingroupcatcode
    \catcode\rightbraceasciicode\endgroupcatcode
    \catcode\doublecommentsignal\commentcatcode
\stopcatcodetable

\letcatcodecommand \ctxcatcodes \barasciicode   \relax
\letcatcodecommand \ctxcatcodes \tildeasciicode \relax

     \catcodetable        \ctxcatcodes
\let \defaultcatcodetable \ctxcatcodes
%    \defaultcatcodetable \ctxcatcodes % also an option

% for the moment here:

\protected\def\starttexcode
  {\pushcatcodetable
   \catcodetable\prtcatcodes}

\protected\def\stoptexcode
  {\popcatcodetable}

\protected\def\startcontextcode
  {\pushcatcodetable
   \catcodetable\ctxcatcodes}

\protected\def\stopcontextcode
  {\popcatcodetable}

% not visible, only for special cases

\newcatcodetable \ctdcatcodes % context definitions

\startcatcodetable \ctdcatcodes
    \catcode\tabasciicode            \ignorecatcode
    \catcode\endoflineasciicode      \ignorecatcode
    \catcode\formfeedasciicode       \ignorecatcode
    \catcode\spaceasciicode          \ignorecatcode
    \catcode\endoffileasciicode      \ignorecatcode
    \catcode\circumflexasciicode     \superscriptcatcode     % candidate
    \catcode\underscoreasciicode     \lettercatcode
    \catcode\ampersandasciicode      \alignmentcatcode
%   \catcode\colonasciicode          \lettercatcode          % candidate
    \catcode\backslashasciicode      \escapecatcode
    \catcode\leftbraceasciicode      \begingroupcatcode
    \catcode\rightbraceasciicode     \endgroupcatcode
    \catcode\dollarasciicode         \mathshiftcatcode
    \catcode\hashasciicode           \parametercatcode
    \catcode\commentasciicode        \commentcatcode
    \catcode\atsignasciicode         \lettercatcode
    \catcode\exclamationmarkasciicode\lettercatcode
    \catcode\questionmarkasciicode   \lettercatcode
    \catcode\tildeasciicode          \activecatcode
    \catcode\barasciicode            \activecatcode
\stopcatcodetable

\protected\def\startcontextdefinitioncode
  {\pushcatcodetable
   \catcodetable\ctdcatcodes}

\protected\def\stopcontextdefinitioncode
  {\popcatcodetable}

\endinput