]> git.saurik.com Git - bison.git/blame - src/reader.h
Fix a longstanding bug uncovered by bro-0.9a9/src/parse.y, which I
[bison.git] / src / reader.h
CommitLineData
ef4479de
PE
1/* Input parser for Bison
2
6b702268
PE
3 Copyright (C) 2000, 2001, 2002, 2003, 2005, 2006 Free Software
4 Foundation, Inc.
a70083a3
AD
5
6 This file is part of Bison, the GNU Compiler Compiler.
7
8 Bison 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 2, or (at your option)
11 any later version.
12
13 Bison 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 Bison; see the file COPYING. If not, write to
0fb669f9
PE
20 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 Boston, MA 02110-1301, USA. */
a70083a3
AD
22
23#ifndef READER_H_
24# define READER_H_
25
0aa32d51 26# include "location.h"
56c47203 27# include "symlist.h"
5b2dd224 28
e9955c83
AD
29# include "parse-gram.h"
30
676385e2
PH
31typedef struct merger_list
32{
33 struct merger_list* next;
5b2dd224
PE
34 uniqstr name;
35 uniqstr type;
36} merger_list;
676385e2 37
e9955c83
AD
38/* From the scanner. */
39extern FILE *gram_in;
40extern int gram__flex_debug;
0aa32d51 41extern boundary scanner_cursor;
6b702268
PE
42extern char *last_string;
43extern location last_braced_code_loc;
25005f6a 44extern int max_left_semantic_context;
d33cb3ae
PE
45void scanner_initialize (void);
46void scanner_free (void);
7ec2d4cd 47void scanner_last_string_free (void);
e9955c83 48
04098407
PE
49/* These are declared by the scanner, but not used. We put them here
50 to pacify "make syntax-check". */
51extern FILE *gram_out;
52extern int gram_lineno;
53
5b25cd7c 54# define YY_DECL int gram_lex (YYSTYPE *val, location *loc)
e9955c83
AD
55YY_DECL;
56
57
58/* From the parser. */
59extern int gram_debug;
f6d03984 60int gram_parse (void);
ef4479de 61char const *token_name (int);
9280d3ef 62
e9955c83
AD
63
64/* From reader.c. */
a737b216 65void grammar_start_symbol_set (symbol *sym, location loc);
5b2dd224 66void prologue_augment (const char *prologue, location loc);
8f3596a6
AD
67void grammar_current_rule_begin (symbol *lhs, location loc);
68void grammar_current_rule_end (location loc);
6b702268 69void grammar_midrule_action (void);
5b2dd224
PE
70void grammar_current_rule_prec_set (symbol *precsym, location loc);
71void grammar_current_rule_dprec_set (int dprec, location loc);
72void grammar_current_rule_merge_set (uniqstr name, location loc);
5b2dd224
PE
73void grammar_current_rule_symbol_append (symbol *sym, location loc);
74void grammar_current_rule_action_append (const char *action, location loc);
75extern symbol_list *current_rule;
d33cb3ae
PE
76void reader (void);
77void free_merger_functions (void);
676385e2
PH
78
79extern merger_list *merge_functions;
80
affac613 81/* Was %union seen? */
d0829076 82extern bool typed;
affac613
AD
83
84/* Should rules have a default precedence? */
39a06c25 85extern bool default_prec;
a70083a3
AD
86
87#endif /* !READER_H_ */