]> git.saurik.com Git - bison.git/blame - src/reader.h
* src/parse-gram.y (YYLLOC_DEFAULT, current_lhs_location): New.
[bison.git] / src / reader.h
CommitLineData
a70083a3 1/* Input parser for bison
76514394 2 Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc.
a70083a3
AD
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
7 it 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,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU 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
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. */
20
21#ifndef READER_H_
22# define READER_H_
23
0c15323d
AD
24# include "location.h"
25
e9955c83
AD
26typedef struct symbol_list
27{
28 struct symbol_list *next;
29 symbol_t *sym;
8efe435c 30 location_t location;
280a38c3 31
e9955c83
AD
32 /* The action is attached to the LHS of a rule. */
33 const char *action;
8efe435c 34 location_t action_location;
a70083a3 35
e9955c83
AD
36 symbol_t *ruleprec;
37} symbol_list;
38
39# include "parse-gram.h"
40
e9955c83
AD
41typedef struct gram_control_s
42{
43 int errcode;
44} gram_control_t;
45
46/* From the scanner. */
47extern FILE *gram_in;
48extern int gram__flex_debug;
4cdb01db 49void scanner_last_string_free PARAMS ((void));
1d6412ad 50void scanner_initialize PARAMS ((void));
4cdb01db 51void scanner_free PARAMS ((void));
e9955c83
AD
52
53# define YY_DECL \
0c15323d 54 int gram_lex (yystype *yylval, location_t *yylloc, \
e9955c83
AD
55 gram_control_t *yycontrol)
56YY_DECL;
57
58
59/* From the parser. */
60extern int gram_debug;
61void gram_error (gram_control_t *control,
0c15323d 62 location_t *loc, const char *msg);
e9955c83
AD
63int gram_parse (void *control);
64
65char *get_type_name PARAMS ((int n, symbol_list *rule));
66extern int typed;
67
68/* From reader.c. */
8efe435c 69void grammar_start_symbol_set PARAMS ((symbol_t *s, location_t l));
e9955c83
AD
70void prologue_augment PARAMS ((const char *prologue, location_t location));
71void epilogue_set PARAMS ((const char *epilogue, location_t location));
8efe435c
AD
72void grammar_symbol_append PARAMS ((symbol_t *s, location_t l));
73void grammar_rule_begin PARAMS ((symbol_t *lhs, location_t l));
74void grammar_rule_end PARAMS ((location_t l));
e9955c83
AD
75void grammar_midrule_action PARAMS ((void));
76void grammar_current_rule_prec_set PARAMS ((symbol_t *precsym));
8efe435c
AD
77void grammar_current_rule_symbol_append PARAMS ((symbol_t *symbol,
78 location_t l));
e9955c83 79void grammar_current_rule_action_append PARAMS ((const char *action,
8efe435c 80 location_t l));
e9955c83
AD
81extern symbol_list *current_rule;
82void reader PARAMS ((void));
a70083a3
AD
83
84#endif /* !READER_H_ */