summaryrefslogtreecommitdiff
path: root/support/splint/examples/ld/ltokenset.sty
blob: f980114823ef3a78bf03ab1f6bb1a03d742e0586 (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
% Copyright 2012-2022, Alexander Shibakov
% This file is part of SPLinT
%
% SPLinT is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% SPLinT is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with SPLinT.  If not, see <http://www.gnu.org/licenses/>.

\let\currentparsernamespace\parsernamespace
\let\parsernamespace\indexpseudonamespace % use the correct namespace
\input yypretty.sty % input standard prettified tokens first 
                    % so that we can change their appearance below
\let\parsernamespace\cwebclinknamespace
\prettywordpair{.origin&}{{$\cdot\cdot$}}% special . name in \ld\ scripts
\let\parsernamespace\currentparsernamespace

\prettywordpairwvis{comma}{{\tt,}}{,}
\prettywordpairwvis{semicolon}{{\tt;}}{;}
\prettywordpair@@{file\_NAME\_list}{{\ifinheader\itbold\else\it\fi file\_{\rm name}\_list}}
\prettywordpair@@{high\_level\_library\_NAME\_list}{{\ifinheader\itbold\else\it\fi high\_level\_library\_{\rm name}\_list}}
\prettywordpair@@{low\_level\_library\_NAME\_list}{{\ifinheader\itbold\else\it\fi low\_level\_library\_{\rm name}\_list}}
\prettywordpair@@{NAME}{{\rm name}}
\prettywordpair@@wvis{LNAME}{{\rm name$_{\rm L}$}}{name_L}
\prettywordpair@@{END}{{\rm end}}
\prettywordpair@@{UNARY}{{\rm unary}}
\prettywordpair@@{VERSIONK}{{\tt VERSION}$_{\rm K}$}
\prettytoken{ALIGN}
\prettytoken{MIN}
\prettytoken{MAX}
\prettytoken{TARGET}
\prettytoken{ASSERT}
\prettytoken{INSERT}
\prettywordpair@@wvis{PLUSEQ}{{}$\MRL{+{\K}}${}}{=+}
\prettywordpair@@wvis{MINUSEQ}{{}$\MRL{-{\K}}${}}{=-}
\prettywordpair@@wvis{MULTEQ}{{}$\MRL{\times{\K}}${}}{=*}
\prettywordpair@@wvis{DIVEQ}{{}$\MRL{{\div}{\K}}${}}{=/}
\prettywordpair@@wvis{ANDEQ}{{}$\Xandxeq${}}{=W}
\prettywordpair@@wvis{OREQ}{{}$\Xorxeq${}}{=V}
\prettywordpair@@wvis{LSHIFTEQ}{{}$\MRL{\ll{\K}}${}}{=<<}
\prettywordpair@@wvis{RSHIFTEQ}{{}$\MRL{\gg{\K}}${}}{=>>}
\prettywordpair@@wvis{NE}{{}$\not=${}}{= }
\prettywordpair@@wvis{LE}{{}$\leq${}}{<=}
\prettywordpair@@wvis{GE}{{}$\geq${}}{>=}
\prettywordpair@@wvis{EQ}{{}$=${}}{=}
\prettywordpair@@wvis{OROR}{{}$\V${}}{||}
\prettywordpair@@wvis{ANDAND}{{}$\W${}}{&&}
\prettywordpair@@wvis{LSHIFT}{{}$\ll${}}{<<}
\prettywordpair@@wvis{RSHIFT}{{}$\gg${}}{>>}
\prettywordpair@@wvis{=}{{}$\K${}}{=:}
\prettywordpair@@{+}{{}$+${}}
\prettywordpair@@{-}{{}$-${}}
\prettywordpair@@{!}{{}$\CM${}}
\prettywordpair@@{~}{{}$\R${}}
\prettywordpair@@{^}{{}$\XOR${}}
\prettywordpair@@{|}{{}$\OR${}}
\prettywordpair@@{&}{{}$\AND${}}
\prettywordpair@@{\{}{{\ntt@\{}}% the purpose is to adjust the indexing
\prettywordpair@@{\}}{{\ntt@\}}}% the purpose is to adjust the indexing

% the switches below are sloppy, since the macros in the index
% read a-z as letters (category 11) whereas the parser records them as 
% non-letters, it would be beter to use category 12 throughout (by,
% for example passing the context as a stream of character codes

\def\gtsymswitch{%
    exp \raw exp *left *right\raw {%
        {}$>${}% 
    }
}

\def\gtsymswitchdefault{{\tt >}}

\def\ltsymswitch{%
    exp \raw exp *left *right\raw {%
        {}$<${}% 
    }
}

\def\ltsymswitchdefault{{\tt <}}

\setspecialcharsfrom\gtsymswitch
\setspecialcharsfrom\ltsymswitch

% the visual key switches below slightly abuse the properties of
% \yyifsamestring, namely that it ignores the category code of the characters

\prettywordpair@@wvis{>}{{%
    \let\default\gtsymswitchdefault
    \switchon{#1}\in\gtsymswitch
}}{%
    \yyifsamestring{exp}{#1}{> exp}{%
        \yyifsamestring{*left}{#1}{> exp}{%
            \yyifsamestring{*right}{#1}{> exp}{>}%
        }%
    }%
}

\prettywordpair@@wvis{<}{{%
    \let\default\ltsymswitchdefault
    \switchon{#1}\in\ltsymswitch
}}{%
    \yyifsamestring{exp}{#1}{< exp}{%
        \yyifsamestring{*left}{#1}{< exp}{%
            \yyifsamestring{*right}{#1}{< exp}{<}%
        }%
    }%
}

\def\astsymswitch{%
    exp \raw exp *left *right\raw {%
        {}$\times${}% 
    }
}

\def\astsymswitchdefault{{\tt *}}

\setspecialcharsfrom\astsymswitch

\prettywordpair@@wvis{*}{%
    {%
        \let\default\astsymswitchdefault
        \switchon{#1}\in\astsymswitch
    }%
}{%
    \yyifsamestring{exp}{#1}{* exp}{%
        \yyifsamestring{*left}{#1}{* exp}{%
            \yyifsamestring{*right}{#1}{* exp}{*}%
        }%
    }%
}

\prettywordpair@@{/}{{}$/${}}

\expandafter\prettywordpair@@\expandafter{\harmlesscomment}{{}$\div${}}