]> git.saurik.com Git - bison.git/blob - src/reader.h
824194028a2ac81a1415a729c02d75ea641ac35f
[bison.git] / src / reader.h
1 /* Input parser for bison
2 Copyright (C) 2000, 2001, 2002 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
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
24 # include "location.h"
25
26 typedef struct symbol_list
27 {
28 struct symbol_list *next;
29 symbol_t *sym;
30 location_t location;
31
32 /* The action is attached to the LHS of a rule. */
33 const char *action;
34 location_t action_location;
35
36 symbol_t *ruleprec;
37 } symbol_list;
38
39 symbol_list *symbol_list_new PARAMS ((symbol_t *sym, location_t location));
40 symbol_list *symbol_list_prepend PARAMS ((symbol_list *list,
41 symbol_t *sym, location_t location));
42
43 # include "parse-gram.h"
44
45 typedef struct gram_control_s
46 {
47 int errcode;
48 } gram_control_t;
49
50 /* From the scanner. */
51 extern FILE *gram_in;
52 extern int gram__flex_debug;
53 void scanner_last_string_free PARAMS ((void));
54 void scanner_initialize PARAMS ((void));
55 void scanner_free PARAMS ((void));
56
57 # define YY_DECL \
58 int gram_lex (yystype *yylval, location_t *yylloc, \
59 gram_control_t *yycontrol)
60 YY_DECL;
61
62
63 /* From the parser. */
64 extern int gram_debug;
65 void gram_error (gram_control_t *control,
66 location_t *loc, const char *msg);
67 int gram_parse (void *control);
68
69 char *get_type_name PARAMS ((int n, symbol_list *rule));
70 extern int typed;
71
72 /* From reader.c. */
73 void grammar_start_symbol_set PARAMS ((symbol_t *s, location_t l));
74 void prologue_augment PARAMS ((const char *prologue, location_t location));
75 void epilogue_set PARAMS ((const char *epilogue, location_t location));
76 void grammar_symbol_append PARAMS ((symbol_t *s, location_t l));
77 void grammar_rule_begin PARAMS ((symbol_t *lhs, location_t l));
78 void grammar_rule_end PARAMS ((location_t l));
79 void grammar_midrule_action PARAMS ((void));
80 void grammar_current_rule_prec_set PARAMS ((symbol_t *precsym));
81 void grammar_current_rule_symbol_append PARAMS ((symbol_t *symbol,
82 location_t l));
83 void grammar_current_rule_action_append PARAMS ((const char *action,
84 location_t l));
85 extern symbol_list *current_rule;
86 void reader PARAMS ((void));
87
88 #endif /* !READER_H_ */