1/* Input parser for Bison
2
3 Copyright (C) 2000-2003, 2005-2007, 2009-2015, 2018-2019 Free
4 Software Foundation, Inc.
5
6 This file is part of Bison, the GNU Compiler Compiler.
7
8 This program is free software: you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation, either version 3 of the License, or
11 (at your option) any later version.
12
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>. */
20
21#ifndef READER_H_
22# define READER_H_
23
24# include "location.h"
25# include "symlist.h"
26# include "named-ref.h"
27
28# include "parse-gram.h"
29
30typedef struct merger_list
31{
32 struct merger_list* next;
33 uniqstr name;
34 uniqstr type;
35 location type_declaration_loc;
36} merger_list;
37
38/* From the parser. */
39extern int gram_debug;
40int gram_parse (void);
41
42
43/* From reader.c. */
44void grammar_start_symbol_set (symbol *sym, location loc);
45void grammar_current_rule_begin (symbol *lhs, location loc,
46 named_ref *lhs_named_ref);
47void grammar_current_rule_end (location loc);
48void grammar_midrule_action (void);
49/* Apply %empty to the current rule. */
50void grammar_current_rule_empty_set (location loc);
51void grammar_current_rule_prec_set (symbol *precsym, location loc);
52void grammar_current_rule_dprec_set (int dprec, location loc);
53void grammar_current_rule_merge_set (uniqstr name, location loc);
54void grammar_current_rule_expect_sr (int count, location loc);
55void grammar_current_rule_expect_rr (int count, location loc);
56void grammar_current_rule_symbol_append (symbol *sym, location loc,
57 named_ref *nref);
58/* Attach an ACTION to the current rule. */
59void grammar_current_rule_action_append (const char *action, location loc,
60 named_ref *nref, uniqstr tag);
61/* Attach a PREDICATE to the current rule. */
62void grammar_current_rule_predicate_append (const char *predicate, location loc);
63void reader (void);
64void free_merger_functions (void);
65
66extern merger_list *merge_functions;
67
68/* Was %union seen? */
69extern bool union_seen;
70
71/* Should rules have a default precedence? */
72extern bool default_prec;
73
74#endif /* !READER_H_ */
75