-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathbwterms.sty
executable file
·61 lines (61 loc) · 1.77 KB
/
bwterms.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
%%
%% This is file `bwterms.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% pretprin.dtx (with options: `terms,bwterms')
%%
%% 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{bwterms}
[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}
\DeclareRobustCommand*\formatterm[1]{\fbox{#1}}
\endinput
%%
%% End of file `bwterms.sty'.