glr2.cc: put glr_state_set and glr_stack_item in unnamed namespace
[bison.git] / src / parse-gram.h
blob55837bc41d8fd86e60893c35b60298e6f35b12c9
1 /* A Bison parser, made by GNU Bison 3.8.1. */
3 /* Bison interface for Yacc-like parsers in C
5 Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2021 Free Software Foundation,
6 Inc.
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.
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.
18 You should have received a copy of the GNU General Public License
19 along with this program. If not, see <https://www.gnu.org/licenses/>. */
21 /* As a special exception, you may create a larger work that contains
22 part or all of the Bison parser skeleton and distribute that work
23 under terms of your choice, so long as that work isn't itself a
24 parser generator using the skeleton or a modified version thereof
25 as a parser skeleton. Alternatively, if you modify or redistribute
26 the parser skeleton itself, you may (at your option) remove this
27 special exception, which will cause the skeleton and the resulting
28 Bison output files to be licensed under the GNU General Public
29 License without this special exception.
31 This special exception was added by the Free Software Foundation in
32 version 2.2 of Bison. */
34 /* DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual,
35 especially those whose name start with YY_ or yy_. They are
36 private implementation details that can be changed or removed. */
38 #ifndef YY_GRAM_SRC_PARSE_GRAM_H_INCLUDED
39 # define YY_GRAM_SRC_PARSE_GRAM_H_INCLUDED
40 /* Debug traces. */
41 #ifndef GRAM_DEBUG
42 # if defined YYDEBUG
43 #if YYDEBUG
44 # define GRAM_DEBUG 1
45 # else
46 # define GRAM_DEBUG 0
47 # endif
48 # else /* ! defined YYDEBUG */
49 # define GRAM_DEBUG 1
50 # endif /* ! defined YYDEBUG */
51 #endif /* ! defined GRAM_DEBUG */
52 #if GRAM_DEBUG
53 extern int gram_debug;
54 #endif
55 /* "%code requires" blocks. */
57 #include "symlist.h"
58 #include "symtab.h"
60 typedef enum
62 param_none = 0,
63 param_lex = 1 << 0,
64 param_parse = 1 << 1,
65 param_both = param_lex | param_parse
66 } param_type;
68 #include "muscle-tab.h"
69 typedef struct
71 char const *chars;
72 muscle_kind kind;
73 } value_type;
76 /* Token kinds. */
77 #ifndef GRAM_TOKENTYPE
78 # define GRAM_TOKENTYPE
79 enum gram_tokentype
81 GRAM_EMPTY = -2,
82 GRAM_EOF = 0, /* "end of file" */
83 GRAM_error = 1, /* error */
84 GRAM_UNDEF = 2, /* "invalid token" */
85 STRING = 3, /* "string" */
86 TSTRING = 4, /* "translatable string" */
87 PERCENT_TOKEN = 5, /* "%token" */
88 PERCENT_NTERM = 6, /* "%nterm" */
89 PERCENT_TYPE = 7, /* "%type" */
90 PERCENT_DESTRUCTOR = 8, /* "%destructor" */
91 PERCENT_PRINTER = 9, /* "%printer" */
92 PERCENT_LEFT = 10, /* "%left" */
93 PERCENT_RIGHT = 11, /* "%right" */
94 PERCENT_NONASSOC = 12, /* "%nonassoc" */
95 PERCENT_PRECEDENCE = 13, /* "%precedence" */
96 PERCENT_PREC = 14, /* "%prec" */
97 PERCENT_DPREC = 15, /* "%dprec" */
98 PERCENT_MERGE = 16, /* "%merge" */
99 PERCENT_CODE = 17, /* "%code" */
100 PERCENT_DEFAULT_PREC = 18, /* "%default-prec" */
101 PERCENT_DEFINE = 19, /* "%define" */
102 PERCENT_ERROR_VERBOSE = 20, /* "%error-verbose" */
103 PERCENT_EXPECT = 21, /* "%expect" */
104 PERCENT_EXPECT_RR = 22, /* "%expect-rr" */
105 PERCENT_FILE_PREFIX = 23, /* "%file-prefix" */
106 PERCENT_FLAG = 24, /* "%<flag>" */
107 PERCENT_GLR_PARSER = 25, /* "%glr-parser" */
108 PERCENT_HEADER = 26, /* "%header" */
109 PERCENT_INITIAL_ACTION = 27, /* "%initial-action" */
110 PERCENT_LANGUAGE = 28, /* "%language" */
111 PERCENT_NAME_PREFIX = 29, /* "%name-prefix" */
112 PERCENT_NO_DEFAULT_PREC = 30, /* "%no-default-prec" */
113 PERCENT_NO_LINES = 31, /* "%no-lines" */
114 PERCENT_NONDETERMINISTIC_PARSER = 32, /* "%nondeterministic-parser" */
115 PERCENT_OUTPUT = 33, /* "%output" */
116 PERCENT_PURE_PARSER = 34, /* "%pure-parser" */
117 PERCENT_REQUIRE = 35, /* "%require" */
118 PERCENT_SKELETON = 36, /* "%skeleton" */
119 PERCENT_START = 37, /* "%start" */
120 PERCENT_TOKEN_TABLE = 38, /* "%token-table" */
121 PERCENT_VERBOSE = 39, /* "%verbose" */
122 PERCENT_YACC = 40, /* "%yacc" */
123 BRACED_CODE = 41, /* "{...}" */
124 BRACED_PREDICATE = 42, /* "%?{...}" */
125 BRACKETED_ID = 43, /* "[identifier]" */
126 CHAR_LITERAL = 44, /* "character literal" */
127 COLON = 45, /* ":" */
128 EPILOGUE = 46, /* "epilogue" */
129 EQUAL = 47, /* "=" */
130 ID = 48, /* "identifier" */
131 ID_COLON = 49, /* "identifier:" */
132 PERCENT_PERCENT = 50, /* "%%" */
133 PIPE = 51, /* "|" */
134 PROLOGUE = 52, /* "%{...%}" */
135 SEMICOLON = 53, /* ";" */
136 TAG = 54, /* "<tag>" */
137 TAG_ANY = 55, /* "<*>" */
138 TAG_NONE = 56, /* "<>" */
139 INT_LITERAL = 57, /* "integer literal" */
140 PERCENT_PARAM = 58, /* "%param" */
141 PERCENT_UNION = 59, /* "%union" */
142 PERCENT_EMPTY = 60 /* "%empty" */
144 typedef enum gram_tokentype gram_token_kind_t;
145 #endif
147 /* Value type. */
148 #if ! defined GRAM_STYPE && ! defined GRAM_STYPE_IS_DECLARED
149 union GRAM_STYPE
151 assoc precedence_declarator; /* precedence_declarator */
152 char* STRING; /* "string" */
153 char* TSTRING; /* "translatable string" */
154 char* BRACED_CODE; /* "{...}" */
155 char* BRACED_PREDICATE; /* "%?{...}" */
156 char* EPILOGUE; /* "epilogue" */
157 char* PROLOGUE; /* "%{...%}" */
158 char* yykind_75; /* string.opt */
159 code_props_type code_props_type; /* code_props_type */
160 int INT_LITERAL; /* "integer literal" */
161 int yykind_84; /* int.opt */
162 named_ref* yykind_97; /* named_ref.opt */
163 param_type PERCENT_PARAM; /* "%param" */
164 symbol* token_decl; /* token_decl */
165 symbol* alias; /* alias */
166 symbol* token_decl_for_prec; /* token_decl_for_prec */
167 symbol* id; /* id */
168 symbol* id_colon; /* id_colon */
169 symbol* symbol; /* symbol */
170 symbol* string_as_id; /* string_as_id */
171 symbol_list* generic_symlist; /* generic_symlist */
172 symbol_list* generic_symlist_item; /* generic_symlist_item */
173 symbol_list* nterm_decls; /* nterm_decls */
174 symbol_list* token_decls; /* token_decls */
175 symbol_list* yykind_82; /* token_decl.1 */
176 symbol_list* token_decls_for_prec; /* token_decls_for_prec */
177 symbol_list* yykind_87; /* token_decl_for_prec.1 */
178 symbol_list* symbol_decls; /* symbol_decls */
179 symbol_list* yykind_90; /* symbols.1 */
180 uniqstr PERCENT_ERROR_VERBOSE; /* "%error-verbose" */
181 uniqstr PERCENT_FILE_PREFIX; /* "%file-prefix" */
182 uniqstr PERCENT_FLAG; /* "%<flag>" */
183 uniqstr PERCENT_NAME_PREFIX; /* "%name-prefix" */
184 uniqstr PERCENT_PURE_PARSER; /* "%pure-parser" */
185 uniqstr BRACKETED_ID; /* "[identifier]" */
186 uniqstr ID; /* "identifier" */
187 uniqstr ID_COLON; /* "identifier:" */
188 uniqstr TAG; /* "<tag>" */
189 uniqstr yykind_76; /* tag.opt */
190 uniqstr tag; /* tag */
191 uniqstr variable; /* variable */
192 unsigned char CHAR_LITERAL; /* "character literal" */
193 value_type value; /* value */
197 typedef union GRAM_STYPE GRAM_STYPE;
198 # define GRAM_STYPE_IS_TRIVIAL 1
199 # define GRAM_STYPE_IS_DECLARED 1
200 #endif
202 /* Location type. */
203 #if ! defined GRAM_LTYPE && ! defined GRAM_LTYPE_IS_DECLARED
204 typedef struct GRAM_LTYPE GRAM_LTYPE;
205 struct GRAM_LTYPE
207 int first_line;
208 int first_column;
209 int last_line;
210 int last_column;
212 # define GRAM_LTYPE_IS_DECLARED 1
213 # define GRAM_LTYPE_IS_TRIVIAL 1
214 #endif
219 int gram_parse (void);
221 /* "%code provides" blocks. */
223 /* Initialize unquote. */
224 void parser_init (void);
225 /* Deallocate storage for unquote. */
226 void parser_free (void);
229 #endif /* !YY_GRAM_SRC_PARSE_GRAM_H_INCLUDED */