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
|
{
Yacc Library Unit for TP Yacc
Copyright (c) 1990-92 Albert Graef <ag@muwiinfa.geschichte.uni-mainz.de>
Copyright (C) 1996 Berend de Boer <berend@pobox.com>
This program 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 2 of the License, or
(at your option) any later version.
This program 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 this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$Revision: 1.2 $
$Modtime: 96-08-01 14:04 $
$History: YACCLIB.PAS $
*
* ***************** Version 2 *****************
* User: Berend Date: 96-10-10 Time: 21:16
* Updated in $/Lex and Yacc/tply
* Updated for protected mode, windows and Delphi 1.X and 2.X.
}
{$I-}
unit h2pYaccLib;
(* Yacc Library Unit for TP Yacc Version 3.0, 6-17-91 AG *)
interface
const yymaxdepth = 10000;
(* default stack size of parser *)
type YYSType = Integer;
(* default value type, may be redefined in Yacc output file *)
var
yychar : Integer; (* current lookahead character *)
yynerrs : Integer; (* current number of syntax errors reported by the
parser *)
yydebug : Boolean; (* set to true to enable debugging output of parser *)
line_no : longint;
procedure yyerror ( msg : String );
(* error message printing routine used by the parser *)
procedure yyclearin;
(* delete the current lookahead token *)
procedure yyaccept;
(* trigger accept action of the parser; yyparse accepts returning 0, as if
it reached end of input *)
procedure yyabort;
(* like yyaccept, but causes parser to return with value 1, as if an
unrecoverable syntax error had been encountered *)
procedure yyerrlab;
(* causes error recovery to be started, as if a syntax error had been
encountered *)
procedure yyerrok;
(* when in error mode, resets the parser to its normal mode of
operation *)
(* Flags used internally by the parser routine: *)
var
yyflag : ( yyfnone, yyfaccept, yyfabort, yyferror );
yyerrflag : Integer;
implementation
procedure yyerror ( msg : String );
begin
writeln('at line ',line_no,' error : ',msg);
end(*yyerrmsg*);
procedure yyclearin;
begin
yychar := -1;
end(*yyclearin*);
procedure yyaccept;
begin
yyflag := yyfaccept;
end(*yyaccept*);
procedure yyabort;
begin
yyflag := yyfabort;
end(*yyabort*);
procedure yyerrlab;
begin
yyflag := yyferror;
end(*yyerrlab*);
procedure yyerrok;
begin
yyerrflag := 0;
end(*yyerrork*);
end(*YaccLib*).
|