-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathterms.sty
executable file
·74 lines (74 loc) · 2.17 KB
/
terms.sty
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
%%
%% This is file `terms.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% pretprin.dtx (with options: `terms')
%%
%% IMPORTANT NOTICE:
%%
%% For the copyright see the source file.
%%
%% You are *not* allowed to modify this file.
%%
%% You are *not* allowed to distribute this file.
%% For distribution of the original source see the terms
%% for copying and modification in the file pretprin.dtx.
%%
%% Programming languages pretty-printer package for LaTeX
%% copyright (c) by Marcin Woli\'nski
%%
%%
\NeedsTeXFormat{LaTeX2e}
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{terms}
[1998/03/17 Sample pretty-printer for a language of terms]
\@ifpackageloaded{pretprin}{}{\RequirePackage{pretprin}}
\ProvidesPrettyprinter{Terms}{t}
\DeclareCategory{atom}
\DeclareCategory{open}
\DeclareCategory{close}
\DeclareCategory{comma}
\DeclareCategory{termhd}
\DeclareCategory{term}
\DeclareGroupByCatcode{l}{a}
\DeclareGroup{w}"^^I^^M "
\CompileGroups
\DeclareTransition 1-l->2.
\DeclareTransition 1-,->3.
\DeclareTransition 1-(->4.
\DeclareTransition 1-)->5.
\DeclareTransition 1-w->6.
\DeclareState{2}{\AppendElem{atom}{#1}}
\DeclareTransition 2-l->2.
\DeclareState{3}{\AppendElem{comma}{#1}}
\DeclareState{4}{\AppendElem{open}{#1}}
\DeclareState{5}{\AppendElem{close}{#1}}
\DeclareState{6}{}
\CompileScanner{1}{3}
\DeclareProduction{atom,open}
\ThisElem\TwoElems{termhd}{#2#1}\ThisElem{1}
\DeclareProduction{termhd,term,comma}
\ThisElem\ThreeElems{termhd}{#3\formatterm{#2}#1\ }\ThisElem{2}
\DeclareProduction{termhd,term,close}
\ThisElem\ThreeElems{term}{#3\formatterm{#2}#1}\PrevElem{3}
\DeclareProduction{atom}
\ThisElem\OneElem{term}{\textit{#1}}\PrevElem{4}
\RequirePackage[dvips]{color}
\definecolor{lev0color}{named}{Black}
\definecolor{lev1color}{named}{Red}
\definecolor{lev2color}{named}{Yellow}
\definecolor{lev3color}{named}{Green}
\definecolor{lev4color}{named}{Orange}
\definecolor{lev5color}{named}{MidnightBlue}
\definecolor{lev6color}{named}{Cyan}
\newcount\arglevel
\DeclarePretprinHook{preoutput}{\arglevel=0}
\DeclareRobustCommand*\formatterm[1]{%
\advance\arglevel1
\textcolor{lev\number\arglevel color}{#1}%
}
\endinput
%%
%% End of file `terms.sty'.