mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 12:23:04 +00:00
77 lines
2.6 KiB
C
77 lines
2.6 KiB
C
/* Parse Bison Skeletons.
|
|
Copyright (C) 2001 Free Software Foundation, Inc.
|
|
|
|
This file is part of Bison, the GNU Compiler Compiler.
|
|
|
|
Bison 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, or (at your option)
|
|
any later version.
|
|
|
|
Bison 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 Bison; see the file COPYING. If not, write to the Free
|
|
Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
|
02111-1307, USA. */
|
|
|
|
#ifndef SKELETON_H_
|
|
# define SKELETON_H_
|
|
|
|
# include "parse-skel.h"
|
|
|
|
/* Initialize LOC. */
|
|
# define LOCATION_RESET(Loc) \
|
|
(Loc).first_column = (Loc).first_line = 1; \
|
|
(Loc).last_column = (Loc).last_line = 1;
|
|
|
|
/* Advance of NUM lines. */
|
|
# define LOCATION_LINES(Loc, Num) \
|
|
(Loc).last_column = 1; \
|
|
(Loc).last_line += Num;
|
|
|
|
/* Restart: move the first cursor to the last position. */
|
|
# define LOCATION_STEP(Loc) \
|
|
(Loc).first_column = (Loc).last_column; \
|
|
(Loc).first_line = (Loc).last_line;
|
|
|
|
/* Output LOC on the stream OUT. */
|
|
# define LOCATION_PRINT(Out, Loc) \
|
|
if ((Loc).first_line != (Loc).last_line) \
|
|
fprintf (Out, "%d.%d-%d.%d", \
|
|
(Loc).first_line, (Loc).first_column, \
|
|
(Loc).last_line, (Loc).last_column - 1); \
|
|
else if ((Loc).first_column < (Loc).last_column - 1) \
|
|
fprintf (Out, "%d.%d-%d", (Loc).first_line, \
|
|
(Loc).first_column, (Loc).last_column - 1); \
|
|
else \
|
|
fprintf (Out, "%d.%d", (Loc).first_line, (Loc).first_column)
|
|
|
|
|
|
/* Pure parsers need to pass arguments to yyparse. */
|
|
typedef struct skel_control_s
|
|
{
|
|
/* For the time being, nothing. */
|
|
} skel_control_t;
|
|
|
|
/* From parse-skel.y. */
|
|
extern int skel_debug;
|
|
void skel_error PARAMS ((skel_control_t *control,
|
|
const yyltype *loc, const char *msg));
|
|
void process_skeleton PARAMS ((const char* skel));
|
|
|
|
/* From scan-skel.l. */
|
|
extern int skel__flex_debug;
|
|
|
|
/* Renamed yyin. */
|
|
extern FILE* skel_in;
|
|
|
|
# define YY_DECL \
|
|
int skel_lex PARAMS ((yystype *yylval, yyltype *yylloc))
|
|
YY_DECL;
|
|
|
|
#endif /* ! SKELETON_H_ */
|