1 // A Bison parser, made by GNU Bison 3.8.2.
2 
3 // Skeleton interface for Bison GLR parsers in C++
4 
5 // Copyright (C) 2002-2015, 2018-2021 Free Software Foundation, Inc.
6 
7 // This program is free software: you can redistribute it and/or modify
8 // it under the terms of the GNU General Public License as published by
9 // the Free Software Foundation, either version 3 of the License, or
10 // (at your option) any later version.
11 
12 // This program is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 // GNU General Public License for more details.
16 
17 // You should have received a copy of the GNU General Public License
18 // along with this program.  If not, see <https://www.gnu.org/licenses/>.
19 
20 // As a special exception, you may create a larger work that contains
21 // part or all of the Bison parser skeleton and distribute that work
22 // under terms of your choice, so long as that work isn't itself a
23 // parser generator using the skeleton or a modified version thereof
24 // as a parser skeleton.  Alternatively, if you modify or redistribute
25 // the parser skeleton itself, you may (at your option) remove this
26 // special exception, which will cause the skeleton and the resulting
27 // Bison output files to be licensed under the GNU General Public
28 // License without this special exception.
29 
30 // This special exception was added by the Free Software Foundation in
31 // version 2.2 of Bison.
32 
33 // C++ GLR parser skeleton written by Akim Demaille.
34 
35 // DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual,
36 // especially those whose name start with YY_ or yy_.  They are
37 // private implementation details that can be changed or removed.
38 
39 #ifndef YY_YY_OUT_SOONG_TEMP_SBOX_6CCC6C3E3124BFC9B15AEE1BDCC6CBDD83474AF7_OUT_PACKAGES_MODULES_BLUETOOTH_SYSTEM_GD_PACKET_PARSER_LANGUAGE_Y_H_INCLUDED
40 # define YY_YY_OUT_SOONG_TEMP_SBOX_6CCC6C3E3124BFC9B15AEE1BDCC6CBDD83474AF7_OUT_PACKAGES_MODULES_BLUETOOTH_SYSTEM_GD_PACKET_PARSER_LANGUAGE_Y_H_INCLUDED
41 // "%code requires" blocks.
42 #line 1 "packages/modules/Bluetooth/system/gd/packet/parser/language_y.yy"
43 
44   #include <iostream>
45   #include <vector>
46   #include <list>
47   #include <map>
48 
49   #include "declarations.h"
50   #include "logging.h"
51   #include "field_list.h"
52   #include "fields/all_fields.h"
53 
54 #line 55 "out/soong/.intermediates/packages/modules/Bluetooth/system/gd/packet/parser/bluetooth_packetgen/linux_glibc_x86_64/gen/yacc/packages/modules/Bluetooth/system/gd/packet/parser/language_y.h"
55 
56 #include <iostream>
57 #include <stdexcept>
58 #include <string>
59 
60 #if defined __cplusplus
61 # define YY_CPLUSPLUS __cplusplus
62 #else
63 # define YY_CPLUSPLUS 199711L
64 #endif
65 
66 // Support move semantics when possible.
67 #if 201103L <= YY_CPLUSPLUS
68 # define YY_MOVE           std::move
69 # define YY_MOVE_OR_COPY   move
70 # define YY_MOVE_REF(Type) Type&&
71 # define YY_RVREF(Type)    Type&&
72 # define YY_COPY(Type)     Type
73 #else
74 # define YY_MOVE
75 # define YY_MOVE_OR_COPY   copy
76 # define YY_MOVE_REF(Type) Type&
77 # define YY_RVREF(Type)    const Type&
78 # define YY_COPY(Type)     const Type&
79 #endif
80 
81 // Support noexcept when possible.
82 #if 201103L <= YY_CPLUSPLUS
83 # define YY_NOEXCEPT noexcept
84 # define YY_NOTHROW
85 #else
86 # define YY_NOEXCEPT
87 # define YY_NOTHROW throw ()
88 #endif
89 
90 // Support constexpr when possible.
91 #if 201703 <= YY_CPLUSPLUS
92 # define YY_CONSTEXPR constexpr
93 #else
94 # define YY_CONSTEXPR
95 #endif
96 # include "location.hh"
97 
98 
99 // Whether we are compiled with exception support.
100 #ifndef YY_EXCEPTIONS
101 # if defined __GNUC__ && !defined __EXCEPTIONS
102 #  define YY_EXCEPTIONS 0
103 # else
104 #  define YY_EXCEPTIONS 1
105 # endif
106 #endif
107 
108 /* Debug traces.  */
109 #ifndef YYDEBUG
110 # define YYDEBUG 1
111 #endif
112 
113 namespace yy {
114 #line 115 "out/soong/.intermediates/packages/modules/Bluetooth/system/gd/packet/parser/bluetooth_packetgen/linux_glibc_x86_64/gen/yacc/packages/modules/Bluetooth/system/gd/packet/parser/language_y.h"
115 
116 
117 
118 
119   /// A Bison parser.
120   class parser
121   {
122   public:
123 #ifdef YYSTYPE
124 # ifdef __GNUC__
125 #  pragma GCC message "bison: do not #define YYSTYPE in C++, use %define api.value.type"
126 # endif
127     typedef YYSTYPE value_type;
128 #else
129     /// Symbol semantic values.
130     union value_type
131     {
132 #line 36 "packages/modules/Bluetooth/system/gd/packet/parser/language_y.yy"
133 
134   uint64_t integer;
135   std::string* string;
136 
137   EnumDef* enum_definition;
138   std::map<uint64_t, std::string>* enumeration_values;
139   std::pair<uint64_t, std::string>* enumeration_value;
140 
141   PacketDef* packet_definition_value;
142   FieldList* packet_field_definitions;
143   PacketField* packet_field_type;
144 
145   StructDef* struct_definition_value;
146 
147   std::set<std::string*>* test_cases_t;
148   std::string* test_case_t;
149 
150   std::map<std::string, std::variant<int64_t, std::string>>* constraint_list_t;
151   std::pair<std::string, std::variant<int64_t, std::string>>* constraint_t;
152 
153 #line 154 "out/soong/.intermediates/packages/modules/Bluetooth/system/gd/packet/parser/bluetooth_packetgen/linux_glibc_x86_64/gen/yacc/packages/modules/Bluetooth/system/gd/packet/parser/language_y.h"
154 
155     };
156 #endif
157     /// Backward compatibility (Bison 3.8).
158     typedef value_type semantic_type;
159 
160     /// Symbol locations.
161     typedef location location_type;
162 
163     /// Syntax errors thrown from user actions.
164     struct syntax_error : std::runtime_error
165     {
syntax_errorsyntax_error166       syntax_error (const location_type& l, const std::string& m)
167         : std::runtime_error (m)
168         , location (l)
169       {}
170 
syntax_errorsyntax_error171       syntax_error (const syntax_error& s)
172         : std::runtime_error (s.what ())
173         , location (s.location)
174       {}
175 
176       ~syntax_error () YY_NOEXCEPT YY_NOTHROW;
177 
178       location_type location;
179     };
180 
181     /// Token kinds.
182     struct token
183     {
184       enum token_kind_type
185       {
186         YYEMPTY = -2,
187     YYEOF = 0,                     // "end of file"
188     YYerror = 256,                 // error
189     YYUNDEF = 257,                 // "invalid token"
190     INTEGER = 258,                 // INTEGER
191     IS_LITTLE_ENDIAN = 259,        // IS_LITTLE_ENDIAN
192     IDENTIFIER = 260,              // IDENTIFIER
193     SIZE_MODIFIER = 261,           // SIZE_MODIFIER
194     STRING = 262,                  // STRING
195     ENUM = 263,                    // "enum"
196     PACKET = 264,                  // "packet"
197     PAYLOAD = 265,                 // "payload"
198     BODY = 266,                    // "body"
199     STRUCT = 267,                  // "struct"
200     SIZE = 268,                    // "size"
201     COUNT = 269,                   // "count"
202     FIXED = 270,                   // "fixed"
203     RESERVED = 271,                // "reserved"
204     GROUP = 272,                   // "group"
205     CUSTOM_FIELD = 273,            // "custom_field"
206     CHECKSUM = 274,                // "checksum"
207     CHECKSUM_START = 275,          // "checksum_start"
208     PADDING = 276,                 // "padding"
209     TEST = 277                     // "test"
210       };
211       /// Backward compatibility alias (Bison 3.6).
212       typedef token_kind_type yytokentype;
213     };
214 
215     /// Token kind, as returned by yylex.
216     typedef token::token_kind_type token_kind_type;
217 
218     /// Backward compatibility alias (Bison 3.6).
219     typedef token_kind_type token_type;
220 
221     /// Symbol kinds.
222     struct symbol_kind
223     {
224       enum symbol_kind_type
225       {
226         YYNTOKENS = 32, ///< Number of tokens.
227         S_YYEMPTY = -2,
228         S_YYEOF = 0,                             // "end of file"
229         S_YYerror = 1,                           // error
230         S_YYUNDEF = 2,                           // "invalid token"
231         S_INTEGER = 3,                           // INTEGER
232         S_IS_LITTLE_ENDIAN = 4,                  // IS_LITTLE_ENDIAN
233         S_IDENTIFIER = 5,                        // IDENTIFIER
234         S_SIZE_MODIFIER = 6,                     // SIZE_MODIFIER
235         S_STRING = 7,                            // STRING
236         S_ENUM = 8,                              // "enum"
237         S_PACKET = 9,                            // "packet"
238         S_PAYLOAD = 10,                          // "payload"
239         S_BODY = 11,                             // "body"
240         S_STRUCT = 12,                           // "struct"
241         S_SIZE = 13,                             // "size"
242         S_COUNT = 14,                            // "count"
243         S_FIXED = 15,                            // "fixed"
244         S_RESERVED = 16,                         // "reserved"
245         S_GROUP = 17,                            // "group"
246         S_CUSTOM_FIELD = 18,                     // "custom_field"
247         S_CHECKSUM = 19,                         // "checksum"
248         S_CHECKSUM_START = 20,                   // "checksum_start"
249         S_PADDING = 21,                          // "padding"
250         S_TEST = 22,                             // "test"
251         S_23_ = 23,                              // ':'
252         S_24_ = 24,                              // '{'
253         S_25_ = 25,                              // ','
254         S_26_ = 26,                              // '}'
255         S_27_ = 27,                              // '='
256         S_28_ = 28,                              // '('
257         S_29_ = 29,                              // ')'
258         S_30_ = 30,                              // '['
259         S_31_ = 31,                              // ']'
260         S_YYACCEPT = 32,                         // $accept
261         S_file = 33,                             // file
262         S_declarations = 34,                     // declarations
263         S_declaration = 35,                      // declaration
264         S_enum_definition = 36,                  // enum_definition
265         S_enumeration_list = 37,                 // enumeration_list
266         S_enumeration = 38,                      // enumeration
267         S_group_definition = 39,                 // group_definition
268         S_checksum_definition = 40,              // checksum_definition
269         S_custom_field_definition = 41,          // custom_field_definition
270         S_test_definition = 42,                  // test_definition
271         S_test_case_list = 43,                   // test_case_list
272         S_test_case = 44,                        // test_case
273         S_struct_definition = 45,                // struct_definition
274         S_packet_definition = 46,                // packet_definition
275         S_field_definition_list = 47,            // field_definition_list
276         S_field_definition = 48,                 // field_definition
277         S_group_field_definition = 49,           // group_field_definition
278         S_constraint_list = 50,                  // constraint_list
279         S_constraint = 51,                       // constraint
280         S_type_def_field_definition = 52,        // type_def_field_definition
281         S_scalar_field_definition = 53,          // scalar_field_definition
282         S_body_field_definition = 54,            // body_field_definition
283         S_payload_field_definition = 55,         // payload_field_definition
284         S_checksum_start_field_definition = 56,  // checksum_start_field_definition
285         S_padding_field_definition = 57,         // padding_field_definition
286         S_size_field_definition = 58,            // size_field_definition
287         S_fixed_field_definition = 59,           // fixed_field_definition
288         S_reserved_field_definition = 60,        // reserved_field_definition
289         S_array_field_definition = 61            // array_field_definition
290       };
291     };
292 
293     /// (Internal) symbol kind.
294     typedef symbol_kind::symbol_kind_type symbol_kind_type;
295 
296     /// The number of tokens.
297     static const symbol_kind_type YYNTOKENS = symbol_kind::YYNTOKENS;
298 
299 
300     /// Build a parser object.
301     parser (void* scanner_yyarg, Declarations* decls_yyarg);
302     virtual ~parser ();
303 
304     /// Parse.  An alias for parse ().
305     /// \returns  0 iff parsing succeeded.
306     int operator() ();
307 
308     /// Parse.
309     /// \returns  0 iff parsing succeeded.
310     virtual int parse ();
311 
312 #if YYDEBUG
313     /// The current debugging stream.
314     std::ostream& debug_stream () const;
315     /// Set the current debugging stream.
316     void set_debug_stream (std::ostream &);
317 
318     /// Type for debugging levels.
319     typedef int debug_level_type;
320     /// The current debugging level.
321     debug_level_type debug_level () const;
322     /// Set the current debugging level.
323     void set_debug_level (debug_level_type l);
324 #endif
325 
326     /// Report a syntax error.
327     /// \param loc    where the syntax error is found.
328     /// \param msg    a description of the syntax error.
329     virtual void error (const location_type& loc, const std::string& msg);
330 
331 # if YYDEBUG
332   public:
333     /// \brief Report a symbol value on the debug stream.
334     /// \param yykind       The symbol kind.
335     /// \param yyvaluep     Its semantic value.
336     /// \param yylocationp  Its location.
337     virtual void yy_symbol_value_print_ (symbol_kind_type yykind,
338                                          const value_type* yyvaluep,
339                                          const location_type* yylocationp) const;
340     /// \brief Report a symbol on the debug stream.
341     /// \param yykind       The symbol kind.
342     /// \param yyvaluep     Its semantic value.
343     /// \param yylocationp  Its location.
344     virtual void yy_symbol_print_ (symbol_kind_type yykind,
345                                    const value_type* yyvaluep,
346                                    const location_type* yylocationp) const;
347   private:
348     /// Debug stream.
349     std::ostream* yycdebug_;
350 #endif
351 
352 
353     // User arguments.
354     void* scanner;
355     Declarations* decls;
356   };
357 
358 } // yy
359 #line 360 "out/soong/.intermediates/packages/modules/Bluetooth/system/gd/packet/parser/bluetooth_packetgen/linux_glibc_x86_64/gen/yacc/packages/modules/Bluetooth/system/gd/packet/parser/language_y.h"
360 
361 
362 
363 
364 #endif // !YY_YY_OUT_SOONG_TEMP_SBOX_6CCC6C3E3124BFC9B15AEE1BDCC6CBDD83474AF7_OUT_PACKAGES_MODULES_BLUETOOTH_SYSTEM_GD_PACKET_PARSER_LANGUAGE_Y_H_INCLUDED
365