1 // A Bison parser, made by GNU Bison 3.8.2.
2
3 // Skeleton implementation 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 Paul Hilfinger. */
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 /* Identify Bison output, and Bison version. */
40 #define YYBISON 30802
41
42 /* Bison version string. */
43 #define YYBISON_VERSION "3.8.2"
44
45 /* Skeleton name. */
46 #define YYSKELETON_NAME "glr.cc"
47
48 /* Pure parsers. */
49 #define YYPURE 1
50
51
52
53
54
55
56 // First part of user prologue.
57 #line 17 "system/tools/hidl/hidl-gen_y.yy"
58
59
60 #include "AST.h"
61 #include "Annotation.h"
62 #include "ArrayType.h"
63 #include "CompoundType.h"
64 #include "ConstantExpression.h"
65 #include "Coordinator.h"
66 #include "DocComment.h"
67 #include "EnumType.h"
68 #include "Interface.h"
69 #include "Location.h"
70 #include "Method.h"
71 #include "Scope.h"
72 #include "TypeDef.h"
73 #include "VectorType.h"
74
75 #include "hidl-gen_y-helpers.h"
76
77 #include <android-base/logging.h>
78 #include <hidl-util/FQName.h>
79 #include <hidl-util/StringHelper.h>
80 #include <stdio.h>
81
82 using namespace android;
83
84 extern int yylex(yy::parser::semantic_type*, yy::parser::location_type*, void*, AST* const,
85 Scope** const);
86
enterScope(AST *,Scope ** scope,Scope * container)87 void enterScope(AST* /* ast */, Scope** scope, Scope* container) {
88 CHECK(container->parent() == (*scope));
89 *scope = container;
90 }
91
leaveScope(AST * ast,Scope ** scope)92 void leaveScope(AST* ast, Scope** scope) {
93 CHECK((*scope) != &ast->getRootScope());
94 *scope = (*scope)->parent();
95 }
96
convertYYLoc(const yy::parser::location_type & loc,const AST * ast)97 ::android::Location convertYYLoc(const yy::parser::location_type& loc, const AST* ast) {
98 return ::android::Location(
99 ::android::Position(ast->getCoordinator().makeRelative(*(loc.begin.filename)),
100 loc.begin.line, loc.begin.column),
101 ::android::Position(ast->getCoordinator().makeRelative(*(loc.end.filename)),
102 loc.end.line, loc.end.column));
103 }
104
isValidInterfaceField(const std::string & identifier,std::string * errorMsg)105 bool isValidInterfaceField(const std::string& identifier, std::string *errorMsg) {
106 static const std::vector<std::string> reserved({
107 // Injected names to C++ interfaces by auto-generated code
108 "isRemote", "descriptor", "hidlStaticBlock", "onTransact",
109 "castFrom", "Proxy", "Stub", "getService",
110
111 // Injected names to Java interfaces by auto-generated code
112 "asInterface", "castFrom", "getService", "toString",
113
114 // Inherited methods from IBase is detected in addMethod. Not added here
115 // because we need hidl-gen to compile IBase.
116
117 // Inherited names by interfaces from IInterface / IBinder
118 "onAsBinder", "asBinder", "queryLocalInterface", "getInterfaceDescriptor", "isBinderAlive",
119 "pingBinder", "dump", "transact", "checkSubclass", "attachObject", "findObject",
120 "detachObject", "localBinder", "remoteBinder", "mImpl",
121
122 // Inherited names from HidlInstrumentor
123 "InstrumentationEvent", "configureInstrumentation", "registerInstrumentationCallbacks",
124 "isInstrumentationLib", "mInstrumentationCallbacks", "mEnableInstrumentation",
125 "mInstrumentationLibPackage", "mInterfaceName",
126
127 // Collide with names in BsFoo
128 "mImpl", "addOnewayTask", "mOnewayQueue",
129
130 // Inherited names from Java IHwInterface
131 "asBinder",
132 });
133 if (std::find(reserved.begin(), reserved.end(), identifier) != reserved.end()) {
134 *errorMsg = identifier + " cannot be a name inside an interface";
135 return false;
136 }
137 return true;
138 }
139
isValidStructField(const std::string & identifier,std::string * errorMsg)140 bool isValidStructField(const std::string& identifier, std::string *errorMsg) {
141 static const std::vector<std::string> reserved({
142 // Injected names to structs and unions by auto-generated code
143 "readEmbeddedFromParcel", "writeEmbeddedToParcel", "readVectorFromParcel",
144 "writeVectorToParcel", "writeEmbeddedToBlob",
145 });
146 if (std::find(reserved.begin(), reserved.end(), identifier) != reserved.end()) {
147 *errorMsg = identifier + " cannot be a name inside an struct or union";
148 return false;
149 }
150 return true;
151 }
152
isValidCompoundTypeField(CompoundType::Style style,const std::string & identifier,std::string * errorMsg)153 bool isValidCompoundTypeField(CompoundType::Style style, const std::string& identifier,
154 std::string *errorMsg) {
155 // Unions don't support fix-up types; as such, they can't
156 // have name collisions with embedded read/write methods.
157 if (style == CompoundType::STYLE_UNION) { return true; }
158
159 return isValidStructField(identifier, errorMsg);;
160 }
161
isValidIdentifier(const std::string & identifier,std::string * errorMsg)162 bool isValidIdentifier(const std::string& identifier, std::string *errorMsg) {
163 static const std::vector<std::string> keywords({
164 "uint8_t", "uint16_t", "uint32_t", "uint64_t",
165 "int8_t", "int16_t", "int32_t", "int64_t", "bool", "float", "double",
166 "interface", "struct", "union", "string", "vec", "enum", "ref", "handle",
167 "package", "import", "typedef", "generates", "oneway", "extends",
168 "fmq_sync", "fmq_unsync", "safe_union",
169 });
170 static const std::vector<std::string> cppKeywords({
171 "alignas", "alignof", "and", "and_eq", "asm", "atomic_cancel", "atomic_commit",
172 "atomic_noexcept", "auto", "bitand", "bitor", "bool", "break", "case", "catch",
173 "char", "char16_t", "char32_t", "class", "compl", "concept", "const", "constexpr",
174 "const_cast", "continue", "decltype", "default", "delete", "do", "double",
175 "dynamic_cast", "else", "enum", "explicit", "export", "extern", "false", "float",
176 "for", "friend", "goto", "if", "inline", "int", "import", "long", "module", "mutable",
177 "namespace", "new", "noexcept", "not", "not_eq", "nullptr", "operator", "or", "or_eq",
178 "private", "protected", "public", "register", "reinterpret_cast", "requires", "return",
179 "short", "signed", "sizeof", "static", "static_assert", "static_cast", "struct",
180 "switch", "synchronized", "template", "this", "thread_local", "throw", "true", "try",
181 "typedef", "typeid", "typename", "union", "unsigned", "using", "virtual", "void",
182 "volatile", "wchar_t", "while", "xor", "xor_eq",
183 });
184 static const std::vector<std::string> javaKeywords({
185 "abstract", "continue", "for", "new", "switch", "assert", "default", "goto", "package",
186 "synchronized", "boolean", "do", "if", "private", "this", "break", "double",
187 "implements", "protected", "throw", "byte", "else", "import", "public", "throws",
188 "case", "enum", "instanceof", "return", "transient", "catch", "extends", "int",
189 "short", "try", "char", "final", "interface", "static", "void", "class", "finally",
190 "long", "strictfp", "volatile", "const", "float", "native", "super", "while",
191 });
192 static const std::vector<std::string> cppCollide({
193 "size_t", "offsetof",
194 });
195
196 // errors
197 if (std::find(keywords.begin(), keywords.end(), identifier) != keywords.end()) {
198 *errorMsg = identifier + " is a HIDL keyword "
199 "and is therefore not a valid identifier";
200 return false;
201 }
202 if (std::find(cppKeywords.begin(), cppKeywords.end(), identifier) != cppKeywords.end()) {
203 *errorMsg = identifier + " is a C++ keyword "
204 "and is therefore not a valid identifier";
205 return false;
206 }
207 if (std::find(javaKeywords.begin(), javaKeywords.end(), identifier) != javaKeywords.end()) {
208 *errorMsg = identifier + " is a Java keyword "
209 "and is therefore not a valid identifier";
210 return false;
211 }
212 if (std::find(cppCollide.begin(), cppCollide.end(), identifier) != cppCollide.end()) {
213 *errorMsg = identifier + " collides with reserved names in C++ code "
214 "and is therefore not a valid identifier";
215 return false;
216 }
217 if (StringHelper::StartsWith(identifier, "_hidl_")) {
218 *errorMsg = identifier + " starts with _hidl_ "
219 "and is therefore not a valid identifier";
220 return false;
221 }
222 if (StringHelper::StartsWith(identifier, "hidl_")) {
223 *errorMsg = identifier + " starts with hidl_ "
224 "and is therefore not a valid identifier";
225 return false;
226 }
227 if (StringHelper::EndsWith(identifier, "_cb")) {
228 *errorMsg = identifier + " ends with _cb "
229 "and is therefore not a valid identifier";
230 return false;
231 }
232
233 return true;
234 }
235
236 // Return true if identifier is an acceptable name for an UDT.
isValidTypeName(const std::string & identifier,std::string * errorMsg)237 bool isValidTypeName(const std::string& identifier, std::string *errorMsg) {
238 if (!isValidIdentifier(identifier, errorMsg)) {
239 return false;
240 }
241
242 if (identifier == "toString") {
243 *errorMsg = identifier + " is not a valid type name";
244 return false;
245 }
246
247 return true;
248 }
249
250
251 #line 252 "out/soong/.intermediates/system/tools/hidl/libhidl-gen-ast/linux_glibc_x86_64_static/gen/yacc/system/tools/hidl/hidl-gen_y.cpp"
252
253 # ifndef YY_CAST
254 # ifdef __cplusplus
255 # define YY_CAST(Type, Val) static_cast<Type> (Val)
256 # define YY_REINTERPRET_CAST(Type, Val) reinterpret_cast<Type> (Val)
257 # else
258 # define YY_CAST(Type, Val) ((Type) (Val))
259 # define YY_REINTERPRET_CAST(Type, Val) ((Type) (Val))
260 # endif
261 # endif
262 # ifndef YY_NULLPTR
263 # if defined __cplusplus
264 # if 201103L <= __cplusplus
265 # define YY_NULLPTR nullptr
266 # else
267 # define YY_NULLPTR 0
268 # endif
269 # else
270 # define YY_NULLPTR ((void*)0)
271 # endif
272 # endif
273
274 #include "hidl-gen_y.h"
275
276 #ifndef YY_ATTRIBUTE_PURE
277 # if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__)
278 # define YY_ATTRIBUTE_PURE __attribute__ ((__pure__))
279 # else
280 # define YY_ATTRIBUTE_PURE
281 # endif
282 #endif
283
284 #ifndef YY_ATTRIBUTE_UNUSED
285 # if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__)
286 # define YY_ATTRIBUTE_UNUSED __attribute__ ((__unused__))
287 # else
288 # define YY_ATTRIBUTE_UNUSED
289 # endif
290 #endif
291
292 /* Suppress unused-variable warnings by "using" E. */
293 #if ! defined lint || defined __GNUC__
294 # define YY_USE(E) ((void) (E))
295 #else
296 # define YY_USE(E) /* empty */
297 #endif
298
299 /* Suppress an incorrect diagnostic about yylval being uninitialized. */
300 #if defined __GNUC__ && ! defined __ICC && 406 <= __GNUC__ * 100 + __GNUC_MINOR__
301 # if __GNUC__ * 100 + __GNUC_MINOR__ < 407
302 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
303 _Pragma ("GCC diagnostic push") \
304 _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")
305 # else
306 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
307 _Pragma ("GCC diagnostic push") \
308 _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") \
309 _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
310 # endif
311 # define YY_IGNORE_MAYBE_UNINITIALIZED_END \
312 _Pragma ("GCC diagnostic pop")
313 #else
314 # define YY_INITIAL_VALUE(Value) Value
315 #endif
316 #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
317 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
318 # define YY_IGNORE_MAYBE_UNINITIALIZED_END
319 #endif
320 #ifndef YY_INITIAL_VALUE
321 # define YY_INITIAL_VALUE(Value) /* Nothing. */
322 #endif
323
324 #if defined __cplusplus && defined __GNUC__ && ! defined __ICC && 6 <= __GNUC__
325 # define YY_IGNORE_USELESS_CAST_BEGIN \
326 _Pragma ("GCC diagnostic push") \
327 _Pragma ("GCC diagnostic ignored \"-Wuseless-cast\"")
328 # define YY_IGNORE_USELESS_CAST_END \
329 _Pragma ("GCC diagnostic pop")
330 #endif
331 #ifndef YY_IGNORE_USELESS_CAST_BEGIN
332 # define YY_IGNORE_USELESS_CAST_BEGIN
333 # define YY_IGNORE_USELESS_CAST_END
334 #endif
335
336 # ifndef YY_NULLPTR
337 # if defined __cplusplus
338 # if 201103L <= __cplusplus
339 # define YY_NULLPTR nullptr
340 # else
341 # define YY_NULLPTR 0
342 # endif
343 # else
344 # define YY_NULLPTR ((void*)0)
345 # endif
346 # endif
347
348 // This skeleton is based on C, yet compiles it as C++.
349 // So expect warnings about C style casts.
350 #if defined __clang__ && 306 <= __clang_major__ * 100 + __clang_minor__
351 # pragma clang diagnostic ignored "-Wold-style-cast"
352 #elif defined __GNUC__ && 406 <= __GNUC__ * 100 + __GNUC_MINOR__
353 # pragma GCC diagnostic ignored "-Wold-style-cast"
354 #endif
355
356 // On MacOS, PTRDIFF_MAX is defined as long long, which Clang's
357 // -pedantic reports as being a C++11 extension.
358 #if defined __APPLE__ && YY_CPLUSPLUS < 201103L \
359 && defined __clang__ && 4 <= __clang_major__
360 # pragma clang diagnostic ignored "-Wc++11-long-long"
361 #endif
362
363 #undef YYEMPTY
364 #define YYEMPTY yy::parser::token::YYEMPTY
365 #undef YYEOF
366 #define YYEOF yy::parser::token::YYEOF
367 #undef YYerror
368 #define YYerror yy::parser::token::YYerror
369
370 #ifndef YYSTYPE
371 # define YYSTYPE yy::parser::value_type
372 #endif
373 #ifndef YYLTYPE
374 # define YYLTYPE yy::parser::location_type
375 #endif
376
377 typedef yy::parser::symbol_kind_type yysymbol_kind_t;
378
379 // Expose C++ symbol kinds to C.
380 #define S_YYEMPTY yy::parser::symbol_kind::S_YYEMPTY
381 #define S_YYEOF yy::parser::symbol_kind::S_YYEOF
382 #define S_YYerror yy::parser::symbol_kind::S_YYerror
383 #define S_YYUNDEF yy::parser::symbol_kind::S_YYUNDEF
384 #define S_MULTILINE_COMMENT yy::parser::symbol_kind::S_MULTILINE_COMMENT
385 #define S_DOC_COMMENT yy::parser::symbol_kind::S_DOC_COMMENT
386 #define S_ENUM yy::parser::symbol_kind::S_ENUM
387 #define S_EXTENDS yy::parser::symbol_kind::S_EXTENDS
388 #define S_FQNAME yy::parser::symbol_kind::S_FQNAME
389 #define S_GENERATES yy::parser::symbol_kind::S_GENERATES
390 #define S_IDENTIFIER yy::parser::symbol_kind::S_IDENTIFIER
391 #define S_IMPORT yy::parser::symbol_kind::S_IMPORT
392 #define S_INTEGER yy::parser::symbol_kind::S_INTEGER
393 #define S_FLOAT yy::parser::symbol_kind::S_FLOAT
394 #define S_INTERFACE yy::parser::symbol_kind::S_INTERFACE
395 #define S_PACKAGE yy::parser::symbol_kind::S_PACKAGE
396 #define S_TYPE yy::parser::symbol_kind::S_TYPE
397 #define S_STRUCT yy::parser::symbol_kind::S_STRUCT
398 #define S_STRING_LITERAL yy::parser::symbol_kind::S_STRING_LITERAL
399 #define S_TYPEDEF yy::parser::symbol_kind::S_TYPEDEF
400 #define S_UNION yy::parser::symbol_kind::S_UNION
401 #define S_SAFE_UNION yy::parser::symbol_kind::S_SAFE_UNION
402 #define S_TEMPLATED yy::parser::symbol_kind::S_TEMPLATED
403 #define S_ONEWAY yy::parser::symbol_kind::S_ONEWAY
404 #define S_UNKNOWN yy::parser::symbol_kind::S_UNKNOWN
405 #define S_24_ yy::parser::symbol_kind::S_24_
406 #define S_25_ yy::parser::symbol_kind::S_25_
407 #define S_LOGICAL_OR yy::parser::symbol_kind::S_LOGICAL_OR
408 #define S_LOGICAL_AND yy::parser::symbol_kind::S_LOGICAL_AND
409 #define S_28_ yy::parser::symbol_kind::S_28_
410 #define S_29_ yy::parser::symbol_kind::S_29_
411 #define S_30_ yy::parser::symbol_kind::S_30_
412 #define S_EQUALITY yy::parser::symbol_kind::S_EQUALITY
413 #define S_NEQ yy::parser::symbol_kind::S_NEQ
414 #define S_33_ yy::parser::symbol_kind::S_33_
415 #define S_34_ yy::parser::symbol_kind::S_34_
416 #define S_LEQ yy::parser::symbol_kind::S_LEQ
417 #define S_GEQ yy::parser::symbol_kind::S_GEQ
418 #define S_LSHIFT yy::parser::symbol_kind::S_LSHIFT
419 #define S_RSHIFT yy::parser::symbol_kind::S_RSHIFT
420 #define S_39_ yy::parser::symbol_kind::S_39_
421 #define S_40_ yy::parser::symbol_kind::S_40_
422 #define S_41_ yy::parser::symbol_kind::S_41_
423 #define S_42_ yy::parser::symbol_kind::S_42_
424 #define S_43_ yy::parser::symbol_kind::S_43_
425 #define S_UNARY_MINUS yy::parser::symbol_kind::S_UNARY_MINUS
426 #define S_UNARY_PLUS yy::parser::symbol_kind::S_UNARY_PLUS
427 #define S_46_ yy::parser::symbol_kind::S_46_
428 #define S_47_ yy::parser::symbol_kind::S_47_
429 #define S_48_ yy::parser::symbol_kind::S_48_
430 #define S_49_ yy::parser::symbol_kind::S_49_
431 #define S_50_ yy::parser::symbol_kind::S_50_
432 #define S_51_ yy::parser::symbol_kind::S_51_
433 #define S_52_ yy::parser::symbol_kind::S_52_
434 #define S_53_ yy::parser::symbol_kind::S_53_
435 #define S_54_ yy::parser::symbol_kind::S_54_
436 #define S_55_ yy::parser::symbol_kind::S_55_
437 #define S_56_ yy::parser::symbol_kind::S_56_
438 #define S_57_ yy::parser::symbol_kind::S_57_
439 #define S_58_ yy::parser::symbol_kind::S_58_
440 #define S_YYACCEPT yy::parser::symbol_kind::S_YYACCEPT
441 #define S_program yy::parser::symbol_kind::S_program
442 #define S_doc_comment yy::parser::symbol_kind::S_doc_comment
443 #define S_doc_comments yy::parser::symbol_kind::S_doc_comments
444 #define S_ignore_doc_comments yy::parser::symbol_kind::S_ignore_doc_comments
445 #define S_valid_identifier yy::parser::symbol_kind::S_valid_identifier
446 #define S_valid_type_name yy::parser::symbol_kind::S_valid_type_name
447 #define S_opt_annotations yy::parser::symbol_kind::S_opt_annotations
448 #define S_annotation yy::parser::symbol_kind::S_annotation
449 #define S_opt_annotation_params yy::parser::symbol_kind::S_opt_annotation_params
450 #define S_annotation_params yy::parser::symbol_kind::S_annotation_params
451 #define S_annotation_param yy::parser::symbol_kind::S_annotation_param
452 #define S_annotation_string_value yy::parser::symbol_kind::S_annotation_string_value
453 #define S_annotation_string_values yy::parser::symbol_kind::S_annotation_string_values
454 #define S_error_stmt yy::parser::symbol_kind::S_error_stmt
455 #define S_require_semicolon yy::parser::symbol_kind::S_require_semicolon
456 #define S_fqname yy::parser::symbol_kind::S_fqname
457 #define S_fqtype yy::parser::symbol_kind::S_fqtype
458 #define S_package yy::parser::symbol_kind::S_package
459 #define S_import_stmt yy::parser::symbol_kind::S_import_stmt
460 #define S_opt_extends yy::parser::symbol_kind::S_opt_extends
461 #define S_interface_declarations yy::parser::symbol_kind::S_interface_declarations
462 #define S_declarations yy::parser::symbol_kind::S_declarations
463 #define S_commentable_declaration yy::parser::symbol_kind::S_commentable_declaration
464 #define S_commentable_type_declaration yy::parser::symbol_kind::S_commentable_type_declaration
465 #define S_type_declaration yy::parser::symbol_kind::S_type_declaration
466 #define S_type_declaration_body yy::parser::symbol_kind::S_type_declaration_body
467 #define S_interface_declaration yy::parser::symbol_kind::S_interface_declaration
468 #define S_87_1 yy::parser::symbol_kind::S_87_1
469 #define S_interface_declaration_body yy::parser::symbol_kind::S_interface_declaration_body
470 #define S_typedef_declaration yy::parser::symbol_kind::S_typedef_declaration
471 #define S_const_expr yy::parser::symbol_kind::S_const_expr
472 #define S_commentable_method_declaration yy::parser::symbol_kind::S_commentable_method_declaration
473 #define S_method_declaration yy::parser::symbol_kind::S_method_declaration
474 #define S_typed_vars yy::parser::symbol_kind::S_typed_vars
475 #define S_non_empty_typed_vars yy::parser::symbol_kind::S_non_empty_typed_vars
476 #define S_typed_var yy::parser::symbol_kind::S_typed_var
477 #define S_uncommented_typed_var yy::parser::symbol_kind::S_uncommented_typed_var
478 #define S_struct_or_union_keyword yy::parser::symbol_kind::S_struct_or_union_keyword
479 #define S_named_struct_or_union_declaration yy::parser::symbol_kind::S_named_struct_or_union_declaration
480 #define S_99_2 yy::parser::symbol_kind::S_99_2
481 #define S_struct_or_union_body yy::parser::symbol_kind::S_struct_or_union_body
482 #define S_field_declarations yy::parser::symbol_kind::S_field_declarations
483 #define S_commentable_field_declaration yy::parser::symbol_kind::S_commentable_field_declaration
484 #define S_field_declaration yy::parser::symbol_kind::S_field_declaration
485 #define S_annotated_compound_declaration yy::parser::symbol_kind::S_annotated_compound_declaration
486 #define S_compound_declaration yy::parser::symbol_kind::S_compound_declaration
487 #define S_enum_storage_type yy::parser::symbol_kind::S_enum_storage_type
488 #define S_named_enum_declaration yy::parser::symbol_kind::S_named_enum_declaration
489 #define S_108_3 yy::parser::symbol_kind::S_108_3
490 #define S_enum_declaration_body yy::parser::symbol_kind::S_enum_declaration_body
491 #define S_commentable_enum_value yy::parser::symbol_kind::S_commentable_enum_value
492 #define S_enum_value yy::parser::symbol_kind::S_enum_value
493 #define S_enum_values yy::parser::symbol_kind::S_enum_values
494 #define S_array_type_base yy::parser::symbol_kind::S_array_type_base
495 #define S_array_type yy::parser::symbol_kind::S_array_type
496 #define S_type yy::parser::symbol_kind::S_type
497 #define S_type_or_inplace_compound_declaration yy::parser::symbol_kind::S_type_or_inplace_compound_declaration
498
499
500 /* Default (constant) value used for initialization for null
501 right-hand sides. Unlike the standard yacc.c template, here we set
502 the default value of $$ to a zeroed-out value. Since the default
503 value is undefined, this behavior is technically correct. */
504 static YYSTYPE yyval_default;
505 static YYLTYPE yyloc_default
506 # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
507 = { 1, 1, 1, 1 }
508 # endif
509 ;
510
511 // Second part of user prologue.
512 #line 513 "out/soong/.intermediates/system/tools/hidl/libhidl-gen-ast/linux_glibc_x86_64_static/gen/yacc/system/tools/hidl/hidl-gen_y.cpp"
513 static void
514 yyerror (const yy::parser::location_type *yylocationp,
515 yy::parser& yyparser, void* scanner, android::AST* const ast, android::Scope** const scope,
516 const char* msg);
517 #line 518 "out/soong/.intermediates/system/tools/hidl/libhidl-gen-ast/linux_glibc_x86_64_static/gen/yacc/system/tools/hidl/hidl-gen_y.cpp"
518
519
520 #include <stddef.h>
521 #include <stdint.h>
522 #include <stdio.h>
523 #include <stdlib.h>
524 #include <string.h>
525
526 #ifdef short
527 # undef short
528 #endif
529
530 /* On compilers that do not define __PTRDIFF_MAX__ etc., make sure
531 <limits.h> and (if available) <stdint.h> are included
532 so that the code can choose integer types of a good width. */
533
534 #ifndef __PTRDIFF_MAX__
535 # include <limits.h> /* INFRINGES ON USER NAME SPACE */
536 # if defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
537 # include <stdint.h> /* INFRINGES ON USER NAME SPACE */
538 # define YY_STDINT_H
539 # endif
540 #endif
541
542 /* Narrow types that promote to a signed type and that can represent a
543 signed or unsigned integer of at least N bits. In tables they can
544 save space and decrease cache pressure. Promoting to a signed type
545 helps avoid bugs in integer arithmetic. */
546
547 #ifdef __INT_LEAST8_MAX__
548 typedef __INT_LEAST8_TYPE__ yytype_int8;
549 #elif defined YY_STDINT_H
550 typedef int_least8_t yytype_int8;
551 #else
552 typedef signed char yytype_int8;
553 #endif
554
555 #ifdef __INT_LEAST16_MAX__
556 typedef __INT_LEAST16_TYPE__ yytype_int16;
557 #elif defined YY_STDINT_H
558 typedef int_least16_t yytype_int16;
559 #else
560 typedef short yytype_int16;
561 #endif
562
563 /* Work around bug in HP-UX 11.23, which defines these macros
564 incorrectly for preprocessor constants. This workaround can likely
565 be removed in 2023, as HPE has promised support for HP-UX 11.23
566 (aka HP-UX 11i v2) only through the end of 2022; see Table 2 of
567 <https://h20195.www2.hpe.com/V2/getpdf.aspx/4AA4-7673ENW.pdf>. */
568 #ifdef __hpux
569 # undef UINT_LEAST8_MAX
570 # undef UINT_LEAST16_MAX
571 # define UINT_LEAST8_MAX 255
572 # define UINT_LEAST16_MAX 65535
573 #endif
574
575 #if defined __UINT_LEAST8_MAX__ && __UINT_LEAST8_MAX__ <= __INT_MAX__
576 typedef __UINT_LEAST8_TYPE__ yytype_uint8;
577 #elif (!defined __UINT_LEAST8_MAX__ && defined YY_STDINT_H \
578 && UINT_LEAST8_MAX <= INT_MAX)
579 typedef uint_least8_t yytype_uint8;
580 #elif !defined __UINT_LEAST8_MAX__ && UCHAR_MAX <= INT_MAX
581 typedef unsigned char yytype_uint8;
582 #else
583 typedef short yytype_uint8;
584 #endif
585
586 #if defined __UINT_LEAST16_MAX__ && __UINT_LEAST16_MAX__ <= __INT_MAX__
587 typedef __UINT_LEAST16_TYPE__ yytype_uint16;
588 #elif (!defined __UINT_LEAST16_MAX__ && defined YY_STDINT_H \
589 && UINT_LEAST16_MAX <= INT_MAX)
590 typedef uint_least16_t yytype_uint16;
591 #elif !defined __UINT_LEAST16_MAX__ && USHRT_MAX <= INT_MAX
592 typedef unsigned short yytype_uint16;
593 #else
594 typedef int yytype_uint16;
595 #endif
596 #ifndef YYPTRDIFF_T
597 # if defined __PTRDIFF_TYPE__ && defined __PTRDIFF_MAX__
598 # define YYPTRDIFF_T __PTRDIFF_TYPE__
599 # define YYPTRDIFF_MAXIMUM __PTRDIFF_MAX__
600 # elif defined PTRDIFF_MAX
601 # ifndef ptrdiff_t
602 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
603 # endif
604 # define YYPTRDIFF_T ptrdiff_t
605 # define YYPTRDIFF_MAXIMUM PTRDIFF_MAX
606 # else
607 # define YYPTRDIFF_T long
608 # define YYPTRDIFF_MAXIMUM LONG_MAX
609 # endif
610 #endif
611
612 #ifndef YYSIZE_T
613 # ifdef __SIZE_TYPE__
614 # define YYSIZE_T __SIZE_TYPE__
615 # elif defined size_t
616 # define YYSIZE_T size_t
617 # elif defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
618 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
619 # define YYSIZE_T size_t
620 # else
621 # define YYSIZE_T unsigned
622 # endif
623 #endif
624
625 #define YYSIZE_MAXIMUM \
626 YY_CAST (YYPTRDIFF_T, \
627 (YYPTRDIFF_MAXIMUM < YY_CAST (YYSIZE_T, -1) \
628 ? YYPTRDIFF_MAXIMUM \
629 : YY_CAST (YYSIZE_T, -1)))
630
631 #define YYSIZEOF(X) YY_CAST (YYPTRDIFF_T, sizeof (X))
632
633
634 #ifndef YY_
635 # if defined YYENABLE_NLS && YYENABLE_NLS
636 # if ENABLE_NLS
637 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
638 # define YY_(Msgid) dgettext ("bison-runtime", Msgid)
639 # endif
640 # endif
641 # ifndef YY_
642 # define YY_(Msgid) Msgid
643 # endif
644 #endif
645
646
647 #ifndef YYFREE
648 # define YYFREE free
649 #endif
650 #ifndef YYMALLOC
651 # define YYMALLOC malloc
652 #endif
653 #ifndef YYREALLOC
654 # define YYREALLOC realloc
655 #endif
656
657 #ifdef __cplusplus
658 typedef bool yybool;
659 # define yytrue true
660 # define yyfalse false
661 #else
662 /* When we move to stdbool, get rid of the various casts to yybool. */
663 typedef signed char yybool;
664 # define yytrue 1
665 # define yyfalse 0
666 #endif
667
668 #ifndef YYSETJMP
669 # include <setjmp.h>
670 # define YYJMP_BUF jmp_buf
671 # define YYSETJMP(Env) setjmp (Env)
672 /* Pacify Clang and ICC. */
673 # define YYLONGJMP(Env, Val) \
674 do { \
675 longjmp (Env, Val); \
676 YY_ASSERT (0); \
677 } while (yyfalse)
678 #endif
679
680 #ifndef YY_ATTRIBUTE_PURE
681 # if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__)
682 # define YY_ATTRIBUTE_PURE __attribute__ ((__pure__))
683 # else
684 # define YY_ATTRIBUTE_PURE
685 # endif
686 #endif
687
688 #ifndef YY_ATTRIBUTE_UNUSED
689 # if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__)
690 # define YY_ATTRIBUTE_UNUSED __attribute__ ((__unused__))
691 # else
692 # define YY_ATTRIBUTE_UNUSED
693 # endif
694 #endif
695
696 /* The _Noreturn keyword of C11. */
697 #ifndef _Noreturn
698 # if (defined __cplusplus \
699 && ((201103 <= __cplusplus && !(__GNUC__ == 4 && __GNUC_MINOR__ == 7)) \
700 || (defined _MSC_VER && 1900 <= _MSC_VER)))
701 # define _Noreturn [[noreturn]]
702 # elif ((!defined __cplusplus || defined __clang__) \
703 && (201112 <= (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) \
704 || (!defined __STRICT_ANSI__ \
705 && (4 < __GNUC__ + (7 <= __GNUC_MINOR__) \
706 || (defined __apple_build_version__ \
707 ? 6000000 <= __apple_build_version__ \
708 : 3 < __clang_major__ + (5 <= __clang_minor__))))))
709 /* _Noreturn works as-is. */
710 # elif (2 < __GNUC__ + (8 <= __GNUC_MINOR__) || defined __clang__ \
711 || 0x5110 <= __SUNPRO_C)
712 # define _Noreturn __attribute__ ((__noreturn__))
713 # elif 1200 <= (defined _MSC_VER ? _MSC_VER : 0)
714 # define _Noreturn __declspec (noreturn)
715 # else
716 # define _Noreturn
717 # endif
718 #endif
719
720 /* Suppress unused-variable warnings by "using" E. */
721 #if ! defined lint || defined __GNUC__
722 # define YY_USE(E) ((void) (E))
723 #else
724 # define YY_USE(E) /* empty */
725 #endif
726
727 /* Suppress an incorrect diagnostic about yylval being uninitialized. */
728 #if defined __GNUC__ && ! defined __ICC && 406 <= __GNUC__ * 100 + __GNUC_MINOR__
729 # if __GNUC__ * 100 + __GNUC_MINOR__ < 407
730 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
731 _Pragma ("GCC diagnostic push") \
732 _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")
733 # else
734 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
735 _Pragma ("GCC diagnostic push") \
736 _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") \
737 _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
738 # endif
739 # define YY_IGNORE_MAYBE_UNINITIALIZED_END \
740 _Pragma ("GCC diagnostic pop")
741 #else
742 # define YY_INITIAL_VALUE(Value) Value
743 #endif
744 #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
745 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
746 # define YY_IGNORE_MAYBE_UNINITIALIZED_END
747 #endif
748 #ifndef YY_INITIAL_VALUE
749 # define YY_INITIAL_VALUE(Value) /* Nothing. */
750 #endif
751
752 #if defined __cplusplus && defined __GNUC__ && ! defined __ICC && 6 <= __GNUC__
753 # define YY_IGNORE_USELESS_CAST_BEGIN \
754 _Pragma ("GCC diagnostic push") \
755 _Pragma ("GCC diagnostic ignored \"-Wuseless-cast\"")
756 # define YY_IGNORE_USELESS_CAST_END \
757 _Pragma ("GCC diagnostic pop")
758 #endif
759 #ifndef YY_IGNORE_USELESS_CAST_BEGIN
760 # define YY_IGNORE_USELESS_CAST_BEGIN
761 # define YY_IGNORE_USELESS_CAST_END
762 #endif
763
764
765 #define YY_ASSERT(E) ((void) (0 && (E)))
766
767 /* YYFINAL -- State number of the termination state. */
768 #define YYFINAL 10
769 /* YYLAST -- Last index in YYTABLE. */
770 #define YYLAST 566
771
772 /* YYNTOKENS -- Number of terminals. */
773 #define YYNTOKENS 59
774 /* YYNNTS -- Number of nonterminals. */
775 #define YYNNTS 58
776 /* YYNRULES -- Number of rules. */
777 #define YYNRULES 139
778 /* YYNSTATES -- Number of states. */
779 #define YYNSTATES 253
780 /* YYMAXRHS -- Maximum number of symbols on right-hand side of rule. */
781 #define YYMAXRHS 10
782 /* YYMAXLEFT -- Maximum number of symbols to the left of a handle
783 accessed by $0, $-1, etc., in any rule. */
784 #define YYMAXLEFT 0
785
786 /* YYMAXUTOK -- Last valid token kind. */
787 #define YYMAXUTOK 288
788
789 /* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
790 as returned by yylex, with out-of-bounds checking. */
791 #define YYTRANSLATE(YYX) \
792 (0 <= (YYX) && (YYX) <= YYMAXUTOK \
793 ? YY_CAST (yysymbol_kind_t, yytranslate[YYX]) \
794 : S_YYUNDEF)
795
796 /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
797 as returned by yylex. */
798 static const yytype_int8 yytranslate[] =
799 {
800 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
801 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
802 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
803 2, 2, 2, 46, 2, 48, 2, 43, 30, 2,
804 50, 51, 41, 39, 52, 40, 2, 42, 2, 2,
805 2, 2, 2, 2, 2, 2, 2, 2, 25, 56,
806 33, 53, 34, 24, 49, 2, 2, 2, 2, 2,
807 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
808 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
809 2, 57, 2, 58, 29, 2, 2, 2, 2, 2,
810 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
811 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
812 2, 2, 2, 54, 28, 55, 47, 2, 2, 2,
813 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
814 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
815 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
816 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
817 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
818 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
819 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
820 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
821 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
822 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
823 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
824 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
825 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
826 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
827 15, 16, 17, 18, 19, 20, 21, 22, 23, 26,
828 27, 31, 32, 35, 36, 37, 38, 44, 45
829 };
830
831 #if YYDEBUG
832 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
833 static const yytype_int16 yyrline[] =
834 {
835 0, 345, 345, 349, 353, 354, 358, 359, 367, 368,
836 372, 384, 397, 400, 408, 416, 419, 426, 431, 439,
837 446, 451, 455, 460, 468, 476, 478, 485, 495, 508,
838 512, 519, 531, 540, 548, 556, 560, 561, 565, 566,
839 579, 605, 606, 607, 611, 615, 616, 636, 641, 645,
840 664, 665, 666, 667, 672, 671, 732, 736, 749, 759,
841 771, 776, 780, 781, 782, 783, 784, 785, 786, 787,
842 788, 789, 790, 791, 792, 793, 794, 795, 796, 797,
843 798, 799, 800, 801, 802, 807, 816, 821, 827, 828,
844 837, 846, 864, 867, 874, 883, 895, 899, 903, 918,
845 919, 920, 925, 924, 942, 946, 947, 954, 959, 962,
846 963, 981, 1001, 1010, 1011, 1015, 1016, 1021, 1020, 1048,
847 1049, 1053, 1058, 1062, 1066, 1074, 1075, 1080, 1085, 1092,
848 1102, 1103, 1108, 1117, 1121, 1129, 1130, 1134, 1142, 1143
849 };
850 #endif
851
852 #define YYPACT_NINF (-197)
853 #define YYTABLE_NINF (-126)
854
855 // YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
856 // STATE-NUM.
857 static const yytype_int16 yypact[] =
858 {
859 179, -197, -197, -197, 17, 46, -197, 179, 323, -8,
860 -197, -197, 323, 26, -197, 146, -197, -197, 146, -197,
861 184, 50, 115, -197, -197, 50, -197, 48, -197, 61,
862 61, -197, 130, -197, -197, 76, -197, -197, -8, -8,
863 61, -8, -8, -8, -197, -8, -197, 64, 100, -197,
864 96, -197, 62, -197, -197, -197, 96, 40, 61, 69,
865 -197, -197, -197, -197, -197, -197, -197, 107, -197, 107,
866 -197, 96, -197, 342, 66, 306, -197, -197, 112, -197,
867 71, 96, 82, -197, 87, 109, 119, 306, -197, 306,
868 306, 306, 306, 151, 111, 347, 104, 60, -197, -197,
869 -197, -197, 28, -197, -197, -197, 342, -197, 380, -197,
870 -197, -197, -197, 110, 413, 157, 306, 306, 306, 306,
871 306, 306, 306, 306, 306, 306, 306, 306, 306, 306,
872 306, 306, 306, 306, 306, -197, 4, -197, 112, 58,
873 118, -197, 201, 123, -197, -197, 75, 265, -12, -197,
874 -197, -197, -197, 441, 478, 494, 509, 523, 360, 391,
875 391, 327, 327, 327, 327, 269, 269, 193, 193, -197,
876 -197, -197, -197, 162, -197, -197, 89, 137, 158, -197,
877 -197, -197, 35, -197, 176, 201, 96, 306, 14, -197,
878 285, 141, 224, -197, -197, -197, -197, -197, -197, 306,
879 -197, 113, -197, -197, -197, -197, -197, -197, -197, -8,
880 -197, -197, 461, 147, 201, 154, -197, -197, -197, -197,
881 176, 165, 461, 195, -197, -197, 201, -197, 166, 30,
882 -197, -197, 30, 130, 174, 178, -197, 175, -197, 176,
883 32, 96, -8, 96, 182, -197, -197, -197, -197, 30,
884 187, -8, -197
885 };
886
887 // YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
888 // Performed when YYTABLE does not specify something else to do. Zero
889 // means the default is an error.
890 static const yytype_uint8 yydefact[] =
891 {
892 0, 32, 5, 4, 0, 0, 6, 0, 0, 26,
893 1, 7, 0, 0, 42, 12, 25, 31, 12, 24,
894 12, 3, 0, 43, 45, 2, 44, 0, 46, 0,
895 0, 99, 0, 100, 101, 0, 13, 49, 26, 26,
896 0, 26, 26, 26, 11, 26, 35, 116, 36, 27,
897 8, 30, 0, 28, 29, 130, 8, 8, 0, 15,
898 53, 52, 102, 50, 51, 33, 34, 0, 117, 0,
899 54, 9, 137, 0, 135, 0, 136, 57, 0, 14,
900 0, 8, 0, 37, 0, 0, 0, 0, 58, 0,
901 0, 0, 0, 0, 59, 0, 0, 0, 17, 105,
902 103, 115, 0, 118, 38, 55, 0, 131, 0, 80,
903 81, 82, 83, 0, 0, 0, 0, 0, 0, 0,
904 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
905 0, 0, 0, 0, 0, 134, 0, 16, 0, 0,
906 0, 10, 0, 123, 126, 122, 0, 0, 0, 133,
907 85, 84, 60, 0, 62, 63, 64, 65, 66, 67,
908 68, 69, 70, 71, 72, 73, 74, 75, 76, 77,
909 78, 79, 20, 0, 19, 18, 0, 0, 0, 109,
910 106, 108, 8, 138, 0, 0, 8, 0, 0, 119,
911 0, 0, 0, 88, 39, 48, 40, 87, 132, 0,
912 22, 0, 107, 104, 113, 112, 114, 111, 139, 26,
913 128, 121, 124, 0, 9, 0, 127, 47, 86, 56,
914 0, 0, 61, 0, 21, 110, 0, 120, 0, 8,
915 23, 129, 8, 0, 0, 93, 94, 0, 96, 98,
916 26, 8, 26, 8, 0, 89, 95, 90, 97, 8,
917 0, 26, 91
918 };
919
920 // YYPGOTO[NTERM-NUM].
921 static const yytype_int16 yypgoto[] =
922 {
923 -197, -197, 5, 1, -15, -164, 173, -75, -197, -197,
924 -197, 101, -197, -197, -21, -34, -22, -17, 234, -197,
925 -197, -197, 233, -197, -197, -18, -197, -197, -197, -197,
926 -197, 131, -197, 77, -196, -197, 31, -197, -197, 93,
927 -197, -197, -197, -197, 99, -197, -197, -197, 98, -197,
928 -197, -158, -128, -197, -197, -197, -19, -197
929 };
930
931 // YYDEFGOTO[NTERM-NUM].
932 static const yytype_uint8 yydefgoto[] =
933 {
934 0, 5, 6, 71, 233, 143, 53, 22, 36, 79,
935 97, 98, 174, 201, 14, 17, 94, 55, 8, 28,
936 70, 147, 15, 23, 194, 24, 37, 38, 84, 105,
937 39, 95, 196, 197, 234, 235, 236, 238, 40, 41,
938 80, 100, 139, 180, 181, 182, 205, 68, 42, 82,
939 103, 144, 145, 146, 56, 57, 183, 184
940 };
941
942 // YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
943 // positive, shift that token. If negative, reduce the rule whose
944 // number is the opposite. If YYTABLE_NINF, syntax error.
945 static const yytype_int16 yytable[] =
946 {
947 21, 7, 26, 25, 60, 61, 46, 63, 64, 65,
948 54, 66, 11, 58, 186, 213, 20, 2, 3, 20,
949 209, 172, 107, 141, 9, 11, 198, 210, 221, 140,
950 216, 2, 3, 2, 3, 72, 237, 141, 2, 3,
951 244, 74, 76, 2, 3, 54, 10, 54, 16, 13,
952 81, 54, 83, 250, 86, 43, 228, 44, 173, 13,
953 27, 2, 3, -12, 178, 49, 101, 44, 231, -8,
954 44, 50, 192, 51, -12, 243, 11, -12, -12, 52,
955 -125, -92, 19, -125, 54, 59, 186, 148, 16, 67,
956 13, 207, 2, 3, -12, 73, 49, 75, 44, 2,
957 3, 178, 50, 142, 51, -12, 69, -12, -12, -12,
958 52, 137, 138, -8, 49, 192, 44, 54, 179, 78,
959 29, 96, 51, 87, 177, 99, 193, 188, 30, 195,
960 189, 31, 191, 32, 33, 34, 102, 49, -12, 44,
961 176, 104, 106, 50, -9, 51, -8, 11, 190, 2,
962 3, 52, 113, 107, 54, 179, -8, 136, 49, 115,
963 44, 150, 88, 29, 35, 223, 152, 208, 224, 193,
964 185, 211, 217, 215, 31, 225, 187, 33, 34, 200,
965 1, 11, 2, 3, -9, 141, 142, 2, 3, 214,
966 89, 90, 203, 4, -9, 11, 219, 91, 92, 226,
967 45, 93, 47, 48, 2, 3, 245, 35, 247, 227,
968 141, 54, 230, 62, 239, 229, 232, 252, 108, 11,
969 109, 110, 111, 112, 114, 240, 242, 142, 248, 29,
970 241, 77, 249, 141, 132, 133, 134, 30, 251, 175,
971 31, 12, 32, 33, 34, 18, 220, 153, 154, 155,
972 156, 157, 158, 159, 160, 161, 162, 163, 164, 165,
973 166, 167, 168, 169, 170, 171, 13, 218, 2, 3,
974 -12, 204, 246, 35, -12, 202, 206, 0, -12, 0,
975 0, -12, 0, -12, -12, -12, 13, -12, 2, 3,
976 -12, 0, 0, 0, -12, 0, 0, 0, -12, 0,
977 0, -12, 0, -12, -12, -12, 0, -12, 130, 131,
978 132, 133, 134, 49, -12, 44, 0, 88, 212, 0,
979 -8, 0, 0, -41, 13, 0, -41, -41, -41, 0,
980 222, 0, 0, -41, -12, 0, -41, 0, 0, -41,
981 -9, -41, -41, -41, 0, 89, 90, 0, 0, 49,
982 0, 44, 91, 92, 0, 50, 93, 51, 0, 0,
983 0, 0, 0, 85, 128, 129, 130, 131, 132, 133,
984 134, 116, -41, 117, 118, 119, 120, 121, 122, 123,
985 124, 125, 126, 127, 128, 129, 130, 131, 132, 133,
986 134, 122, 123, 124, 125, 126, 127, 128, 129, 130,
987 131, 132, 133, 134, 116, 135, 117, 118, 119, 120,
988 121, 122, 123, 124, 125, 126, 127, 128, 129, 130,
989 131, 132, 133, 134, 124, 125, 126, 127, 128, 129,
990 130, 131, 132, 133, 134, 0, 0, 116, 149, 117,
991 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
992 128, 129, 130, 131, 132, 133, 134, 0, 0, 0,
993 0, 0, 0, 0, 151, 116, 199, 117, 118, 119,
994 120, 121, 122, 123, 124, 125, 126, 127, 128, 129,
995 130, 131, 132, 133, 134, 116, 0, 117, 118, 119,
996 120, 121, 122, 123, 124, 125, 126, 127, 128, 129,
997 130, 131, 132, 133, 134, 118, 119, 120, 121, 122,
998 123, 124, 125, 126, 127, 128, 129, 130, 131, 132,
999 133, 134, 119, 120, 121, 122, 123, 124, 125, 126,
1000 127, 128, 129, 130, 131, 132, 133, 134, 120, 121,
1001 122, 123, 124, 125, 126, 127, 128, 129, 130, 131,
1002 132, 133, 134, 121, 122, 123, 124, 125, 126, 127,
1003 128, 129, 130, 131, 132, 133, 134
1004 };
1005
1006 static const yytype_int16 yycheck[] =
1007 {
1008 15, 0, 20, 18, 38, 39, 27, 41, 42, 43,
1009 32, 45, 7, 32, 142, 1, 15, 3, 4, 18,
1010 184, 17, 34, 9, 7, 20, 38, 185, 192, 1,
1011 188, 3, 4, 3, 4, 50, 232, 9, 3, 4,
1012 8, 56, 57, 3, 4, 67, 0, 69, 56, 1,
1013 67, 73, 69, 249, 73, 7, 220, 9, 54, 1,
1014 10, 3, 4, 5, 139, 7, 81, 9, 226, 55,
1015 9, 13, 147, 15, 16, 239, 71, 19, 20, 21,
1016 52, 51, 56, 55, 106, 9, 214, 106, 56, 25,
1017 1, 56, 3, 4, 5, 33, 7, 57, 9, 3,
1018 4, 176, 13, 102, 15, 16, 6, 49, 19, 20,
1019 21, 51, 52, 55, 7, 190, 9, 139, 139, 50,
1020 5, 9, 15, 57, 139, 54, 147, 52, 13, 147,
1021 55, 16, 147, 18, 19, 20, 54, 7, 49, 9,
1022 139, 54, 33, 13, 55, 15, 0, 142, 147, 3,
1023 4, 21, 1, 34, 176, 176, 10, 53, 7, 48,
1024 9, 51, 11, 5, 49, 52, 9, 182, 55, 190,
1025 52, 186, 190, 188, 16, 209, 53, 19, 20, 17,
1026 1, 176, 3, 4, 0, 9, 185, 3, 4, 188,
1027 39, 40, 55, 14, 10, 190, 55, 46, 47, 52,
1028 27, 50, 29, 30, 3, 4, 240, 49, 242, 55,
1029 9, 233, 17, 40, 233, 50, 50, 251, 87, 214,
1030 89, 90, 91, 92, 93, 51, 51, 226, 243, 5,
1031 52, 58, 50, 9, 41, 42, 43, 13, 51, 138,
1032 16, 7, 18, 19, 20, 12, 22, 116, 117, 118,
1033 119, 120, 121, 122, 123, 124, 125, 126, 127, 128,
1034 129, 130, 131, 132, 133, 134, 1, 190, 3, 4,
1035 5, 178, 241, 49, 9, 176, 178, -1, 13, -1,
1036 -1, 16, -1, 18, 19, 20, 1, 22, 3, 4,
1037 5, -1, -1, -1, 9, -1, -1, -1, 13, -1,
1038 -1, 16, -1, 18, 19, 20, -1, 22, 39, 40,
1039 41, 42, 43, 7, 49, 9, -1, 11, 187, -1,
1040 55, -1, -1, 0, 1, -1, 3, 4, 5, -1,
1041 199, -1, -1, 10, 49, -1, 13, -1, -1, 16,
1042 55, 18, 19, 20, -1, 39, 40, -1, -1, 7,
1043 -1, 9, 46, 47, -1, 13, 50, 15, -1, -1,
1044 -1, -1, -1, 21, 37, 38, 39, 40, 41, 42,
1045 43, 24, 49, 26, 27, 28, 29, 30, 31, 32,
1046 33, 34, 35, 36, 37, 38, 39, 40, 41, 42,
1047 43, 31, 32, 33, 34, 35, 36, 37, 38, 39,
1048 40, 41, 42, 43, 24, 58, 26, 27, 28, 29,
1049 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
1050 40, 41, 42, 43, 33, 34, 35, 36, 37, 38,
1051 39, 40, 41, 42, 43, -1, -1, 24, 58, 26,
1052 27, 28, 29, 30, 31, 32, 33, 34, 35, 36,
1053 37, 38, 39, 40, 41, 42, 43, -1, -1, -1,
1054 -1, -1, -1, -1, 51, 24, 25, 26, 27, 28,
1055 29, 30, 31, 32, 33, 34, 35, 36, 37, 38,
1056 39, 40, 41, 42, 43, 24, -1, 26, 27, 28,
1057 29, 30, 31, 32, 33, 34, 35, 36, 37, 38,
1058 39, 40, 41, 42, 43, 27, 28, 29, 30, 31,
1059 32, 33, 34, 35, 36, 37, 38, 39, 40, 41,
1060 42, 43, 28, 29, 30, 31, 32, 33, 34, 35,
1061 36, 37, 38, 39, 40, 41, 42, 43, 29, 30,
1062 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
1063 41, 42, 43, 30, 31, 32, 33, 34, 35, 36,
1064 37, 38, 39, 40, 41, 42, 43
1065 };
1066
1067 // YYSTOS[STATE-NUM] -- The symbol kind of the accessing symbol of
1068 // state STATE-NUM.
1069 static const yytype_int8 yystos[] =
1070 {
1071 0, 1, 3, 4, 14, 60, 61, 62, 77, 7,
1072 0, 61, 77, 1, 73, 81, 56, 74, 81, 56,
1073 62, 63, 66, 82, 84, 63, 84, 10, 78, 5,
1074 13, 16, 18, 19, 20, 49, 67, 85, 86, 89,
1075 97, 98, 107, 7, 9, 65, 73, 65, 65, 7,
1076 13, 15, 21, 65, 75, 76, 113, 114, 115, 9,
1077 74, 74, 65, 74, 74, 74, 74, 25, 106, 6,
1078 79, 62, 63, 33, 63, 57, 63, 65, 50, 68,
1079 99, 76, 108, 76, 87, 21, 115, 57, 11, 39,
1080 40, 46, 47, 50, 75, 90, 9, 69, 70, 54,
1081 100, 63, 54, 109, 54, 88, 33, 34, 90, 90,
1082 90, 90, 90, 1, 90, 48, 24, 26, 27, 28,
1083 29, 30, 31, 32, 33, 34, 35, 36, 37, 38,
1084 39, 40, 41, 42, 43, 58, 53, 51, 52, 101,
1085 1, 9, 62, 64, 110, 111, 112, 80, 115, 58,
1086 51, 51, 9, 90, 90, 90, 90, 90, 90, 90,
1087 90, 90, 90, 90, 90, 90, 90, 90, 90, 90,
1088 90, 90, 17, 54, 71, 70, 62, 63, 66, 73,
1089 102, 103, 104, 115, 116, 52, 111, 53, 52, 55,
1090 62, 63, 66, 73, 83, 84, 91, 92, 38, 25,
1091 17, 72, 103, 55, 98, 105, 107, 56, 63, 64,
1092 110, 63, 90, 1, 62, 63, 110, 84, 92, 55,
1093 22, 64, 90, 52, 55, 74, 52, 55, 64, 50,
1094 17, 110, 50, 63, 93, 94, 95, 93, 96, 115,
1095 51, 52, 51, 64, 8, 74, 95, 74, 63, 50,
1096 93, 51, 74
1097 };
1098
1099 // YYR1[RULE-NUM] -- Symbol kind of the left-hand side of rule RULE-NUM.
1100 static const yytype_int8 yyr1[] =
1101 {
1102 0, 59, 60, 60, 61, 61, 62, 62, 63, 63,
1103 64, 65, 66, 66, 67, 68, 68, 69, 69, 70,
1104 71, 71, 72, 72, 73, 74, 74, 75, 75, 76,
1105 76, 77, 77, 78, 78, 78, 79, 79, 80, 80,
1106 80, 81, 81, 81, 82, 82, 82, 83, 83, 84,
1107 85, 85, 85, 85, 87, 86, 88, 89, 90, 90,
1108 90, 90, 90, 90, 90, 90, 90, 90, 90, 90,
1109 90, 90, 90, 90, 90, 90, 90, 90, 90, 90,
1110 90, 90, 90, 90, 90, 90, 91, 91, 92, 92,
1111 92, 92, 93, 93, 94, 94, 95, 96, 96, 97,
1112 97, 97, 99, 98, 100, 101, 101, 102, 102, 103,
1113 103, 103, 104, 105, 105, 106, 106, 108, 107, 109,
1114 109, 110, 110, 111, 111, 112, 112, 112, 112, 112,
1115 113, 113, 113, 114, 114, 115, 115, 115, 116, 116
1116 };
1117
1118 // YYR2[RULE-NUM] -- Number of symbols on the right-hand side of rule RULE-NUM.
1119 static const yytype_int8 yyr2[] =
1120 {
1121 0, 2, 4, 3, 1, 1, 1, 2, 0, 1,
1122 1, 1, 0, 2, 3, 0, 3, 1, 3, 3,
1123 1, 3, 1, 3, 2, 1, 0, 1, 1, 1,
1124 1, 3, 1, 3, 3, 2, 0, 2, 0, 2,
1125 2, 0, 1, 2, 2, 1, 2, 2, 1, 2,
1126 2, 2, 2, 2, 0, 5, 4, 3, 1, 1,
1127 3, 5, 3, 3, 3, 3, 3, 3, 3, 3,
1128 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
1129 2, 2, 2, 2, 3, 3, 2, 1, 1, 6,
1130 7, 10, 0, 1, 1, 3, 2, 3, 1, 1,
1131 1, 1, 0, 4, 4, 0, 2, 2, 1, 1,
1132 3, 2, 2, 1, 1, 3, 0, 0, 5, 3,
1133 5, 3, 1, 1, 3, 0, 1, 3, 3, 5,
1134 1, 4, 6, 5, 4, 2, 2, 2, 1, 2
1135 };
1136
1137
1138 /* YYDPREC[RULE-NUM] -- Dynamic precedence of rule #RULE-NUM (0 if none). */
1139 static const yytype_int8 yydprec[] =
1140 {
1141 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1142 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1143 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1144 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1145 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1146 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1147 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1148 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1149 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1150 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1151 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1152 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1153 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1154 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
1155 };
1156
1157 /* YYMERGER[RULE-NUM] -- Index of merging function for rule #RULE-NUM. */
1158 static const yytype_int8 yymerger[] =
1159 {
1160 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1161 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1162 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1163 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1164 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1165 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1166 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1167 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1168 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1169 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1170 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1171 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1172 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1173 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
1174 };
1175
1176 /* YYIMMEDIATE[RULE-NUM] -- True iff rule #RULE-NUM is not to be deferred, as
1177 in the case of predicates. */
1178 static const yybool yyimmediate[] =
1179 {
1180 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1181 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1182 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1183 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1184 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1185 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1186 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1187 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1188 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1189 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1190 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1191 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1192 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1193 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
1194 };
1195
1196 /* YYCONFLP[YYPACT[STATE-NUM]] -- Pointer into YYCONFL of start of
1197 list of conflicting reductions corresponding to action entry for
1198 state STATE-NUM in yytable. 0 means no conflicts. The list in
1199 yyconfl is terminated by a rule number of 0. */
1200 static const yytype_int8 yyconflp[] =
1201 {
1202 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1203 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1204 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1205 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1206 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1207 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1208 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1209 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1210 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1211 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1212 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1213 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1214 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1215 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1216 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1217 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1218 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1219 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1220 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1221 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1222 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1223 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1224 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1225 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1226 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1227 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1228 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1229 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1230 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1231 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1232 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1233 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1234 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1235 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1236 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1237 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1238 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1239 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1240 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1241 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1242 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1243 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1244 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1245 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1246 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1247 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1248 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1249 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1250 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1251 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1252 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1253 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1254 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1255 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1256 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1257 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1258 0, 0, 0, 0, 0, 0, 0
1259 };
1260
1261 /* YYCONFL[I] -- lists of conflicting rule numbers, each terminated by
1262 0, pointed into by YYCONFLP. */
1263 static const short yyconfl[] =
1264 {
1265 0
1266 };
1267
1268
1269 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
1270 If N is 0, then set CURRENT to the empty location which ends
1271 the previous symbol: RHS[0] (always defined). */
1272
1273 # ifndef YYLLOC_DEFAULT
1274 # define YYLLOC_DEFAULT(Current, Rhs, N) \
1275 do \
1276 if (N) \
1277 { \
1278 (Current).begin = YYRHSLOC (Rhs, 1).begin; \
1279 (Current).end = YYRHSLOC (Rhs, N).end; \
1280 } \
1281 else \
1282 { \
1283 (Current).begin = (Current).end = YYRHSLOC (Rhs, 0).end; \
1284 } \
1285 while (false)
1286 # endif
1287
1288 # define YYRHSLOC(Rhs, K) ((Rhs)[K].yystate.yyloc)
1289
1290
1291
1292 #undef yynerrs
1293 #define yynerrs (yystackp->yyerrcnt)
1294 #undef yychar
1295 #define yychar (yystackp->yyrawchar)
1296 #undef yylval
1297 #define yylval (yystackp->yyval)
1298 #undef yylloc
1299 #define yylloc (yystackp->yyloc)
1300
1301
1302 enum { YYENOMEM = -2 };
1303
1304 typedef enum { yyok, yyaccept, yyabort, yyerr, yynomem } YYRESULTTAG;
1305
1306 #define YYCHK(YYE) \
1307 do { \
1308 YYRESULTTAG yychk_flag = YYE; \
1309 if (yychk_flag != yyok) \
1310 return yychk_flag; \
1311 } while (0)
1312
1313 /* YYINITDEPTH -- initial size of the parser's stacks. */
1314 #ifndef YYINITDEPTH
1315 # define YYINITDEPTH 200
1316 #endif
1317
1318 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1319 if the built-in stack extension method is used).
1320
1321 Do not make this value too large; the results are undefined if
1322 SIZE_MAX < YYMAXDEPTH * sizeof (GLRStackItem)
1323 evaluated with infinite-precision integer arithmetic. */
1324
1325 #ifndef YYMAXDEPTH
1326 # define YYMAXDEPTH 10000
1327 #endif
1328
1329 /* Minimum number of free items on the stack allowed after an
1330 allocation. This is to allow allocation and initialization
1331 to be completed by functions that call yyexpandGLRStack before the
1332 stack is expanded, thus insuring that all necessary pointers get
1333 properly redirected to new data. */
1334 #define YYHEADROOM 2
1335
1336 #ifndef YYSTACKEXPANDABLE
1337 # define YYSTACKEXPANDABLE 1
1338 #endif
1339
1340 #if YYSTACKEXPANDABLE
1341 # define YY_RESERVE_GLRSTACK(Yystack) \
1342 do { \
1343 if (Yystack->yyspaceLeft < YYHEADROOM) \
1344 yyexpandGLRStack (Yystack); \
1345 } while (0)
1346 #else
1347 # define YY_RESERVE_GLRSTACK(Yystack) \
1348 do { \
1349 if (Yystack->yyspaceLeft < YYHEADROOM) \
1350 yyMemoryExhausted (Yystack); \
1351 } while (0)
1352 #endif
1353
1354 /** State numbers. */
1355 typedef int yy_state_t;
1356
1357 /** Rule numbers. */
1358 typedef int yyRuleNum;
1359
1360 /** Item references. */
1361 typedef short yyItemNum;
1362
1363 typedef struct yyGLRState yyGLRState;
1364 typedef struct yyGLRStateSet yyGLRStateSet;
1365 typedef struct yySemanticOption yySemanticOption;
1366 typedef union yyGLRStackItem yyGLRStackItem;
1367 typedef struct yyGLRStack yyGLRStack;
1368
1369 struct yyGLRState
1370 {
1371 /** Type tag: always true. */
1372 yybool yyisState;
1373 /** Type tag for yysemantics. If true, yyval applies, otherwise
1374 * yyfirstVal applies. */
1375 yybool yyresolved;
1376 /** Number of corresponding LALR(1) machine state. */
1377 yy_state_t yylrState;
1378 /** Preceding state in this stack */
1379 yyGLRState* yypred;
1380 /** Source position of the last token produced by my symbol */
1381 YYPTRDIFF_T yyposn;
1382 union {
1383 /** First in a chain of alternative reductions producing the
1384 * nonterminal corresponding to this state, threaded through
1385 * yynext. */
1386 yySemanticOption* yyfirstVal;
1387 /** Semantic value for this state. */
1388 YYSTYPE yyval;
1389 } yysemantics;
1390 /** Source location for this state. */
1391 YYLTYPE yyloc;
1392 };
1393
1394 struct yyGLRStateSet
1395 {
1396 yyGLRState** yystates;
1397 /** During nondeterministic operation, yylookaheadNeeds tracks which
1398 * stacks have actually needed the current lookahead. During deterministic
1399 * operation, yylookaheadNeeds[0] is not maintained since it would merely
1400 * duplicate yychar != YYEMPTY. */
1401 yybool* yylookaheadNeeds;
1402 YYPTRDIFF_T yysize;
1403 YYPTRDIFF_T yycapacity;
1404 };
1405
1406 struct yySemanticOption
1407 {
1408 /** Type tag: always false. */
1409 yybool yyisState;
1410 /** Rule number for this reduction */
1411 yyRuleNum yyrule;
1412 /** The last RHS state in the list of states to be reduced. */
1413 yyGLRState* yystate;
1414 /** The lookahead for this reduction. */
1415 int yyrawchar;
1416 YYSTYPE yyval;
1417 YYLTYPE yyloc;
1418 /** Next sibling in chain of options. To facilitate merging,
1419 * options are chained in decreasing order by address. */
1420 yySemanticOption* yynext;
1421 };
1422
1423 /** Type of the items in the GLR stack. The yyisState field
1424 * indicates which item of the union is valid. */
1425 union yyGLRStackItem {
1426 yyGLRState yystate;
1427 yySemanticOption yyoption;
1428 };
1429
1430 struct yyGLRStack {
1431 int yyerrState;
1432 /* To compute the location of the error token. */
1433 yyGLRStackItem yyerror_range[3];
1434
1435 int yyerrcnt;
1436 int yyrawchar;
1437 YYSTYPE yyval;
1438 YYLTYPE yyloc;
1439
1440 YYJMP_BUF yyexception_buffer;
1441 yyGLRStackItem* yyitems;
1442 yyGLRStackItem* yynextFree;
1443 YYPTRDIFF_T yyspaceLeft;
1444 yyGLRState* yysplitPoint;
1445 yyGLRState* yylastDeleted;
1446 yyGLRStateSet yytops;
1447 };
1448
1449 #if YYSTACKEXPANDABLE
1450 static void yyexpandGLRStack (yyGLRStack* yystackp);
1451 #endif
1452
1453 _Noreturn static void
yyFail(yyGLRStack * yystackp,YYLTYPE * yylocp,yy::parser & yyparser,void * scanner,android::AST * const ast,android::Scope ** const scope,const char * yymsg)1454 yyFail (yyGLRStack* yystackp, YYLTYPE *yylocp, yy::parser& yyparser, void* scanner, android::AST* const ast, android::Scope** const scope, const char* yymsg)
1455 {
1456 if (yymsg != YY_NULLPTR)
1457 yyerror (yylocp, yyparser, scanner, ast, scope, yymsg);
1458 YYLONGJMP (yystackp->yyexception_buffer, 1);
1459 }
1460
1461 _Noreturn static void
yyMemoryExhausted(yyGLRStack * yystackp)1462 yyMemoryExhausted (yyGLRStack* yystackp)
1463 {
1464 YYLONGJMP (yystackp->yyexception_buffer, 2);
1465 }
1466
1467 /** Accessing symbol of state YYSTATE. */
1468 static inline yysymbol_kind_t
yy_accessing_symbol(yy_state_t yystate)1469 yy_accessing_symbol (yy_state_t yystate)
1470 {
1471 return YY_CAST (yysymbol_kind_t, yystos[yystate]);
1472 }
1473
1474 #if 1
1475 /* The user-facing name of the symbol whose (internal) number is
1476 YYSYMBOL. No bounds checking. */
1477 static const char *yysymbol_name (yysymbol_kind_t yysymbol) YY_ATTRIBUTE_UNUSED;
1478
1479 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
1480 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
1481 static const char *const yytname[] =
1482 {
1483 "\"end of file\"", "error", "\"invalid token\"",
1484 "\"multiline comment\"", "\"doc comment\"", "\"keyword `enum`\"",
1485 "\"keyword `extends`\"", "\"fully-qualified name\"",
1486 "\"keyword `generates`\"", "\"identifier\"", "\"keyword `import`\"",
1487 "\"integer value\"", "\"float value\"", "\"keyword `interface`\"",
1488 "\"keyword `package`\"", "\"type\"", "\"keyword `struct`\"",
1489 "\"string literal\"", "\"keyword `typedef`\"", "\"keyword `union`\"",
1490 "\"keyword `safe_union`\"", "\"templated type\"", "\"keyword `oneway`\"",
1491 "\"unknown character\"", "'?'", "':'", "LOGICAL_OR", "LOGICAL_AND",
1492 "'|'", "'^'", "'&'", "EQUALITY", "NEQ", "'<'", "'>'", "LEQ", "GEQ",
1493 "LSHIFT", "RSHIFT", "'+'", "'-'", "'*'", "'/'", "'%'", "UNARY_MINUS",
1494 "UNARY_PLUS", "'!'", "'~'", "'#'", "'@'", "'('", "')'", "','", "'='",
1495 "'{'", "'}'", "';'", "'['", "']'", "$accept", "program", "doc_comment",
1496 "doc_comments", "ignore_doc_comments", "valid_identifier",
1497 "valid_type_name", "opt_annotations", "annotation",
1498 "opt_annotation_params", "annotation_params", "annotation_param",
1499 "annotation_string_value", "annotation_string_values", "error_stmt",
1500 "require_semicolon", "fqname", "fqtype", "package", "import_stmt",
1501 "opt_extends", "interface_declarations", "declarations",
1502 "commentable_declaration", "commentable_type_declaration",
1503 "type_declaration", "type_declaration_body", "interface_declaration",
1504 "$@1", "interface_declaration_body", "typedef_declaration", "const_expr",
1505 "commentable_method_declaration", "method_declaration", "typed_vars",
1506 "non_empty_typed_vars", "typed_var", "uncommented_typed_var",
1507 "struct_or_union_keyword", "named_struct_or_union_declaration", "$@2",
1508 "struct_or_union_body", "field_declarations",
1509 "commentable_field_declaration", "field_declaration",
1510 "annotated_compound_declaration", "compound_declaration",
1511 "enum_storage_type", "named_enum_declaration", "$@3",
1512 "enum_declaration_body", "commentable_enum_value", "enum_value",
1513 "enum_values", "array_type_base", "array_type", "type",
1514 "type_or_inplace_compound_declaration", YY_NULLPTR
1515 };
1516
1517 static const char *
yysymbol_name(yysymbol_kind_t yysymbol)1518 yysymbol_name (yysymbol_kind_t yysymbol)
1519 {
1520 return yytname[yysymbol];
1521 }
1522 #endif
1523
1524 /** Left-hand-side symbol for rule #YYRULE. */
1525 static inline yysymbol_kind_t
yylhsNonterm(yyRuleNum yyrule)1526 yylhsNonterm (yyRuleNum yyrule)
1527 {
1528 return YY_CAST (yysymbol_kind_t, yyr1[yyrule]);
1529 }
1530
1531 #if YYDEBUG
1532
1533 # ifndef YYFPRINTF
1534 # define YYFPRINTF fprintf
1535 # endif
1536
1537 # define YY_FPRINTF \
1538 YY_IGNORE_USELESS_CAST_BEGIN YY_FPRINTF_
1539
1540 # define YY_FPRINTF_(Args) \
1541 do { \
1542 YYFPRINTF Args; \
1543 YY_IGNORE_USELESS_CAST_END \
1544 } while (0)
1545
1546 # define YY_DPRINTF \
1547 YY_IGNORE_USELESS_CAST_BEGIN YY_DPRINTF_
1548
1549 # define YY_DPRINTF_(Args) \
1550 do { \
1551 if (yydebug) \
1552 YYFPRINTF Args; \
1553 YY_IGNORE_USELESS_CAST_END \
1554 } while (0)
1555
1556
1557 /* YYLOCATION_PRINT -- Print the location on the stream.
1558 This macro was not mandated originally: define only if we know
1559 we won't break user code: when these are the locations we know. */
1560
1561 # ifndef YYLOCATION_PRINT
1562
1563 # if defined YY_LOCATION_PRINT
1564
1565 /* Temporary convenience wrapper in case some people defined the
1566 undocumented and private YY_LOCATION_PRINT macros. */
1567 # define YYLOCATION_PRINT(File, Loc) YY_LOCATION_PRINT(File, *(Loc))
1568
1569 # elif defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
1570
1571 /* Print *YYLOCP on YYO. Private, do not rely on its existence. */
1572
1573 YY_ATTRIBUTE_UNUSED
1574 static int
yy_location_print_(FILE * yyo,YYLTYPE const * const yylocp)1575 yy_location_print_ (FILE *yyo, YYLTYPE const * const yylocp)
1576 {
1577 int res = 0;
1578 int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0;
1579 if (0 <= yylocp->first_line)
1580 {
1581 res += YYFPRINTF (yyo, "%d", yylocp->first_line);
1582 if (0 <= yylocp->first_column)
1583 res += YYFPRINTF (yyo, ".%d", yylocp->first_column);
1584 }
1585 if (0 <= yylocp->last_line)
1586 {
1587 if (yylocp->first_line < yylocp->last_line)
1588 {
1589 res += YYFPRINTF (yyo, "-%d", yylocp->last_line);
1590 if (0 <= end_col)
1591 res += YYFPRINTF (yyo, ".%d", end_col);
1592 }
1593 else if (0 <= end_col && yylocp->first_column < end_col)
1594 res += YYFPRINTF (yyo, "-%d", end_col);
1595 }
1596 return res;
1597 }
1598
1599 # define YYLOCATION_PRINT yy_location_print_
1600
1601 /* Temporary convenience wrapper in case some people defined the
1602 undocumented and private YY_LOCATION_PRINT macros. */
1603 # define YY_LOCATION_PRINT(File, Loc) YYLOCATION_PRINT(File, &(Loc))
1604
1605 # else
1606
1607 # define YYLOCATION_PRINT(File, Loc) ((void) 0)
1608 /* Temporary convenience wrapper in case some people defined the
1609 undocumented and private YY_LOCATION_PRINT macros. */
1610 # define YY_LOCATION_PRINT YYLOCATION_PRINT
1611
1612 # endif
1613 # endif /* !defined YYLOCATION_PRINT */
1614
1615
1616 /*--------------------.
1617 | Print this symbol. |
1618 `--------------------*/
1619
1620 static void
yy_symbol_print(FILE *,yy::parser::symbol_kind_type yytoken,const yy::parser::value_type * yyvaluep,const yy::parser::location_type * yylocationp,yy::parser & yyparser,void * scanner,android::AST * const ast,android::Scope ** const scope)1621 yy_symbol_print (FILE *, yy::parser::symbol_kind_type yytoken,
1622 const yy::parser::value_type *yyvaluep,
1623 const yy::parser::location_type *yylocationp, yy::parser& yyparser, void* scanner, android::AST* const ast, android::Scope** const scope)
1624 {
1625 YY_USE (yyparser);
1626 YY_USE (scanner);
1627 YY_USE (ast);
1628 YY_USE (scope);
1629 yyparser.yy_symbol_print_ (yytoken, yyvaluep, yylocationp);
1630 }
1631
1632
1633 # define YY_SYMBOL_PRINT(Title, Kind, Value, Location) \
1634 do { \
1635 if (yydebug) \
1636 { \
1637 YY_FPRINTF ((stderr, "%s ", Title)); \
1638 yy_symbol_print (stderr, Kind, Value, Location, yyparser, scanner, ast, scope); \
1639 YY_FPRINTF ((stderr, "\n")); \
1640 } \
1641 } while (0)
1642
1643 static inline void
1644 yy_reduce_print (yybool yynormal, yyGLRStackItem* yyvsp, YYPTRDIFF_T yyk,
1645 yyRuleNum yyrule, yy::parser& yyparser, void* scanner, android::AST* const ast, android::Scope** const scope);
1646
1647 # define YY_REDUCE_PRINT(Args) \
1648 do { \
1649 if (yydebug) \
1650 yy_reduce_print Args; \
1651 } while (0)
1652
1653 /* Nonzero means print parse trace. It is left uninitialized so that
1654 multiple parsers can coexist. */
1655 int yydebug;
1656
1657 static void yypstack (yyGLRStack* yystackp, YYPTRDIFF_T yyk)
1658 YY_ATTRIBUTE_UNUSED;
1659 static void yypdumpstack (yyGLRStack* yystackp)
1660 YY_ATTRIBUTE_UNUSED;
1661
1662 #else /* !YYDEBUG */
1663
1664 # define YY_DPRINTF(Args) do {} while (yyfalse)
1665 # define YY_SYMBOL_PRINT(Title, Kind, Value, Location)
1666 # define YY_REDUCE_PRINT(Args)
1667
1668 #endif /* !YYDEBUG */
1669
1670 #ifndef yystrlen
1671 # define yystrlen(S) (YY_CAST (YYPTRDIFF_T, strlen (S)))
1672 #endif
1673
1674 #ifndef yystpcpy
1675 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
1676 # define yystpcpy stpcpy
1677 # else
1678 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1679 YYDEST. */
1680 static char *
yystpcpy(char * yydest,const char * yysrc)1681 yystpcpy (char *yydest, const char *yysrc)
1682 {
1683 char *yyd = yydest;
1684 const char *yys = yysrc;
1685
1686 while ((*yyd++ = *yys++) != '\0')
1687 continue;
1688
1689 return yyd - 1;
1690 }
1691 # endif
1692 #endif
1693
1694 #ifndef yytnamerr
1695 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1696 quotes and backslashes, so that it's suitable for yyerror. The
1697 heuristic is that double-quoting is unnecessary unless the string
1698 contains an apostrophe, a comma, or backslash (other than
1699 backslash-backslash). YYSTR is taken from yytname. If YYRES is
1700 null, do not copy; instead, return the length of what the result
1701 would have been. */
1702 static YYPTRDIFF_T
yytnamerr(char * yyres,const char * yystr)1703 yytnamerr (char *yyres, const char *yystr)
1704 {
1705 if (*yystr == '"')
1706 {
1707 YYPTRDIFF_T yyn = 0;
1708 char const *yyp = yystr;
1709
1710 for (;;)
1711 switch (*++yyp)
1712 {
1713 case '\'':
1714 case ',':
1715 goto do_not_strip_quotes;
1716
1717 case '\\':
1718 if (*++yyp != '\\')
1719 goto do_not_strip_quotes;
1720 else
1721 goto append;
1722
1723 append:
1724 default:
1725 if (yyres)
1726 yyres[yyn] = *yyp;
1727 yyn++;
1728 break;
1729
1730 case '"':
1731 if (yyres)
1732 yyres[yyn] = '\0';
1733 return yyn;
1734 }
1735 do_not_strip_quotes: ;
1736 }
1737
1738 if (yyres)
1739 return yystpcpy (yyres, yystr) - yyres;
1740 else
1741 return yystrlen (yystr);
1742 }
1743 #endif
1744
1745
1746 /** Fill in YYVSP[YYLOW1 .. YYLOW0-1] from the chain of states starting
1747 * at YYVSP[YYLOW0].yystate.yypred. Leaves YYVSP[YYLOW1].yystate.yypred
1748 * containing the pointer to the next state in the chain. */
1749 static void yyfillin (yyGLRStackItem *, int, int) YY_ATTRIBUTE_UNUSED;
1750 static void
yyfillin(yyGLRStackItem * yyvsp,int yylow0,int yylow1)1751 yyfillin (yyGLRStackItem *yyvsp, int yylow0, int yylow1)
1752 {
1753 int i;
1754 yyGLRState *s = yyvsp[yylow0].yystate.yypred;
1755 for (i = yylow0-1; i >= yylow1; i -= 1)
1756 {
1757 #if YYDEBUG
1758 yyvsp[i].yystate.yylrState = s->yylrState;
1759 #endif
1760 yyvsp[i].yystate.yyresolved = s->yyresolved;
1761 if (s->yyresolved)
1762 yyvsp[i].yystate.yysemantics.yyval = s->yysemantics.yyval;
1763 else
1764 /* The effect of using yyval or yyloc (in an immediate rule) is
1765 * undefined. */
1766 yyvsp[i].yystate.yysemantics.yyfirstVal = YY_NULLPTR;
1767 yyvsp[i].yystate.yyloc = s->yyloc;
1768 s = yyvsp[i].yystate.yypred = s->yypred;
1769 }
1770 }
1771
1772
1773 /** If yychar is empty, fetch the next token. */
1774 static inline yysymbol_kind_t
yygetToken(int * yycharp,yyGLRStack * yystackp,yy::parser & yyparser,void * scanner,android::AST * const ast,android::Scope ** const scope)1775 yygetToken (int *yycharp, yyGLRStack* yystackp, yy::parser& yyparser, void* scanner, android::AST* const ast, android::Scope** const scope)
1776 {
1777 yysymbol_kind_t yytoken;
1778 YY_USE (yyparser);
1779 YY_USE (scanner);
1780 YY_USE (ast);
1781 YY_USE (scope);
1782 if (*yycharp == YYEMPTY)
1783 {
1784 YY_DPRINTF ((stderr, "Reading a token\n"));
1785 #if YY_EXCEPTIONS
1786 try
1787 {
1788 #endif // YY_EXCEPTIONS
1789 *yycharp = yylex (&yylval, &yylloc, scanner, ast, scope);
1790 #if YY_EXCEPTIONS
1791 }
1792 catch (const yy::parser::syntax_error& yyexc)
1793 {
1794 YY_DPRINTF ((stderr, "Caught exception: %s\n", yyexc.what()));
1795 yylloc = yyexc.location;
1796 yyerror (&yylloc, yyparser, scanner, ast, scope, yyexc.what ());
1797 // Map errors caught in the scanner to the undefined token,
1798 // so that error handling is started. However, record this
1799 // with this special value of yychar.
1800 *yycharp = YYerror;
1801 }
1802 #endif // YY_EXCEPTIONS
1803 }
1804 if (*yycharp <= YYEOF)
1805 {
1806 *yycharp = YYEOF;
1807 yytoken = S_YYEOF;
1808 YY_DPRINTF ((stderr, "Now at end of input.\n"));
1809 }
1810 else
1811 {
1812 yytoken = YYTRANSLATE (*yycharp);
1813 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1814 }
1815 return yytoken;
1816 }
1817
1818 /* Do nothing if YYNORMAL or if *YYLOW <= YYLOW1. Otherwise, fill in
1819 * YYVSP[YYLOW1 .. *YYLOW-1] as in yyfillin and set *YYLOW = YYLOW1.
1820 * For convenience, always return YYLOW1. */
1821 static inline int yyfill (yyGLRStackItem *, int *, int, yybool)
1822 YY_ATTRIBUTE_UNUSED;
1823 static inline int
yyfill(yyGLRStackItem * yyvsp,int * yylow,int yylow1,yybool yynormal)1824 yyfill (yyGLRStackItem *yyvsp, int *yylow, int yylow1, yybool yynormal)
1825 {
1826 if (!yynormal && yylow1 < *yylow)
1827 {
1828 yyfillin (yyvsp, *yylow, yylow1);
1829 *yylow = yylow1;
1830 }
1831 return yylow1;
1832 }
1833
1834 /** Perform user action for rule number YYN, with RHS length YYRHSLEN,
1835 * and top stack item YYVSP. YYLVALP points to place to put semantic
1836 * value ($$), and yylocp points to place for location information
1837 * (@$). Returns yyok for normal return, yyaccept for YYACCEPT,
1838 * yyerr for YYERROR, yyabort for YYABORT, yynomem for YYNOMEM. */
1839 static YYRESULTTAG
yyuserAction(yyRuleNum yyrule,int yyrhslen,yyGLRStackItem * yyvsp,yyGLRStack * yystackp,YYPTRDIFF_T yyk,YYSTYPE * yyvalp,YYLTYPE * yylocp,yy::parser & yyparser,void * scanner,android::AST * const ast,android::Scope ** const scope)1840 yyuserAction (yyRuleNum yyrule, int yyrhslen, yyGLRStackItem* yyvsp,
1841 yyGLRStack* yystackp, YYPTRDIFF_T yyk,
1842 YYSTYPE* yyvalp, YYLTYPE *yylocp, yy::parser& yyparser, void* scanner, android::AST* const ast, android::Scope** const scope)
1843 {
1844 const yybool yynormal YY_ATTRIBUTE_UNUSED = yystackp->yysplitPoint == YY_NULLPTR;
1845 int yylow = 1;
1846 YY_USE (yyvalp);
1847 YY_USE (yylocp);
1848 YY_USE (yyparser);
1849 YY_USE (scanner);
1850 YY_USE (ast);
1851 YY_USE (scope);
1852 YY_USE (yyk);
1853 YY_USE (yyrhslen);
1854 # undef yyerrok
1855 # define yyerrok (yystackp->yyerrState = 0)
1856 # undef YYACCEPT
1857 # define YYACCEPT return yyaccept
1858 # undef YYABORT
1859 # define YYABORT return yyabort
1860 # undef YYNOMEM
1861 # define YYNOMEM return yynomem
1862 # undef YYERROR
1863 # define YYERROR return yyerrok, yyerr
1864 # undef YYRECOVERING
1865 # define YYRECOVERING() (yystackp->yyerrState != 0)
1866 # undef yyclearin
1867 # define yyclearin (yychar = YYEMPTY)
1868 # undef YYFILL
1869 # define YYFILL(N) yyfill (yyvsp, &yylow, (N), yynormal)
1870 # undef YYBACKUP
1871 # define YYBACKUP(Token, Value) \
1872 return yyerror (yylocp, yyparser, scanner, ast, scope, YY_("syntax error: cannot back up")), \
1873 yyerrok, yyerr
1874
1875 if (yyrhslen == 0)
1876 *yyvalp = yyval_default;
1877 else
1878 *yyvalp = yyvsp[YYFILL (1-yyrhslen)].yystate.yysemantics.yyval;
1879 /* Default location. */
1880 YYLLOC_DEFAULT ((*yylocp), (yyvsp - yyrhslen), yyrhslen);
1881 yystackp->yyerror_range[1].yystate.yyloc = *yylocp;
1882 /* If yyk == -1, we are running a deferred action on a temporary
1883 stack. In that case, YY_REDUCE_PRINT must not play with YYFILL,
1884 so pretend the stack is "normal". */
1885 YY_REDUCE_PRINT ((yynormal || yyk == -1, yyvsp, yyk, yyrule, yyparser, scanner, ast, scope));
1886 #if YY_EXCEPTIONS
1887 typedef yy::parser::syntax_error syntax_error;
1888 try
1889 {
1890 #endif // YY_EXCEPTIONS
1891 switch (yyrule)
1892 {
1893 case 2: // program: doc_comments package declarations ignore_doc_comments
1894 #line 346 "system/tools/hidl/hidl-gen_y.yy"
1895 {
1896 ast->setHeader((YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (-3)].yystate.yysemantics.yyval.docComment));
1897 }
1898 #line 1899 "out/soong/.intermediates/system/tools/hidl/libhidl-gen-ast/linux_glibc_x86_64_static/gen/yacc/system/tools/hidl/hidl-gen_y.cpp"
1899 break;
1900
1901 case 4: // doc_comment: "doc comment"
1902 #line 353 "system/tools/hidl/hidl-gen_y.yy"
1903 { ((*yyvalp).docComment) = new DocComment((YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (0)].yystate.yysemantics.yyval.str), convertYYLoc((YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (0)].yystate.yyloc), ast), CommentType::DOC_MULTILINE); }
1904 #line 1905 "out/soong/.intermediates/system/tools/hidl/libhidl-gen-ast/linux_glibc_x86_64_static/gen/yacc/system/tools/hidl/hidl-gen_y.cpp"
1905 break;
1906
1907 case 5: // doc_comment: "multiline comment"
1908 #line 354 "system/tools/hidl/hidl-gen_y.yy"
1909 { ((*yyvalp).docComment) = new DocComment((YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (0)].yystate.yysemantics.yyval.str), convertYYLoc((YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (0)].yystate.yyloc), ast), CommentType::MULTILINE); }
1910 #line 1911 "out/soong/.intermediates/system/tools/hidl/libhidl-gen-ast/linux_glibc_x86_64_static/gen/yacc/system/tools/hidl/hidl-gen_y.cpp"
1911 break;
1912
1913 case 6: // doc_comments: doc_comment
1914 #line 358 "system/tools/hidl/hidl-gen_y.yy"
1915 { ((*yyvalp).docComment) = (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (0)].yystate.yysemantics.yyval.docComment); }
1916 #line 1917 "out/soong/.intermediates/system/tools/hidl/libhidl-gen-ast/linux_glibc_x86_64_static/gen/yacc/system/tools/hidl/hidl-gen_y.cpp"
1917 break;
1918
1919 case 7: // doc_comments: doc_comments doc_comment
1920 #line 360 "system/tools/hidl/hidl-gen_y.yy"
1921 {
1922 (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (-1)].yystate.yysemantics.yyval.docComment)->merge((YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (0)].yystate.yysemantics.yyval.docComment));
1923 ((*yyvalp).docComment) = (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (-1)].yystate.yysemantics.yyval.docComment);
1924 }
1925 #line 1926 "out/soong/.intermediates/system/tools/hidl/libhidl-gen-ast/linux_glibc_x86_64_static/gen/yacc/system/tools/hidl/hidl-gen_y.cpp"
1926 break;
1927
1928 case 8: // ignore_doc_comments: %empty
1929 #line 367 "system/tools/hidl/hidl-gen_y.yy"
1930 { ((*yyvalp).docComment) = nullptr; }
1931 #line 1932 "out/soong/.intermediates/system/tools/hidl/libhidl-gen-ast/linux_glibc_x86_64_static/gen/yacc/system/tools/hidl/hidl-gen_y.cpp"
1932 break;
1933
1934 case 9: // ignore_doc_comments: doc_comments
1935 #line 368 "system/tools/hidl/hidl-gen_y.yy"
1936 { ast->addUnhandledComment((YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (0)].yystate.yysemantics.yyval.docComment)); ((*yyvalp).docComment) = (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (0)].yystate.yysemantics.yyval.docComment); }
1937 #line 1938 "out/soong/.intermediates/system/tools/hidl/libhidl-gen-ast/linux_glibc_x86_64_static/gen/yacc/system/tools/hidl/hidl-gen_y.cpp"
1938 break;
1939
1940 case 10: // valid_identifier: "identifier"
1941 #line 373 "system/tools/hidl/hidl-gen_y.yy"
1942 {
1943 std::string errorMsg;
1944 if (!isValidIdentifier((YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (0)].yystate.yysemantics.yyval.str), &errorMsg)) {
1945 std::cerr << "ERROR: " << errorMsg << " at " << (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (0)].yystate.yyloc) << "\n";
1946 YYERROR;
1947 }
1948 ((*yyvalp).str) = (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (0)].yystate.yysemantics.yyval.str);
1949 }
1950 #line 1951 "out/soong/.intermediates/system/tools/hidl/libhidl-gen-ast/linux_glibc_x86_64_static/gen/yacc/system/tools/hidl/hidl-gen_y.cpp"
1951 break;
1952
1953 case 11: // valid_type_name: "identifier"
1954 #line 385 "system/tools/hidl/hidl-gen_y.yy"
1955 {
1956 std::string errorMsg;
1957 if (!isValidTypeName((YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (0)].yystate.yysemantics.yyval.str), &errorMsg)) {
1958 std::cerr << "ERROR: " << errorMsg << " at " << (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (0)].yystate.yyloc) << "\n";
1959 YYERROR;
1960 }
1961 ((*yyvalp).str) = (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (0)].yystate.yysemantics.yyval.str);
1962 }
1963 #line 1964 "out/soong/.intermediates/system/tools/hidl/libhidl-gen-ast/linux_glibc_x86_64_static/gen/yacc/system/tools/hidl/hidl-gen_y.cpp"
1964 break;
1965
1966 case 12: // opt_annotations: %empty
1967 #line 397 "system/tools/hidl/hidl-gen_y.yy"
1968 {
1969 ((*yyvalp).annotations) = new std::vector<Annotation *>;
1970 }
1971 #line 1972 "out/soong/.intermediates/system/tools/hidl/libhidl-gen-ast/linux_glibc_x86_64_static/gen/yacc/system/tools/hidl/hidl-gen_y.cpp"
1972 break;
1973
1974 case 13: // opt_annotations: opt_annotations annotation
1975 #line 401 "system/tools/hidl/hidl-gen_y.yy"
1976 {
1977 ((*yyvalp).annotations) = (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (-1)].yystate.yysemantics.yyval.annotations);
1978 ((*yyvalp).annotations)->push_back((YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (0)].yystate.yysemantics.yyval.annotation));
1979 }
1980 #line 1981 "out/soong/.intermediates/system/tools/hidl/libhidl-gen-ast/linux_glibc_x86_64_static/gen/yacc/system/tools/hidl/hidl-gen_y.cpp"
1981 break;
1982
1983 case 14: // annotation: '@' "identifier" opt_annotation_params
1984 #line 409 "system/tools/hidl/hidl-gen_y.yy"
1985 {
1986 ((*yyvalp).annotation) = new Annotation((YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (-1)].yystate.yysemantics.yyval.str), (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (0)].yystate.yysemantics.yyval.annotationParams));
1987 }
1988 #line 1989 "out/soong/.intermediates/system/tools/hidl/libhidl-gen-ast/linux_glibc_x86_64_static/gen/yacc/system/tools/hidl/hidl-gen_y.cpp"
1989 break;
1990
1991 case 15: // opt_annotation_params: %empty
1992 #line 416 "system/tools/hidl/hidl-gen_y.yy"
1993 {
1994 ((*yyvalp).annotationParams) = new AnnotationParamVector;
1995 }
1996 #line 1997 "out/soong/.intermediates/system/tools/hidl/libhidl-gen-ast/linux_glibc_x86_64_static/gen/yacc/system/tools/hidl/hidl-gen_y.cpp"
1997 break;
1998
1999 case 16: // opt_annotation_params: '(' annotation_params ')'
2000 #line 420 "system/tools/hidl/hidl-gen_y.yy"
2001 {
2002 ((*yyvalp).annotationParams) = (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (-1)].yystate.yysemantics.yyval.annotationParams);
2003 }
2004 #line 2005 "out/soong/.intermediates/system/tools/hidl/libhidl-gen-ast/linux_glibc_x86_64_static/gen/yacc/system/tools/hidl/hidl-gen_y.cpp"
2005 break;
2006
2007 case 17: // annotation_params: annotation_param
2008 #line 427 "system/tools/hidl/hidl-gen_y.yy"
2009 {
2010 ((*yyvalp).annotationParams) = new AnnotationParamVector;
2011 ((*yyvalp).annotationParams)->push_back((YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (0)].yystate.yysemantics.yyval.annotationParam));
2012 }
2013 #line 2014 "out/soong/.intermediates/system/tools/hidl/libhidl-gen-ast/linux_glibc_x86_64_static/gen/yacc/system/tools/hidl/hidl-gen_y.cpp"
2014 break;
2015
2016 case 18: // annotation_params: annotation_params ',' annotation_param
2017 #line 432 "system/tools/hidl/hidl-gen_y.yy"
2018 {
2019 ((*yyvalp).annotationParams) = (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (-2)].yystate.yysemantics.yyval.annotationParams);
2020 ((*yyvalp).annotationParams)->push_back((YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (0)].yystate.yysemantics.yyval.annotationParam));
2021 }
2022 #line 2023 "out/soong/.intermediates/system/tools/hidl/libhidl-gen-ast/linux_glibc_x86_64_static/gen/yacc/system/tools/hidl/hidl-gen_y.cpp"
2023 break;
2024
2025 case 19: // annotation_param: "identifier" '=' annotation_string_value
2026 #line 440 "system/tools/hidl/hidl-gen_y.yy"
2027 {
2028 ((*yyvalp).annotationParam) = new StringAnnotationParam((YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (-2)].yystate.yysemantics.yyval.str), (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (0)].yystate.yysemantics.yyval.stringVec));
2029 }
2030 #line 2031 "out/soong/.intermediates/system/tools/hidl/libhidl-gen-ast/linux_glibc_x86_64_static/gen/yacc/system/tools/hidl/hidl-gen_y.cpp"
2031 break;
2032
2033 case 20: // annotation_string_value: "string literal"
2034 #line 447 "system/tools/hidl/hidl-gen_y.yy"
2035 {
2036 ((*yyvalp).stringVec) = new std::vector<std::string>;
2037 ((*yyvalp).stringVec)->push_back((YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (0)].yystate.yysemantics.yyval.str));
2038 }
2039 #line 2040 "out/soong/.intermediates/system/tools/hidl/libhidl-gen-ast/linux_glibc_x86_64_static/gen/yacc/system/tools/hidl/hidl-gen_y.cpp"
2040 break;
2041
2042 case 21: // annotation_string_value: '{' annotation_string_values '}'
2043 #line 451 "system/tools/hidl/hidl-gen_y.yy"
2044 { ((*yyvalp).stringVec) = (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (-1)].yystate.yysemantics.yyval.stringVec); }
2045 #line 2046 "out/soong/.intermediates/system/tools/hidl/libhidl-gen-ast/linux_glibc_x86_64_static/gen/yacc/system/tools/hidl/hidl-gen_y.cpp"
2046 break;
2047
2048 case 22: // annotation_string_values: "string literal"
2049 #line 456 "system/tools/hidl/hidl-gen_y.yy"
2050 {
2051 ((*yyvalp).stringVec) = new std::vector<std::string>;
2052 ((*yyvalp).stringVec)->push_back((YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (0)].yystate.yysemantics.yyval.str));
2053 }
2054 #line 2055 "out/soong/.intermediates/system/tools/hidl/libhidl-gen-ast/linux_glibc_x86_64_static/gen/yacc/system/tools/hidl/hidl-gen_y.cpp"
2055 break;
2056
2057 case 23: // annotation_string_values: annotation_string_values ',' "string literal"
2058 #line 461 "system/tools/hidl/hidl-gen_y.yy"
2059 {
2060 ((*yyvalp).stringVec) = (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (-2)].yystate.yysemantics.yyval.stringVec);
2061 ((*yyvalp).stringVec)->push_back((YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (0)].yystate.yysemantics.yyval.str));
2062 }
2063 #line 2064 "out/soong/.intermediates/system/tools/hidl/libhidl-gen-ast/linux_glibc_x86_64_static/gen/yacc/system/tools/hidl/hidl-gen_y.cpp"
2064 break;
2065
2066 case 24: // error_stmt: error ';'
2067 #line 469 "system/tools/hidl/hidl-gen_y.yy"
2068 {
2069 ((*yyvalp).str) = (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (-1)].yystate.yysemantics.yyval.str);
2070 ast->addSyntaxError();
2071 }
2072 #line 2073 "out/soong/.intermediates/system/tools/hidl/libhidl-gen-ast/linux_glibc_x86_64_static/gen/yacc/system/tools/hidl/hidl-gen_y.cpp"
2073 break;
2074
2075 case 26: // require_semicolon: %empty
2076 #line 478 "system/tools/hidl/hidl-gen_y.yy"
2077 {
2078 std::cerr << "ERROR: missing ; at " << (*yylocp) << "\n";
2079 ast->addSyntaxError();
2080 }
2081 #line 2082 "out/soong/.intermediates/system/tools/hidl/libhidl-gen-ast/linux_glibc_x86_64_static/gen/yacc/system/tools/hidl/hidl-gen_y.cpp"
2082 break;
2083
2084 case 27: // fqname: "fully-qualified name"
2085 #line 486 "system/tools/hidl/hidl-gen_y.yy"
2086 {
2087 ((*yyvalp).fqName) = new FQName();
2088 if(!FQName::parse((YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (0)].yystate.yysemantics.yyval.str), ((*yyvalp).fqName))) {
2089 std::cerr << "ERROR: FQName '" << (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (0)].yystate.yysemantics.yyval.str) << "' is not valid at "
2090 << (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (0)].yystate.yyloc)
2091 << ".\n";
2092 YYERROR;
2093 }
2094 }
2095 #line 2096 "out/soong/.intermediates/system/tools/hidl/libhidl-gen-ast/linux_glibc_x86_64_static/gen/yacc/system/tools/hidl/hidl-gen_y.cpp"
2096 break;
2097
2098 case 28: // fqname: valid_type_name
2099 #line 496 "system/tools/hidl/hidl-gen_y.yy"
2100 {
2101 ((*yyvalp).fqName) = new FQName();
2102 if(!FQName::parse((YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (0)].yystate.yysemantics.yyval.str), ((*yyvalp).fqName))) {
2103 std::cerr << "ERROR: FQName '" << (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (0)].yystate.yysemantics.yyval.str) << "' is not valid at "
2104 << (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (0)].yystate.yyloc)
2105 << ".\n";
2106 YYERROR;
2107 }
2108 }
2109 #line 2110 "out/soong/.intermediates/system/tools/hidl/libhidl-gen-ast/linux_glibc_x86_64_static/gen/yacc/system/tools/hidl/hidl-gen_y.cpp"
2110 break;
2111
2112 case 29: // fqtype: fqname
2113 #line 509 "system/tools/hidl/hidl-gen_y.yy"
2114 {
2115 ((*yyvalp).referenceToType) = new Reference<Type>((YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (0)].yystate.yysemantics.yyval.fqName)->string(), *(YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (0)].yystate.yysemantics.yyval.fqName), convertYYLoc((YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (0)].yystate.yyloc), ast));
2116 }
2117 #line 2118 "out/soong/.intermediates/system/tools/hidl/libhidl-gen-ast/linux_glibc_x86_64_static/gen/yacc/system/tools/hidl/hidl-gen_y.cpp"
2118 break;
2119
2120 case 30: // fqtype: "type"
2121 #line 513 "system/tools/hidl/hidl-gen_y.yy"
2122 {
2123 ((*yyvalp).referenceToType) = new Reference<Type>((YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (0)].yystate.yysemantics.yyval.type)->definedName(), (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (0)].yystate.yysemantics.yyval.type), convertYYLoc((YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (0)].yystate.yyloc), ast));
2124 }
2125 #line 2126 "out/soong/.intermediates/system/tools/hidl/libhidl-gen-ast/linux_glibc_x86_64_static/gen/yacc/system/tools/hidl/hidl-gen_y.cpp"
2126 break;
2127
2128 case 31: // package: "keyword `package`" "fully-qualified name" require_semicolon
2129 #line 520 "system/tools/hidl/hidl-gen_y.yy"
2130 {
2131 if (!ast->setPackage((YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (-1)].yystate.yysemantics.yyval.str))) {
2132 std::cerr << "ERROR: Malformed package identifier '"
2133 << (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (-1)].yystate.yysemantics.yyval.str)
2134 << "' at "
2135 << (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (-1)].yystate.yyloc)
2136 << "\n";
2137
2138 YYERROR;
2139 }
2140 }
2141 #line 2142 "out/soong/.intermediates/system/tools/hidl/libhidl-gen-ast/linux_glibc_x86_64_static/gen/yacc/system/tools/hidl/hidl-gen_y.cpp"
2142 break;
2143
2144 case 32: // package: error
2145 #line 532 "system/tools/hidl/hidl-gen_y.yy"
2146 {
2147 std::cerr << "ERROR: Package statement must be at the beginning of the file (" << (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (0)].yystate.yyloc) << ")\n";
2148 ((*yyvalp).str) = (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (0)].yystate.yysemantics.yyval.str);
2149 ast->addSyntaxError();
2150 }
2151 #line 2152 "out/soong/.intermediates/system/tools/hidl/libhidl-gen-ast/linux_glibc_x86_64_static/gen/yacc/system/tools/hidl/hidl-gen_y.cpp"
2152 break;
2153
2154 case 33: // import_stmt: "keyword `import`" "fully-qualified name" require_semicolon
2155 #line 541 "system/tools/hidl/hidl-gen_y.yy"
2156 {
2157 if (!ast->addImport((YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (-1)].yystate.yysemantics.yyval.str), convertYYLoc((YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (-1)].yystate.yyloc), ast))) {
2158 std::cerr << "ERROR: Unable to import '" << (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (-1)].yystate.yysemantics.yyval.str) << "' at " << (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (-1)].yystate.yyloc)
2159 << "\n";
2160 ast->addSyntaxError();
2161 }
2162 }
2163 #line 2164 "out/soong/.intermediates/system/tools/hidl/libhidl-gen-ast/linux_glibc_x86_64_static/gen/yacc/system/tools/hidl/hidl-gen_y.cpp"
2164 break;
2165
2166 case 34: // import_stmt: "keyword `import`" valid_type_name require_semicolon
2167 #line 549 "system/tools/hidl/hidl-gen_y.yy"
2168 {
2169 if (!ast->addImport((YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (-1)].yystate.yysemantics.yyval.str), convertYYLoc((YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (-1)].yystate.yyloc), ast))) {
2170 std::cerr << "ERROR: Unable to import '" << (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (-1)].yystate.yysemantics.yyval.str) << "' at " << (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (-1)].yystate.yyloc)
2171 << "\n";
2172 ast->addSyntaxError();
2173 }
2174 }
2175 #line 2176 "out/soong/.intermediates/system/tools/hidl/libhidl-gen-ast/linux_glibc_x86_64_static/gen/yacc/system/tools/hidl/hidl-gen_y.cpp"
2176 break;
2177
2178 case 36: // opt_extends: %empty
2179 #line 560 "system/tools/hidl/hidl-gen_y.yy"
2180 { ((*yyvalp).referenceToType) = nullptr; }
2181 #line 2182 "out/soong/.intermediates/system/tools/hidl/libhidl-gen-ast/linux_glibc_x86_64_static/gen/yacc/system/tools/hidl/hidl-gen_y.cpp"
2182 break;
2183
2184 case 37: // opt_extends: "keyword `extends`" fqtype
2185 #line 561 "system/tools/hidl/hidl-gen_y.yy"
2186 { ((*yyvalp).referenceToType) = (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (0)].yystate.yysemantics.yyval.referenceToType); }
2187 #line 2188 "out/soong/.intermediates/system/tools/hidl/libhidl-gen-ast/linux_glibc_x86_64_static/gen/yacc/system/tools/hidl/hidl-gen_y.cpp"
2188 break;
2189
2190 case 39: // interface_declarations: interface_declarations commentable_type_declaration
2191 #line 567 "system/tools/hidl/hidl-gen_y.yy"
2192 {
2193 CHECK((*scope)->isInterface());
2194
2195 std::string errorMsg;
2196 if ((YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (0)].yystate.yysemantics.yyval.type) != nullptr && (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (0)].yystate.yysemantics.yyval.type)->isNamedType() &&
2197 !isValidInterfaceField(static_cast<NamedType*>((YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (0)].yystate.yysemantics.yyval.type))->definedName().c_str(),
2198 &errorMsg)) {
2199 std::cerr << "ERROR: " << errorMsg << " at "
2200 << (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (0)].yystate.yyloc) << "\n";
2201 YYERROR;
2202 }
2203 }
2204 #line 2205 "out/soong/.intermediates/system/tools/hidl/libhidl-gen-ast/linux_glibc_x86_64_static/gen/yacc/system/tools/hidl/hidl-gen_y.cpp"
2205 break;
2206
2207 case 40: // interface_declarations: interface_declarations commentable_method_declaration
2208 #line 580 "system/tools/hidl/hidl-gen_y.yy"
2209 {
2210 CHECK((*scope)->isInterface());
2211
2212 std::string errorMsg;
2213 if ((YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (0)].yystate.yysemantics.yyval.method) != nullptr &&
2214 !isValidInterfaceField((YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (0)].yystate.yysemantics.yyval.method)->name().c_str(), &errorMsg)) {
2215 std::cerr << "ERROR: " << errorMsg << " at "
2216 << (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (0)].yystate.yyloc) << "\n";
2217 YYERROR;
2218 }
2219
2220 if ((YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (0)].yystate.yysemantics.yyval.method) != nullptr) {
2221 Interface *iface = static_cast<Interface*>(*scope);
2222 if (!ast->addMethod((YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (0)].yystate.yysemantics.yyval.method), iface)) {
2223 std::cerr << "ERROR: Unable to add method '" << (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (0)].yystate.yysemantics.yyval.method)->name()
2224 << "' at " << (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (0)].yystate.yyloc) << "\n";
2225
2226 YYERROR;
2227 }
2228 }
2229 // ignore if $2 is nullptr (from error recovery)
2230 }
2231 #line 2232 "out/soong/.intermediates/system/tools/hidl/libhidl-gen-ast/linux_glibc_x86_64_static/gen/yacc/system/tools/hidl/hidl-gen_y.cpp"
2232 break;
2233
2234 case 44: // commentable_declaration: doc_comments type_declaration
2235 #line 612 "system/tools/hidl/hidl-gen_y.yy"
2236 {
2237 (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (0)].yystate.yysemantics.yyval.type)->setDocComment((YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (-1)].yystate.yysemantics.yyval.docComment));
2238 }
2239 #line 2240 "out/soong/.intermediates/system/tools/hidl/libhidl-gen-ast/linux_glibc_x86_64_static/gen/yacc/system/tools/hidl/hidl-gen_y.cpp"
2240 break;
2241
2242 case 46: // commentable_declaration: ignore_doc_comments import_stmt
2243 #line 617 "system/tools/hidl/hidl-gen_y.yy"
2244 {
2245 // Import statements must be first. The grammar allows them later so that:
2246 // - there is a nice error if imports are later
2247 // - doc_comments can be factored out here to avoid shift/reduce conflicts
2248 if (!ast->getRootScope().getDefinedTypes().empty()) {
2249 std::cerr << "ERROR: import at " << (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (0)].yystate.yyloc)
2250 << " follows type definitions, but imports must come first" << std::endl;
2251
2252 YYERROR;
2253 }
2254 }
2255 #line 2256 "out/soong/.intermediates/system/tools/hidl/libhidl-gen-ast/linux_glibc_x86_64_static/gen/yacc/system/tools/hidl/hidl-gen_y.cpp"
2256 break;
2257
2258 case 47: // commentable_type_declaration: doc_comments type_declaration
2259 #line 637 "system/tools/hidl/hidl-gen_y.yy"
2260 {
2261 (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (0)].yystate.yysemantics.yyval.type)->setDocComment((YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (-1)].yystate.yysemantics.yyval.docComment));
2262 ((*yyvalp).type) = (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (0)].yystate.yysemantics.yyval.type);
2263 }
2264 #line 2265 "out/soong/.intermediates/system/tools/hidl/libhidl-gen-ast/linux_glibc_x86_64_static/gen/yacc/system/tools/hidl/hidl-gen_y.cpp"
2265 break;
2266
2267 case 48: // commentable_type_declaration: type_declaration
2268 #line 641 "system/tools/hidl/hidl-gen_y.yy"
2269 { ((*yyvalp).type) = (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (0)].yystate.yysemantics.yyval.type); }
2270 #line 2271 "out/soong/.intermediates/system/tools/hidl/libhidl-gen-ast/linux_glibc_x86_64_static/gen/yacc/system/tools/hidl/hidl-gen_y.cpp"
2271 break;
2272
2273 case 49: // type_declaration: opt_annotations type_declaration_body
2274 #line 646 "system/tools/hidl/hidl-gen_y.yy"
2275 {
2276 if (!(YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (0)].yystate.yysemantics.yyval.type)->isTypeDef()) {
2277 CHECK((YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (0)].yystate.yysemantics.yyval.type)->isScope());
2278 static_cast<Scope*>((YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (0)].yystate.yysemantics.yyval.type))->setAnnotations((YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (-1)].yystate.yysemantics.yyval.annotations));
2279 } else if (!(YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (-1)].yystate.yysemantics.yyval.annotations)->empty()) {
2280 // Since typedefs are always resolved to their target it makes
2281 // little sense to annotate them and have their annotations
2282 // impose semantics other than their target type.
2283 std::cerr << "ERROR: typedefs cannot be annotated at " << (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (0)].yystate.yyloc)
2284 << "\n";
2285
2286 YYERROR;
2287 }
2288 ((*yyvalp).type) = (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (0)].yystate.yysemantics.yyval.type);
2289 }
2290 #line 2291 "out/soong/.intermediates/system/tools/hidl/libhidl-gen-ast/linux_glibc_x86_64_static/gen/yacc/system/tools/hidl/hidl-gen_y.cpp"
2291 break;
2292
2293 case 50: // type_declaration_body: named_struct_or_union_declaration require_semicolon
2294 #line 664 "system/tools/hidl/hidl-gen_y.yy"
2295 { ((*yyvalp).type) = (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (-1)].yystate.yysemantics.yyval.type); }
2296 #line 2297 "out/soong/.intermediates/system/tools/hidl/libhidl-gen-ast/linux_glibc_x86_64_static/gen/yacc/system/tools/hidl/hidl-gen_y.cpp"
2297 break;
2298
2299 case 51: // type_declaration_body: named_enum_declaration require_semicolon
2300 #line 665 "system/tools/hidl/hidl-gen_y.yy"
2301 { ((*yyvalp).type) = (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (-1)].yystate.yysemantics.yyval.type); }
2302 #line 2303 "out/soong/.intermediates/system/tools/hidl/libhidl-gen-ast/linux_glibc_x86_64_static/gen/yacc/system/tools/hidl/hidl-gen_y.cpp"
2303 break;
2304
2305 case 52: // type_declaration_body: typedef_declaration require_semicolon
2306 #line 666 "system/tools/hidl/hidl-gen_y.yy"
2307 { ((*yyvalp).type) = (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (-1)].yystate.yysemantics.yyval.type); }
2308 #line 2309 "out/soong/.intermediates/system/tools/hidl/libhidl-gen-ast/linux_glibc_x86_64_static/gen/yacc/system/tools/hidl/hidl-gen_y.cpp"
2309 break;
2310
2311 case 53: // type_declaration_body: interface_declaration require_semicolon
2312 #line 667 "system/tools/hidl/hidl-gen_y.yy"
2313 { ((*yyvalp).type) = (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (-1)].yystate.yysemantics.yyval.type); }
2314 #line 2315 "out/soong/.intermediates/system/tools/hidl/libhidl-gen-ast/linux_glibc_x86_64_static/gen/yacc/system/tools/hidl/hidl-gen_y.cpp"
2315 break;
2316
2317 case 54: // $@1: %empty
2318 #line 672 "system/tools/hidl/hidl-gen_y.yy"
2319 {
2320 Reference<Type>* superType = (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (0)].yystate.yysemantics.yyval.referenceToType);
2321 bool isIBase = ast->package().package() == gIBaseFqName.package();
2322
2323 if (isIBase) {
2324 if (superType != nullptr) {
2325 std::cerr << "ERROR: IBase must not extend any interface at " << (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (0)].yystate.yyloc)
2326 << "\n";
2327
2328 YYERROR;
2329 }
2330 superType = new Reference<Type>();
2331 } else {
2332 if (!ast->addImplicitImport(gIBaseFqName)) {
2333 std::cerr << "ERROR: Unable to automatically import '"
2334 << gIBaseFqName.string()
2335 << "' at " << (*yylocp)
2336 << "\n";
2337 YYERROR;
2338 }
2339
2340 if (superType == nullptr) {
2341 superType = new Reference<Type>(gIBaseFqName.string(), gIBaseFqName, convertYYLoc((*yylocp), ast));
2342 }
2343 }
2344
2345 if ((YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (-1)].yystate.yysemantics.yyval.str)[0] != 'I') {
2346 std::cerr << "ERROR: All interface names must start with an 'I' "
2347 << "prefix at " << (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (-1)].yystate.yyloc) << "\n";
2348
2349 YYERROR;
2350 }
2351
2352 if (*scope != &ast->getRootScope()) {
2353 std::cerr << "ERROR: All interface must declared in "
2354 << "global scope at " << (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (-1)].yystate.yyloc) << "\n";
2355
2356 YYERROR;
2357 }
2358
2359 Interface* iface = new Interface(
2360 (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (-1)].yystate.yysemantics.yyval.str), ast->makeFullName((YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (-1)].yystate.yysemantics.yyval.str), *scope), convertYYLoc((YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (-1)].yystate.yyloc), ast),
2361 *scope, *superType, ast->getFileHash());
2362
2363 enterScope(ast, scope, iface);
2364 }
2365 #line 2366 "out/soong/.intermediates/system/tools/hidl/libhidl-gen-ast/linux_glibc_x86_64_static/gen/yacc/system/tools/hidl/hidl-gen_y.cpp"
2366 break;
2367
2368 case 55: // interface_declaration: "keyword `interface`" valid_type_name opt_extends $@1 interface_declaration_body
2369 #line 719 "system/tools/hidl/hidl-gen_y.yy"
2370 {
2371 CHECK((*scope)->isInterface());
2372
2373 Interface *iface = static_cast<Interface *>(*scope);
2374 CHECK(ast->addAllReservedMethodsToInterface(iface));
2375
2376 leaveScope(ast, scope);
2377 ast->addScopedType(iface, *scope);
2378 ((*yyvalp).type) = iface;
2379 }
2380 #line 2381 "out/soong/.intermediates/system/tools/hidl/libhidl-gen-ast/linux_glibc_x86_64_static/gen/yacc/system/tools/hidl/hidl-gen_y.cpp"
2381 break;
2382
2383 case 57: // typedef_declaration: "keyword `typedef`" type valid_type_name
2384 #line 737 "system/tools/hidl/hidl-gen_y.yy"
2385 {
2386 // The reason we wrap the given type in a TypeDef is simply to suppress
2387 // emitting any type definitions later on, since this is just an alias
2388 // to a type defined elsewhere.
2389 TypeDef* typeDef = new TypeDef(
2390 (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (0)].yystate.yysemantics.yyval.str), ast->makeFullName((YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (0)].yystate.yysemantics.yyval.str), *scope), convertYYLoc((YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (-1)].yystate.yyloc), ast), *scope, *(YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (-1)].yystate.yysemantics.yyval.referenceToType));
2391 ast->addScopedType(typeDef, *scope);
2392 ((*yyvalp).type) = typeDef;
2393 }
2394 #line 2395 "out/soong/.intermediates/system/tools/hidl/libhidl-gen-ast/linux_glibc_x86_64_static/gen/yacc/system/tools/hidl/hidl-gen_y.cpp"
2395 break;
2396
2397 case 58: // const_expr: "integer value"
2398 #line 750 "system/tools/hidl/hidl-gen_y.yy"
2399 {
2400 ((*yyvalp).constantExpression) = LiteralConstantExpression::tryParse((YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (0)].yystate.yysemantics.yyval.str));
2401
2402 if (((*yyvalp).constantExpression) == nullptr) {
2403 std::cerr << "ERROR: Could not parse literal: "
2404 << (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (0)].yystate.yysemantics.yyval.str) << " at " << (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (0)].yystate.yyloc) << ".\n";
2405 YYERROR;
2406 }
2407 }
2408 #line 2409 "out/soong/.intermediates/system/tools/hidl/libhidl-gen-ast/linux_glibc_x86_64_static/gen/yacc/system/tools/hidl/hidl-gen_y.cpp"
2409 break;
2410
2411 case 59: // const_expr: fqname
2412 #line 760 "system/tools/hidl/hidl-gen_y.yy"
2413 {
2414 if(!(YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (0)].yystate.yysemantics.yyval.fqName)->isValidValueName()) {
2415 std::cerr << "ERROR: '" << (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (0)].yystate.yysemantics.yyval.fqName)->string()
2416 << "' does not refer to an enum value at "
2417 << (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (0)].yystate.yyloc) << ".\n";
2418 YYERROR;
2419 }
2420
2421 ((*yyvalp).constantExpression) = new ReferenceConstantExpression(
2422 Reference<LocalIdentifier>((YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (0)].yystate.yysemantics.yyval.fqName)->string(), *(YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (0)].yystate.yysemantics.yyval.fqName), convertYYLoc((YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (0)].yystate.yyloc), ast)), (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (0)].yystate.yysemantics.yyval.fqName)->string());
2423 }
2424 #line 2425 "out/soong/.intermediates/system/tools/hidl/libhidl-gen-ast/linux_glibc_x86_64_static/gen/yacc/system/tools/hidl/hidl-gen_y.cpp"
2425 break;
2426
2427 case 60: // const_expr: fqname '#' "identifier"
2428 #line 772 "system/tools/hidl/hidl-gen_y.yy"
2429 {
2430 ((*yyvalp).constantExpression) = new AttributeConstantExpression(
2431 Reference<Type>((YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (-2)].yystate.yysemantics.yyval.fqName)->string(), *(YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (-2)].yystate.yysemantics.yyval.fqName), convertYYLoc((YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (-2)].yystate.yyloc), ast)), (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (-2)].yystate.yysemantics.yyval.fqName)->string(), (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (0)].yystate.yysemantics.yyval.str));
2432 }
2433 #line 2434 "out/soong/.intermediates/system/tools/hidl/libhidl-gen-ast/linux_glibc_x86_64_static/gen/yacc/system/tools/hidl/hidl-gen_y.cpp"
2434 break;
2435
2436 case 61: // const_expr: const_expr '?' const_expr ':' const_expr
2437 #line 777 "system/tools/hidl/hidl-gen_y.yy"
2438 {
2439 ((*yyvalp).constantExpression) = new TernaryConstantExpression((YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (-4)].yystate.yysemantics.yyval.constantExpression), (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (-2)].yystate.yysemantics.yyval.constantExpression), (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (0)].yystate.yysemantics.yyval.constantExpression));
2440 }
2441 #line 2442 "out/soong/.intermediates/system/tools/hidl/libhidl-gen-ast/linux_glibc_x86_64_static/gen/yacc/system/tools/hidl/hidl-gen_y.cpp"
2442 break;
2443
2444 case 62: // const_expr: const_expr LOGICAL_OR const_expr
2445 #line 780 "system/tools/hidl/hidl-gen_y.yy"
2446 { ((*yyvalp).constantExpression) = new BinaryConstantExpression((YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (-2)].yystate.yysemantics.yyval.constantExpression), "||", (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (0)].yystate.yysemantics.yyval.constantExpression)); }
2447 #line 2448 "out/soong/.intermediates/system/tools/hidl/libhidl-gen-ast/linux_glibc_x86_64_static/gen/yacc/system/tools/hidl/hidl-gen_y.cpp"
2448 break;
2449
2450 case 63: // const_expr: const_expr LOGICAL_AND const_expr
2451 #line 781 "system/tools/hidl/hidl-gen_y.yy"
2452 { ((*yyvalp).constantExpression) = new BinaryConstantExpression((YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (-2)].yystate.yysemantics.yyval.constantExpression), "&&", (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (0)].yystate.yysemantics.yyval.constantExpression)); }
2453 #line 2454 "out/soong/.intermediates/system/tools/hidl/libhidl-gen-ast/linux_glibc_x86_64_static/gen/yacc/system/tools/hidl/hidl-gen_y.cpp"
2454 break;
2455
2456 case 64: // const_expr: const_expr '|' const_expr
2457 #line 782 "system/tools/hidl/hidl-gen_y.yy"
2458 { ((*yyvalp).constantExpression) = new BinaryConstantExpression((YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (-2)].yystate.yysemantics.yyval.constantExpression), "|" , (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (0)].yystate.yysemantics.yyval.constantExpression)); }
2459 #line 2460 "out/soong/.intermediates/system/tools/hidl/libhidl-gen-ast/linux_glibc_x86_64_static/gen/yacc/system/tools/hidl/hidl-gen_y.cpp"
2460 break;
2461
2462 case 65: // const_expr: const_expr '^' const_expr
2463 #line 783 "system/tools/hidl/hidl-gen_y.yy"
2464 { ((*yyvalp).constantExpression) = new BinaryConstantExpression((YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (-2)].yystate.yysemantics.yyval.constantExpression), "^" , (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (0)].yystate.yysemantics.yyval.constantExpression)); }
2465 #line 2466 "out/soong/.intermediates/system/tools/hidl/libhidl-gen-ast/linux_glibc_x86_64_static/gen/yacc/system/tools/hidl/hidl-gen_y.cpp"
2466 break;
2467
2468 case 66: // const_expr: const_expr '&' const_expr
2469 #line 784 "system/tools/hidl/hidl-gen_y.yy"
2470 { ((*yyvalp).constantExpression) = new BinaryConstantExpression((YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (-2)].yystate.yysemantics.yyval.constantExpression), "&" , (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (0)].yystate.yysemantics.yyval.constantExpression)); }
2471 #line 2472 "out/soong/.intermediates/system/tools/hidl/libhidl-gen-ast/linux_glibc_x86_64_static/gen/yacc/system/tools/hidl/hidl-gen_y.cpp"
2472 break;
2473
2474 case 67: // const_expr: const_expr EQUALITY const_expr
2475 #line 785 "system/tools/hidl/hidl-gen_y.yy"
2476 { ((*yyvalp).constantExpression) = new BinaryConstantExpression((YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (-2)].yystate.yysemantics.yyval.constantExpression), "==", (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (0)].yystate.yysemantics.yyval.constantExpression)); }
2477 #line 2478 "out/soong/.intermediates/system/tools/hidl/libhidl-gen-ast/linux_glibc_x86_64_static/gen/yacc/system/tools/hidl/hidl-gen_y.cpp"
2478 break;
2479
2480 case 68: // const_expr: const_expr NEQ const_expr
2481 #line 786 "system/tools/hidl/hidl-gen_y.yy"
2482 { ((*yyvalp).constantExpression) = new BinaryConstantExpression((YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (-2)].yystate.yysemantics.yyval.constantExpression), "!=", (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (0)].yystate.yysemantics.yyval.constantExpression)); }
2483 #line 2484 "out/soong/.intermediates/system/tools/hidl/libhidl-gen-ast/linux_glibc_x86_64_static/gen/yacc/system/tools/hidl/hidl-gen_y.cpp"
2484 break;
2485
2486 case 69: // const_expr: const_expr '<' const_expr
2487 #line 787 "system/tools/hidl/hidl-gen_y.yy"
2488 { ((*yyvalp).constantExpression) = new BinaryConstantExpression((YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (-2)].yystate.yysemantics.yyval.constantExpression), "<" , (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (0)].yystate.yysemantics.yyval.constantExpression)); }
2489 #line 2490 "out/soong/.intermediates/system/tools/hidl/libhidl-gen-ast/linux_glibc_x86_64_static/gen/yacc/system/tools/hidl/hidl-gen_y.cpp"
2490 break;
2491
2492 case 70: // const_expr: const_expr '>' const_expr
2493 #line 788 "system/tools/hidl/hidl-gen_y.yy"
2494 { ((*yyvalp).constantExpression) = new BinaryConstantExpression((YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (-2)].yystate.yysemantics.yyval.constantExpression), ">" , (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (0)].yystate.yysemantics.yyval.constantExpression)); }
2495 #line 2496 "out/soong/.intermediates/system/tools/hidl/libhidl-gen-ast/linux_glibc_x86_64_static/gen/yacc/system/tools/hidl/hidl-gen_y.cpp"
2496 break;
2497
2498 case 71: // const_expr: const_expr LEQ const_expr
2499 #line 789 "system/tools/hidl/hidl-gen_y.yy"
2500 { ((*yyvalp).constantExpression) = new BinaryConstantExpression((YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (-2)].yystate.yysemantics.yyval.constantExpression), "<=", (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (0)].yystate.yysemantics.yyval.constantExpression)); }
2501 #line 2502 "out/soong/.intermediates/system/tools/hidl/libhidl-gen-ast/linux_glibc_x86_64_static/gen/yacc/system/tools/hidl/hidl-gen_y.cpp"
2502 break;
2503
2504 case 72: // const_expr: const_expr GEQ const_expr
2505 #line 790 "system/tools/hidl/hidl-gen_y.yy"
2506 { ((*yyvalp).constantExpression) = new BinaryConstantExpression((YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (-2)].yystate.yysemantics.yyval.constantExpression), ">=", (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (0)].yystate.yysemantics.yyval.constantExpression)); }
2507 #line 2508 "out/soong/.intermediates/system/tools/hidl/libhidl-gen-ast/linux_glibc_x86_64_static/gen/yacc/system/tools/hidl/hidl-gen_y.cpp"
2508 break;
2509
2510 case 73: // const_expr: const_expr LSHIFT const_expr
2511 #line 791 "system/tools/hidl/hidl-gen_y.yy"
2512 { ((*yyvalp).constantExpression) = new BinaryConstantExpression((YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (-2)].yystate.yysemantics.yyval.constantExpression), "<<", (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (0)].yystate.yysemantics.yyval.constantExpression)); }
2513 #line 2514 "out/soong/.intermediates/system/tools/hidl/libhidl-gen-ast/linux_glibc_x86_64_static/gen/yacc/system/tools/hidl/hidl-gen_y.cpp"
2514 break;
2515
2516 case 74: // const_expr: const_expr RSHIFT const_expr
2517 #line 792 "system/tools/hidl/hidl-gen_y.yy"
2518 { ((*yyvalp).constantExpression) = new BinaryConstantExpression((YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (-2)].yystate.yysemantics.yyval.constantExpression), ">>", (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (0)].yystate.yysemantics.yyval.constantExpression)); }
2519 #line 2520 "out/soong/.intermediates/system/tools/hidl/libhidl-gen-ast/linux_glibc_x86_64_static/gen/yacc/system/tools/hidl/hidl-gen_y.cpp"
2520 break;
2521
2522 case 75: // const_expr: const_expr '+' const_expr
2523 #line 793 "system/tools/hidl/hidl-gen_y.yy"
2524 { ((*yyvalp).constantExpression) = new BinaryConstantExpression((YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (-2)].yystate.yysemantics.yyval.constantExpression), "+" , (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (0)].yystate.yysemantics.yyval.constantExpression)); }
2525 #line 2526 "out/soong/.intermediates/system/tools/hidl/libhidl-gen-ast/linux_glibc_x86_64_static/gen/yacc/system/tools/hidl/hidl-gen_y.cpp"
2526 break;
2527
2528 case 76: // const_expr: const_expr '-' const_expr
2529 #line 794 "system/tools/hidl/hidl-gen_y.yy"
2530 { ((*yyvalp).constantExpression) = new BinaryConstantExpression((YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (-2)].yystate.yysemantics.yyval.constantExpression), "-" , (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (0)].yystate.yysemantics.yyval.constantExpression)); }
2531 #line 2532 "out/soong/.intermediates/system/tools/hidl/libhidl-gen-ast/linux_glibc_x86_64_static/gen/yacc/system/tools/hidl/hidl-gen_y.cpp"
2532 break;
2533
2534 case 77: // const_expr: const_expr '*' const_expr
2535 #line 795 "system/tools/hidl/hidl-gen_y.yy"
2536 { ((*yyvalp).constantExpression) = new BinaryConstantExpression((YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (-2)].yystate.yysemantics.yyval.constantExpression), "*" , (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (0)].yystate.yysemantics.yyval.constantExpression)); }
2537 #line 2538 "out/soong/.intermediates/system/tools/hidl/libhidl-gen-ast/linux_glibc_x86_64_static/gen/yacc/system/tools/hidl/hidl-gen_y.cpp"
2538 break;
2539
2540 case 78: // const_expr: const_expr '/' const_expr
2541 #line 796 "system/tools/hidl/hidl-gen_y.yy"
2542 { ((*yyvalp).constantExpression) = new BinaryConstantExpression((YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (-2)].yystate.yysemantics.yyval.constantExpression), "/" , (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (0)].yystate.yysemantics.yyval.constantExpression)); }
2543 #line 2544 "out/soong/.intermediates/system/tools/hidl/libhidl-gen-ast/linux_glibc_x86_64_static/gen/yacc/system/tools/hidl/hidl-gen_y.cpp"
2544 break;
2545
2546 case 79: // const_expr: const_expr '%' const_expr
2547 #line 797 "system/tools/hidl/hidl-gen_y.yy"
2548 { ((*yyvalp).constantExpression) = new BinaryConstantExpression((YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (-2)].yystate.yysemantics.yyval.constantExpression), "%" , (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (0)].yystate.yysemantics.yyval.constantExpression)); }
2549 #line 2550 "out/soong/.intermediates/system/tools/hidl/libhidl-gen-ast/linux_glibc_x86_64_static/gen/yacc/system/tools/hidl/hidl-gen_y.cpp"
2550 break;
2551
2552 case 80: // const_expr: '+' const_expr
2553 #line 798 "system/tools/hidl/hidl-gen_y.yy"
2554 { ((*yyvalp).constantExpression) = new UnaryConstantExpression("+", (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (0)].yystate.yysemantics.yyval.constantExpression)); }
2555 #line 2556 "out/soong/.intermediates/system/tools/hidl/libhidl-gen-ast/linux_glibc_x86_64_static/gen/yacc/system/tools/hidl/hidl-gen_y.cpp"
2556 break;
2557
2558 case 81: // const_expr: '-' const_expr
2559 #line 799 "system/tools/hidl/hidl-gen_y.yy"
2560 { ((*yyvalp).constantExpression) = new UnaryConstantExpression("-", (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (0)].yystate.yysemantics.yyval.constantExpression)); }
2561 #line 2562 "out/soong/.intermediates/system/tools/hidl/libhidl-gen-ast/linux_glibc_x86_64_static/gen/yacc/system/tools/hidl/hidl-gen_y.cpp"
2562 break;
2563
2564 case 82: // const_expr: '!' const_expr
2565 #line 800 "system/tools/hidl/hidl-gen_y.yy"
2566 { ((*yyvalp).constantExpression) = new UnaryConstantExpression("!", (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (0)].yystate.yysemantics.yyval.constantExpression)); }
2567 #line 2568 "out/soong/.intermediates/system/tools/hidl/libhidl-gen-ast/linux_glibc_x86_64_static/gen/yacc/system/tools/hidl/hidl-gen_y.cpp"
2568 break;
2569
2570 case 83: // const_expr: '~' const_expr
2571 #line 801 "system/tools/hidl/hidl-gen_y.yy"
2572 { ((*yyvalp).constantExpression) = new UnaryConstantExpression("~", (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (0)].yystate.yysemantics.yyval.constantExpression)); }
2573 #line 2574 "out/soong/.intermediates/system/tools/hidl/libhidl-gen-ast/linux_glibc_x86_64_static/gen/yacc/system/tools/hidl/hidl-gen_y.cpp"
2574 break;
2575
2576 case 84: // const_expr: '(' const_expr ')'
2577 #line 803 "system/tools/hidl/hidl-gen_y.yy"
2578 {
2579 (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (-1)].yystate.yysemantics.yyval.constantExpression)->surroundWithParens();
2580 ((*yyvalp).constantExpression) = (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (-1)].yystate.yysemantics.yyval.constantExpression);
2581 }
2582 #line 2583 "out/soong/.intermediates/system/tools/hidl/libhidl-gen-ast/linux_glibc_x86_64_static/gen/yacc/system/tools/hidl/hidl-gen_y.cpp"
2583 break;
2584
2585 case 85: // const_expr: '(' error ')'
2586 #line 808 "system/tools/hidl/hidl-gen_y.yy"
2587 {
2588 ast->addSyntaxError();
2589 // to avoid segfaults
2590 ((*yyvalp).constantExpression) = ConstantExpression::Zero(ScalarType::KIND_INT32).release();
2591 }
2592 #line 2593 "out/soong/.intermediates/system/tools/hidl/libhidl-gen-ast/linux_glibc_x86_64_static/gen/yacc/system/tools/hidl/hidl-gen_y.cpp"
2593 break;
2594
2595 case 86: // commentable_method_declaration: doc_comments method_declaration
2596 #line 817 "system/tools/hidl/hidl-gen_y.yy"
2597 {
2598 if ((YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (0)].yystate.yysemantics.yyval.method) != nullptr) (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (0)].yystate.yysemantics.yyval.method)->setDocComment((YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (-1)].yystate.yysemantics.yyval.docComment));
2599 ((*yyvalp).method) = (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (0)].yystate.yysemantics.yyval.method);
2600 }
2601 #line 2602 "out/soong/.intermediates/system/tools/hidl/libhidl-gen-ast/linux_glibc_x86_64_static/gen/yacc/system/tools/hidl/hidl-gen_y.cpp"
2602 break;
2603
2604 case 87: // commentable_method_declaration: method_declaration
2605 #line 822 "system/tools/hidl/hidl-gen_y.yy"
2606 {
2607 ((*yyvalp).method) = (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (0)].yystate.yysemantics.yyval.method);
2608 }
2609 #line 2610 "out/soong/.intermediates/system/tools/hidl/libhidl-gen-ast/linux_glibc_x86_64_static/gen/yacc/system/tools/hidl/hidl-gen_y.cpp"
2610 break;
2611
2612 case 88: // method_declaration: error_stmt
2613 #line 827 "system/tools/hidl/hidl-gen_y.yy"
2614 { ((*yyvalp).method) = nullptr; }
2615 #line 2616 "out/soong/.intermediates/system/tools/hidl/libhidl-gen-ast/linux_glibc_x86_64_static/gen/yacc/system/tools/hidl/hidl-gen_y.cpp"
2616 break;
2617
2618 case 89: // method_declaration: opt_annotations valid_identifier '(' typed_vars ')' require_semicolon
2619 #line 829 "system/tools/hidl/hidl-gen_y.yy"
2620 {
2621 ((*yyvalp).method) = new Method((YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (-4)].yystate.yysemantics.yyval.str) /* name */,
2622 (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (-2)].yystate.yysemantics.yyval.typedVars) /* args */,
2623 new std::vector<NamedReference<Type>*> /* results */,
2624 false /* oneway */,
2625 (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (-5)].yystate.yysemantics.yyval.annotations) /* annotations */,
2626 convertYYLoc((*yylocp), ast));
2627 }
2628 #line 2629 "out/soong/.intermediates/system/tools/hidl/libhidl-gen-ast/linux_glibc_x86_64_static/gen/yacc/system/tools/hidl/hidl-gen_y.cpp"
2629 break;
2630
2631 case 90: // method_declaration: opt_annotations "keyword `oneway`" valid_identifier '(' typed_vars ')' require_semicolon
2632 #line 838 "system/tools/hidl/hidl-gen_y.yy"
2633 {
2634 ((*yyvalp).method) = new Method((YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (-4)].yystate.yysemantics.yyval.str) /* name */,
2635 (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (-2)].yystate.yysemantics.yyval.typedVars) /* args */,
2636 new std::vector<NamedReference<Type>*> /* results */,
2637 true /* oneway */,
2638 (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (-6)].yystate.yysemantics.yyval.annotations) /* annotations */,
2639 convertYYLoc((*yylocp), ast));
2640 }
2641 #line 2642 "out/soong/.intermediates/system/tools/hidl/libhidl-gen-ast/linux_glibc_x86_64_static/gen/yacc/system/tools/hidl/hidl-gen_y.cpp"
2642 break;
2643
2644 case 91: // method_declaration: opt_annotations valid_identifier '(' typed_vars ')' "keyword `generates`" '(' typed_vars ')' require_semicolon
2645 #line 847 "system/tools/hidl/hidl-gen_y.yy"
2646 {
2647 if ((YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (-2)].yystate.yysemantics.yyval.typedVars)->empty()) {
2648 std::cerr << "ERROR: generates clause used without result at " << (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (-9)].yystate.yyloc) << "\n";
2649 ast->addSyntaxError();
2650 }
2651
2652 ((*yyvalp).method) = new Method((YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (-8)].yystate.yysemantics.yyval.str) /* name */,
2653 (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (-6)].yystate.yysemantics.yyval.typedVars) /* args */,
2654 (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (-2)].yystate.yysemantics.yyval.typedVars) /* results */,
2655 false /* oneway */,
2656 (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (-9)].yystate.yysemantics.yyval.annotations) /* annotations */,
2657 convertYYLoc((*yylocp), ast));
2658 }
2659 #line 2660 "out/soong/.intermediates/system/tools/hidl/libhidl-gen-ast/linux_glibc_x86_64_static/gen/yacc/system/tools/hidl/hidl-gen_y.cpp"
2660 break;
2661
2662 case 92: // typed_vars: %empty
2663 #line 864 "system/tools/hidl/hidl-gen_y.yy"
2664 {
2665 ((*yyvalp).typedVars) = new TypedVarVector();
2666 }
2667 #line 2668 "out/soong/.intermediates/system/tools/hidl/libhidl-gen-ast/linux_glibc_x86_64_static/gen/yacc/system/tools/hidl/hidl-gen_y.cpp"
2668 break;
2669
2670 case 93: // typed_vars: non_empty_typed_vars
2671 #line 868 "system/tools/hidl/hidl-gen_y.yy"
2672 {
2673 ((*yyvalp).typedVars) = (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (0)].yystate.yysemantics.yyval.typedVars);
2674 }
2675 #line 2676 "out/soong/.intermediates/system/tools/hidl/libhidl-gen-ast/linux_glibc_x86_64_static/gen/yacc/system/tools/hidl/hidl-gen_y.cpp"
2676 break;
2677
2678 case 94: // non_empty_typed_vars: typed_var
2679 #line 875 "system/tools/hidl/hidl-gen_y.yy"
2680 {
2681 ((*yyvalp).typedVars) = new TypedVarVector();
2682 if (!((*yyvalp).typedVars)->add((YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (0)].yystate.yysemantics.yyval.typedVar))) {
2683 std::cerr << "ERROR: duplicated argument or result name "
2684 << (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (0)].yystate.yysemantics.yyval.typedVar)->name() << " at " << (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (0)].yystate.yyloc) << "\n";
2685 ast->addSyntaxError();
2686 }
2687 }
2688 #line 2689 "out/soong/.intermediates/system/tools/hidl/libhidl-gen-ast/linux_glibc_x86_64_static/gen/yacc/system/tools/hidl/hidl-gen_y.cpp"
2689 break;
2690
2691 case 95: // non_empty_typed_vars: non_empty_typed_vars ',' typed_var
2692 #line 884 "system/tools/hidl/hidl-gen_y.yy"
2693 {
2694 ((*yyvalp).typedVars) = (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (-2)].yystate.yysemantics.yyval.typedVars);
2695 if (!((*yyvalp).typedVars)->add((YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (0)].yystate.yysemantics.yyval.typedVar))) {
2696 std::cerr << "ERROR: duplicated argument or result name "
2697 << (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (0)].yystate.yysemantics.yyval.typedVar)->name() << " at " << (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (0)].yystate.yyloc) << "\n";
2698 ast->addSyntaxError();
2699 }
2700 }
2701 #line 2702 "out/soong/.intermediates/system/tools/hidl/libhidl-gen-ast/linux_glibc_x86_64_static/gen/yacc/system/tools/hidl/hidl-gen_y.cpp"
2702 break;
2703
2704 case 96: // typed_var: ignore_doc_comments uncommented_typed_var
2705 #line 895 "system/tools/hidl/hidl-gen_y.yy"
2706 { ((*yyvalp).typedVar) = (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (0)].yystate.yysemantics.yyval.typedVar); }
2707 #line 2708 "out/soong/.intermediates/system/tools/hidl/libhidl-gen-ast/linux_glibc_x86_64_static/gen/yacc/system/tools/hidl/hidl-gen_y.cpp"
2708 break;
2709
2710 case 97: // uncommented_typed_var: type valid_identifier ignore_doc_comments
2711 #line 900 "system/tools/hidl/hidl-gen_y.yy"
2712 {
2713 ((*yyvalp).typedVar) = new NamedReference<Type>((YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (-1)].yystate.yysemantics.yyval.str), *(YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (-2)].yystate.yysemantics.yyval.referenceToType), convertYYLoc((YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (-1)].yystate.yyloc), ast));
2714 }
2715 #line 2716 "out/soong/.intermediates/system/tools/hidl/libhidl-gen-ast/linux_glibc_x86_64_static/gen/yacc/system/tools/hidl/hidl-gen_y.cpp"
2716 break;
2717
2718 case 98: // uncommented_typed_var: type
2719 #line 904 "system/tools/hidl/hidl-gen_y.yy"
2720 {
2721 ((*yyvalp).typedVar) = new NamedReference<Type>("", *(YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (0)].yystate.yysemantics.yyval.referenceToType), convertYYLoc((YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (0)].yystate.yyloc), ast));
2722
2723 const std::string typeName = ((*yyvalp).typedVar)->isResolved()
2724 ? ((*yyvalp).typedVar)->get()->typeName() : ((*yyvalp).typedVar)->getLookupFqName().string();
2725
2726 std::cerr << "ERROR: variable of type " << typeName
2727 << " is missing a variable name at " << (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (0)].yystate.yyloc) << "\n";
2728 ast->addSyntaxError();
2729 }
2730 #line 2731 "out/soong/.intermediates/system/tools/hidl/libhidl-gen-ast/linux_glibc_x86_64_static/gen/yacc/system/tools/hidl/hidl-gen_y.cpp"
2731 break;
2732
2733 case 99: // struct_or_union_keyword: "keyword `struct`"
2734 #line 918 "system/tools/hidl/hidl-gen_y.yy"
2735 { ((*yyvalp).compoundStyle) = CompoundType::STYLE_STRUCT; }
2736 #line 2737 "out/soong/.intermediates/system/tools/hidl/libhidl-gen-ast/linux_glibc_x86_64_static/gen/yacc/system/tools/hidl/hidl-gen_y.cpp"
2737 break;
2738
2739 case 100: // struct_or_union_keyword: "keyword `union`"
2740 #line 919 "system/tools/hidl/hidl-gen_y.yy"
2741 { ((*yyvalp).compoundStyle) = CompoundType::STYLE_UNION; }
2742 #line 2743 "out/soong/.intermediates/system/tools/hidl/libhidl-gen-ast/linux_glibc_x86_64_static/gen/yacc/system/tools/hidl/hidl-gen_y.cpp"
2743 break;
2744
2745 case 101: // struct_or_union_keyword: "keyword `safe_union`"
2746 #line 920 "system/tools/hidl/hidl-gen_y.yy"
2747 { ((*yyvalp).compoundStyle) = CompoundType::STYLE_SAFE_UNION; }
2748 #line 2749 "out/soong/.intermediates/system/tools/hidl/libhidl-gen-ast/linux_glibc_x86_64_static/gen/yacc/system/tools/hidl/hidl-gen_y.cpp"
2749 break;
2750
2751 case 102: // $@2: %empty
2752 #line 925 "system/tools/hidl/hidl-gen_y.yy"
2753 {
2754 CompoundType *container = new CompoundType(
2755 (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (-1)].yystate.yysemantics.yyval.compoundStyle), (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (0)].yystate.yysemantics.yyval.str), ast->makeFullName((YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (0)].yystate.yysemantics.yyval.str), *scope), convertYYLoc((YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (0)].yystate.yyloc), ast), *scope);
2756 enterScope(ast, scope, container);
2757 }
2758 #line 2759 "out/soong/.intermediates/system/tools/hidl/libhidl-gen-ast/linux_glibc_x86_64_static/gen/yacc/system/tools/hidl/hidl-gen_y.cpp"
2759 break;
2760
2761 case 103: // named_struct_or_union_declaration: struct_or_union_keyword valid_type_name $@2 struct_or_union_body
2762 #line 931 "system/tools/hidl/hidl-gen_y.yy"
2763 {
2764 CHECK((*scope)->isCompoundType());
2765 CompoundType *container = static_cast<CompoundType *>(*scope);
2766
2767 leaveScope(ast, scope);
2768 ast->addScopedType(container, *scope);
2769 ((*yyvalp).type) = container;
2770 }
2771 #line 2772 "out/soong/.intermediates/system/tools/hidl/libhidl-gen-ast/linux_glibc_x86_64_static/gen/yacc/system/tools/hidl/hidl-gen_y.cpp"
2772 break;
2773
2774 case 104: // struct_or_union_body: '{' field_declarations ignore_doc_comments '}'
2775 #line 942 "system/tools/hidl/hidl-gen_y.yy"
2776 { ((*yyvalp).fields) = (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (-2)].yystate.yysemantics.yyval.fields); }
2777 #line 2778 "out/soong/.intermediates/system/tools/hidl/libhidl-gen-ast/linux_glibc_x86_64_static/gen/yacc/system/tools/hidl/hidl-gen_y.cpp"
2778 break;
2779
2780 case 105: // field_declarations: %empty
2781 #line 946 "system/tools/hidl/hidl-gen_y.yy"
2782 { ((*yyvalp).fields) = nullptr; }
2783 #line 2784 "out/soong/.intermediates/system/tools/hidl/libhidl-gen-ast/linux_glibc_x86_64_static/gen/yacc/system/tools/hidl/hidl-gen_y.cpp"
2784 break;
2785
2786 case 106: // field_declarations: field_declarations commentable_field_declaration
2787 #line 948 "system/tools/hidl/hidl-gen_y.yy"
2788 {
2789 ((*yyvalp).fields) = nullptr;
2790 }
2791 #line 2792 "out/soong/.intermediates/system/tools/hidl/libhidl-gen-ast/linux_glibc_x86_64_static/gen/yacc/system/tools/hidl/hidl-gen_y.cpp"
2792 break;
2793
2794 case 107: // commentable_field_declaration: doc_comments field_declaration
2795 #line 955 "system/tools/hidl/hidl-gen_y.yy"
2796 {
2797 if ((YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (0)].yystate.yysemantics.yyval.docCommentable) != nullptr) (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (0)].yystate.yysemantics.yyval.docCommentable)->setDocComment((YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (-1)].yystate.yysemantics.yyval.docComment));
2798 ((*yyvalp).docCommentable) = (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (0)].yystate.yysemantics.yyval.docCommentable);
2799 }
2800 #line 2801 "out/soong/.intermediates/system/tools/hidl/libhidl-gen-ast/linux_glibc_x86_64_static/gen/yacc/system/tools/hidl/hidl-gen_y.cpp"
2801 break;
2802
2803 case 108: // commentable_field_declaration: field_declaration
2804 #line 959 "system/tools/hidl/hidl-gen_y.yy"
2805 { ((*yyvalp).docCommentable) = (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (0)].yystate.yysemantics.yyval.docCommentable); }
2806 #line 2807 "out/soong/.intermediates/system/tools/hidl/libhidl-gen-ast/linux_glibc_x86_64_static/gen/yacc/system/tools/hidl/hidl-gen_y.cpp"
2807 break;
2808
2809 case 109: // field_declaration: error_stmt
2810 #line 962 "system/tools/hidl/hidl-gen_y.yy"
2811 { ((*yyvalp).docCommentable) = nullptr; }
2812 #line 2813 "out/soong/.intermediates/system/tools/hidl/libhidl-gen-ast/linux_glibc_x86_64_static/gen/yacc/system/tools/hidl/hidl-gen_y.cpp"
2813 break;
2814
2815 case 110: // field_declaration: type_or_inplace_compound_declaration valid_identifier require_semicolon
2816 #line 964 "system/tools/hidl/hidl-gen_y.yy"
2817 {
2818 CHECK((*scope)->isCompoundType());
2819
2820 std::string errorMsg;
2821 CompoundType* compoundType = static_cast<CompoundType *>(*scope);
2822 auto style = compoundType->style();
2823
2824 if (!isValidCompoundTypeField(style, (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (-1)].yystate.yysemantics.yyval.str), &errorMsg)) {
2825 std::cerr << "ERROR: " << errorMsg << " at "
2826 << (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (-1)].yystate.yyloc) << "\n";
2827 YYERROR;
2828 }
2829
2830 NamedReference<Type>* field = new NamedReference<Type>((YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (-1)].yystate.yysemantics.yyval.str), *(YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (-2)].yystate.yysemantics.yyval.referenceToType), convertYYLoc((YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (-1)].yystate.yyloc), ast));
2831 compoundType->addField(field);
2832 ((*yyvalp).docCommentable) = field;
2833 }
2834 #line 2835 "out/soong/.intermediates/system/tools/hidl/libhidl-gen-ast/linux_glibc_x86_64_static/gen/yacc/system/tools/hidl/hidl-gen_y.cpp"
2835 break;
2836
2837 case 111: // field_declaration: annotated_compound_declaration ';'
2838 #line 982 "system/tools/hidl/hidl-gen_y.yy"
2839 {
2840 CHECK((*scope)->isCompoundType());
2841
2842 std::string errorMsg;
2843 auto style = static_cast<CompoundType *>(*scope)->style();
2844
2845 if ((YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (-1)].yystate.yysemantics.yyval.type) != nullptr && (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (-1)].yystate.yysemantics.yyval.type)->isNamedType() &&
2846 !isValidCompoundTypeField(style, static_cast<NamedType*>(
2847 (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (-1)].yystate.yysemantics.yyval.type))->definedName().c_str(), &errorMsg)) {
2848 std::cerr << "ERROR: " << errorMsg << " at "
2849 << (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (0)].yystate.yyloc) << "\n";
2850 YYERROR;
2851 }
2852
2853 ((*yyvalp).docCommentable) = (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (-1)].yystate.yysemantics.yyval.type);
2854 }
2855 #line 2856 "out/soong/.intermediates/system/tools/hidl/libhidl-gen-ast/linux_glibc_x86_64_static/gen/yacc/system/tools/hidl/hidl-gen_y.cpp"
2856 break;
2857
2858 case 112: // annotated_compound_declaration: opt_annotations compound_declaration
2859 #line 1002 "system/tools/hidl/hidl-gen_y.yy"
2860 {
2861 CHECK((YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (0)].yystate.yysemantics.yyval.type)->isScope());
2862 static_cast<Scope*>((YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (0)].yystate.yysemantics.yyval.type))->setAnnotations((YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (-1)].yystate.yysemantics.yyval.annotations));
2863 ((*yyvalp).type) = (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (0)].yystate.yysemantics.yyval.type);
2864 }
2865 #line 2866 "out/soong/.intermediates/system/tools/hidl/libhidl-gen-ast/linux_glibc_x86_64_static/gen/yacc/system/tools/hidl/hidl-gen_y.cpp"
2866 break;
2867
2868 case 113: // compound_declaration: named_struct_or_union_declaration
2869 #line 1010 "system/tools/hidl/hidl-gen_y.yy"
2870 { ((*yyvalp).type) = (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (0)].yystate.yysemantics.yyval.type); }
2871 #line 2872 "out/soong/.intermediates/system/tools/hidl/libhidl-gen-ast/linux_glibc_x86_64_static/gen/yacc/system/tools/hidl/hidl-gen_y.cpp"
2872 break;
2873
2874 case 114: // compound_declaration: named_enum_declaration
2875 #line 1011 "system/tools/hidl/hidl-gen_y.yy"
2876 { ((*yyvalp).type) = (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (0)].yystate.yysemantics.yyval.type); }
2877 #line 2878 "out/soong/.intermediates/system/tools/hidl/libhidl-gen-ast/linux_glibc_x86_64_static/gen/yacc/system/tools/hidl/hidl-gen_y.cpp"
2878 break;
2879
2880 case 115: // enum_storage_type: ':' fqtype ignore_doc_comments
2881 #line 1015 "system/tools/hidl/hidl-gen_y.yy"
2882 { ((*yyvalp).referenceToType) = (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (-1)].yystate.yysemantics.yyval.referenceToType); }
2883 #line 2884 "out/soong/.intermediates/system/tools/hidl/libhidl-gen-ast/linux_glibc_x86_64_static/gen/yacc/system/tools/hidl/hidl-gen_y.cpp"
2884 break;
2885
2886 case 116: // enum_storage_type: %empty
2887 #line 1016 "system/tools/hidl/hidl-gen_y.yy"
2888 { ((*yyvalp).referenceToType) = nullptr; }
2889 #line 2890 "out/soong/.intermediates/system/tools/hidl/libhidl-gen-ast/linux_glibc_x86_64_static/gen/yacc/system/tools/hidl/hidl-gen_y.cpp"
2890 break;
2891
2892 case 117: // $@3: %empty
2893 #line 1021 "system/tools/hidl/hidl-gen_y.yy"
2894 {
2895 auto storageType = (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (0)].yystate.yysemantics.yyval.referenceToType);
2896
2897 if (storageType == nullptr) {
2898 std::cerr << "ERROR: Must explicitly specify enum storage type for "
2899 << (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (-1)].yystate.yysemantics.yyval.str) << " at " << (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (-1)].yystate.yyloc) << "\n";
2900 ast->addSyntaxError();
2901 ScalarType* scalar = new ScalarType(ScalarType::KIND_INT64, *scope);
2902 storageType = new Reference<Type>(scalar->definedName(), scalar, convertYYLoc((YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (-1)].yystate.yyloc), ast));
2903 }
2904
2905 EnumType* enumType = new EnumType(
2906 (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (-1)].yystate.yysemantics.yyval.str), ast->makeFullName((YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (-1)].yystate.yysemantics.yyval.str), *scope), convertYYLoc((YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (-1)].yystate.yyloc), ast), *storageType, *scope);
2907 enterScope(ast, scope, enumType);
2908 }
2909 #line 2910 "out/soong/.intermediates/system/tools/hidl/libhidl-gen-ast/linux_glibc_x86_64_static/gen/yacc/system/tools/hidl/hidl-gen_y.cpp"
2910 break;
2911
2912 case 118: // named_enum_declaration: "keyword `enum`" valid_type_name enum_storage_type $@3 enum_declaration_body
2913 #line 1037 "system/tools/hidl/hidl-gen_y.yy"
2914 {
2915 CHECK((*scope)->isEnum());
2916 EnumType* enumType = static_cast<EnumType*>(*scope);
2917
2918 leaveScope(ast, scope);
2919 ast->addScopedType(enumType, *scope);
2920 ((*yyvalp).type) = enumType;
2921 }
2922 #line 2923 "out/soong/.intermediates/system/tools/hidl/libhidl-gen-ast/linux_glibc_x86_64_static/gen/yacc/system/tools/hidl/hidl-gen_y.cpp"
2923 break;
2924
2925 case 119: // enum_declaration_body: '{' enum_values '}'
2926 #line 1048 "system/tools/hidl/hidl-gen_y.yy"
2927 { ((*yyvalp).enumValues) = (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (-1)].yystate.yysemantics.yyval.enumValues); }
2928 #line 2929 "out/soong/.intermediates/system/tools/hidl/libhidl-gen-ast/linux_glibc_x86_64_static/gen/yacc/system/tools/hidl/hidl-gen_y.cpp"
2929 break;
2930
2931 case 120: // enum_declaration_body: '{' enum_values ',' ignore_doc_comments '}'
2932 #line 1049 "system/tools/hidl/hidl-gen_y.yy"
2933 { ((*yyvalp).enumValues) = (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (-3)].yystate.yysemantics.yyval.enumValues); }
2934 #line 2935 "out/soong/.intermediates/system/tools/hidl/libhidl-gen-ast/linux_glibc_x86_64_static/gen/yacc/system/tools/hidl/hidl-gen_y.cpp"
2935 break;
2936
2937 case 121: // commentable_enum_value: doc_comments enum_value ignore_doc_comments
2938 #line 1054 "system/tools/hidl/hidl-gen_y.yy"
2939 {
2940 (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (-1)].yystate.yysemantics.yyval.enumValue)->setDocComment((YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (-2)].yystate.yysemantics.yyval.docComment));
2941 ((*yyvalp).enumValue) = (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (-1)].yystate.yysemantics.yyval.enumValue);
2942 }
2943 #line 2944 "out/soong/.intermediates/system/tools/hidl/libhidl-gen-ast/linux_glibc_x86_64_static/gen/yacc/system/tools/hidl/hidl-gen_y.cpp"
2944 break;
2945
2946 case 122: // commentable_enum_value: enum_value
2947 #line 1058 "system/tools/hidl/hidl-gen_y.yy"
2948 { ((*yyvalp).enumValue) = (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (0)].yystate.yysemantics.yyval.enumValue); }
2949 #line 2950 "out/soong/.intermediates/system/tools/hidl/libhidl-gen-ast/linux_glibc_x86_64_static/gen/yacc/system/tools/hidl/hidl-gen_y.cpp"
2950 break;
2951
2952 case 123: // enum_value: valid_identifier
2953 #line 1063 "system/tools/hidl/hidl-gen_y.yy"
2954 {
2955 ((*yyvalp).enumValue) = new EnumValue((YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (0)].yystate.yysemantics.yyval.str) /* name */, nullptr /* value */, convertYYLoc((*yylocp), ast));
2956 }
2957 #line 2958 "out/soong/.intermediates/system/tools/hidl/libhidl-gen-ast/linux_glibc_x86_64_static/gen/yacc/system/tools/hidl/hidl-gen_y.cpp"
2958 break;
2959
2960 case 124: // enum_value: valid_identifier '=' const_expr
2961 #line 1067 "system/tools/hidl/hidl-gen_y.yy"
2962 {
2963 ((*yyvalp).enumValue) = new EnumValue((YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (-2)].yystate.yysemantics.yyval.str) /* name */, (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (0)].yystate.yysemantics.yyval.constantExpression) /* value */, convertYYLoc((*yylocp), ast));
2964 }
2965 #line 2966 "out/soong/.intermediates/system/tools/hidl/libhidl-gen-ast/linux_glibc_x86_64_static/gen/yacc/system/tools/hidl/hidl-gen_y.cpp"
2966 break;
2967
2968 case 125: // enum_values: %empty
2969 #line 1074 "system/tools/hidl/hidl-gen_y.yy"
2970 { /* do nothing */ }
2971 #line 2972 "out/soong/.intermediates/system/tools/hidl/libhidl-gen-ast/linux_glibc_x86_64_static/gen/yacc/system/tools/hidl/hidl-gen_y.cpp"
2972 break;
2973
2974 case 126: // enum_values: commentable_enum_value
2975 #line 1076 "system/tools/hidl/hidl-gen_y.yy"
2976 {
2977 CHECK((*scope)->isEnum());
2978 static_cast<EnumType *>(*scope)->addValue((YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (0)].yystate.yysemantics.yyval.enumValue));
2979 }
2980 #line 2981 "out/soong/.intermediates/system/tools/hidl/libhidl-gen-ast/linux_glibc_x86_64_static/gen/yacc/system/tools/hidl/hidl-gen_y.cpp"
2981 break;
2982
2983 case 127: // enum_values: enum_values ',' commentable_enum_value
2984 #line 1081 "system/tools/hidl/hidl-gen_y.yy"
2985 {
2986 CHECK((*scope)->isEnum());
2987 static_cast<EnumType *>(*scope)->addValue((YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (0)].yystate.yysemantics.yyval.enumValue));
2988 }
2989 #line 2990 "out/soong/.intermediates/system/tools/hidl/libhidl-gen-ast/linux_glibc_x86_64_static/gen/yacc/system/tools/hidl/hidl-gen_y.cpp"
2990 break;
2991
2992 case 128: // enum_values: error ',' commentable_enum_value
2993 #line 1086 "system/tools/hidl/hidl-gen_y.yy"
2994 {
2995 ast->addSyntaxError();
2996
2997 CHECK((*scope)->isEnum());
2998 static_cast<EnumType *>(*scope)->addValue((YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (0)].yystate.yysemantics.yyval.enumValue));
2999 }
3000 #line 3001 "out/soong/.intermediates/system/tools/hidl/libhidl-gen-ast/linux_glibc_x86_64_static/gen/yacc/system/tools/hidl/hidl-gen_y.cpp"
3001 break;
3002
3003 case 129: // enum_values: enum_values ',' error ',' commentable_enum_value
3004 #line 1093 "system/tools/hidl/hidl-gen_y.yy"
3005 {
3006 ast->addSyntaxError();
3007
3008 CHECK((*scope)->isEnum());
3009 static_cast<EnumType *>(*scope)->addValue((YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (0)].yystate.yysemantics.yyval.enumValue));
3010 }
3011 #line 3012 "out/soong/.intermediates/system/tools/hidl/libhidl-gen-ast/linux_glibc_x86_64_static/gen/yacc/system/tools/hidl/hidl-gen_y.cpp"
3012 break;
3013
3014 case 130: // array_type_base: fqtype
3015 #line 1102 "system/tools/hidl/hidl-gen_y.yy"
3016 { ((*yyvalp).referenceToType) = (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (0)].yystate.yysemantics.yyval.referenceToType); }
3017 #line 3018 "out/soong/.intermediates/system/tools/hidl/libhidl-gen-ast/linux_glibc_x86_64_static/gen/yacc/system/tools/hidl/hidl-gen_y.cpp"
3018 break;
3019
3020 case 131: // array_type_base: "templated type" '<' type '>'
3021 #line 1104 "system/tools/hidl/hidl-gen_y.yy"
3022 {
3023 (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (-3)].yystate.yysemantics.yyval.templatedType)->setElementType(*(YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (-1)].yystate.yysemantics.yyval.referenceToType));
3024 ((*yyvalp).referenceToType) = new Reference<Type>((YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (-3)].yystate.yysemantics.yyval.templatedType)->definedName(), (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (-3)].yystate.yysemantics.yyval.templatedType), convertYYLoc((YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (-3)].yystate.yyloc), ast));
3025 }
3026 #line 3027 "out/soong/.intermediates/system/tools/hidl/libhidl-gen-ast/linux_glibc_x86_64_static/gen/yacc/system/tools/hidl/hidl-gen_y.cpp"
3027 break;
3028
3029 case 132: // array_type_base: "templated type" '<' "templated type" '<' type RSHIFT
3030 #line 1109 "system/tools/hidl/hidl-gen_y.yy"
3031 {
3032 (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (-3)].yystate.yysemantics.yyval.templatedType)->setElementType(*(YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (-1)].yystate.yysemantics.yyval.referenceToType));
3033 (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (-5)].yystate.yysemantics.yyval.templatedType)->setElementType(Reference<Type>((YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (-3)].yystate.yysemantics.yyval.templatedType)->definedName(), (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (-3)].yystate.yysemantics.yyval.templatedType), convertYYLoc((YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (-3)].yystate.yyloc), ast)));
3034 ((*yyvalp).referenceToType) = new Reference<Type>((YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (-5)].yystate.yysemantics.yyval.templatedType)->definedName(), (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (-5)].yystate.yysemantics.yyval.templatedType), convertYYLoc((YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (-5)].yystate.yyloc), ast));
3035 }
3036 #line 3037 "out/soong/.intermediates/system/tools/hidl/libhidl-gen-ast/linux_glibc_x86_64_static/gen/yacc/system/tools/hidl/hidl-gen_y.cpp"
3037 break;
3038
3039 case 133: // array_type: array_type_base ignore_doc_comments '[' const_expr ']'
3040 #line 1118 "system/tools/hidl/hidl-gen_y.yy"
3041 {
3042 ((*yyvalp).arrayType) = new ArrayType(*(YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (-4)].yystate.yysemantics.yyval.referenceToType), (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (-1)].yystate.yysemantics.yyval.constantExpression), *scope);
3043 }
3044 #line 3045 "out/soong/.intermediates/system/tools/hidl/libhidl-gen-ast/linux_glibc_x86_64_static/gen/yacc/system/tools/hidl/hidl-gen_y.cpp"
3045 break;
3046
3047 case 134: // array_type: array_type '[' const_expr ']'
3048 #line 1122 "system/tools/hidl/hidl-gen_y.yy"
3049 {
3050 ((*yyvalp).arrayType) = (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (-3)].yystate.yysemantics.yyval.arrayType);
3051 ((*yyvalp).arrayType)->appendDimension((YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (-1)].yystate.yysemantics.yyval.constantExpression));
3052 }
3053 #line 3054 "out/soong/.intermediates/system/tools/hidl/libhidl-gen-ast/linux_glibc_x86_64_static/gen/yacc/system/tools/hidl/hidl-gen_y.cpp"
3054 break;
3055
3056 case 135: // type: array_type_base ignore_doc_comments
3057 #line 1129 "system/tools/hidl/hidl-gen_y.yy"
3058 { ((*yyvalp).referenceToType) = (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (-1)].yystate.yysemantics.yyval.referenceToType); }
3059 #line 3060 "out/soong/.intermediates/system/tools/hidl/libhidl-gen-ast/linux_glibc_x86_64_static/gen/yacc/system/tools/hidl/hidl-gen_y.cpp"
3060 break;
3061
3062 case 136: // type: array_type ignore_doc_comments
3063 #line 1131 "system/tools/hidl/hidl-gen_y.yy"
3064 {
3065 ((*yyvalp).referenceToType) = new Reference<Type>((YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (-1)].yystate.yysemantics.yyval.arrayType)->definedName(), (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (-1)].yystate.yysemantics.yyval.arrayType), convertYYLoc((YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (-1)].yystate.yyloc), ast));
3066 }
3067 #line 3068 "out/soong/.intermediates/system/tools/hidl/libhidl-gen-ast/linux_glibc_x86_64_static/gen/yacc/system/tools/hidl/hidl-gen_y.cpp"
3068 break;
3069
3070 case 137: // type: "keyword `interface`" ignore_doc_comments
3071 #line 1135 "system/tools/hidl/hidl-gen_y.yy"
3072 {
3073 // "interface" is a synonym of [email protected]::IBase
3074 ((*yyvalp).referenceToType) = new Reference<Type>("interface", gIBaseFqName, convertYYLoc((YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (-1)].yystate.yyloc), ast));
3075 }
3076 #line 3077 "out/soong/.intermediates/system/tools/hidl/libhidl-gen-ast/linux_glibc_x86_64_static/gen/yacc/system/tools/hidl/hidl-gen_y.cpp"
3077 break;
3078
3079 case 138: // type_or_inplace_compound_declaration: type
3080 #line 1142 "system/tools/hidl/hidl-gen_y.yy"
3081 { ((*yyvalp).referenceToType) = (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (0)].yystate.yysemantics.yyval.referenceToType); }
3082 #line 3083 "out/soong/.intermediates/system/tools/hidl/libhidl-gen-ast/linux_glibc_x86_64_static/gen/yacc/system/tools/hidl/hidl-gen_y.cpp"
3083 break;
3084
3085 case 139: // type_or_inplace_compound_declaration: annotated_compound_declaration ignore_doc_comments
3086 #line 1144 "system/tools/hidl/hidl-gen_y.yy"
3087 {
3088 ((*yyvalp).referenceToType) = new Reference<Type>((YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (-1)].yystate.yysemantics.yyval.type)->definedName(), (YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (-1)].yystate.yysemantics.yyval.type), convertYYLoc((YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL (-1)].yystate.yyloc), ast), true);
3089 }
3090 #line 3091 "out/soong/.intermediates/system/tools/hidl/libhidl-gen-ast/linux_glibc_x86_64_static/gen/yacc/system/tools/hidl/hidl-gen_y.cpp"
3091 break;
3092
3093
3094 #line 3095 "out/soong/.intermediates/system/tools/hidl/libhidl-gen-ast/linux_glibc_x86_64_static/gen/yacc/system/tools/hidl/hidl-gen_y.cpp"
3095
3096 default: break;
3097 }
3098 #if YY_EXCEPTIONS
3099 }
3100 catch (const syntax_error& yyexc)
3101 {
3102 YY_DPRINTF ((stderr, "Caught exception: %s\n", yyexc.what()));
3103 *yylocp = yyexc.location;
3104 yyerror (yylocp, yyparser, scanner, ast, scope, yyexc.what ());
3105 YYERROR;
3106 }
3107 #endif // YY_EXCEPTIONS
3108 YY_SYMBOL_PRINT ("-> $$ =", yylhsNonterm (yyrule), yyvalp, yylocp);
3109
3110 return yyok;
3111 # undef yyerrok
3112 # undef YYABORT
3113 # undef YYACCEPT
3114 # undef YYNOMEM
3115 # undef YYERROR
3116 # undef YYBACKUP
3117 # undef yyclearin
3118 # undef YYRECOVERING
3119 }
3120
3121
3122 static void
yyuserMerge(int yyn,YYSTYPE * yy0,YYSTYPE * yy1)3123 yyuserMerge (int yyn, YYSTYPE* yy0, YYSTYPE* yy1)
3124 {
3125 YY_USE (yy0);
3126 YY_USE (yy1);
3127
3128 switch (yyn)
3129 {
3130
3131 default: break;
3132 }
3133 }
3134
3135 /* Bison grammar-table manipulation. */
3136
3137 /*-----------------------------------------------.
3138 | Release the memory associated to this symbol. |
3139 `-----------------------------------------------*/
3140
3141 static void
yydestruct(const char * yymsg,yysymbol_kind_t yykind,YYSTYPE * yyvaluep,YYLTYPE * yylocationp,yy::parser & yyparser,void * scanner,android::AST * const ast,android::Scope ** const scope)3142 yydestruct (const char *yymsg,
3143 yysymbol_kind_t yykind, YYSTYPE *yyvaluep, YYLTYPE *yylocationp, yy::parser& yyparser, void* scanner, android::AST* const ast, android::Scope** const scope)
3144 {
3145 YY_USE (yyvaluep);
3146 YY_USE (yylocationp);
3147 YY_USE (yyparser);
3148 YY_USE (scanner);
3149 YY_USE (ast);
3150 YY_USE (scope);
3151 if (!yymsg)
3152 yymsg = "Deleting";
3153 YY_SYMBOL_PRINT (yymsg, yykind, yyvaluep, yylocationp);
3154
3155 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
3156 YY_USE (yykind);
3157 YY_IGNORE_MAYBE_UNINITIALIZED_END
3158 }
3159
3160 /** Number of symbols composing the right hand side of rule #RULE. */
3161 static inline int
yyrhsLength(yyRuleNum yyrule)3162 yyrhsLength (yyRuleNum yyrule)
3163 {
3164 return yyr2[yyrule];
3165 }
3166
3167 static void
yydestroyGLRState(char const * yymsg,yyGLRState * yys,yy::parser & yyparser,void * scanner,android::AST * const ast,android::Scope ** const scope)3168 yydestroyGLRState (char const *yymsg, yyGLRState *yys, yy::parser& yyparser, void* scanner, android::AST* const ast, android::Scope** const scope)
3169 {
3170 if (yys->yyresolved)
3171 yydestruct (yymsg, yy_accessing_symbol (yys->yylrState),
3172 &yys->yysemantics.yyval, &yys->yyloc, yyparser, scanner, ast, scope);
3173 else
3174 {
3175 #if YYDEBUG
3176 if (yydebug)
3177 {
3178 if (yys->yysemantics.yyfirstVal)
3179 YY_FPRINTF ((stderr, "%s unresolved", yymsg));
3180 else
3181 YY_FPRINTF ((stderr, "%s incomplete", yymsg));
3182 YY_SYMBOL_PRINT ("", yy_accessing_symbol (yys->yylrState), YY_NULLPTR, &yys->yyloc);
3183 }
3184 #endif
3185
3186 if (yys->yysemantics.yyfirstVal)
3187 {
3188 yySemanticOption *yyoption = yys->yysemantics.yyfirstVal;
3189 yyGLRState *yyrh;
3190 int yyn;
3191 for (yyrh = yyoption->yystate, yyn = yyrhsLength (yyoption->yyrule);
3192 yyn > 0;
3193 yyrh = yyrh->yypred, yyn -= 1)
3194 yydestroyGLRState (yymsg, yyrh, yyparser, scanner, ast, scope);
3195 }
3196 }
3197 }
3198
3199 #define yypact_value_is_default(Yyn) \
3200 ((Yyn) == YYPACT_NINF)
3201
3202 /** True iff LR state YYSTATE has only a default reduction (regardless
3203 * of token). */
3204 static inline yybool
yyisDefaultedState(yy_state_t yystate)3205 yyisDefaultedState (yy_state_t yystate)
3206 {
3207 return yypact_value_is_default (yypact[yystate]);
3208 }
3209
3210 /** The default reduction for YYSTATE, assuming it has one. */
3211 static inline yyRuleNum
yydefaultAction(yy_state_t yystate)3212 yydefaultAction (yy_state_t yystate)
3213 {
3214 return yydefact[yystate];
3215 }
3216
3217 #define yytable_value_is_error(Yyn) \
3218 0
3219
3220 /** The action to take in YYSTATE on seeing YYTOKEN.
3221 * Result R means
3222 * R < 0: Reduce on rule -R.
3223 * R = 0: Error.
3224 * R > 0: Shift to state R.
3225 * Set *YYCONFLICTS to a pointer into yyconfl to a 0-terminated list
3226 * of conflicting reductions.
3227 */
3228 static inline int
yygetLRActions(yy_state_t yystate,yysymbol_kind_t yytoken,const short ** yyconflicts)3229 yygetLRActions (yy_state_t yystate, yysymbol_kind_t yytoken, const short** yyconflicts)
3230 {
3231 int yyindex = yypact[yystate] + yytoken;
3232 if (yytoken == S_YYerror)
3233 {
3234 // This is the error token.
3235 *yyconflicts = yyconfl;
3236 return 0;
3237 }
3238 else if (yyisDefaultedState (yystate)
3239 || yyindex < 0 || YYLAST < yyindex || yycheck[yyindex] != yytoken)
3240 {
3241 *yyconflicts = yyconfl;
3242 return -yydefact[yystate];
3243 }
3244 else if (! yytable_value_is_error (yytable[yyindex]))
3245 {
3246 *yyconflicts = yyconfl + yyconflp[yyindex];
3247 return yytable[yyindex];
3248 }
3249 else
3250 {
3251 *yyconflicts = yyconfl + yyconflp[yyindex];
3252 return 0;
3253 }
3254 }
3255
3256 /** Compute post-reduction state.
3257 * \param yystate the current state
3258 * \param yysym the nonterminal to push on the stack
3259 */
3260 static inline yy_state_t
yyLRgotoState(yy_state_t yystate,yysymbol_kind_t yysym)3261 yyLRgotoState (yy_state_t yystate, yysymbol_kind_t yysym)
3262 {
3263 int yyr = yypgoto[yysym - YYNTOKENS] + yystate;
3264 if (0 <= yyr && yyr <= YYLAST && yycheck[yyr] == yystate)
3265 return yytable[yyr];
3266 else
3267 return yydefgoto[yysym - YYNTOKENS];
3268 }
3269
3270 static inline yybool
yyisShiftAction(int yyaction)3271 yyisShiftAction (int yyaction)
3272 {
3273 return 0 < yyaction;
3274 }
3275
3276 static inline yybool
yyisErrorAction(int yyaction)3277 yyisErrorAction (int yyaction)
3278 {
3279 return yyaction == 0;
3280 }
3281
3282 /* GLRStates */
3283
3284 /** Return a fresh GLRStackItem in YYSTACKP. The item is an LR state
3285 * if YYISSTATE, and otherwise a semantic option. Callers should call
3286 * YY_RESERVE_GLRSTACK afterwards to make sure there is sufficient
3287 * headroom. */
3288
3289 static inline yyGLRStackItem*
yynewGLRStackItem(yyGLRStack * yystackp,yybool yyisState)3290 yynewGLRStackItem (yyGLRStack* yystackp, yybool yyisState)
3291 {
3292 yyGLRStackItem* yynewItem = yystackp->yynextFree;
3293 yystackp->yyspaceLeft -= 1;
3294 yystackp->yynextFree += 1;
3295 yynewItem->yystate.yyisState = yyisState;
3296 return yynewItem;
3297 }
3298
3299 /** Add a new semantic action that will execute the action for rule
3300 * YYRULE on the semantic values in YYRHS to the list of
3301 * alternative actions for YYSTATE. Assumes that YYRHS comes from
3302 * stack #YYK of *YYSTACKP. */
3303 static void
yyaddDeferredAction(yyGLRStack * yystackp,YYPTRDIFF_T yyk,yyGLRState * yystate,yyGLRState * yyrhs,yyRuleNum yyrule)3304 yyaddDeferredAction (yyGLRStack* yystackp, YYPTRDIFF_T yyk, yyGLRState* yystate,
3305 yyGLRState* yyrhs, yyRuleNum yyrule)
3306 {
3307 yySemanticOption* yynewOption =
3308 &yynewGLRStackItem (yystackp, yyfalse)->yyoption;
3309 YY_ASSERT (!yynewOption->yyisState);
3310 yynewOption->yystate = yyrhs;
3311 yynewOption->yyrule = yyrule;
3312 if (yystackp->yytops.yylookaheadNeeds[yyk])
3313 {
3314 yynewOption->yyrawchar = yychar;
3315 yynewOption->yyval = yylval;
3316 yynewOption->yyloc = yylloc;
3317 }
3318 else
3319 yynewOption->yyrawchar = YYEMPTY;
3320 yynewOption->yynext = yystate->yysemantics.yyfirstVal;
3321 yystate->yysemantics.yyfirstVal = yynewOption;
3322
3323 YY_RESERVE_GLRSTACK (yystackp);
3324 }
3325
3326 /* GLRStacks */
3327
3328 /** Initialize YYSET to a singleton set containing an empty stack. */
3329 static yybool
yyinitStateSet(yyGLRStateSet * yyset)3330 yyinitStateSet (yyGLRStateSet* yyset)
3331 {
3332 yyset->yysize = 1;
3333 yyset->yycapacity = 16;
3334 yyset->yystates
3335 = YY_CAST (yyGLRState**,
3336 YYMALLOC (YY_CAST (YYSIZE_T, yyset->yycapacity)
3337 * sizeof yyset->yystates[0]));
3338 if (! yyset->yystates)
3339 return yyfalse;
3340 yyset->yystates[0] = YY_NULLPTR;
3341 yyset->yylookaheadNeeds
3342 = YY_CAST (yybool*,
3343 YYMALLOC (YY_CAST (YYSIZE_T, yyset->yycapacity)
3344 * sizeof yyset->yylookaheadNeeds[0]));
3345 if (! yyset->yylookaheadNeeds)
3346 {
3347 YYFREE (yyset->yystates);
3348 return yyfalse;
3349 }
3350 memset (yyset->yylookaheadNeeds,
3351 0,
3352 YY_CAST (YYSIZE_T, yyset->yycapacity) * sizeof yyset->yylookaheadNeeds[0]);
3353 return yytrue;
3354 }
3355
yyfreeStateSet(yyGLRStateSet * yyset)3356 static void yyfreeStateSet (yyGLRStateSet* yyset)
3357 {
3358 YYFREE (yyset->yystates);
3359 YYFREE (yyset->yylookaheadNeeds);
3360 }
3361
3362 /** Initialize *YYSTACKP to a single empty stack, with total maximum
3363 * capacity for all stacks of YYSIZE. */
3364 static yybool
yyinitGLRStack(yyGLRStack * yystackp,YYPTRDIFF_T yysize)3365 yyinitGLRStack (yyGLRStack* yystackp, YYPTRDIFF_T yysize)
3366 {
3367 yystackp->yyerrState = 0;
3368 yynerrs = 0;
3369 yystackp->yyspaceLeft = yysize;
3370 yystackp->yyitems
3371 = YY_CAST (yyGLRStackItem*,
3372 YYMALLOC (YY_CAST (YYSIZE_T, yysize)
3373 * sizeof yystackp->yynextFree[0]));
3374 if (!yystackp->yyitems)
3375 return yyfalse;
3376 yystackp->yynextFree = yystackp->yyitems;
3377 yystackp->yysplitPoint = YY_NULLPTR;
3378 yystackp->yylastDeleted = YY_NULLPTR;
3379 return yyinitStateSet (&yystackp->yytops);
3380 }
3381
3382
3383 #if YYSTACKEXPANDABLE
3384 # define YYRELOC(YYFROMITEMS, YYTOITEMS, YYX, YYTYPE) \
3385 &((YYTOITEMS) \
3386 - ((YYFROMITEMS) - YY_REINTERPRET_CAST (yyGLRStackItem*, (YYX))))->YYTYPE
3387
3388 /** If *YYSTACKP is expandable, extend it. WARNING: Pointers into the
3389 stack from outside should be considered invalid after this call.
3390 We always expand when there are 1 or fewer items left AFTER an
3391 allocation, so that we can avoid having external pointers exist
3392 across an allocation. */
3393 static void
yyexpandGLRStack(yyGLRStack * yystackp)3394 yyexpandGLRStack (yyGLRStack* yystackp)
3395 {
3396 yyGLRStackItem* yynewItems;
3397 yyGLRStackItem* yyp0, *yyp1;
3398 YYPTRDIFF_T yynewSize;
3399 YYPTRDIFF_T yyn;
3400 YYPTRDIFF_T yysize = yystackp->yynextFree - yystackp->yyitems;
3401 if (YYMAXDEPTH - YYHEADROOM < yysize)
3402 yyMemoryExhausted (yystackp);
3403 yynewSize = 2*yysize;
3404 if (YYMAXDEPTH < yynewSize)
3405 yynewSize = YYMAXDEPTH;
3406 yynewItems
3407 = YY_CAST (yyGLRStackItem*,
3408 YYMALLOC (YY_CAST (YYSIZE_T, yynewSize)
3409 * sizeof yynewItems[0]));
3410 if (! yynewItems)
3411 yyMemoryExhausted (yystackp);
3412 for (yyp0 = yystackp->yyitems, yyp1 = yynewItems, yyn = yysize;
3413 0 < yyn;
3414 yyn -= 1, yyp0 += 1, yyp1 += 1)
3415 {
3416 *yyp1 = *yyp0;
3417 if (*YY_REINTERPRET_CAST (yybool *, yyp0))
3418 {
3419 yyGLRState* yys0 = &yyp0->yystate;
3420 yyGLRState* yys1 = &yyp1->yystate;
3421 if (yys0->yypred != YY_NULLPTR)
3422 yys1->yypred =
3423 YYRELOC (yyp0, yyp1, yys0->yypred, yystate);
3424 if (! yys0->yyresolved && yys0->yysemantics.yyfirstVal != YY_NULLPTR)
3425 yys1->yysemantics.yyfirstVal =
3426 YYRELOC (yyp0, yyp1, yys0->yysemantics.yyfirstVal, yyoption);
3427 }
3428 else
3429 {
3430 yySemanticOption* yyv0 = &yyp0->yyoption;
3431 yySemanticOption* yyv1 = &yyp1->yyoption;
3432 if (yyv0->yystate != YY_NULLPTR)
3433 yyv1->yystate = YYRELOC (yyp0, yyp1, yyv0->yystate, yystate);
3434 if (yyv0->yynext != YY_NULLPTR)
3435 yyv1->yynext = YYRELOC (yyp0, yyp1, yyv0->yynext, yyoption);
3436 }
3437 }
3438 if (yystackp->yysplitPoint != YY_NULLPTR)
3439 yystackp->yysplitPoint = YYRELOC (yystackp->yyitems, yynewItems,
3440 yystackp->yysplitPoint, yystate);
3441
3442 for (yyn = 0; yyn < yystackp->yytops.yysize; yyn += 1)
3443 if (yystackp->yytops.yystates[yyn] != YY_NULLPTR)
3444 yystackp->yytops.yystates[yyn] =
3445 YYRELOC (yystackp->yyitems, yynewItems,
3446 yystackp->yytops.yystates[yyn], yystate);
3447 YYFREE (yystackp->yyitems);
3448 yystackp->yyitems = yynewItems;
3449 yystackp->yynextFree = yynewItems + yysize;
3450 yystackp->yyspaceLeft = yynewSize - yysize;
3451 }
3452 #endif
3453
3454 static void
yyfreeGLRStack(yyGLRStack * yystackp)3455 yyfreeGLRStack (yyGLRStack* yystackp)
3456 {
3457 YYFREE (yystackp->yyitems);
3458 yyfreeStateSet (&yystackp->yytops);
3459 }
3460
3461 /** Assuming that YYS is a GLRState somewhere on *YYSTACKP, update the
3462 * splitpoint of *YYSTACKP, if needed, so that it is at least as deep as
3463 * YYS. */
3464 static inline void
yyupdateSplit(yyGLRStack * yystackp,yyGLRState * yys)3465 yyupdateSplit (yyGLRStack* yystackp, yyGLRState* yys)
3466 {
3467 if (yystackp->yysplitPoint != YY_NULLPTR && yystackp->yysplitPoint > yys)
3468 yystackp->yysplitPoint = yys;
3469 }
3470
3471 /** Invalidate stack #YYK in *YYSTACKP. */
3472 static inline void
yymarkStackDeleted(yyGLRStack * yystackp,YYPTRDIFF_T yyk)3473 yymarkStackDeleted (yyGLRStack* yystackp, YYPTRDIFF_T yyk)
3474 {
3475 if (yystackp->yytops.yystates[yyk] != YY_NULLPTR)
3476 yystackp->yylastDeleted = yystackp->yytops.yystates[yyk];
3477 yystackp->yytops.yystates[yyk] = YY_NULLPTR;
3478 }
3479
3480 /** Undelete the last stack in *YYSTACKP that was marked as deleted. Can
3481 only be done once after a deletion, and only when all other stacks have
3482 been deleted. */
3483 static void
yyundeleteLastStack(yyGLRStack * yystackp)3484 yyundeleteLastStack (yyGLRStack* yystackp)
3485 {
3486 if (yystackp->yylastDeleted == YY_NULLPTR || yystackp->yytops.yysize != 0)
3487 return;
3488 yystackp->yytops.yystates[0] = yystackp->yylastDeleted;
3489 yystackp->yytops.yysize = 1;
3490 YY_DPRINTF ((stderr, "Restoring last deleted stack as stack #0.\n"));
3491 yystackp->yylastDeleted = YY_NULLPTR;
3492 }
3493
3494 static inline void
yyremoveDeletes(yyGLRStack * yystackp)3495 yyremoveDeletes (yyGLRStack* yystackp)
3496 {
3497 YYPTRDIFF_T yyi, yyj;
3498 yyi = yyj = 0;
3499 while (yyj < yystackp->yytops.yysize)
3500 {
3501 if (yystackp->yytops.yystates[yyi] == YY_NULLPTR)
3502 {
3503 if (yyi == yyj)
3504 YY_DPRINTF ((stderr, "Removing dead stacks.\n"));
3505 yystackp->yytops.yysize -= 1;
3506 }
3507 else
3508 {
3509 yystackp->yytops.yystates[yyj] = yystackp->yytops.yystates[yyi];
3510 /* In the current implementation, it's unnecessary to copy
3511 yystackp->yytops.yylookaheadNeeds[yyi] since, after
3512 yyremoveDeletes returns, the parser immediately either enters
3513 deterministic operation or shifts a token. However, it doesn't
3514 hurt, and the code might evolve to need it. */
3515 yystackp->yytops.yylookaheadNeeds[yyj] =
3516 yystackp->yytops.yylookaheadNeeds[yyi];
3517 if (yyj != yyi)
3518 YY_DPRINTF ((stderr, "Rename stack %ld -> %ld.\n",
3519 YY_CAST (long, yyi), YY_CAST (long, yyj)));
3520 yyj += 1;
3521 }
3522 yyi += 1;
3523 }
3524 }
3525
3526 /** Shift to a new state on stack #YYK of *YYSTACKP, corresponding to LR
3527 * state YYLRSTATE, at input position YYPOSN, with (resolved) semantic
3528 * value *YYVALP and source location *YYLOCP. */
3529 static inline void
yyglrShift(yyGLRStack * yystackp,YYPTRDIFF_T yyk,yy_state_t yylrState,YYPTRDIFF_T yyposn,YYSTYPE * yyvalp,YYLTYPE * yylocp)3530 yyglrShift (yyGLRStack* yystackp, YYPTRDIFF_T yyk, yy_state_t yylrState,
3531 YYPTRDIFF_T yyposn,
3532 YYSTYPE* yyvalp, YYLTYPE* yylocp)
3533 {
3534 yyGLRState* yynewState = &yynewGLRStackItem (yystackp, yytrue)->yystate;
3535
3536 yynewState->yylrState = yylrState;
3537 yynewState->yyposn = yyposn;
3538 yynewState->yyresolved = yytrue;
3539 yynewState->yypred = yystackp->yytops.yystates[yyk];
3540 yynewState->yysemantics.yyval = *yyvalp;
3541 yynewState->yyloc = *yylocp;
3542 yystackp->yytops.yystates[yyk] = yynewState;
3543
3544 YY_RESERVE_GLRSTACK (yystackp);
3545 }
3546
3547 /** Shift stack #YYK of *YYSTACKP, to a new state corresponding to LR
3548 * state YYLRSTATE, at input position YYPOSN, with the (unresolved)
3549 * semantic value of YYRHS under the action for YYRULE. */
3550 static inline void
yyglrShiftDefer(yyGLRStack * yystackp,YYPTRDIFF_T yyk,yy_state_t yylrState,YYPTRDIFF_T yyposn,yyGLRState * yyrhs,yyRuleNum yyrule)3551 yyglrShiftDefer (yyGLRStack* yystackp, YYPTRDIFF_T yyk, yy_state_t yylrState,
3552 YYPTRDIFF_T yyposn, yyGLRState* yyrhs, yyRuleNum yyrule)
3553 {
3554 yyGLRState* yynewState = &yynewGLRStackItem (yystackp, yytrue)->yystate;
3555 YY_ASSERT (yynewState->yyisState);
3556
3557 yynewState->yylrState = yylrState;
3558 yynewState->yyposn = yyposn;
3559 yynewState->yyresolved = yyfalse;
3560 yynewState->yypred = yystackp->yytops.yystates[yyk];
3561 yynewState->yysemantics.yyfirstVal = YY_NULLPTR;
3562 yystackp->yytops.yystates[yyk] = yynewState;
3563
3564 /* Invokes YY_RESERVE_GLRSTACK. */
3565 yyaddDeferredAction (yystackp, yyk, yynewState, yyrhs, yyrule);
3566 }
3567
3568 #if YYDEBUG
3569
3570 /*----------------------------------------------------------------------.
3571 | Report that stack #YYK of *YYSTACKP is going to be reduced by YYRULE. |
3572 `----------------------------------------------------------------------*/
3573
3574 static inline void
yy_reduce_print(yybool yynormal,yyGLRStackItem * yyvsp,YYPTRDIFF_T yyk,yyRuleNum yyrule,yy::parser & yyparser,void * scanner,android::AST * const ast,android::Scope ** const scope)3575 yy_reduce_print (yybool yynormal, yyGLRStackItem* yyvsp, YYPTRDIFF_T yyk,
3576 yyRuleNum yyrule, yy::parser& yyparser, void* scanner, android::AST* const ast, android::Scope** const scope)
3577 {
3578 int yynrhs = yyrhsLength (yyrule);
3579 int yylow = 1;
3580 int yyi;
3581 YY_FPRINTF ((stderr, "Reducing stack %ld by rule %d (line %d):\n",
3582 YY_CAST (long, yyk), yyrule - 1, yyrline[yyrule]));
3583 if (! yynormal)
3584 yyfillin (yyvsp, 1, -yynrhs);
3585 /* The symbols being reduced. */
3586 for (yyi = 0; yyi < yynrhs; yyi++)
3587 {
3588 YY_FPRINTF ((stderr, " $%d = ", yyi + 1));
3589 yy_symbol_print (stderr,
3590 yy_accessing_symbol (yyvsp[yyi - yynrhs + 1].yystate.yylrState),
3591 &yyvsp[yyi - yynrhs + 1].yystate.yysemantics.yyval,
3592 &(YY_CAST (yyGLRStackItem const *, yyvsp)[YYFILL ((yyi + 1) - (yynrhs))].yystate.yyloc) , yyparser, scanner, ast, scope);
3593 if (!yyvsp[yyi - yynrhs + 1].yystate.yyresolved)
3594 YY_FPRINTF ((stderr, " (unresolved)"));
3595 YY_FPRINTF ((stderr, "\n"));
3596 }
3597 }
3598 #endif
3599
3600 /** Pop the symbols consumed by reduction #YYRULE from the top of stack
3601 * #YYK of *YYSTACKP, and perform the appropriate semantic action on their
3602 * semantic values. Assumes that all ambiguities in semantic values
3603 * have been previously resolved. Set *YYVALP to the resulting value,
3604 * and *YYLOCP to the computed location (if any). Return value is as
3605 * for userAction. */
3606 static inline YYRESULTTAG
yydoAction(yyGLRStack * yystackp,YYPTRDIFF_T yyk,yyRuleNum yyrule,YYSTYPE * yyvalp,YYLTYPE * yylocp,yy::parser & yyparser,void * scanner,android::AST * const ast,android::Scope ** const scope)3607 yydoAction (yyGLRStack* yystackp, YYPTRDIFF_T yyk, yyRuleNum yyrule,
3608 YYSTYPE* yyvalp, YYLTYPE *yylocp, yy::parser& yyparser, void* scanner, android::AST* const ast, android::Scope** const scope)
3609 {
3610 int yynrhs = yyrhsLength (yyrule);
3611
3612 if (yystackp->yysplitPoint == YY_NULLPTR)
3613 {
3614 /* Standard special case: single stack. */
3615 yyGLRStackItem* yyrhs
3616 = YY_REINTERPRET_CAST (yyGLRStackItem*, yystackp->yytops.yystates[yyk]);
3617 YY_ASSERT (yyk == 0);
3618 yystackp->yynextFree -= yynrhs;
3619 yystackp->yyspaceLeft += yynrhs;
3620 yystackp->yytops.yystates[0] = & yystackp->yynextFree[-1].yystate;
3621 return yyuserAction (yyrule, yynrhs, yyrhs, yystackp, yyk,
3622 yyvalp, yylocp, yyparser, scanner, ast, scope);
3623 }
3624 else
3625 {
3626 yyGLRStackItem yyrhsVals[YYMAXRHS + YYMAXLEFT + 1];
3627 yyGLRState* yys = yyrhsVals[YYMAXRHS + YYMAXLEFT].yystate.yypred
3628 = yystackp->yytops.yystates[yyk];
3629 int yyi;
3630 if (yynrhs == 0)
3631 /* Set default location. */
3632 yyrhsVals[YYMAXRHS + YYMAXLEFT - 1].yystate.yyloc = yys->yyloc;
3633 for (yyi = 0; yyi < yynrhs; yyi += 1)
3634 {
3635 yys = yys->yypred;
3636 YY_ASSERT (yys);
3637 }
3638 yyupdateSplit (yystackp, yys);
3639 yystackp->yytops.yystates[yyk] = yys;
3640 return yyuserAction (yyrule, yynrhs, yyrhsVals + YYMAXRHS + YYMAXLEFT - 1,
3641 yystackp, yyk, yyvalp, yylocp, yyparser, scanner, ast, scope);
3642 }
3643 }
3644
3645 /** Pop items off stack #YYK of *YYSTACKP according to grammar rule YYRULE,
3646 * and push back on the resulting nonterminal symbol. Perform the
3647 * semantic action associated with YYRULE and store its value with the
3648 * newly pushed state, if YYFORCEEVAL or if *YYSTACKP is currently
3649 * unambiguous. Otherwise, store the deferred semantic action with
3650 * the new state. If the new state would have an identical input
3651 * position, LR state, and predecessor to an existing state on the stack,
3652 * it is identified with that existing state, eliminating stack #YYK from
3653 * *YYSTACKP. In this case, the semantic value is
3654 * added to the options for the existing state's semantic value.
3655 */
3656 static inline YYRESULTTAG
yyglrReduce(yyGLRStack * yystackp,YYPTRDIFF_T yyk,yyRuleNum yyrule,yybool yyforceEval,yy::parser & yyparser,void * scanner,android::AST * const ast,android::Scope ** const scope)3657 yyglrReduce (yyGLRStack* yystackp, YYPTRDIFF_T yyk, yyRuleNum yyrule,
3658 yybool yyforceEval, yy::parser& yyparser, void* scanner, android::AST* const ast, android::Scope** const scope)
3659 {
3660 YYPTRDIFF_T yyposn = yystackp->yytops.yystates[yyk]->yyposn;
3661
3662 if (yyforceEval || yystackp->yysplitPoint == YY_NULLPTR)
3663 {
3664 YYSTYPE yyval;
3665 YYLTYPE yyloc;
3666
3667 YYRESULTTAG yyflag = yydoAction (yystackp, yyk, yyrule, &yyval, &yyloc, yyparser, scanner, ast, scope);
3668 if (yyflag == yyerr && yystackp->yysplitPoint != YY_NULLPTR)
3669 YY_DPRINTF ((stderr,
3670 "Parse on stack %ld rejected by rule %d (line %d).\n",
3671 YY_CAST (long, yyk), yyrule - 1, yyrline[yyrule]));
3672 if (yyflag != yyok)
3673 return yyflag;
3674 yyglrShift (yystackp, yyk,
3675 yyLRgotoState (yystackp->yytops.yystates[yyk]->yylrState,
3676 yylhsNonterm (yyrule)),
3677 yyposn, &yyval, &yyloc);
3678 }
3679 else
3680 {
3681 YYPTRDIFF_T yyi;
3682 int yyn;
3683 yyGLRState* yys, *yys0 = yystackp->yytops.yystates[yyk];
3684 yy_state_t yynewLRState;
3685
3686 for (yys = yystackp->yytops.yystates[yyk], yyn = yyrhsLength (yyrule);
3687 0 < yyn; yyn -= 1)
3688 {
3689 yys = yys->yypred;
3690 YY_ASSERT (yys);
3691 }
3692 yyupdateSplit (yystackp, yys);
3693 yynewLRState = yyLRgotoState (yys->yylrState, yylhsNonterm (yyrule));
3694 YY_DPRINTF ((stderr,
3695 "Reduced stack %ld by rule %d (line %d); action deferred. "
3696 "Now in state %d.\n",
3697 YY_CAST (long, yyk), yyrule - 1, yyrline[yyrule],
3698 yynewLRState));
3699 for (yyi = 0; yyi < yystackp->yytops.yysize; yyi += 1)
3700 if (yyi != yyk && yystackp->yytops.yystates[yyi] != YY_NULLPTR)
3701 {
3702 yyGLRState *yysplit = yystackp->yysplitPoint;
3703 yyGLRState *yyp = yystackp->yytops.yystates[yyi];
3704 while (yyp != yys && yyp != yysplit && yyp->yyposn >= yyposn)
3705 {
3706 if (yyp->yylrState == yynewLRState && yyp->yypred == yys)
3707 {
3708 yyaddDeferredAction (yystackp, yyk, yyp, yys0, yyrule);
3709 yymarkStackDeleted (yystackp, yyk);
3710 YY_DPRINTF ((stderr, "Merging stack %ld into stack %ld.\n",
3711 YY_CAST (long, yyk), YY_CAST (long, yyi)));
3712 return yyok;
3713 }
3714 yyp = yyp->yypred;
3715 }
3716 }
3717 yystackp->yytops.yystates[yyk] = yys;
3718 yyglrShiftDefer (yystackp, yyk, yynewLRState, yyposn, yys0, yyrule);
3719 }
3720 return yyok;
3721 }
3722
3723 static YYPTRDIFF_T
yysplitStack(yyGLRStack * yystackp,YYPTRDIFF_T yyk)3724 yysplitStack (yyGLRStack* yystackp, YYPTRDIFF_T yyk)
3725 {
3726 if (yystackp->yysplitPoint == YY_NULLPTR)
3727 {
3728 YY_ASSERT (yyk == 0);
3729 yystackp->yysplitPoint = yystackp->yytops.yystates[yyk];
3730 }
3731 if (yystackp->yytops.yycapacity <= yystackp->yytops.yysize)
3732 {
3733 YYPTRDIFF_T state_size = YYSIZEOF (yystackp->yytops.yystates[0]);
3734 YYPTRDIFF_T half_max_capacity = YYSIZE_MAXIMUM / 2 / state_size;
3735 if (half_max_capacity < yystackp->yytops.yycapacity)
3736 yyMemoryExhausted (yystackp);
3737 yystackp->yytops.yycapacity *= 2;
3738
3739 {
3740 yyGLRState** yynewStates
3741 = YY_CAST (yyGLRState**,
3742 YYREALLOC (yystackp->yytops.yystates,
3743 (YY_CAST (YYSIZE_T, yystackp->yytops.yycapacity)
3744 * sizeof yynewStates[0])));
3745 if (yynewStates == YY_NULLPTR)
3746 yyMemoryExhausted (yystackp);
3747 yystackp->yytops.yystates = yynewStates;
3748 }
3749
3750 {
3751 yybool* yynewLookaheadNeeds
3752 = YY_CAST (yybool*,
3753 YYREALLOC (yystackp->yytops.yylookaheadNeeds,
3754 (YY_CAST (YYSIZE_T, yystackp->yytops.yycapacity)
3755 * sizeof yynewLookaheadNeeds[0])));
3756 if (yynewLookaheadNeeds == YY_NULLPTR)
3757 yyMemoryExhausted (yystackp);
3758 yystackp->yytops.yylookaheadNeeds = yynewLookaheadNeeds;
3759 }
3760 }
3761 yystackp->yytops.yystates[yystackp->yytops.yysize]
3762 = yystackp->yytops.yystates[yyk];
3763 yystackp->yytops.yylookaheadNeeds[yystackp->yytops.yysize]
3764 = yystackp->yytops.yylookaheadNeeds[yyk];
3765 yystackp->yytops.yysize += 1;
3766 return yystackp->yytops.yysize - 1;
3767 }
3768
3769 /** True iff YYY0 and YYY1 represent identical options at the top level.
3770 * That is, they represent the same rule applied to RHS symbols
3771 * that produce the same terminal symbols. */
3772 static yybool
yyidenticalOptions(yySemanticOption * yyy0,yySemanticOption * yyy1)3773 yyidenticalOptions (yySemanticOption* yyy0, yySemanticOption* yyy1)
3774 {
3775 if (yyy0->yyrule == yyy1->yyrule)
3776 {
3777 yyGLRState *yys0, *yys1;
3778 int yyn;
3779 for (yys0 = yyy0->yystate, yys1 = yyy1->yystate,
3780 yyn = yyrhsLength (yyy0->yyrule);
3781 yyn > 0;
3782 yys0 = yys0->yypred, yys1 = yys1->yypred, yyn -= 1)
3783 if (yys0->yyposn != yys1->yyposn)
3784 return yyfalse;
3785 return yytrue;
3786 }
3787 else
3788 return yyfalse;
3789 }
3790
3791 /** Assuming identicalOptions (YYY0,YYY1), destructively merge the
3792 * alternative semantic values for the RHS-symbols of YYY1 and YYY0. */
3793 static void
yymergeOptionSets(yySemanticOption * yyy0,yySemanticOption * yyy1)3794 yymergeOptionSets (yySemanticOption* yyy0, yySemanticOption* yyy1)
3795 {
3796 yyGLRState *yys0, *yys1;
3797 int yyn;
3798 for (yys0 = yyy0->yystate, yys1 = yyy1->yystate,
3799 yyn = yyrhsLength (yyy0->yyrule);
3800 0 < yyn;
3801 yys0 = yys0->yypred, yys1 = yys1->yypred, yyn -= 1)
3802 {
3803 if (yys0 == yys1)
3804 break;
3805 else if (yys0->yyresolved)
3806 {
3807 yys1->yyresolved = yytrue;
3808 yys1->yysemantics.yyval = yys0->yysemantics.yyval;
3809 }
3810 else if (yys1->yyresolved)
3811 {
3812 yys0->yyresolved = yytrue;
3813 yys0->yysemantics.yyval = yys1->yysemantics.yyval;
3814 }
3815 else
3816 {
3817 yySemanticOption** yyz0p = &yys0->yysemantics.yyfirstVal;
3818 yySemanticOption* yyz1 = yys1->yysemantics.yyfirstVal;
3819 while (yytrue)
3820 {
3821 if (yyz1 == *yyz0p || yyz1 == YY_NULLPTR)
3822 break;
3823 else if (*yyz0p == YY_NULLPTR)
3824 {
3825 *yyz0p = yyz1;
3826 break;
3827 }
3828 else if (*yyz0p < yyz1)
3829 {
3830 yySemanticOption* yyz = *yyz0p;
3831 *yyz0p = yyz1;
3832 yyz1 = yyz1->yynext;
3833 (*yyz0p)->yynext = yyz;
3834 }
3835 yyz0p = &(*yyz0p)->yynext;
3836 }
3837 yys1->yysemantics.yyfirstVal = yys0->yysemantics.yyfirstVal;
3838 }
3839 }
3840 }
3841
3842 /** Y0 and Y1 represent two possible actions to take in a given
3843 * parsing state; return 0 if no combination is possible,
3844 * 1 if user-mergeable, 2 if Y0 is preferred, 3 if Y1 is preferred. */
3845 static int
yypreference(yySemanticOption * y0,yySemanticOption * y1)3846 yypreference (yySemanticOption* y0, yySemanticOption* y1)
3847 {
3848 yyRuleNum r0 = y0->yyrule, r1 = y1->yyrule;
3849 int p0 = yydprec[r0], p1 = yydprec[r1];
3850
3851 if (p0 == p1)
3852 {
3853 if (yymerger[r0] == 0 || yymerger[r0] != yymerger[r1])
3854 return 0;
3855 else
3856 return 1;
3857 }
3858 if (p0 == 0 || p1 == 0)
3859 return 0;
3860 if (p0 < p1)
3861 return 3;
3862 if (p1 < p0)
3863 return 2;
3864 return 0;
3865 }
3866
3867 static YYRESULTTAG
3868 yyresolveValue (yyGLRState* yys, yyGLRStack* yystackp, yy::parser& yyparser, void* scanner, android::AST* const ast, android::Scope** const scope);
3869
3870
3871 /** Resolve the previous YYN states starting at and including state YYS
3872 * on *YYSTACKP. If result != yyok, some states may have been left
3873 * unresolved possibly with empty semantic option chains. Regardless
3874 * of whether result = yyok, each state has been left with consistent
3875 * data so that yydestroyGLRState can be invoked if necessary. */
3876 static YYRESULTTAG
yyresolveStates(yyGLRState * yys,int yyn,yyGLRStack * yystackp,yy::parser & yyparser,void * scanner,android::AST * const ast,android::Scope ** const scope)3877 yyresolveStates (yyGLRState* yys, int yyn,
3878 yyGLRStack* yystackp, yy::parser& yyparser, void* scanner, android::AST* const ast, android::Scope** const scope)
3879 {
3880 if (0 < yyn)
3881 {
3882 YY_ASSERT (yys->yypred);
3883 YYCHK (yyresolveStates (yys->yypred, yyn-1, yystackp, yyparser, scanner, ast, scope));
3884 if (! yys->yyresolved)
3885 YYCHK (yyresolveValue (yys, yystackp, yyparser, scanner, ast, scope));
3886 }
3887 return yyok;
3888 }
3889
3890 /** Resolve the states for the RHS of YYOPT on *YYSTACKP, perform its
3891 * user action, and return the semantic value and location in *YYVALP
3892 * and *YYLOCP. Regardless of whether result = yyok, all RHS states
3893 * have been destroyed (assuming the user action destroys all RHS
3894 * semantic values if invoked). */
3895 static YYRESULTTAG
yyresolveAction(yySemanticOption * yyopt,yyGLRStack * yystackp,YYSTYPE * yyvalp,YYLTYPE * yylocp,yy::parser & yyparser,void * scanner,android::AST * const ast,android::Scope ** const scope)3896 yyresolveAction (yySemanticOption* yyopt, yyGLRStack* yystackp,
3897 YYSTYPE* yyvalp, YYLTYPE *yylocp, yy::parser& yyparser, void* scanner, android::AST* const ast, android::Scope** const scope)
3898 {
3899 yyGLRStackItem yyrhsVals[YYMAXRHS + YYMAXLEFT + 1];
3900 int yynrhs = yyrhsLength (yyopt->yyrule);
3901 YYRESULTTAG yyflag =
3902 yyresolveStates (yyopt->yystate, yynrhs, yystackp, yyparser, scanner, ast, scope);
3903 if (yyflag != yyok)
3904 {
3905 yyGLRState *yys;
3906 for (yys = yyopt->yystate; yynrhs > 0; yys = yys->yypred, yynrhs -= 1)
3907 yydestroyGLRState ("Cleanup: popping", yys, yyparser, scanner, ast, scope);
3908 return yyflag;
3909 }
3910
3911 yyrhsVals[YYMAXRHS + YYMAXLEFT].yystate.yypred = yyopt->yystate;
3912 if (yynrhs == 0)
3913 /* Set default location. */
3914 yyrhsVals[YYMAXRHS + YYMAXLEFT - 1].yystate.yyloc = yyopt->yystate->yyloc;
3915 {
3916 int yychar_current = yychar;
3917 YYSTYPE yylval_current = yylval;
3918 YYLTYPE yylloc_current = yylloc;
3919 yychar = yyopt->yyrawchar;
3920 yylval = yyopt->yyval;
3921 yylloc = yyopt->yyloc;
3922 yyflag = yyuserAction (yyopt->yyrule, yynrhs,
3923 yyrhsVals + YYMAXRHS + YYMAXLEFT - 1,
3924 yystackp, -1, yyvalp, yylocp, yyparser, scanner, ast, scope);
3925 yychar = yychar_current;
3926 yylval = yylval_current;
3927 yylloc = yylloc_current;
3928 }
3929 return yyflag;
3930 }
3931
3932 #if YYDEBUG
3933 static void
yyreportTree(yySemanticOption * yyx,int yyindent)3934 yyreportTree (yySemanticOption* yyx, int yyindent)
3935 {
3936 int yynrhs = yyrhsLength (yyx->yyrule);
3937 int yyi;
3938 yyGLRState* yys;
3939 yyGLRState* yystates[1 + YYMAXRHS];
3940 yyGLRState yyleftmost_state;
3941
3942 for (yyi = yynrhs, yys = yyx->yystate; 0 < yyi; yyi -= 1, yys = yys->yypred)
3943 yystates[yyi] = yys;
3944 if (yys == YY_NULLPTR)
3945 {
3946 yyleftmost_state.yyposn = 0;
3947 yystates[0] = &yyleftmost_state;
3948 }
3949 else
3950 yystates[0] = yys;
3951
3952 if (yyx->yystate->yyposn < yys->yyposn + 1)
3953 YY_FPRINTF ((stderr, "%*s%s -> <Rule %d, empty>\n",
3954 yyindent, "", yysymbol_name (yylhsNonterm (yyx->yyrule)),
3955 yyx->yyrule - 1));
3956 else
3957 YY_FPRINTF ((stderr, "%*s%s -> <Rule %d, tokens %ld .. %ld>\n",
3958 yyindent, "", yysymbol_name (yylhsNonterm (yyx->yyrule)),
3959 yyx->yyrule - 1, YY_CAST (long, yys->yyposn + 1),
3960 YY_CAST (long, yyx->yystate->yyposn)));
3961 for (yyi = 1; yyi <= yynrhs; yyi += 1)
3962 {
3963 if (yystates[yyi]->yyresolved)
3964 {
3965 if (yystates[yyi-1]->yyposn+1 > yystates[yyi]->yyposn)
3966 YY_FPRINTF ((stderr, "%*s%s <empty>\n", yyindent+2, "",
3967 yysymbol_name (yy_accessing_symbol (yystates[yyi]->yylrState))));
3968 else
3969 YY_FPRINTF ((stderr, "%*s%s <tokens %ld .. %ld>\n", yyindent+2, "",
3970 yysymbol_name (yy_accessing_symbol (yystates[yyi]->yylrState)),
3971 YY_CAST (long, yystates[yyi-1]->yyposn + 1),
3972 YY_CAST (long, yystates[yyi]->yyposn)));
3973 }
3974 else
3975 yyreportTree (yystates[yyi]->yysemantics.yyfirstVal, yyindent+2);
3976 }
3977 }
3978 #endif
3979
3980 static YYRESULTTAG
yyreportAmbiguity(yySemanticOption * yyx0,yySemanticOption * yyx1,YYLTYPE * yylocp,yy::parser & yyparser,void * scanner,android::AST * const ast,android::Scope ** const scope)3981 yyreportAmbiguity (yySemanticOption* yyx0,
3982 yySemanticOption* yyx1, YYLTYPE *yylocp, yy::parser& yyparser, void* scanner, android::AST* const ast, android::Scope** const scope)
3983 {
3984 YY_USE (yyx0);
3985 YY_USE (yyx1);
3986
3987 #if YYDEBUG
3988 YY_FPRINTF ((stderr, "Ambiguity detected.\n"));
3989 YY_FPRINTF ((stderr, "Option 1,\n"));
3990 yyreportTree (yyx0, 2);
3991 YY_FPRINTF ((stderr, "\nOption 2,\n"));
3992 yyreportTree (yyx1, 2);
3993 YY_FPRINTF ((stderr, "\n"));
3994 #endif
3995
3996 yyerror (yylocp, yyparser, scanner, ast, scope, YY_("syntax is ambiguous"));
3997 return yyabort;
3998 }
3999
4000 /** Resolve the locations for each of the YYN1 states in *YYSTACKP,
4001 * ending at YYS1. Has no effect on previously resolved states.
4002 * The first semantic option of a state is always chosen. */
4003 static void
yyresolveLocations(yyGLRState * yys1,int yyn1,yyGLRStack * yystackp,yy::parser & yyparser,void * scanner,android::AST * const ast,android::Scope ** const scope)4004 yyresolveLocations (yyGLRState *yys1, int yyn1,
4005 yyGLRStack *yystackp, yy::parser& yyparser, void* scanner, android::AST* const ast, android::Scope** const scope)
4006 {
4007 if (0 < yyn1)
4008 {
4009 yyresolveLocations (yys1->yypred, yyn1 - 1, yystackp, yyparser, scanner, ast, scope);
4010 if (!yys1->yyresolved)
4011 {
4012 yyGLRStackItem yyrhsloc[1 + YYMAXRHS];
4013 int yynrhs;
4014 yySemanticOption *yyoption = yys1->yysemantics.yyfirstVal;
4015 YY_ASSERT (yyoption);
4016 yynrhs = yyrhsLength (yyoption->yyrule);
4017 if (0 < yynrhs)
4018 {
4019 yyGLRState *yys;
4020 int yyn;
4021 yyresolveLocations (yyoption->yystate, yynrhs,
4022 yystackp, yyparser, scanner, ast, scope);
4023 for (yys = yyoption->yystate, yyn = yynrhs;
4024 yyn > 0;
4025 yys = yys->yypred, yyn -= 1)
4026 yyrhsloc[yyn].yystate.yyloc = yys->yyloc;
4027 }
4028 else
4029 {
4030 /* Both yyresolveAction and yyresolveLocations traverse the GSS
4031 in reverse rightmost order. It is only necessary to invoke
4032 yyresolveLocations on a subforest for which yyresolveAction
4033 would have been invoked next had an ambiguity not been
4034 detected. Thus the location of the previous state (but not
4035 necessarily the previous state itself) is guaranteed to be
4036 resolved already. */
4037 yyGLRState *yyprevious = yyoption->yystate;
4038 yyrhsloc[0].yystate.yyloc = yyprevious->yyloc;
4039 }
4040 YYLLOC_DEFAULT ((yys1->yyloc), yyrhsloc, yynrhs);
4041 }
4042 }
4043 }
4044
4045 /** Resolve the ambiguity represented in state YYS in *YYSTACKP,
4046 * perform the indicated actions, and set the semantic value of YYS.
4047 * If result != yyok, the chain of semantic options in YYS has been
4048 * cleared instead or it has been left unmodified except that
4049 * redundant options may have been removed. Regardless of whether
4050 * result = yyok, YYS has been left with consistent data so that
4051 * yydestroyGLRState can be invoked if necessary. */
4052 static YYRESULTTAG
yyresolveValue(yyGLRState * yys,yyGLRStack * yystackp,yy::parser & yyparser,void * scanner,android::AST * const ast,android::Scope ** const scope)4053 yyresolveValue (yyGLRState* yys, yyGLRStack* yystackp, yy::parser& yyparser, void* scanner, android::AST* const ast, android::Scope** const scope)
4054 {
4055 yySemanticOption* yyoptionList = yys->yysemantics.yyfirstVal;
4056 yySemanticOption* yybest = yyoptionList;
4057 yySemanticOption** yypp;
4058 yybool yymerge = yyfalse;
4059 YYSTYPE yyval;
4060 YYRESULTTAG yyflag;
4061 YYLTYPE *yylocp = &yys->yyloc;
4062
4063 for (yypp = &yyoptionList->yynext; *yypp != YY_NULLPTR; )
4064 {
4065 yySemanticOption* yyp = *yypp;
4066
4067 if (yyidenticalOptions (yybest, yyp))
4068 {
4069 yymergeOptionSets (yybest, yyp);
4070 *yypp = yyp->yynext;
4071 }
4072 else
4073 {
4074 switch (yypreference (yybest, yyp))
4075 {
4076 case 0:
4077 yyresolveLocations (yys, 1, yystackp, yyparser, scanner, ast, scope);
4078 return yyreportAmbiguity (yybest, yyp, yylocp, yyparser, scanner, ast, scope);
4079 break;
4080 case 1:
4081 yymerge = yytrue;
4082 break;
4083 case 2:
4084 break;
4085 case 3:
4086 yybest = yyp;
4087 yymerge = yyfalse;
4088 break;
4089 default:
4090 /* This cannot happen so it is not worth a YY_ASSERT (yyfalse),
4091 but some compilers complain if the default case is
4092 omitted. */
4093 break;
4094 }
4095 yypp = &yyp->yynext;
4096 }
4097 }
4098
4099 if (yymerge)
4100 {
4101 yySemanticOption* yyp;
4102 int yyprec = yydprec[yybest->yyrule];
4103 yyflag = yyresolveAction (yybest, yystackp, &yyval, yylocp, yyparser, scanner, ast, scope);
4104 if (yyflag == yyok)
4105 for (yyp = yybest->yynext; yyp != YY_NULLPTR; yyp = yyp->yynext)
4106 {
4107 if (yyprec == yydprec[yyp->yyrule])
4108 {
4109 YYSTYPE yyval_other;
4110 YYLTYPE yydummy;
4111 yyflag = yyresolveAction (yyp, yystackp, &yyval_other, &yydummy, yyparser, scanner, ast, scope);
4112 if (yyflag != yyok)
4113 {
4114 yydestruct ("Cleanup: discarding incompletely merged value for",
4115 yy_accessing_symbol (yys->yylrState),
4116 &yyval, yylocp, yyparser, scanner, ast, scope);
4117 break;
4118 }
4119 yyuserMerge (yymerger[yyp->yyrule], &yyval, &yyval_other);
4120 }
4121 }
4122 }
4123 else
4124 yyflag = yyresolveAction (yybest, yystackp, &yyval, yylocp, yyparser, scanner, ast, scope);
4125
4126 if (yyflag == yyok)
4127 {
4128 yys->yyresolved = yytrue;
4129 yys->yysemantics.yyval = yyval;
4130 }
4131 else
4132 yys->yysemantics.yyfirstVal = YY_NULLPTR;
4133 return yyflag;
4134 }
4135
4136 static YYRESULTTAG
yyresolveStack(yyGLRStack * yystackp,yy::parser & yyparser,void * scanner,android::AST * const ast,android::Scope ** const scope)4137 yyresolveStack (yyGLRStack* yystackp, yy::parser& yyparser, void* scanner, android::AST* const ast, android::Scope** const scope)
4138 {
4139 if (yystackp->yysplitPoint != YY_NULLPTR)
4140 {
4141 yyGLRState* yys;
4142 int yyn;
4143
4144 for (yyn = 0, yys = yystackp->yytops.yystates[0];
4145 yys != yystackp->yysplitPoint;
4146 yys = yys->yypred, yyn += 1)
4147 continue;
4148 YYCHK (yyresolveStates (yystackp->yytops.yystates[0], yyn, yystackp
4149 , yyparser, scanner, ast, scope));
4150 }
4151 return yyok;
4152 }
4153
4154 /** Called when returning to deterministic operation to clean up the extra
4155 * stacks. */
4156 static void
yycompressStack(yyGLRStack * yystackp)4157 yycompressStack (yyGLRStack* yystackp)
4158 {
4159 /* yyr is the state after the split point. */
4160 yyGLRState *yyr;
4161
4162 if (yystackp->yytops.yysize != 1 || yystackp->yysplitPoint == YY_NULLPTR)
4163 return;
4164
4165 {
4166 yyGLRState *yyp, *yyq;
4167 for (yyp = yystackp->yytops.yystates[0], yyq = yyp->yypred, yyr = YY_NULLPTR;
4168 yyp != yystackp->yysplitPoint;
4169 yyr = yyp, yyp = yyq, yyq = yyp->yypred)
4170 yyp->yypred = yyr;
4171 }
4172
4173 yystackp->yyspaceLeft += yystackp->yynextFree - yystackp->yyitems;
4174 yystackp->yynextFree = YY_REINTERPRET_CAST (yyGLRStackItem*, yystackp->yysplitPoint) + 1;
4175 yystackp->yyspaceLeft -= yystackp->yynextFree - yystackp->yyitems;
4176 yystackp->yysplitPoint = YY_NULLPTR;
4177 yystackp->yylastDeleted = YY_NULLPTR;
4178
4179 while (yyr != YY_NULLPTR)
4180 {
4181 yystackp->yynextFree->yystate = *yyr;
4182 yyr = yyr->yypred;
4183 yystackp->yynextFree->yystate.yypred = &yystackp->yynextFree[-1].yystate;
4184 yystackp->yytops.yystates[0] = &yystackp->yynextFree->yystate;
4185 yystackp->yynextFree += 1;
4186 yystackp->yyspaceLeft -= 1;
4187 }
4188 }
4189
4190 static YYRESULTTAG
yyprocessOneStack(yyGLRStack * yystackp,YYPTRDIFF_T yyk,YYPTRDIFF_T yyposn,YYLTYPE * yylocp,yy::parser & yyparser,void * scanner,android::AST * const ast,android::Scope ** const scope)4191 yyprocessOneStack (yyGLRStack* yystackp, YYPTRDIFF_T yyk,
4192 YYPTRDIFF_T yyposn, YYLTYPE *yylocp, yy::parser& yyparser, void* scanner, android::AST* const ast, android::Scope** const scope)
4193 {
4194 while (yystackp->yytops.yystates[yyk] != YY_NULLPTR)
4195 {
4196 yy_state_t yystate = yystackp->yytops.yystates[yyk]->yylrState;
4197 YY_DPRINTF ((stderr, "Stack %ld Entering state %d\n",
4198 YY_CAST (long, yyk), yystate));
4199
4200 YY_ASSERT (yystate != YYFINAL);
4201
4202 if (yyisDefaultedState (yystate))
4203 {
4204 YYRESULTTAG yyflag;
4205 yyRuleNum yyrule = yydefaultAction (yystate);
4206 if (yyrule == 0)
4207 {
4208 YY_DPRINTF ((stderr, "Stack %ld dies.\n", YY_CAST (long, yyk)));
4209 yymarkStackDeleted (yystackp, yyk);
4210 return yyok;
4211 }
4212 yyflag = yyglrReduce (yystackp, yyk, yyrule, yyimmediate[yyrule], yyparser, scanner, ast, scope);
4213 if (yyflag == yyerr)
4214 {
4215 YY_DPRINTF ((stderr,
4216 "Stack %ld dies "
4217 "(predicate failure or explicit user error).\n",
4218 YY_CAST (long, yyk)));
4219 yymarkStackDeleted (yystackp, yyk);
4220 return yyok;
4221 }
4222 if (yyflag != yyok)
4223 return yyflag;
4224 }
4225 else
4226 {
4227 yysymbol_kind_t yytoken = yygetToken (&yychar, yystackp, yyparser, scanner, ast, scope);
4228 const short* yyconflicts;
4229 const int yyaction = yygetLRActions (yystate, yytoken, &yyconflicts);
4230 yystackp->yytops.yylookaheadNeeds[yyk] = yytrue;
4231
4232 for (/* nothing */; *yyconflicts; yyconflicts += 1)
4233 {
4234 YYRESULTTAG yyflag;
4235 YYPTRDIFF_T yynewStack = yysplitStack (yystackp, yyk);
4236 YY_DPRINTF ((stderr, "Splitting off stack %ld from %ld.\n",
4237 YY_CAST (long, yynewStack), YY_CAST (long, yyk)));
4238 yyflag = yyglrReduce (yystackp, yynewStack,
4239 *yyconflicts,
4240 yyimmediate[*yyconflicts], yyparser, scanner, ast, scope);
4241 if (yyflag == yyok)
4242 YYCHK (yyprocessOneStack (yystackp, yynewStack,
4243 yyposn, yylocp, yyparser, scanner, ast, scope));
4244 else if (yyflag == yyerr)
4245 {
4246 YY_DPRINTF ((stderr, "Stack %ld dies.\n", YY_CAST (long, yynewStack)));
4247 yymarkStackDeleted (yystackp, yynewStack);
4248 }
4249 else
4250 return yyflag;
4251 }
4252
4253 if (yyisShiftAction (yyaction))
4254 break;
4255 else if (yyisErrorAction (yyaction))
4256 {
4257 YY_DPRINTF ((stderr, "Stack %ld dies.\n", YY_CAST (long, yyk)));
4258 yymarkStackDeleted (yystackp, yyk);
4259 break;
4260 }
4261 else
4262 {
4263 YYRESULTTAG yyflag = yyglrReduce (yystackp, yyk, -yyaction,
4264 yyimmediate[-yyaction], yyparser, scanner, ast, scope);
4265 if (yyflag == yyerr)
4266 {
4267 YY_DPRINTF ((stderr,
4268 "Stack %ld dies "
4269 "(predicate failure or explicit user error).\n",
4270 YY_CAST (long, yyk)));
4271 yymarkStackDeleted (yystackp, yyk);
4272 break;
4273 }
4274 else if (yyflag != yyok)
4275 return yyflag;
4276 }
4277 }
4278 }
4279 return yyok;
4280 }
4281
4282 /* Put in YYARG at most YYARGN of the expected tokens given the
4283 current YYSTACKP, and return the number of tokens stored in YYARG. If
4284 YYARG is null, return the number of expected tokens (guaranteed to
4285 be less than YYNTOKENS). */
4286 static int
yypcontext_expected_tokens(const yyGLRStack * yystackp,yysymbol_kind_t yyarg[],int yyargn)4287 yypcontext_expected_tokens (const yyGLRStack* yystackp,
4288 yysymbol_kind_t yyarg[], int yyargn)
4289 {
4290 /* Actual size of YYARG. */
4291 int yycount = 0;
4292 int yyn = yypact[yystackp->yytops.yystates[0]->yylrState];
4293 if (!yypact_value_is_default (yyn))
4294 {
4295 /* Start YYX at -YYN if negative to avoid negative indexes in
4296 YYCHECK. In other words, skip the first -YYN actions for
4297 this state because they are default actions. */
4298 int yyxbegin = yyn < 0 ? -yyn : 0;
4299 /* Stay within bounds of both yycheck and yytname. */
4300 int yychecklim = YYLAST - yyn + 1;
4301 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
4302 int yyx;
4303 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
4304 if (yycheck[yyx + yyn] == yyx && yyx != S_YYerror
4305 && !yytable_value_is_error (yytable[yyx + yyn]))
4306 {
4307 if (!yyarg)
4308 ++yycount;
4309 else if (yycount == yyargn)
4310 return 0;
4311 else
4312 yyarg[yycount++] = YY_CAST (yysymbol_kind_t, yyx);
4313 }
4314 }
4315 if (yyarg && yycount == 0 && 0 < yyargn)
4316 yyarg[0] = S_YYEMPTY;
4317 return yycount;
4318 }
4319
4320 static int
yy_syntax_error_arguments(const yyGLRStack * yystackp,yysymbol_kind_t yyarg[],int yyargn)4321 yy_syntax_error_arguments (const yyGLRStack* yystackp,
4322 yysymbol_kind_t yyarg[], int yyargn)
4323 {
4324 yysymbol_kind_t yytoken = yychar == YYEMPTY ? S_YYEMPTY : YYTRANSLATE (yychar);
4325 /* Actual size of YYARG. */
4326 int yycount = 0;
4327 /* There are many possibilities here to consider:
4328 - If this state is a consistent state with a default action, then
4329 the only way this function was invoked is if the default action
4330 is an error action. In that case, don't check for expected
4331 tokens because there are none.
4332 - The only way there can be no lookahead present (in yychar) is if
4333 this state is a consistent state with a default action. Thus,
4334 detecting the absence of a lookahead is sufficient to determine
4335 that there is no unexpected or expected token to report. In that
4336 case, just report a simple "syntax error".
4337 - Don't assume there isn't a lookahead just because this state is a
4338 consistent state with a default action. There might have been a
4339 previous inconsistent state, consistent state with a non-default
4340 action, or user semantic action that manipulated yychar.
4341 - Of course, the expected token list depends on states to have
4342 correct lookahead information, and it depends on the parser not
4343 to perform extra reductions after fetching a lookahead from the
4344 scanner and before detecting a syntax error. Thus, state merging
4345 (from LALR or IELR) and default reductions corrupt the expected
4346 token list. However, the list is correct for canonical LR with
4347 one exception: it will still contain any token that will not be
4348 accepted due to an error action in a later state.
4349 */
4350 if (yytoken != S_YYEMPTY)
4351 {
4352 int yyn;
4353 if (yyarg)
4354 yyarg[yycount] = yytoken;
4355 ++yycount;
4356 yyn = yypcontext_expected_tokens (yystackp,
4357 yyarg ? yyarg + 1 : yyarg, yyargn - 1);
4358 if (yyn == YYENOMEM)
4359 return YYENOMEM;
4360 else
4361 yycount += yyn;
4362 }
4363 return yycount;
4364 }
4365
4366
4367
4368 static void
yyreportSyntaxError(yyGLRStack * yystackp,yy::parser & yyparser,void * scanner,android::AST * const ast,android::Scope ** const scope)4369 yyreportSyntaxError (yyGLRStack* yystackp, yy::parser& yyparser, void* scanner, android::AST* const ast, android::Scope** const scope)
4370 {
4371 if (yystackp->yyerrState != 0)
4372 return;
4373 {
4374 yybool yysize_overflow = yyfalse;
4375 char* yymsg = YY_NULLPTR;
4376 enum { YYARGS_MAX = 5 };
4377 /* Internationalized format string. */
4378 const char *yyformat = YY_NULLPTR;
4379 /* Arguments of yyformat: reported tokens (one for the "unexpected",
4380 one per "expected"). */
4381 yysymbol_kind_t yyarg[YYARGS_MAX];
4382 /* Cumulated lengths of YYARG. */
4383 YYPTRDIFF_T yysize = 0;
4384
4385 /* Actual size of YYARG. */
4386 int yycount
4387 = yy_syntax_error_arguments (yystackp, yyarg, YYARGS_MAX);
4388 if (yycount == YYENOMEM)
4389 yyMemoryExhausted (yystackp);
4390
4391 switch (yycount)
4392 {
4393 #define YYCASE_(N, S) \
4394 case N: \
4395 yyformat = S; \
4396 break
4397 default: /* Avoid compiler warnings. */
4398 YYCASE_(0, YY_("syntax error"));
4399 YYCASE_(1, YY_("syntax error, unexpected %s"));
4400 YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
4401 YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
4402 YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
4403 YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
4404 #undef YYCASE_
4405 }
4406
4407 /* Compute error message size. Don't count the "%s"s, but reserve
4408 room for the terminator. */
4409 yysize = yystrlen (yyformat) - 2 * yycount + 1;
4410 {
4411 int yyi;
4412 for (yyi = 0; yyi < yycount; ++yyi)
4413 {
4414 YYPTRDIFF_T yysz
4415 = yytnamerr (YY_NULLPTR, yytname[yyarg[yyi]]);
4416 if (YYSIZE_MAXIMUM - yysize < yysz)
4417 yysize_overflow = yytrue;
4418 else
4419 yysize += yysz;
4420 }
4421 }
4422
4423 if (!yysize_overflow)
4424 yymsg = YY_CAST (char *, YYMALLOC (YY_CAST (YYSIZE_T, yysize)));
4425
4426 if (yymsg)
4427 {
4428 char *yyp = yymsg;
4429 int yyi = 0;
4430 while ((*yyp = *yyformat))
4431 {
4432 if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
4433 {
4434 yyp += yytnamerr (yyp, yytname[yyarg[yyi++]]);
4435 yyformat += 2;
4436 }
4437 else
4438 {
4439 ++yyp;
4440 ++yyformat;
4441 }
4442 }
4443 yyerror (&yylloc, yyparser, scanner, ast, scope, yymsg);
4444 YYFREE (yymsg);
4445 }
4446 else
4447 {
4448 yyerror (&yylloc, yyparser, scanner, ast, scope, YY_("syntax error"));
4449 yyMemoryExhausted (yystackp);
4450 }
4451 }
4452 yynerrs += 1;
4453 }
4454
4455 /* Recover from a syntax error on *YYSTACKP, assuming that *YYSTACKP->YYTOKENP,
4456 yylval, and yylloc are the syntactic category, semantic value, and location
4457 of the lookahead. */
4458 static void
yyrecoverSyntaxError(yyGLRStack * yystackp,yy::parser & yyparser,void * scanner,android::AST * const ast,android::Scope ** const scope)4459 yyrecoverSyntaxError (yyGLRStack* yystackp, yy::parser& yyparser, void* scanner, android::AST* const ast, android::Scope** const scope)
4460 {
4461 if (yystackp->yyerrState == 3)
4462 /* We just shifted the error token and (perhaps) took some
4463 reductions. Skip tokens until we can proceed. */
4464 while (yytrue)
4465 {
4466 yysymbol_kind_t yytoken;
4467 int yyj;
4468 if (yychar == YYEOF)
4469 yyFail (yystackp, &yylloc, yyparser, scanner, ast, scope, YY_NULLPTR);
4470 if (yychar != YYEMPTY)
4471 {
4472 /* We throw away the lookahead, but the error range
4473 of the shifted error token must take it into account. */
4474 yyGLRState *yys = yystackp->yytops.yystates[0];
4475 yyGLRStackItem yyerror_range[3];
4476 yyerror_range[1].yystate.yyloc = yys->yyloc;
4477 yyerror_range[2].yystate.yyloc = yylloc;
4478 YYLLOC_DEFAULT ((yys->yyloc), yyerror_range, 2);
4479 yytoken = YYTRANSLATE (yychar);
4480 yydestruct ("Error: discarding",
4481 yytoken, &yylval, &yylloc, yyparser, scanner, ast, scope);
4482 yychar = YYEMPTY;
4483 }
4484 yytoken = yygetToken (&yychar, yystackp, yyparser, scanner, ast, scope);
4485 yyj = yypact[yystackp->yytops.yystates[0]->yylrState];
4486 if (yypact_value_is_default (yyj))
4487 return;
4488 yyj += yytoken;
4489 if (yyj < 0 || YYLAST < yyj || yycheck[yyj] != yytoken)
4490 {
4491 if (yydefact[yystackp->yytops.yystates[0]->yylrState] != 0)
4492 return;
4493 }
4494 else if (! yytable_value_is_error (yytable[yyj]))
4495 return;
4496 }
4497
4498 /* Reduce to one stack. */
4499 {
4500 YYPTRDIFF_T yyk;
4501 for (yyk = 0; yyk < yystackp->yytops.yysize; yyk += 1)
4502 if (yystackp->yytops.yystates[yyk] != YY_NULLPTR)
4503 break;
4504 if (yyk >= yystackp->yytops.yysize)
4505 yyFail (yystackp, &yylloc, yyparser, scanner, ast, scope, YY_NULLPTR);
4506 for (yyk += 1; yyk < yystackp->yytops.yysize; yyk += 1)
4507 yymarkStackDeleted (yystackp, yyk);
4508 yyremoveDeletes (yystackp);
4509 yycompressStack (yystackp);
4510 }
4511
4512 /* Pop stack until we find a state that shifts the error token. */
4513 yystackp->yyerrState = 3;
4514 while (yystackp->yytops.yystates[0] != YY_NULLPTR)
4515 {
4516 yyGLRState *yys = yystackp->yytops.yystates[0];
4517 int yyj = yypact[yys->yylrState];
4518 if (! yypact_value_is_default (yyj))
4519 {
4520 yyj += S_YYerror;
4521 if (0 <= yyj && yyj <= YYLAST && yycheck[yyj] == S_YYerror
4522 && yyisShiftAction (yytable[yyj]))
4523 {
4524 /* Shift the error token. */
4525 int yyaction = yytable[yyj];
4526 /* First adjust its location.*/
4527 YYLTYPE yyerrloc;
4528 yystackp->yyerror_range[2].yystate.yyloc = yylloc;
4529 YYLLOC_DEFAULT (yyerrloc, (yystackp->yyerror_range), 2);
4530 YY_SYMBOL_PRINT ("Shifting", yy_accessing_symbol (yyaction),
4531 &yylval, &yyerrloc);
4532 yyglrShift (yystackp, 0, yyaction,
4533 yys->yyposn, &yylval, &yyerrloc);
4534 yys = yystackp->yytops.yystates[0];
4535 break;
4536 }
4537 }
4538 yystackp->yyerror_range[1].yystate.yyloc = yys->yyloc;
4539 if (yys->yypred != YY_NULLPTR)
4540 yydestroyGLRState ("Error: popping", yys, yyparser, scanner, ast, scope);
4541 yystackp->yytops.yystates[0] = yys->yypred;
4542 yystackp->yynextFree -= 1;
4543 yystackp->yyspaceLeft += 1;
4544 }
4545 if (yystackp->yytops.yystates[0] == YY_NULLPTR)
4546 yyFail (yystackp, &yylloc, yyparser, scanner, ast, scope, YY_NULLPTR);
4547 }
4548
4549 #define YYCHK1(YYE) \
4550 do { \
4551 switch (YYE) { \
4552 case yyok: break; \
4553 case yyabort: goto yyabortlab; \
4554 case yyaccept: goto yyacceptlab; \
4555 case yyerr: goto yyuser_error; \
4556 case yynomem: goto yyexhaustedlab; \
4557 default: goto yybuglab; \
4558 } \
4559 } while (0)
4560
4561 /*----------.
4562 | yyparse. |
4563 `----------*/
4564
4565 int
yy_parse_impl(yy::parser & yyparser,void * scanner,android::AST * const ast,android::Scope ** const scope)4566 yy_parse_impl (yy::parser& yyparser, void* scanner, android::AST* const ast, android::Scope** const scope)
4567 {
4568 int yyresult;
4569 yyGLRStack yystack;
4570 yyGLRStack* const yystackp = &yystack;
4571 YYPTRDIFF_T yyposn;
4572
4573 YY_DPRINTF ((stderr, "Starting parse\n"));
4574
4575 yychar = YYEMPTY;
4576 yylval = yyval_default;
4577 yylloc = yyloc_default;
4578
4579 // User initialization code.
4580 yylloc.initialize ();
4581 #line 211 "system/tools/hidl/hidl-gen_y.yy"
4582 {
4583 // Initialize the initial location.
4584 yylloc.begin.filename = yylloc.end.filename =
4585 const_cast<std::string *>(&ast->getFilename());
4586 }
4587
4588 #line 4589 "out/soong/.intermediates/system/tools/hidl/libhidl-gen-ast/linux_glibc_x86_64_static/gen/yacc/system/tools/hidl/hidl-gen_y.cpp"
4589
4590
4591 if (! yyinitGLRStack (yystackp, YYINITDEPTH))
4592 goto yyexhaustedlab;
4593 switch (YYSETJMP (yystack.yyexception_buffer))
4594 {
4595 case 0: break;
4596 case 1: goto yyabortlab;
4597 case 2: goto yyexhaustedlab;
4598 default: goto yybuglab;
4599 }
4600 yyglrShift (&yystack, 0, 0, 0, &yylval, &yylloc);
4601 yyposn = 0;
4602
4603 while (yytrue)
4604 {
4605 /* For efficiency, we have two loops, the first of which is
4606 specialized to deterministic operation (single stack, no
4607 potential ambiguity). */
4608 /* Standard mode. */
4609 while (yytrue)
4610 {
4611 yy_state_t yystate = yystack.yytops.yystates[0]->yylrState;
4612 YY_DPRINTF ((stderr, "Entering state %d\n", yystate));
4613 if (yystate == YYFINAL)
4614 goto yyacceptlab;
4615 if (yyisDefaultedState (yystate))
4616 {
4617 yyRuleNum yyrule = yydefaultAction (yystate);
4618 if (yyrule == 0)
4619 {
4620 yystack.yyerror_range[1].yystate.yyloc = yylloc;
4621 yyreportSyntaxError (&yystack, yyparser, scanner, ast, scope);
4622 goto yyuser_error;
4623 }
4624 YYCHK1 (yyglrReduce (&yystack, 0, yyrule, yytrue, yyparser, scanner, ast, scope));
4625 }
4626 else
4627 {
4628 yysymbol_kind_t yytoken = yygetToken (&yychar, yystackp, yyparser, scanner, ast, scope);
4629 const short* yyconflicts;
4630 int yyaction = yygetLRActions (yystate, yytoken, &yyconflicts);
4631 if (*yyconflicts)
4632 /* Enter nondeterministic mode. */
4633 break;
4634 if (yyisShiftAction (yyaction))
4635 {
4636 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
4637 yychar = YYEMPTY;
4638 yyposn += 1;
4639 yyglrShift (&yystack, 0, yyaction, yyposn, &yylval, &yylloc);
4640 if (0 < yystack.yyerrState)
4641 yystack.yyerrState -= 1;
4642 }
4643 else if (yyisErrorAction (yyaction))
4644 {
4645 yystack.yyerror_range[1].yystate.yyloc = yylloc;
4646 /* Issue an error message unless the scanner already
4647 did. */
4648 if (yychar != YYerror)
4649 yyreportSyntaxError (&yystack, yyparser, scanner, ast, scope);
4650 goto yyuser_error;
4651 }
4652 else
4653 YYCHK1 (yyglrReduce (&yystack, 0, -yyaction, yytrue, yyparser, scanner, ast, scope));
4654 }
4655 }
4656
4657 /* Nondeterministic mode. */
4658 while (yytrue)
4659 {
4660 yysymbol_kind_t yytoken_to_shift;
4661 YYPTRDIFF_T yys;
4662
4663 for (yys = 0; yys < yystack.yytops.yysize; yys += 1)
4664 yystackp->yytops.yylookaheadNeeds[yys] = yychar != YYEMPTY;
4665
4666 /* yyprocessOneStack returns one of three things:
4667
4668 - An error flag. If the caller is yyprocessOneStack, it
4669 immediately returns as well. When the caller is finally
4670 yyparse, it jumps to an error label via YYCHK1.
4671
4672 - yyok, but yyprocessOneStack has invoked yymarkStackDeleted
4673 (&yystack, yys), which sets the top state of yys to NULL. Thus,
4674 yyparse's following invocation of yyremoveDeletes will remove
4675 the stack.
4676
4677 - yyok, when ready to shift a token.
4678
4679 Except in the first case, yyparse will invoke yyremoveDeletes and
4680 then shift the next token onto all remaining stacks. This
4681 synchronization of the shift (that is, after all preceding
4682 reductions on all stacks) helps prevent double destructor calls
4683 on yylval in the event of memory exhaustion. */
4684
4685 for (yys = 0; yys < yystack.yytops.yysize; yys += 1)
4686 YYCHK1 (yyprocessOneStack (&yystack, yys, yyposn, &yylloc, yyparser, scanner, ast, scope));
4687 yyremoveDeletes (&yystack);
4688 if (yystack.yytops.yysize == 0)
4689 {
4690 yyundeleteLastStack (&yystack);
4691 if (yystack.yytops.yysize == 0)
4692 yyFail (&yystack, &yylloc, yyparser, scanner, ast, scope, YY_("syntax error"));
4693 YYCHK1 (yyresolveStack (&yystack, yyparser, scanner, ast, scope));
4694 YY_DPRINTF ((stderr, "Returning to deterministic operation.\n"));
4695 yystack.yyerror_range[1].yystate.yyloc = yylloc;
4696 yyreportSyntaxError (&yystack, yyparser, scanner, ast, scope);
4697 goto yyuser_error;
4698 }
4699
4700 /* If any yyglrShift call fails, it will fail after shifting. Thus,
4701 a copy of yylval will already be on stack 0 in the event of a
4702 failure in the following loop. Thus, yychar is set to YYEMPTY
4703 before the loop to make sure the user destructor for yylval isn't
4704 called twice. */
4705 yytoken_to_shift = YYTRANSLATE (yychar);
4706 yychar = YYEMPTY;
4707 yyposn += 1;
4708 for (yys = 0; yys < yystack.yytops.yysize; yys += 1)
4709 {
4710 yy_state_t yystate = yystack.yytops.yystates[yys]->yylrState;
4711 const short* yyconflicts;
4712 int yyaction = yygetLRActions (yystate, yytoken_to_shift,
4713 &yyconflicts);
4714 /* Note that yyconflicts were handled by yyprocessOneStack. */
4715 YY_DPRINTF ((stderr, "On stack %ld, ", YY_CAST (long, yys)));
4716 YY_SYMBOL_PRINT ("shifting", yytoken_to_shift, &yylval, &yylloc);
4717 yyglrShift (&yystack, yys, yyaction, yyposn,
4718 &yylval, &yylloc);
4719 YY_DPRINTF ((stderr, "Stack %ld now in state %d\n",
4720 YY_CAST (long, yys),
4721 yystack.yytops.yystates[yys]->yylrState));
4722 }
4723
4724 if (yystack.yytops.yysize == 1)
4725 {
4726 YYCHK1 (yyresolveStack (&yystack, yyparser, scanner, ast, scope));
4727 YY_DPRINTF ((stderr, "Returning to deterministic operation.\n"));
4728 yycompressStack (&yystack);
4729 break;
4730 }
4731 }
4732 continue;
4733 yyuser_error:
4734 yyrecoverSyntaxError (&yystack, yyparser, scanner, ast, scope);
4735 yyposn = yystack.yytops.yystates[0]->yyposn;
4736 }
4737
4738 yyacceptlab:
4739 yyresult = 0;
4740 goto yyreturnlab;
4741
4742 yybuglab:
4743 YY_ASSERT (yyfalse);
4744 goto yyabortlab;
4745
4746 yyabortlab:
4747 yyresult = 1;
4748 goto yyreturnlab;
4749
4750 yyexhaustedlab:
4751 yyerror (&yylloc, yyparser, scanner, ast, scope, YY_("memory exhausted"));
4752 yyresult = 2;
4753 goto yyreturnlab;
4754
4755 yyreturnlab:
4756 if (yychar != YYEMPTY)
4757 yydestruct ("Cleanup: discarding lookahead",
4758 YYTRANSLATE (yychar), &yylval, &yylloc, yyparser, scanner, ast, scope);
4759
4760 /* If the stack is well-formed, pop the stack until it is empty,
4761 destroying its entries as we go. But free the stack regardless
4762 of whether it is well-formed. */
4763 if (yystack.yyitems)
4764 {
4765 yyGLRState** yystates = yystack.yytops.yystates;
4766 if (yystates)
4767 {
4768 YYPTRDIFF_T yysize = yystack.yytops.yysize;
4769 YYPTRDIFF_T yyk;
4770 for (yyk = 0; yyk < yysize; yyk += 1)
4771 if (yystates[yyk])
4772 {
4773 while (yystates[yyk])
4774 {
4775 yyGLRState *yys = yystates[yyk];
4776 yystack.yyerror_range[1].yystate.yyloc = yys->yyloc;
4777 if (yys->yypred != YY_NULLPTR)
4778 yydestroyGLRState ("Cleanup: popping", yys, yyparser, scanner, ast, scope);
4779 yystates[yyk] = yys->yypred;
4780 yystack.yynextFree -= 1;
4781 yystack.yyspaceLeft += 1;
4782 }
4783 break;
4784 }
4785 }
4786 yyfreeGLRStack (&yystack);
4787 }
4788
4789 return yyresult;
4790 }
4791
4792 /* DEBUGGING ONLY */
4793 #if YYDEBUG
4794 /* Print *YYS and its predecessors. */
4795 static void
yy_yypstack(yyGLRState * yys)4796 yy_yypstack (yyGLRState* yys)
4797 {
4798 if (yys->yypred)
4799 {
4800 yy_yypstack (yys->yypred);
4801 YY_FPRINTF ((stderr, " -> "));
4802 }
4803 YY_FPRINTF ((stderr, "%d@%ld", yys->yylrState, YY_CAST (long, yys->yyposn)));
4804 }
4805
4806 /* Print YYS (possibly NULL) and its predecessors. */
4807 static void
yypstates(yyGLRState * yys)4808 yypstates (yyGLRState* yys)
4809 {
4810 if (yys == YY_NULLPTR)
4811 YY_FPRINTF ((stderr, "<null>"));
4812 else
4813 yy_yypstack (yys);
4814 YY_FPRINTF ((stderr, "\n"));
4815 }
4816
4817 /* Print the stack #YYK. */
4818 static void
yypstack(yyGLRStack * yystackp,YYPTRDIFF_T yyk)4819 yypstack (yyGLRStack* yystackp, YYPTRDIFF_T yyk)
4820 {
4821 yypstates (yystackp->yytops.yystates[yyk]);
4822 }
4823
4824 /* Print all the stacks. */
4825 static void
yypdumpstack(yyGLRStack * yystackp)4826 yypdumpstack (yyGLRStack* yystackp)
4827 {
4828 #define YYINDEX(YYX) \
4829 YY_CAST (long, \
4830 ((YYX) \
4831 ? YY_REINTERPRET_CAST (yyGLRStackItem*, (YYX)) - yystackp->yyitems \
4832 : -1))
4833
4834 yyGLRStackItem* yyp;
4835 for (yyp = yystackp->yyitems; yyp < yystackp->yynextFree; yyp += 1)
4836 {
4837 YY_FPRINTF ((stderr, "%3ld. ",
4838 YY_CAST (long, yyp - yystackp->yyitems)));
4839 if (*YY_REINTERPRET_CAST (yybool *, yyp))
4840 {
4841 YY_ASSERT (yyp->yystate.yyisState);
4842 YY_ASSERT (yyp->yyoption.yyisState);
4843 YY_FPRINTF ((stderr, "Res: %d, LR State: %d, posn: %ld, pred: %ld",
4844 yyp->yystate.yyresolved, yyp->yystate.yylrState,
4845 YY_CAST (long, yyp->yystate.yyposn),
4846 YYINDEX (yyp->yystate.yypred)));
4847 if (! yyp->yystate.yyresolved)
4848 YY_FPRINTF ((stderr, ", firstVal: %ld",
4849 YYINDEX (yyp->yystate.yysemantics.yyfirstVal)));
4850 }
4851 else
4852 {
4853 YY_ASSERT (!yyp->yystate.yyisState);
4854 YY_ASSERT (!yyp->yyoption.yyisState);
4855 YY_FPRINTF ((stderr, "Option. rule: %d, state: %ld, next: %ld",
4856 yyp->yyoption.yyrule - 1,
4857 YYINDEX (yyp->yyoption.yystate),
4858 YYINDEX (yyp->yyoption.yynext)));
4859 }
4860 YY_FPRINTF ((stderr, "\n"));
4861 }
4862
4863 YY_FPRINTF ((stderr, "Tops:"));
4864 {
4865 YYPTRDIFF_T yyi;
4866 for (yyi = 0; yyi < yystackp->yytops.yysize; yyi += 1)
4867 YY_FPRINTF ((stderr, "%ld: %ld; ", YY_CAST (long, yyi),
4868 YYINDEX (yystackp->yytops.yystates[yyi])));
4869 YY_FPRINTF ((stderr, "\n"));
4870 }
4871 #undef YYINDEX
4872 }
4873 #endif
4874
4875 #undef yylval
4876 #undef yychar
4877 #undef yynerrs
4878 #undef yylloc
4879
4880
4881
4882 #line 4883 "out/soong/.intermediates/system/tools/hidl/libhidl-gen-ast/linux_glibc_x86_64_static/gen/yacc/system/tools/hidl/hidl-gen_y.cpp"
4883
4884 /*------------------.
4885 | Report an error. |
4886 `------------------*/
4887
4888 static void
yyerror(const yy::parser::location_type * yylocationp,yy::parser & yyparser,void * scanner,android::AST * const ast,android::Scope ** const scope,const char * msg)4889 yyerror (const yy::parser::location_type *yylocationp,
4890 yy::parser& yyparser, void* scanner, android::AST* const ast, android::Scope** const scope,
4891 const char* msg)
4892 {
4893 YY_USE (yyparser);
4894 YY_USE (scanner);
4895 YY_USE (ast);
4896 YY_USE (scope);
4897 yyparser.error (*yylocationp, msg);
4898 }
4899
4900
4901 namespace yy {
4902 #line 4903 "out/soong/.intermediates/system/tools/hidl/libhidl-gen-ast/linux_glibc_x86_64_static/gen/yacc/system/tools/hidl/hidl-gen_y.cpp"
4903
4904 /// Build a parser object.
parser(void * scanner_yyarg,android::AST * const ast_yyarg,android::Scope ** const scope_yyarg)4905 parser::parser (void* scanner_yyarg, android::AST* const ast_yyarg, android::Scope** const scope_yyarg)
4906 :
4907 #if YYDEBUG
4908 yycdebug_ (&std::cerr),
4909 #endif
4910 scanner (scanner_yyarg),
4911 ast (ast_yyarg),
4912 scope (scope_yyarg)
4913 {}
4914
~parser()4915 parser::~parser ()
4916 {}
4917
~syntax_error()4918 parser::syntax_error::~syntax_error () YY_NOEXCEPT YY_NOTHROW
4919 {}
4920
4921 int
operator ()()4922 parser::operator() ()
4923 {
4924 return parse ();
4925 }
4926
4927 int
parse()4928 parser::parse ()
4929 {
4930 return ::yy_parse_impl (*this, scanner, ast, scope);
4931 }
4932
4933 #if YYDEBUG
4934 /*--------------------.
4935 | Print this symbol. |
4936 `--------------------*/
4937
4938 void
yy_symbol_value_print_(symbol_kind_type yykind,const value_type * yyvaluep,const location_type * yylocationp) const4939 parser::yy_symbol_value_print_ (symbol_kind_type yykind,
4940 const value_type* yyvaluep,
4941 const location_type* yylocationp) const
4942 {
4943 YY_USE (yylocationp);
4944 YY_USE (yyvaluep);
4945 std::ostream& yyo = debug_stream ();
4946 std::ostream& yyoutput = yyo;
4947 YY_USE (yyoutput);
4948 YY_USE (yykind);
4949 }
4950
4951
4952 void
yy_symbol_print_(symbol_kind_type yykind,const value_type * yyvaluep,const location_type * yylocationp) const4953 parser::yy_symbol_print_ (symbol_kind_type yykind,
4954 const value_type* yyvaluep,
4955 const location_type* yylocationp) const
4956 {
4957 *yycdebug_ << (yykind < YYNTOKENS ? "token" : "nterm")
4958 << ' ' << yysymbol_name (yykind) << " ("
4959 << *yylocationp << ": ";
4960 yy_symbol_value_print_ (yykind, yyvaluep, yylocationp);
4961 *yycdebug_ << ')';
4962 }
4963
4964 std::ostream&
debug_stream() const4965 parser::debug_stream () const
4966 {
4967 return *yycdebug_;
4968 }
4969
4970 void
set_debug_stream(std::ostream & o)4971 parser::set_debug_stream (std::ostream& o)
4972 {
4973 yycdebug_ = &o;
4974 }
4975
4976
4977 parser::debug_level_type
debug_level() const4978 parser::debug_level () const
4979 {
4980 return yydebug;
4981 }
4982
4983 void
set_debug_level(debug_level_type l)4984 parser::set_debug_level (debug_level_type l)
4985 {
4986 // Actually, it is yydebug which is really used.
4987 yydebug = l;
4988 }
4989
4990 #endif
4991 } // yy
4992 #line 4993 "out/soong/.intermediates/system/tools/hidl/libhidl-gen-ast/linux_glibc_x86_64_static/gen/yacc/system/tools/hidl/hidl-gen_y.cpp"
4993
4994 #undef YYEMPTY
4995 #undef YYEOF
4996 #undef YYerror
4997
4998 #undef S_YYEMPTY
4999 #undef S_YYEOF
5000 #undef S_YYerror
5001 #undef S_YYUNDEF
5002 #undef S_MULTILINE_COMMENT
5003 #undef S_DOC_COMMENT
5004 #undef S_ENUM
5005 #undef S_EXTENDS
5006 #undef S_FQNAME
5007 #undef S_GENERATES
5008 #undef S_IDENTIFIER
5009 #undef S_IMPORT
5010 #undef S_INTEGER
5011 #undef S_FLOAT
5012 #undef S_INTERFACE
5013 #undef S_PACKAGE
5014 #undef S_TYPE
5015 #undef S_STRUCT
5016 #undef S_STRING_LITERAL
5017 #undef S_TYPEDEF
5018 #undef S_UNION
5019 #undef S_SAFE_UNION
5020 #undef S_TEMPLATED
5021 #undef S_ONEWAY
5022 #undef S_UNKNOWN
5023 #undef S_24_
5024 #undef S_25_
5025 #undef S_LOGICAL_OR
5026 #undef S_LOGICAL_AND
5027 #undef S_28_
5028 #undef S_29_
5029 #undef S_30_
5030 #undef S_EQUALITY
5031 #undef S_NEQ
5032 #undef S_33_
5033 #undef S_34_
5034 #undef S_LEQ
5035 #undef S_GEQ
5036 #undef S_LSHIFT
5037 #undef S_RSHIFT
5038 #undef S_39_
5039 #undef S_40_
5040 #undef S_41_
5041 #undef S_42_
5042 #undef S_43_
5043 #undef S_UNARY_MINUS
5044 #undef S_UNARY_PLUS
5045 #undef S_46_
5046 #undef S_47_
5047 #undef S_48_
5048 #undef S_49_
5049 #undef S_50_
5050 #undef S_51_
5051 #undef S_52_
5052 #undef S_53_
5053 #undef S_54_
5054 #undef S_55_
5055 #undef S_56_
5056 #undef S_57_
5057 #undef S_58_
5058 #undef S_YYACCEPT
5059 #undef S_program
5060 #undef S_doc_comment
5061 #undef S_doc_comments
5062 #undef S_ignore_doc_comments
5063 #undef S_valid_identifier
5064 #undef S_valid_type_name
5065 #undef S_opt_annotations
5066 #undef S_annotation
5067 #undef S_opt_annotation_params
5068 #undef S_annotation_params
5069 #undef S_annotation_param
5070 #undef S_annotation_string_value
5071 #undef S_annotation_string_values
5072 #undef S_error_stmt
5073 #undef S_require_semicolon
5074 #undef S_fqname
5075 #undef S_fqtype
5076 #undef S_package
5077 #undef S_import_stmt
5078 #undef S_opt_extends
5079 #undef S_interface_declarations
5080 #undef S_declarations
5081 #undef S_commentable_declaration
5082 #undef S_commentable_type_declaration
5083 #undef S_type_declaration
5084 #undef S_type_declaration_body
5085 #undef S_interface_declaration
5086 #undef S_87_1
5087 #undef S_interface_declaration_body
5088 #undef S_typedef_declaration
5089 #undef S_const_expr
5090 #undef S_commentable_method_declaration
5091 #undef S_method_declaration
5092 #undef S_typed_vars
5093 #undef S_non_empty_typed_vars
5094 #undef S_typed_var
5095 #undef S_uncommented_typed_var
5096 #undef S_struct_or_union_keyword
5097 #undef S_named_struct_or_union_declaration
5098 #undef S_99_2
5099 #undef S_struct_or_union_body
5100 #undef S_field_declarations
5101 #undef S_commentable_field_declaration
5102 #undef S_field_declaration
5103 #undef S_annotated_compound_declaration
5104 #undef S_compound_declaration
5105 #undef S_enum_storage_type
5106 #undef S_named_enum_declaration
5107 #undef S_108_3
5108 #undef S_enum_declaration_body
5109 #undef S_commentable_enum_value
5110 #undef S_enum_value
5111 #undef S_enum_values
5112 #undef S_array_type_base
5113 #undef S_array_type
5114 #undef S_type
5115 #undef S_type_or_inplace_compound_declaration
5116
5117 #line 1149 "system/tools/hidl/hidl-gen_y.yy"
5118
5119
error(const yy::parser::location_type & where,const std::string & errstr)5120 void yy::parser::error(
5121 const yy::parser::location_type &where,
5122 const std::string &errstr) {
5123 std::cerr << "ERROR: " << errstr << " at " << where << "\n";
5124 }
5125