blob: a64512ff91c939f4940db1bf732be6aac415173c (
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
|
\def\lispread#1#2{\gdef\@read@buffer{#2\@@eof\@@eof}\@lispread#1}
\def\@lispread#1{%
\begingroup
\readchar
\if(\expandafter\noexpand\@currentread
\readchar
\if\expandafter\noexpand\@currentread)%
\gdef#1{\@tlabel@nil{}}%
\else
\unreadchar
\@lispread\@temp@i
\readchar
\if.\expandafter\noexpand\@currentread
\let\@save@temp\@temp@i
\@lispread\@temp@ii
\let\@temp@i\@save@temp
\readchar
\if)\expandafter\noexpand\@currentread
\expandafter\expandafter\expandafter\@make@cons
\expandafter\expandafter\expandafter#1%
\expandafter\@temp@i\@temp@ii
\else
\errmessage{LISP on TeX [Parse] :CANNOT FIND )}%
\fi
\else\if)\expandafter\noexpand\@currentread
\expandafter\@make@cons\expandafter#1\@temp@i\@tlabel@nil{}%
\else
\unreadchar
\expandafter\gdef
\expandafter\@read@buffer
\expandafter{%
\expandafter(\@read@buffer}%
\let\@save@temp\@temp@i
\@lispread\@temp@ii
\let\@temp@i\@save@temp
\expandafter\expandafter\expandafter\@make@cons
\expandafter\expandafter\expandafter#1%
\expandafter\@temp@i\@temp@ii
\fi\fi
\fi
\else\ifcat\relax\expandafter\noexpand\@currentread
\expandafter\gdef\expandafter#1\expandafter{%
\expandafter\@tlabel@symbol\expandafter{\@currentread}}%
\else\if'\expandafter\noexpand\@currentread
\expandafter\@read@string\expandafter#1\expandafter\@lisp@empty\@read@buffer\@@end
\else\if/\expandafter\noexpand\@currentread
\readchar
\xdef#1{\noexpand\@tlabel@bool{\@currentread}}%
\else\if:\expandafter\noexpand\@currentread
\expandafter\@read@num\expandafter#1\@read@buffer
\else\if!\expandafter\noexpand\@currentread
\expandafter\@read@dimen\expandafter#1\@read@buffer
\else\if @\expandafter\noexpand\@currentread
\expandafter\@read@skip\expandafter#1\@read@buffer
\else\if +\expandafter\noexpand\@currentread % parser module
\readchar
\expandafter\@read@module\expandafter#1\@currentread\@@end
\fi\fi\fi\fi\fi\fi\fi\fi
\endgroup}
\newcount\@temp@read@cnt
\def\@read@num#1#2\@@eof\@@eof{%
\afterassignment\@@read@num\@temp@read@cnt#2\@@end
\expandafter\gdef
\expandafter#1%
\expandafter{\expandafter\@tlabel@int\expandafter{\the\@temp@read@cnt}}}
\def\@@read@num#1\@@end{\gdef\@read@buffer{#1\@@eof\@@eof}}
\def\@read@dimen#1#2\@@eof\@@eof{\afterassignment\@@read@dimen\dimen@#2\@@end
\expandafter\gdef\expandafter#1\expandafter{\expandafter\@tlabel@dimen\expandafter{\the\dimen@}}}
\let\@@read@dimen\@@read@num
\def\@read@skip#1#2\@@eof\@@eof{\afterassignment\@@read@skip\skip@#2\@@end
\expandafter\gdef\expandafter#1\expandafter{\expandafter\@tlabel@skip\expandafter{\the\skip@}}}
\let\@@read@skip\@@read@num
\def\@read@string#1#2'#3\@@end{%
\expandafter\gdef\expandafter#1%
\expandafter{\expandafter\@tlabel@string\expandafter{#2}}% expand \@lisp@empty
\gdef\@read@buffer{#3}}% I don't consider that #3 is single grouped tokens. In LISP on TeX, it never happen.
\def\@read@module#1#2::#3\@@end{% #1 : register, #2 : module name (MUST unique), #3 : parse target
\csname @mod@read@#2\endcsname#1{#3}}
|