]>
Commit | Line | Data |
---|---|---|
1 | /* Parse Bison Skeletons. | |
2 | Copyright (C) 2001 Free Software Foundation, Inc. | |
3 | ||
4 | This file is part of Bison, the GNU Compiler Compiler. | |
5 | ||
6 | Bison is free software; you can redistribute it and/or modify it | |
7 | under the terms of the GNU General Public License as published by | |
8 | the Free Software Foundation; either version 2, or (at your option) | |
9 | any later version. | |
10 | ||
11 | Bison is distributed in the hope that it will be useful, but | |
12 | WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
14 | General Public License for more details. | |
15 | ||
16 | You should have received a copy of the GNU General Public License | |
17 | along with Bison; see the file COPYING. If not, write to the Free | |
18 | Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA | |
19 | 02111-1307, USA. */ | |
20 | ||
21 | #ifndef SKELETON_H_ | |
22 | # define SKELETON_H_ | |
23 | ||
24 | # include "parse-skel.h" | |
25 | ||
26 | /* Initialize LOC. */ | |
27 | # define LOCATION_RESET(Loc) \ | |
28 | (Loc).first_column = (Loc).first_line = 1; \ | |
29 | (Loc).last_column = (Loc).last_line = 1; | |
30 | ||
31 | /* Advance of NUM lines. */ | |
32 | # define LOCATION_LINES(Loc, Num) \ | |
33 | (Loc).last_column = 1; \ | |
34 | (Loc).last_line += Num; | |
35 | ||
36 | /* Restart: move the first cursor to the last position. */ | |
37 | # define LOCATION_STEP(Loc) \ | |
38 | (Loc).first_column = (Loc).last_column; \ | |
39 | (Loc).first_line = (Loc).last_line; | |
40 | ||
41 | /* Output LOC on the stream OUT. */ | |
42 | # define LOCATION_PRINT(Out, Loc) \ | |
43 | if ((Loc).first_line != (Loc).last_line) \ | |
44 | fprintf (Out, "%d.%d-%d.%d", \ | |
45 | (Loc).first_line, (Loc).first_column, \ | |
46 | (Loc).last_line, (Loc).last_column - 1); \ | |
47 | else if ((Loc).first_column < (Loc).last_column - 1) \ | |
48 | fprintf (Out, "%d.%d-%d", (Loc).first_line, \ | |
49 | (Loc).first_column, (Loc).last_column - 1); \ | |
50 | else \ | |
51 | fprintf (Out, "%d.%d", (Loc).first_line, (Loc).first_column) | |
52 | ||
53 | ||
54 | /* Pure parsers need to pass arguments to yyparse. */ | |
55 | typedef struct skel_control_s | |
56 | { | |
57 | /* For the time being, nothing. */ | |
58 | } skel_control_t; | |
59 | ||
60 | /* From parse-skel.y. */ | |
61 | extern int skel_debug; | |
62 | void skel_error PARAMS ((skel_control_t *control, | |
63 | const yyltype *loc, const char *msg)); | |
64 | void process_skeleton PARAMS ((const char* skel)); | |
65 | ||
66 | /* From scan-skel.l. */ | |
67 | extern int skel__flex_debug; | |
68 | ||
69 | /* Renamed yyin. */ | |
70 | extern FILE* skel_in; | |
71 | ||
72 | # define YY_DECL \ | |
73 | int skel_lex PARAMS ((yystype *yylval, yyltype *yylloc)) | |
74 | YY_DECL; | |
75 | ||
76 | #endif SKELETON_H_ |