4 #define YYLTYPE Location
8 # define YYLLOC_DEFAULT(Current, Rhs, N) \
9 (Current).start = (Rhs)[1].start; \
10 (Current).end = (Rhs)[N].end;
14 extern File fileInput;
20 bool deleteWatchable = false;
22 #define MAX_STRUCT_LEVELS 256
23 AccessMode memberAccessStack[MAX_STRUCT_LEVELS];
24 int defaultMemberAccess = -1;
26 #define POP_DEFAULT_ACCESS if(defaultMemberAccess > -1) defaultMemberAccess--;
36 SpecifierType specifierType;
43 Enumerator enumerator;
44 Declarator declarator;
46 Initializer initializer;
47 InitDeclarator initDeclarator;
49 Declaration declaration;
51 FunctionDefinition function;
59 Instantiation instance;
60 MembersInit membersInit;
61 MemberInit memberInit;
62 ClassFunction classFunction;
63 ClassDefinition _class;
68 PropertyWatch propertyWatch;
69 TemplateParameter templateParameter;
70 TemplateArgument templateArgument;
71 TemplateDatatype templateDatatype;
73 DBTableEntry dbtableEntry;
74 DBIndexItem dbindexItem;
75 DBTableDef dbtableDef;
80 %type <symbol> class_decl
81 %type <specifierType> struct_or_union
82 %type <i> unary_operator assignment_operator
83 %type <declMode> member_access declaration_mode
84 %type <id> identifier enum_decl
85 %type <exp> primary_expression primary_expression_error postfix_expression unary_expression cast_expression
86 multiplicative_expression additive_expression shift_expression
87 relational_expression relational_expression_smaller_than equality_expression and_expression
88 exclusive_or_expression inclusive_or_expression logical_and_expression
89 logical_or_expression conditional_expression assignment_expression
90 constant_expression constant_expression_error
91 anon_instantiation_expression anon_instantiation_expression_error i18n_string
92 postfix_expression_error unary_expression_error cast_expression_error
93 multiplicative_expression_error additive_expression_error shift_expression_error
94 relational_expression_error equality_expression_error and_expression_error
95 exclusive_or_expression_error inclusive_or_expression_error logical_and_expression_error
96 logical_or_expression_error conditional_expression_error assignment_expression_error
97 simple_primary_expression
98 simple_postfix_expression simple_postfix_expression_error
99 common_unary_expression common_unary_expression_error
100 simple_unary_expression simple_unary_expression_error
101 database_open dbfield dbindex dbtable
103 %type <list> argument_expression_list expression expression_anon_inst expression_anon_inst_error enumerator_list type_qualifier_list
104 struct_declarator_list struct_declaration_list
105 declaration_specifiers identifier_list identifier_list_error initializer_list init_declarator_list
106 parameter_list parameter_list_error parameter_type_list parameter_type_list_error declaration_list declaration_list_error statement_list statement_list_error
107 translation_unit members_initialization_list members_initialization_list_coloned members_initialization_list_error data_member_initialization_list data_member_initialization_list_coloned
108 default_property_list data_member_initialization_list_error
109 expression_error init_declarator_list_error argument_expression_list_error default_property_list_error struct_declaration_list_error
110 translation_unit_error
111 guess_declaration_specifiers
112 external_guess_declaration_specifiers external_guess_declaration_specifiers_error
113 specifier_qualifier_list guess_specifier_qualifier_list
114 _inheritance_specifiers inheritance_specifiers property_specifiers
115 new_specifiers renew_specifiers asm_field_list
116 property_watch_list watch_property_list
117 dbindex_item_list dbfield_definition_list
118 template_arguments_list template_parameters_list attribs_list
120 %type <asmField> asm_field
121 %type <specifier> storage_class_specifier enum_specifier_compound enum_specifier_nocompound type_qualifier type_specifier class_specifier class_specifier_error
122 struct_or_union_specifier_compound struct_or_union_specifier_nocompound ext_storage type strict_type guess_type enum_class strict_type_specifier struct_class
123 struct_or_union_specifier_compound_error struct_class_error struct_decl
124 enum_specifier_compound_error enum_class_error external_storage_class_specifier
125 base_strict_type struct_head struct_entry
126 %type <enumerator> enumerator
127 %type <declarator> declarator direct_declarator direct_abstract_declarator abstract_declarator
128 direct_abstract_declarator_noarray abstract_declarator_noarray
129 struct_declarator direct_declarator_function direct_declarator_function_start declarator_function_error direct_declarator_function_error declarator_function direct_declarator_nofunction
130 declarator_nofunction
131 %type <pointer> pointer
132 %type <initializer> initializer initializer_error initializer_condition initializer_condition_error
133 %type <initDeclarator> init_declarator init_declarator_error
134 %type <typeName> type_name guess_type_name parameter_declaration parameter_declaration_error
135 %type <stmt> statement labeled_statement labeled_statement_error compound_statement compound_statement_error expression_statement
136 selection_statement selection_statement_error iteration_statement jump_statement jump_statement_error compound_inside compound_inside_error
137 iteration_statement_error statement_error asm_statement
138 stopwatching watch_definition firewatchers
140 %type <declaration> declaration declaration_error external_guess_declaration external_guess_declaration_error
141 %type <function> function_definition function_definition_error
142 %type <external> external_declaration external_declaration_error
144 %type <instance> instantiation_named instantiation_named_error instantiation_unnamed instantiation_unnamed_error guess_instantiation_named guess_instantiation_named_error external_guess_instantiation_named
145 instantiation_anon instantiation_anon_error
146 %type <memberInit> data_member_initialization data_member_initialization_error default_property default_property_error
147 %type <classFunction> class_function_definition class_function_definition_error class_function_definition_start
148 class_function_definition_start_error virtual_class_function_definition_start virtual_class_function_definition_start_error
149 constructor_function_definition_start destructor_function_definition_start
150 %type <classFunction> instance_class_function_definition instance_class_function_definition_error instance_class_function_definition_start instance_class_function_definition_start_error
151 %type <_class> class class_error class_head
152 %type <classDef> struct_declaration struct_declaration_error
153 %type <string> string_literal base_strict_type_name attribute_word
154 %type <extDecl> ext_decl
155 %type <attrib> attrib
156 %type <attribute> attribute
157 %type <prop> property property_start property_body class_property class_property_start class_property_body
158 %type <propertyWatch> property_watch self_watch_definition
160 %type <templateParameter> template_parameter template_type_parameter template_identifier_parameter template_expression_parameter
161 %type <templateArgument> template_argument template_type_argument template_identifier_argument template_expression_argument
162 %type <templateDatatype> template_datatype
164 %type <dbtableEntry> dbindex_entry dbfield_entry
165 %type <dbindexItem> dbindex_item
166 %type <dbtableDef> dbtable_definition
167 %type <context> compound_start class_entry
169 %token IDENTIFIER CONSTANT STRING_LITERAL SIZEOF
170 %token PTR_OP INC_OP DEC_OP LEFT_OP RIGHT_OP LE_OP GE_OP EQ_OP NE_OP
171 %token AND_OP OR_OP MUL_ASSIGN DIV_ASSIGN MOD_ASSIGN ADD_ASSIGN
172 %token SUB_ASSIGN LEFT_ASSIGN RIGHT_ASSIGN AND_ASSIGN
173 %token XOR_ASSIGN OR_ASSIGN TYPE_NAME
175 %token TYPEDEF EXTERN STATIC AUTO REGISTER
176 %token CHAR SHORT INT UINT INT64 LONG SIGNED UNSIGNED FLOAT DOUBLE CONST VOLATILE VOID VALIST
177 %token STRUCT UNION ENUM ELLIPSIS
179 %token CASE DEFAULT IF SWITCH WHILE DO FOR GOTO CONTINUE BREAK RETURN
183 %token CLASS THISCLASS CLASS_NAME
184 %token PROPERTY SETPROP GETPROP NEWOP RENEW DELETE EXT_DECL EXT_STORAGE IMPORT DEFINE VIRTUAL ATTRIB
185 %token PUBLIC PRIVATE
186 %token TYPED_OBJECT ANY_OBJECT _INCREF EXTENSION ASM TYPEOF
187 %token WATCH STOPWATCHING FIREWATCHERS WATCHABLE CLASS_DESIGNER CLASS_NO_EXPANSION CLASS_FIXED ISPROPSET
188 %token CLASS_DEFAULT_PROPERTY PROPERTY_CATEGORY CLASS_DATA CLASS_PROPERTY SUBCLASS NAMESPACE
189 %token NEW0OP RENEW0 VAARG
190 %token DBTABLE DBFIELD DBINDEX DATABASE_OPEN
191 %token ALIGNOF ATTRIB_DEP __ATTRIB
193 %destructor { FreeIdentifier($$); } identifier
194 %destructor { FreePointer($$); } pointer
195 %destructor { FreeExpression($$); } primary_expression primary_expression_error postfix_expression unary_expression cast_expression
196 multiplicative_expression additive_expression shift_expression
197 relational_expression equality_expression and_expression
198 exclusive_or_expression inclusive_or_expression logical_and_expression
199 logical_or_expression conditional_expression assignment_expression
200 constant_expression constant_expression_error
201 postfix_expression_error unary_expression_error cast_expression_error
202 multiplicative_expression_error additive_expression_error shift_expression_error
203 relational_expression_error equality_expression_error and_expression_error
204 exclusive_or_expression_error inclusive_or_expression_error logical_and_expression_error
205 logical_or_expression_error conditional_expression_error assignment_expression_error i18n_string
206 %destructor { FreeSpecifier($$); } storage_class_specifier enum_specifier_compound enum_specifier_nocompound type_qualifier type_specifier class_specifier class_specifier_error
207 struct_or_union_specifier_compound struct_or_union_specifier_nocompound ext_storage type strict_type guess_type enum_class strict_type_specifier struct_class
208 struct_or_union_specifier_compound_error struct_class_error struct_decl
209 enum_specifier_compound_error enum_class_error external_storage_class_specifier
210 base_strict_type struct_head struct_entry
211 %destructor { FreeEnumerator($$); } enumerator
212 %destructor { FreeDeclarator($$); } declarator direct_declarator direct_abstract_declarator abstract_declarator
213 direct_abstract_declarator_noarray abstract_declarator_noarray
214 struct_declarator direct_declarator_function direct_declarator_function_start declarator_function_error direct_declarator_function_error declarator_function direct_declarator_nofunction
215 declarator_nofunction
217 %destructor { FreeInitializer($$); } initializer initializer_error initializer_condition initializer_condition_error
218 %destructor { FreeInitDeclarator($$); } init_declarator init_declarator_error
219 %destructor { FreeTypeName($$); } type_name guess_type_name parameter_declaration parameter_declaration_error
220 %destructor { FreeStatement($$); } statement labeled_statement labeled_statement_error compound_statement compound_statement_error expression_statement
221 selection_statement selection_statement_error iteration_statement jump_statement jump_statement_error compound_inside compound_inside_error
222 iteration_statement_error statement_error
224 %destructor { FreeDeclaration($$); } declaration
225 %destructor { FreeFunction($$); } function_definition function_definition_error
226 %destructor { FreeExternal($$); } external_declaration external_declaration_error
228 %destructor { FreeInstance($$); } instantiation_named instantiation_named_error instantiation_unnamed instantiation_unnamed_error
230 %destructor { FreeMemberInit($$); } data_member_initialization data_member_initialization_error default_property default_property_error
232 %destructor { FreeClassFunction($$); } class_function_definition class_function_definition_error class_function_definition_start
233 class_function_definition_start_error virtual_class_function_definition_start virtual_class_function_definition_start_error
234 constructor_function_definition_start destructor_function_definition_start
235 instance_class_function_definition instance_class_function_definition_error instance_class_function_definition_start instance_class_function_definition_start_error
236 %destructor { Context ctx = curContext; PopContext(ctx); FreeContext(ctx); delete ctx; } class_entry
237 %destructor { Context ctx = curContext; PopContext(ctx); FreeContext(ctx); delete ctx; } class_decl
238 %destructor { FreeClass($$); } class class_error class_head
239 %destructor { FreeClassDef($$); } struct_declaration struct_declaration_error
240 %destructor { delete $$; } string_literal attribute_word base_strict_type_name
241 %destructor { FreeProperty($$); } property
243 %destructor { FreeList($$, FreeExpression); } argument_expression_list expression expression_error argument_expression_list_error
244 %destructor { FreeList($$, FreeEnumerator); } enumerator_list
245 %destructor { FreeList($$, FreeSpecifier); } type_qualifier_list specifier_qualifier_list declaration_specifiers inheritance_specifiers _inheritance_specifiers external_guess_declaration_specifiers external_guess_declaration_specifiers_error
246 guess_declaration_specifiers guess_specifier_qualifier_list
247 %destructor { FreeList($$, FreeDeclarator); } struct_declarator_list
248 %destructor { FreeList($$, FreeDeclaration); } declaration_list declaration_list_error
249 %destructor { FreeList($$, FreeInitializer); } initializer_list
250 %destructor { FreeList($$, FreeInitDeclarator); } init_declarator_list init_declarator_list_error
251 %destructor { FreeList($$, FreeTypeName); } parameter_list parameter_list_error parameter_type_list parameter_type_list_error identifier_list identifier_list_error
252 %destructor { FreeList($$, FreeStatement); } statement_list statement_list_error
253 %destructor { if($$ != ast) FreeList($$, FreeExternal); } translation_unit translation_unit_error
254 %destructor { FreeList($$, FreeClassDef); } struct_declaration_list struct_declaration_list_error
255 %destructor { FreeList($$, FreeMemberInit); } default_property_list default_property_list_error data_member_initialization_list data_member_initialization_list_coloned data_member_initialization_list_error
256 %destructor { FreeList($$, FreeMembersInit); } members_initialization_list members_initialization_list_coloned members_initialization_list_error
257 %destructor { PopContext($$); FreeContext($$); delete $$; } compound_start
258 %destructor { FreeTemplateParameter($$); } template_parameter template_type_parameter template_identifier_parameter template_expression_parameter
259 %destructor { FreeTemplateArgument($$); } template_argument template_type_argument template_identifier_argument template_expression_argument
260 %destructor { FreeTemplateDataType($$); } template_datatype
261 %destructor { FreeList($$, FreeTemplateParameter); } template_parameters_list
262 %destructor { FreeList($$, FreeTemplateArgument); } template_arguments_list
263 %destructor { } declaration_mode
264 %destructor { FreeAttrib($$); } attrib
265 %destructor { FreeExtDecl($$); } ext_decl
266 %destructor { FreeAttribute($$); } attribute
267 %destructor { FreeList($$, FreeAttribute); } attribs_list
277 // if($1._class && !$1._class.name)
281 strcpy(name, $1._class.name ? $1._class.name : "");
283 strcat(name, $1.string);
287 _DeclClass(0, $1.string);
291 fileInput.Seek(@1.start.pos, start);
292 resetScannerPos(&@1.start);
297 YY_STACK_PRINT (yyss, yyssp);
300 YY_STACK_PRINT (yyss, yyssp);
307 // if($1._class && !$1._class.name)
311 strcpy(name, $1._class.name ? $1._class.name : "");
313 strcat(name, $1.string);
317 _DeclClass(0, $1.string);
321 fileInput.Seek(@1.start.pos, start);
322 resetScannerPos(&@1.start);
327 YY_STACK_PRINT (yyss, yyssp);
330 YY_STACK_PRINT (yyss, yyssp);
334 /* | identifier '*' '<' template_arguments_list '>'
336 //if($1._class && !$1._class.name)
340 strcpy(name, $1._class.name ? $1._class.name : "");
342 strcat(name, $1.string);
346 _DeclClass(0, $1.string);
347 fileInput.Seek(@1.start.pos, start);
348 resetScannerPos(&@1.start);
353 YY_STACK_PRINT (yyss, yyssp);
356 YY_STACK_PRINT (yyss, yyssp);
362 strict_type { $$ = $1; }
363 | identifier identifier
366 // if($1._class && !$1._class.name)
370 strcpy(name, $1._class.name ? $1._class.name : "");
372 strcat(name, $1.string);
376 _DeclClass(0, $1.string);
380 fileInput.Seek(@1.start.pos, start);
381 resetScannerPos(&@1.start);
386 YY_STACK_PRINT (yyss, yyssp);
389 YY_STACK_PRINT (yyss, yyssp);
392 Location tmpLoc = yylloc; $$ = $2; yylloc = @1;
393 Compiler_Error($"Not a type: %s\n", $1.string);
394 yylloc = tmpLoc; $2.badID = $1;
401 //if($1._class && !$1._class.name)
405 strcpy(name, $1._class.name ? $1._class.name : "");
407 strcat(name, $1.string);
411 _DeclClass(0, $1.string);
412 fileInput.Seek(@1.start.pos, start);
413 resetScannerPos(&@1.start);
418 YY_STACK_PRINT (yyss, yyssp);
421 YY_STACK_PRINT (yyss, yyssp);
425 /* | strict_type '<' template_arguments_list '>' { $$ = $1; }
426 | identifier identifier '<' template_arguments_list '>'
429 // if($1._class && !$1._class.name)
433 strcpy(name, $1._class.name ? $1._class.name : "");
435 strcat(name, $1.string);
439 _DeclClass(0, $1.string);
443 fileInput.Seek(@1.start.pos, start);
444 resetScannerPos(&@1.start);
449 YY_STACK_PRINT (yyss, yyssp);
452 YY_STACK_PRINT (yyss, yyssp);
455 Location tmpLoc = yylloc; $$ = $2; yylloc = @1;
456 Compiler_Error($"Not a type: %s\n", $1.string);
457 yylloc = tmpLoc; $2.badID = $1;
463 TYPE_NAME { $$ = MkSpecifierName(yytext); }
466 base_strict_type_name:
467 TYPE_NAME { $$ = CopyString(yytext); }
471 | base_strict_type '<' template_arguments_list '>' { $$ = $1; SetClassTemplateArgs($$, $3); $$.loc = @$; }
472 | base_strict_type '<' template_arguments_list RIGHT_OP
475 SetClassTemplateArgs($$, $3);
479 fileInput.Seek(@4.end.pos, start);
480 resetScannerPos(&@4.end);
484 /* | identifier '<' template_arguments_list '>' */
485 /*| identifier '<' error
487 // if($1._class && !$1._class.name)
491 strcpy(name, $1._class.name ? $1._class.name : "");
493 strcat(name, $1.string);
497 _DeclClass(0, $1.string);
501 fileInput.Seek(@1.start.pos, start);
502 resetScannerPos(&@1.start);
507 YY_STACK_PRINT (yyss, yyssp);
510 YY_STACK_PRINT (yyss, yyssp);
513 YY_STACK_PRINT (yyss, yyssp);
516 /* $$ = MkSpecifierNameArgs($1.string, $3); $$.loc = @$; FreeIdentifier($1); */
520 class_function_definition_start:
521 guess_declaration_specifiers declarator_function
522 { $$ = MkClassFunction($1, null, $2, null); $$.loc = @$; $$.id = ++globalContext.nextID; }
523 | declarator_function
524 { $$ = MkClassFunction(null, null, $1, null); $$.loc = @$; $$.id = ++globalContext.nextID; }
527 constructor_function_definition_start:
528 guess_declaration_specifiers '(' ')'
529 { $$ = MkClassFunction(null, null, null, null); $$.isConstructor = true; $$.loc = @$; $$.id = ++globalContext.nextID; FreeList($1, FreeSpecifier); }
532 destructor_function_definition_start:
533 '~' guess_declaration_specifiers '(' ')'
534 { $$ = MkClassFunction(null, null, null, null); $$.isDestructor = true; $$.loc = @$; $$.id = ++globalContext.nextID; FreeList($2, FreeSpecifier) }
537 virtual_class_function_definition_start:
538 VIRTUAL guess_declaration_specifiers declarator_function
539 { $$ = MkClassFunction($2, null, $3, null); $$.isVirtual = true; $$.loc = @$; $$.id = ++globalContext.nextID; }
540 | VIRTUAL declarator_function
541 { $$ = MkClassFunction(null, null, $2, null); $$.isVirtual = true; $$.loc = @$; $$.id = ++globalContext.nextID; }
544 class_function_definition_start_error:
545 guess_declaration_specifiers declarator_function_error
546 { $$ = MkClassFunction($1, null, $2, null); $$.loc = @$; $$.id = ++globalContext.nextID; }
547 | declarator_function_error
548 { $$ = MkClassFunction(null, null, $1, null); $$.loc = @$; $$.id = ++globalContext.nextID; }
551 virtual_class_function_definition_start_error:
552 VIRTUAL guess_declaration_specifiers declarator_function_error
553 { $$ = MkClassFunction($2, null, $3, null); $$.isVirtual = true; $$.loc = @$; $$.id = ++globalContext.nextID; }
554 | VIRTUAL declarator_function_error
555 { $$ = MkClassFunction(null, null, $2, null); $$.isVirtual = true; $$.loc = @$; $$.id = ++globalContext.nextID; }
558 class_function_definition:
559 class_function_definition_start compound_statement
560 { ProcessClassFunctionBody($1, $2); $$.loc = @$; }
561 | virtual_class_function_definition_start compound_statement
562 { ProcessClassFunctionBody($1, $2); $$.loc = @$; }
563 | virtual_class_function_definition_start ';'
564 { ProcessClassFunctionBody($1, null); $$.loc = @$; }
565 | constructor_function_definition_start compound_statement
566 { ProcessClassFunctionBody($1, $2); $$.loc = @$; }
567 | destructor_function_definition_start compound_statement
568 { ProcessClassFunctionBody($1, $2); $$.loc = @$; }
571 | class_function_definition_start ';'
572 { ProcessClassFunctionBody($1, null); $$.loc = @$; }
575 class_function_definition_error:
576 class_function_definition_start compound_statement_error
577 { ProcessClassFunctionBody($1, $2); $$.loc = @$; $$.loc.end = $2.loc.end; }
578 | class_function_definition_start_error
579 { ProcessClassFunctionBody($1, null); $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++;}
580 | virtual_class_function_definition_start compound_statement_error
581 { ProcessClassFunctionBody($1, $2); $$.loc = @$; $$.loc.end = $2.loc.end; }
582 | virtual_class_function_definition_start_error
583 { ProcessClassFunctionBody($1, null); $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++;}
584 | virtual_class_function_definition_start_error ';'
585 { ProcessClassFunctionBody($1, null); $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++;}
588 // In Instances, return type is required to distinguish from calling the function
589 instance_class_function_definition_start:
590 declaration_specifiers declarator_function
591 { $$ = MkClassFunction($1, null, $2, null); $$.loc = @$; $$.id = ++globalContext.nextID; }
592 | declaration_specifiers declarator_nofunction
593 { $$ = MkClassFunction($1, null, MkDeclaratorFunction($2, null), null); $$.loc = @$; $$.id = ++globalContext.nextID; }
596 instance_class_function_definition_start_error:
597 declaration_specifiers declarator_function_error
598 { $$ = MkClassFunction($1, null, $2, null); $$.loc = @$; $$.id = ++globalContext.nextID; }
601 instance_class_function_definition:
602 instance_class_function_definition_start compound_statement
603 { ProcessClassFunctionBody($1, $2); $$.loc = @$; }
606 instance_class_function_definition_error:
607 instance_class_function_definition_start compound_statement_error
608 { ProcessClassFunctionBody($1, $2); $$.loc = @$; $$.loc.end = $2.loc.end; $$.loc.end.charPos++; $$.loc.end.pos++;}
609 | instance_class_function_definition_start_error
610 { ProcessClassFunctionBody($1, null); $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++;}
611 | instance_class_function_definition_start
612 { ProcessClassFunctionBody($1, null); $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++;}
615 data_member_initialization:
616 postfix_expression '=' initializer_condition { $$ = MkMemberInitExp($1, $3); $$.loc = @$; $$.realLoc = @$; $$.initializer.loc.start = @2.end;}
617 | initializer_condition { $$ = MkMemberInit(null, $1); $$.loc = @$; $$.realLoc = @$;}
620 data_member_initialization_error:
621 postfix_expression '=' initializer_condition_error { $$ = MkMemberInitExp($1, $3); $$.loc = @$; $$.realLoc = @$; $$.initializer.loc.start = @2.end;}
622 | postfix_expression '=' error
624 $$ = MkMemberInitExp($1, MkInitializerAssignment(MkExpDummy()));
625 $$.loc = @$; $$.realLoc = @$; $$.initializer.loc.start = $$.initializer.loc.end = @2.end;
627 fileInput.Seek(@2.end.pos, start);
629 resetScannerPos(&@2.end);
633 | initializer_condition_error { $$ = MkMemberInit(null, $1); $$.loc = @$; $$.realLoc = @$;}
636 data_member_initialization_list:
637 data_member_initialization { $$ = MkList(); ListAdd($$, $1); }
638 | data_member_initialization_list ',' data_member_initialization
639 { ((MemberInit)$1->last).loc.end = @3.start; ListAdd($1, $3); $$ = $1; }
640 | data_member_initialization_list_error ',' data_member_initialization
641 { ((MemberInit)$1->last).loc.end = @3.start; ListAdd($1, $3); $$ = $1; }
644 data_member_initialization_list_error:
645 data_member_initialization_error { $$ = MkList(); ListAdd($$, $1); }
646 | data_member_initialization_list ',' data_member_initialization_error
647 { ((MemberInit)$1->last).loc.end = @3.start; ListAdd($1, $3); $$ = $1; }
648 | data_member_initialization_list_error ',' data_member_initialization_error
649 { ((MemberInit)$1->last).loc.end = @3.start; ListAdd($1, $3); $$ = $1; }
651 | data_member_initialization_list ',' error
652 { ((MemberInit)$1->last).loc.end = @2.end;
654 Initializer dummy = MkInitializerAssignment(MkExpDummy());
655 MemberInit memberInit = MkMemberInit(null, dummy);
656 memberInit.realLoc.start = memberInit.loc.start = dummy.loc.start = @2.end;
657 memberInit.realLoc.end = memberInit.loc.end = dummy.loc.end = @2.end;
658 ListAdd($1, memberInit);
663 data_member_initialization_list_error ',' error
664 { ((MemberInit)$1->last).loc.end = @2.end;
666 Initializer dummy = MkInitializerAssignment(MkExpDummy());
667 MemberInit memberInit = MkMemberInit(null, dummy);
668 memberInit.realLoc.start = memberInit.loc.start = dummy.loc.start = @2.end;
669 memberInit.realLoc.end = memberInit.loc.end = dummy.loc.end = @2.end;
670 ListAdd($1, memberInit);
676 Initializer dummy = MkInitializerAssignment(MkExpDummy());
677 MemberInit memberInit = MkMemberInit(null, dummy);
678 memberInit.realLoc.start = memberInit.loc.start = dummy.loc.start = @1.start;
679 memberInit.realLoc.end = memberInit.loc.end = dummy.loc.end = @1.start;
682 ListAdd($$, memberInit);
684 dummy = MkInitializerAssignment(MkExpDummy());
685 memberInit = MkMemberInit(null, dummy);
686 memberInit.realLoc.start = memberInit.loc.start = dummy.loc.start = @1.end;
687 memberInit.realLoc.end = memberInit.loc.end = dummy.loc.end = @1.end;
688 ListAdd($$, memberInit);
692 data_member_initialization_list_coloned:
693 data_member_initialization_list ';'
694 { if($1->last) ((MemberInit)$1->last).loc.end = @2.end; $$ = $1; }
695 | data_member_initialization_list_error ';'
696 { if($1->last) ((MemberInit)$1->last).loc.end = @2.end; $$ = $1; }
699 members_initialization_list_coloned:
700 data_member_initialization_list_coloned { MembersInit members = MkMembersInitList($1); $$ = MkList(); ListAdd($$, members); members.loc = @1; }
701 | instance_class_function_definition { $$ = MkList(); ListAdd($$, MkMembersInitMethod($1)); ((MembersInit)$$->last).loc = @1; }
702 | members_initialization_list_error data_member_initialization_list_coloned { MembersInit members = MkMembersInitList($2); ListAdd($$, members); members.loc = @2; $$ = $1; }
703 | members_initialization_list_error instance_class_function_definition { ListAdd($$, MkMembersInitMethod($2)); ((MembersInit)$$->last).loc = @2; $$ = $1; }
704 | members_initialization_list_coloned data_member_initialization_list_coloned { MembersInit members = MkMembersInitList($2); ListAdd($$, members); members.loc = @2; $$ = $1; }
705 | members_initialization_list_coloned instance_class_function_definition { ListAdd($$, MkMembersInitMethod($2)); ((MembersInit)$$->last).loc = @2; $$ = $1; }
706 | ';' { MembersInit members = MkMembersInitList(MkList()); $$ = MkList(); ListAdd($$, members); members.loc = @1; }
707 | members_initialization_list_error ';'
708 | members_initialization_list_coloned ';' { MembersInit members = MkMembersInitList(MkList()); ListAdd($$, members); members.loc = @2; $$ = $1; }
711 members_initialization_list:
712 members_initialization_list_coloned
713 | data_member_initialization_list { $$ = MkList(); ListAdd($$, MkMembersInitList($1)); ((MembersInit)$$->last).loc = @1; }
714 | members_initialization_list_coloned data_member_initialization_list { ListAdd($1, MkMembersInitList($2)); ((MembersInit)$$->last).loc = @2; }
715 | members_initialization_list_error data_member_initialization_list { ListAdd($1, MkMembersInitList($2)); ((MembersInit)$$->last).loc = @2; }
718 members_initialization_list_error:
719 instance_class_function_definition_error { $$ = MkList(); ListAdd($$, MkMembersInitMethod($1)); ((MembersInit)$$->last).loc = @1; }
720 | members_initialization_list instance_class_function_definition_error { ListAdd($$, MkMembersInitMethod($2)); ((MembersInit)$$->last).loc = @2; $$ = $1; }
721 | members_initialization_list_error instance_class_function_definition_error { ListAdd($$, MkMembersInitMethod($2)); ((MembersInit)$$->last).loc = @2; $$ = $1; }
722 | members_initialization_list_coloned instance_class_function_definition_error { ListAdd($$, MkMembersInitMethod($2)); ((MembersInit)$$->last).loc = @2; $$ = $1; }
723 | members_initialization_list_coloned data_member_initialization_list_error { ListAdd($$, MkMembersInitList($2)); ((MembersInit)$$->last).loc = @2; $$ = $1; }
724 | data_member_initialization_list_error { $$ = MkList(); ListAdd($$, MkMembersInitList($1)); ((MembersInit)$$->last).loc = @1; }
725 | data_member_initialization_list error { $$ = MkList(); ListAdd($$, MkMembersInitList($1)); ((MembersInit)$$->last).loc = @2; }
729 instantiation_named_error '}'
730 { $$.loc = @$; $$.insideLoc.end = @2.start; $$ = $1; }
731 | instantiation_named_error error '}'
732 { $$.loc = @$; $$.insideLoc.end = @2.start; $$ = $1; }
735 instantiation_named_error:
736 declaration_specifiers identifier '{' members_initialization_list_error
737 { $$ = MkInstantiationNamed($1, MkExpIdentifier($2), $4); $$.exp.loc = @2; $$.loc = @$; $$.nameLoc = @2; $$.insideLoc.start = @3.end; $$.insideLoc.end = @4.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
738 | declaration_specifiers identifier '{' members_initialization_list error
739 { $$ = MkInstantiationNamed($1, MkExpIdentifier($2), $4); $$.exp.loc = @2; $$.loc = @$; $$.nameLoc = @2; $$.insideLoc.start = @3.end; $$.insideLoc.end = @4.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
740 | declaration_specifiers identifier '{' members_initialization_list
741 { $$ = MkInstantiationNamed($1, MkExpIdentifier($2), $4); $$.exp.loc = @2; $$.loc = @$; $$.nameLoc = @2; $$.insideLoc.start = @3.end; $$.insideLoc.end = @4.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
742 | declaration_specifiers identifier '{'
743 { $$ = MkInstantiationNamed($1, MkExpIdentifier($2), null); $$.exp.loc = @2; $$.loc = @$; $$.nameLoc = @2; $$.insideLoc.start = @3.end; $$.insideLoc.end = @3.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
744 | declaration_specifiers identifier '{' error
745 { $$ = MkInstantiationNamed($1, MkExpIdentifier($2), null);$$.exp.loc = @2; $$.loc = @$; $$.nameLoc = @2; $$.insideLoc.start = @3.end; $$.insideLoc.end = @3.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
750 declaration_specifiers identifier '{' members_initialization_list '}'
751 { $$ = MkInstantiationNamed($1, MkExpIdentifier($2), $4); $$.exp.loc = @2; $$.loc = @$; $$.nameLoc = @2; $$.insideLoc.start = @3.end; $$.insideLoc.end = @5.start;}
752 | declaration_specifiers identifier '{' members_initialization_list_error '}'
753 { $$ = MkInstantiationNamed($1, MkExpIdentifier($2), $4); $$.exp.loc = @2; $$.loc = @$; $$.nameLoc = @2; $$.insideLoc.start = @3.end; $$.insideLoc.end = @5.start;}
754 | declaration_specifiers identifier '{' '}'
755 { $$ = MkInstantiationNamed($1, MkExpIdentifier($2), MkList()); $$.exp.loc = @2; $$.loc = @$; $$.nameLoc = @2; $$.insideLoc.start = @3.end; $$.insideLoc.end = @4.start;}
758 instantiation_named_error:
759 declaration_specifiers identifier '{' members_initialization_list_error
760 { $$ = MkInstantiationNamed($1, MkExpIdentifier($2), $4); $$.exp.loc = @2; $$.loc = @$; $$.nameLoc = @2; $$.insideLoc.start = @3.end; $$.insideLoc.end = @4.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
761 | declaration_specifiers identifier '{' members_initialization_list error
762 { $$ = MkInstantiationNamed($1, MkExpIdentifier($2), $4); $$.exp.loc = @2; $$.loc = @$; $$.nameLoc = @2; $$.insideLoc.start = @3.end; $$.insideLoc.end = @4.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
763 | declaration_specifiers identifier '{' members_initialization_list
764 { $$ = MkInstantiationNamed($1, MkExpIdentifier($2), $4); $$.exp.loc = @2; $$.loc = @$; $$.nameLoc = @2; $$.insideLoc.start = @3.end; $$.insideLoc.end = @4.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
765 | declaration_specifiers identifier '{'
766 { $$ = MkInstantiationNamed($1, MkExpIdentifier($2), null); $$.exp.loc = @2; $$.loc = @$; $$.nameLoc = @2; $$.insideLoc.start = @3.end; $$.insideLoc.end = @3.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
767 | declaration_specifiers identifier '{' error
768 { $$ = MkInstantiationNamed($1, MkExpIdentifier($2), null);$$.exp.loc = @2; $$.loc = @$; $$.nameLoc = @2; $$.insideLoc.start = @3.end; $$.insideLoc.end = @3.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
773 guess_instantiation_named:
774 guess_instantiation_named_error '}'
775 { $$.loc = @$; $$.insideLoc.end = @2.start; }
776 | guess_instantiation_named_error error '}'
777 { $$.loc = @$; $$.insideLoc.end = @2.start; }
780 guess_instantiation_named_error:
781 guess_declaration_specifiers identifier '{' members_initialization_list_error
782 { $$ = MkInstantiationNamed($1, MkExpIdentifier($2), $4);$$.exp.loc = @2; $$.loc = @$; $$.nameLoc = @2; $$.insideLoc.start = @3.end; $$.insideLoc.end = @4.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
783 | guess_declaration_specifiers identifier '{' members_initialization_list error
784 { $$ = MkInstantiationNamed($1, MkExpIdentifier($2), $4); $$.exp.loc = @2; $$.loc = @$; $$.nameLoc = @2; $$.insideLoc.start = @3.end; $$.insideLoc.end = @4.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
785 | guess_declaration_specifiers identifier '{' members_initialization_list
786 { $$ = MkInstantiationNamed($1, MkExpIdentifier($2), $4);$$.exp.loc = @2; $$.loc = @$; $$.nameLoc = @2; $$.insideLoc.start = @3.end; $$.insideLoc.end = @4.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
787 | guess_declaration_specifiers identifier '{'
788 { $$ = MkInstantiationNamed($1, MkExpIdentifier($2), null);$$.exp.loc = @2; $$.loc = @$; $$.nameLoc = @2; $$.insideLoc.start = @3.end; $$.insideLoc.end = @3.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
789 | guess_declaration_specifiers identifier '{' error
790 { $$ = MkInstantiationNamed($1, MkExpIdentifier($2), null);$$.exp.loc = @2; $$.loc = @$; $$.nameLoc = @2; $$.insideLoc.start = @3.end; $$.insideLoc.end = @3.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
794 guess_instantiation_named:
795 guess_declaration_specifiers identifier '{' members_initialization_list '}'
796 { $$ = MkInstantiationNamed($1, MkExpIdentifier($2), $4);$$.exp.loc = @2; $$.loc = @$; $$.nameLoc = @2; $$.insideLoc.start = @3.end; $$.insideLoc.end = @5.start;}
797 | guess_declaration_specifiers identifier '{' members_initialization_list_error '}'
798 { $$ = MkInstantiationNamed($1, MkExpIdentifier($2), $4); $$.exp.loc = @2; $$.loc = @$; $$.nameLoc = @2; $$.insideLoc.start = @3.end; $$.insideLoc.end = @5.start;}
799 | guess_declaration_specifiers identifier '{' '}'
800 { $$ = MkInstantiationNamed($1, MkExpIdentifier($2), MkList()); $$.exp.loc = @2; $$.loc = @$; $$.nameLoc = @2; $$.insideLoc.start = @3.end; $$.insideLoc.end = @4.start;}
803 guess_instantiation_named_error:
804 guess_declaration_specifiers identifier '{' members_initialization_list_error
805 { $$ = MkInstantiationNamed($1, MkExpIdentifier($2), $4);$$.exp.loc = @2; $$.loc = @$; $$.nameLoc = @2; $$.insideLoc.start = @3.end; $$.insideLoc.end = @4.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
806 | guess_declaration_specifiers identifier '{' members_initialization_list error
807 { $$ = MkInstantiationNamed($1, MkExpIdentifier($2), $4); $$.exp.loc = @2; $$.loc = @$; $$.nameLoc = @2; $$.insideLoc.start = @3.end; $$.insideLoc.end = @4.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
808 | guess_declaration_specifiers identifier '{' members_initialization_list
809 { $$ = MkInstantiationNamed($1, MkExpIdentifier($2), $4);$$.exp.loc = @2; $$.loc = @$; $$.nameLoc = @2; $$.insideLoc.start = @3.end; $$.insideLoc.end = @4.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
810 | guess_declaration_specifiers identifier '{'
811 { $$ = MkInstantiationNamed($1, MkExpIdentifier($2), null);$$.exp.loc = @2; $$.loc = @$; $$.nameLoc = @2; $$.insideLoc.start = @3.end; $$.insideLoc.end = @3.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
812 | guess_declaration_specifiers identifier '{' error
813 { $$ = MkInstantiationNamed($1, MkExpIdentifier($2), null);$$.exp.loc = @2; $$.loc = @$; $$.nameLoc = @2; $$.insideLoc.start = @3.end; $$.insideLoc.end = @3.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
817 external_guess_instantiation_named:
818 external_guess_declaration_specifiers identifier '{' members_initialization_list '}'
819 { $$ = MkInstantiationNamed($1, MkExpIdentifier($2), $4); $$.exp.loc = @2; $$.loc = @$; $$.nameLoc = @2; $$.insideLoc.start = @3.end; $$.insideLoc.end = @5.start;}
820 | external_guess_declaration_specifiers identifier '{' members_initialization_list_error '}'
821 { $$ = MkInstantiationNamed($1, MkExpIdentifier($2), $4); $$.exp.loc = @2; $$.loc = @$; $$.nameLoc = @2; $$.insideLoc.start = @3.end; $$.insideLoc.end = @5.start;}
822 | external_guess_declaration_specifiers identifier '{' '}'
823 { $$ = MkInstantiationNamed($1, MkExpIdentifier($2), MkList()); $$.exp.loc = @2; $$.loc = @$; $$.nameLoc = @2; $$.insideLoc.start = @3.end; $$.insideLoc.end = @4.start;}
826 instantiation_unnamed:
827 instantiation_unnamed_error '}'
828 { $$.loc = @$; $$.insideLoc.end = @2.start; $$ = $1; }
829 | instantiation_unnamed_error error '}'
830 { $$.loc = @$; $$.insideLoc.end = @2.start; $$ = $1; }
833 instantiation_unnamed_error:
834 strict_type '{' members_initialization_list
835 { $$ = MkInstantiation($1, null, $3); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @3.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
836 | identifier '{' members_initialization_list
837 { Location tmpLoc = yylloc; yylloc = @1;
838 yylloc = tmpLoc; $$ = MkInstantiation(MkSpecifierName($1.string), null, $3); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @3.end; FreeIdentifier($1); }
840 | strict_type '{' members_initialization_list_error
841 { $$ = MkInstantiation($1, null, $3); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @3.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
843 { $$ = MkInstantiation($1, null, null); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @2.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
844 | strict_type '{' members_initialization_list error
845 { $$ = MkInstantiation($1, null, $3); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @3.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
846 | strict_type '{' error
847 { $$ = MkInstantiation($1, null, null); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @2.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
851 | identifier '{' members_initialization_list_error
852 { Location tmpLoc = yylloc; yylloc = @1;
853 yylloc = tmpLoc; $$ = MkInstantiation(MkSpecifierName($1.string), null, $3); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @3.end; $$.loc.end.charPos++; $$.loc.end.pos++; FreeIdentifier($1); }
855 { Location tmpLoc = yylloc; yylloc = @1;
856 yylloc = tmpLoc; $$ = MkInstantiation(MkSpecifierName($1.string), null, null); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @2.end; $$.loc.end.charPos++; $$.loc.end.pos++; FreeIdentifier($1); }
857 | identifier '{' members_initialization_list error
858 { Location tmpLoc = yylloc; yylloc = @1;
859 yylloc = tmpLoc; $$ = MkInstantiation(MkSpecifierName($1.string), null, $3); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @3.end; $$.loc.end.charPos++; $$.loc.end.pos++; FreeIdentifier($1); }
860 | identifier '{' error
861 { Location tmpLoc = yylloc; yylloc = @1;
862 yylloc = tmpLoc; $$ = MkInstantiation(MkSpecifierName($1.string), null, null); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @2.end; $$.loc.end.charPos++; $$.loc.end.pos++; FreeIdentifier($1); }
866 instantiation_unnamed:
867 strict_type '{' members_initialization_list '}'
868 { $$ = MkInstantiation($1, null, $3); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @4.start; }
869 | strict_type '{' members_initialization_list error '}'
870 { $$ = MkInstantiation($1, null, $3); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @5.start; }
871 | strict_type '{' members_initialization_list_error '}'
872 { $$ = MkInstantiation($1, null, $3); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @4.start; }
873 | strict_type '{' '}'
874 { $$ = MkInstantiation($1, null, MkList()); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @3.start;}
875 | strict_type '{' error '}'
876 { $$ = MkInstantiation($1, null, MkList()); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @4.start;}
879 | identifier '{' members_initialization_list '}'
880 { Location tmpLoc = yylloc; yylloc = @1;
881 yylloc = tmpLoc; $$ = MkInstantiation(MkSpecifierName($1.string), null, $3); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @4.start; FreeIdentifier($1); }
882 | identifier '{' members_initialization_list_error '}'
883 { Location tmpLoc = yylloc; yylloc = @1;
884 yylloc = tmpLoc; $$ = MkInstantiation(MkSpecifierName($1.string), null, $3); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @4.start; FreeIdentifier($1); }
885 | identifier '{' members_initialization_list error '}'
887 $$ = MkInstantiation(MkSpecifierName($1.string), null, $3); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @5.start; FreeIdentifier($1); }
889 { Location tmpLoc = yylloc; yylloc = @1;
890 yylloc = tmpLoc; $$ = MkInstantiation(MkSpecifierName($1.string), null, MkList()); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @3.start; FreeIdentifier($1);}
891 | identifier '{' error '}'
892 { Location tmpLoc = yylloc; yylloc = @1;
893 yylloc = tmpLoc; $$ = MkInstantiation(MkSpecifierName($1.string), null, MkList()); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @4.start; FreeIdentifier($1); }
897 instantiation_unnamed_error:
898 strict_type '{' members_initialization_list_error
899 { $$ = MkInstantiation($1, null, $3); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @3.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
901 { $$ = MkInstantiation($1, null, null); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @2.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
902 | strict_type '{' members_initialization_list error
903 { $$ = MkInstantiation($1, null, $3); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @3.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
904 | strict_type '{' error
905 { $$ = MkInstantiation($1, null, null); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @2.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
909 | identifier '{' members_initialization_list_error
910 { Location tmpLoc = yylloc; yylloc = @1;
911 yylloc = tmpLoc; $$ = MkInstantiation(MkSpecifierName($1.string), null, $3); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @3.end; $$.loc.end.charPos++; $$.loc.end.pos++; FreeIdentifier($1); }
913 { Location tmpLoc = yylloc; yylloc = @1;
914 yylloc = tmpLoc; $$ = MkInstantiation(MkSpecifierName($1.string), null, null); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @2.end; $$.loc.end.charPos++; $$.loc.end.pos++; FreeIdentifier($1); }
915 | identifier '{' members_initialization_list error
916 { Location tmpLoc = yylloc; yylloc = @1;
917 yylloc = tmpLoc; $$ = MkInstantiation(MkSpecifierName($1.string), null, $3); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @3.end; $$.loc.end.charPos++; $$.loc.end.pos++; FreeIdentifier($1); }
918 | identifier '{' error
919 { Location tmpLoc = yylloc; yylloc = @1;
920 yylloc = tmpLoc; $$ = MkInstantiation(MkSpecifierName($1.string), null, null); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @2.end; $$.loc.end.charPos++; $$.loc.end.pos++; FreeIdentifier($1); }
925 instantiation_anon_error '}'
926 { $$.loc = @$; $$.insideLoc.end = @2.start; }
927 | instantiation_anon_error error '}'
928 { $$.loc = @$; $$.insideLoc.end = @2.start; }
931 instantiation_anon_error:
932 '{' members_initialization_list_error
933 { $$ = MkInstantiation(null, null, $2); $$.loc = @$; $$.insideLoc.start = @1.end; $$.insideLoc.end = @2.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
934 | '{' members_initialization_list error
935 { $$ = MkInstantiation(null, null, $2); $$.loc = @$; $$.insideLoc.start = @1.end; $$.insideLoc.end = @2.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
937 { $$ = MkInstantiation(null, null, null); $$.loc = @$; $$.insideLoc.start = @1.end; $$.insideLoc.end = @1.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
939 { $$ = MkInstantiation(null, null, null); $$.loc = @$; $$.insideLoc.start = @1.end; $$.insideLoc.end = @1.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
940 | '{' members_initialization_list
941 { $$ = MkInstantiation(null, null, $2); $$.loc = @$; $$.insideLoc.start = @1.end; $$.insideLoc.end = @2.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
946 '{' members_initialization_list '}'
947 { $$ = MkInstantiation(null, null, $2); $$.loc = @$; $$.insideLoc.start = @1.end; $$.insideLoc.end = @3.start; }
948 | '{' members_initialization_list error '}'
949 { $$ = MkInstantiation(null, null, $2); $$.loc = @$; $$.insideLoc.start = @1.end; $$.insideLoc.end = @4.start; }
950 | '{' members_initialization_list_error '}'
951 { $$ = MkInstantiation(null, null, $2); $$.loc = @$; $$.insideLoc.start = @1.end; $$.insideLoc.end = @3.start; }
953 { $$ = MkInstantiation(null, null, MkList()); $$.loc = @$; $$.insideLoc.start = @1.end; $$.insideLoc.end = @2.start;}
955 { $$ = MkInstantiation(null, null, MkList()); $$.loc = @$; $$.insideLoc.start = @1.end; $$.insideLoc.end = @3.start;}
958 instantiation_anon_error:
959 '{' members_initialization_list_error
960 { $$ = MkInstantiation(null, null, $2); $$.loc = @$; $$.insideLoc.start = @1.end; $$.insideLoc.end = @2.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
962 { $$ = MkInstantiation(null, null, null); $$.loc = @$; $$.insideLoc.start = @1.end; $$.insideLoc.end = @1.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
963 | '{' members_initialization_list error
964 { $$ = MkInstantiation(null, null, $2); $$.loc = @$; $$.insideLoc.start = @1.end; $$.insideLoc.end = @2.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
966 { $$ = MkInstantiation(null, null, null); $$.loc = @$; $$.insideLoc.start = @1.end; $$.insideLoc.end = @1.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
971 postfix_expression '=' initializer_condition { $$ = MkMemberInitExp($1, $3); $$.loc = @$; $$.realLoc = @$; }
974 default_property_error:
975 postfix_expression '=' initializer_condition_error { $$ = MkMemberInitExp($1, $3); $$.loc = @$; $$.realLoc = @$; $$.initializer.loc.start = @2.end; }
976 | postfix_expression '=' error { $$ = MkMemberInitExp($1, MkInitializerAssignment(MkExpDummy())); $$.loc = @$; $$.realLoc = @$; $$.initializer.loc.start = @2.end; $$.initializer.loc.end = @2.end; }
977 | postfix_expression error { $$ = MkMemberInitExp($1, null); $$.loc = @$; $$.realLoc = @$; }
980 default_property_list:
981 default_property { $$ = MkList(); ListAdd($$, $1); ((MemberInit)$$->last).loc = @$; }
982 | default_property_list ',' default_property { ((MemberInit)$1->last).loc.end = @3.start; ListAdd($1, $3); $$ = $1; }
983 | default_property_list_error ',' default_property { ((MemberInit)$1->last).loc.end = @3.start; ListAdd($1, $3); $$ = $1; }
986 default_property_list_error:
987 default_property_error { $$ = MkList(); ListAdd($$, $1); ((MemberInit)$$->last).loc = @$; }
988 | default_property_list ',' default_property_error { ((MemberInit)$1->last).loc.end = @3.start; ListAdd($1, $3); $$ = $1; }
989 | default_property_list_error ',' default_property_error { ((MemberInit)$1->last).loc.end = @3.start; ListAdd($1, $3); $$ = $1; }
990 | default_property_list error
994 PROPERTY property_specifiers identifier '{'
995 { $$ = MkProperty($2, null, $3, null, null); $$.loc = @$; }
997 | PROPERTY property_specifiers abstract_declarator identifier '{'
998 { $$ = MkProperty($2, $3, $4, null, null); $$.loc = @$; }
1000 | PROPERTY property_specifiers '{'
1001 { $$ = MkProperty($2, null, null, null, null); $$.loc = @$; }
1003 | PROPERTY property_specifiers abstract_declarator '{'
1004 { $$ = MkProperty($2, $3, null, null, null); $$.loc = @$; }
1006 | PROPERTY error '{'
1007 { $$ = MkProperty(null, null, null, null, null); $$.loc = @$; }
1012 | property_body SETPROP compound_statement
1013 { $1.setStmt = $3; }
1014 | property_body GETPROP compound_statement
1015 { $1.getStmt = $3; }
1016 | property_body ISPROPSET compound_statement
1017 { $1.issetStmt = $3; }
1018 | property_body WATCHABLE
1019 { $1.isWatchable = true; }
1020 | property_body PROPERTY_CATEGORY i18n_string
1021 { $1.category = $3; }
1025 property_body '}' { $1.loc.end = @2.end; $$ = $1; }
1028 class_property_start:
1029 CLASS_PROPERTY property_specifiers identifier '{'
1030 { $$ = MkProperty($2, null, $3, null, null); $$.loc = @$; }
1032 | CLASS_PROPERTY property_specifiers abstract_declarator identifier '{'
1033 { $$ = MkProperty($2, $3, $4, null, null); $$.loc = @$; }
1035 | CLASS_PROPERTY property_specifiers '{'
1036 { $$ = MkProperty($2, null, null, null, null); $$.loc = @$; }
1038 | CLASS_PROPERTY property_specifiers abstract_declarator '{'
1039 { $$ = MkProperty($2, $3, null, null, null); $$.loc = @$; }
1041 | CLASS_PROPERTY error '{'
1042 { $$ = MkProperty(null, null, null, null, null); $$.loc = @$; }
1045 class_property_body:
1046 class_property_start
1047 | class_property_body SETPROP compound_statement
1048 { $1.setStmt = $3; }
1049 | class_property_body GETPROP compound_statement
1050 { $1.getStmt = $3; }
1054 class_property_body '}' { $1.loc.end = @2.end; }
1057 watch_property_list:
1059 { $$ = MkListOne($1); }
1060 | watch_property_list identifier
1061 { ListAdd($1, $2); }
1065 watch_property_list compound_statement
1066 { $$ = MkPropertyWatch($1, $2); }
1067 | DELETE compound_statement
1068 { $$ = MkDeleteWatch($2); }
1071 property_watch_list:
1073 { $$ = MkListOne($1); }
1074 | property_watch_list property_watch
1075 { ListAdd($1, $2); }
1078 self_watch_definition:
1079 WATCH '(' watch_property_list ')' compound_statement
1080 { $$ = MkPropertyWatch($3, $5); }
1084 WATCH '(' assignment_expression ')' '{' property_watch_list '}'
1085 { $$ = MkWatchStmt(null, $3, $6); }
1086 | assignment_expression '.' WATCH '(' assignment_expression ')' '{' property_watch_list '}'
1087 { $$ = MkWatchStmt($1, $5, $8); }
1091 STOPWATCHING '(' assignment_expression ',' watch_property_list ')'
1092 { $$ = MkStopWatchingStmt(null, $3, $5); }
1093 | assignment_expression '.' STOPWATCHING '(' assignment_expression ',' watch_property_list ')'
1094 { $$ = MkStopWatchingStmt($1, $5, $7); }
1095 | STOPWATCHING '(' assignment_expression ')'
1096 { $$ = MkStopWatchingStmt(null, $3, null); }
1097 | assignment_expression '.' STOPWATCHING '(' assignment_expression ')'
1098 { $$ = MkStopWatchingStmt($1, $5, null); }
1103 { $$ = MkFireWatchersStmt(null, null); }
1104 | FIREWATCHERS watch_property_list
1105 { $$ = MkFireWatchersStmt(null, $2); }
1106 | postfix_expression '.' FIREWATCHERS
1107 { $$ = MkFireWatchersStmt($1, null); }
1108 | assignment_expression '.' FIREWATCHERS watch_property_list
1109 { $$ = MkFireWatchersStmt($1, $4); }
1113 guess_declaration_specifiers struct_declarator_list ';' { $$ = MkClassDefDeclaration(MkStructDeclaration($1, $2, null)); $$.decl.loc = @$; $$.loc = @$; $$.memberAccess = memberAccessStack[defaultMemberAccess]; }
1114 | guess_declaration_specifiers ';' { $$ = MkClassDefDeclaration(MkStructDeclaration($1, null, null)); $$.decl.loc = @$; $$.loc = @$; $$.memberAccess = memberAccessStack[defaultMemberAccess]; }
1115 | instantiation_unnamed ';' { $$ = MkClassDefDeclaration(MkDeclarationClassInst($1)); $$.loc = @$; $$.decl.loc = @$; $$.memberAccess = memberAccessStack[defaultMemberAccess]; }
1116 | guess_instantiation_named ';' { $$ = MkClassDefDeclaration(MkDeclarationClassInst($1)); $$.loc = @$; $$.decl.loc = @$; $$.memberAccess = memberAccessStack[defaultMemberAccess]; }
1117 | class_function_definition { $$ = MkClassDefFunction($1); $$.loc = @$; $$.memberAccess = memberAccessStack[defaultMemberAccess]; }
1118 | property { $$ = MkClassDefProperty($1); $$.loc = @$; globalContext.nextID++; $$.memberAccess = memberAccessStack[defaultMemberAccess]; }
1120 | member_access guess_declaration_specifiers struct_declarator_list ';' { $$ = MkClassDefDeclaration(MkStructDeclaration($2, $3, null)); $$.decl.loc = @$; $$.loc = @$; $$.memberAccess = $1; }
1121 | member_access guess_declaration_specifiers ';' { $$ = MkClassDefDeclaration(MkStructDeclaration($2, null, null)); $$.decl.loc = @$; $$.loc = @$; $$.memberAccess = $1; }
1122 | member_access instantiation_unnamed ';' { $$ = MkClassDefDeclaration(MkDeclarationClassInst($2)); $$.loc = @$; $$.decl.loc = @$; $$.memberAccess = $1; }
1123 | member_access guess_instantiation_named ';' { $$ = MkClassDefDeclaration(MkDeclarationClassInst($2)); $$.loc = @$; $$.decl.loc = @$; $$.memberAccess = $1; }
1124 | member_access class_function_definition { $$ = MkClassDefFunction($2); $$.loc = @$; $$.memberAccess = $1; }
1125 | member_access property { $$ = MkClassDefProperty($2); $$.loc = @$; globalContext.nextID++; $$.memberAccess = $1; }
1127 | default_property_list ';' { $$ = MkClassDefDefaultProperty($1); if($1->last) ((MemberInit)$1->last).loc.end = @2.start; $$.loc = @$; }
1128 | CLASS_DATA guess_declaration_specifiers struct_declarator_list ';' { $$ = MkClassDefClassData(MkStructDeclaration($2, $3, null)); $$.decl.loc = @$; $$.loc = @$; }
1129 | class_property { $$ = MkClassDefClassProperty($1); $$.loc = @$; globalContext.nextID++; }
1130 | self_watch_definition ';' { $$ = MkClassDefPropertyWatch($1); $$.loc = @$; globalContext.nextID++; }
1131 | WATCHABLE { $$ = null; deleteWatchable = true; }
1132 | CLASS_DESIGNER identifier ';' { $$ = MkClassDefDesigner($2.string); FreeIdentifier($2); }
1133 | CLASS_DESIGNER strict_type ';' { $$ = MkClassDefDesigner($2.name); FreeSpecifier($2); }
1134 | CLASS_NO_EXPANSION { $$ = MkClassDefNoExpansion(); }
1135 | CLASS_FIXED { $$ = MkClassDefFixed(); }
1136 | CLASS_DEFAULT_PROPERTY identifier ';' { $$ = MkClassDefDesignerDefaultProperty($2); }
1137 | CLASS_PROPERTY '(' identifier ')' '=' initializer_condition ';' { $$ = MkClassDefClassPropertyValue($3, $6); $$.loc = @$; }
1139 | ';' { $$ = null; }
1140 | member_access ':' { memberAccessStack[defaultMemberAccess] = $1; if(defaultMemberAccess == 0) { $$ = MkClassDefMemberAccess(); $$.memberAccess = $1; $$.loc = @$; } else $$ = null; }
1142 | member_access '(' identifier ')' { $$ = MkClassDefAccessOverride($1, $3); $$.loc = @$; }
1145 struct_declaration_error:
1146 class_function_definition_error { $$ = MkClassDefFunction($1); $$.loc = $1.loc; $$.loc.end.charPos++; $$.loc.end.pos++; $$.memberAccess = memberAccessStack[defaultMemberAccess]; }
1147 | guess_instantiation_named_error error { $$ = MkClassDefDeclaration(MkDeclarationClassInst($1)); $$.loc = $1.loc; $$.decl.loc = $$.loc; $$.memberAccess = memberAccessStack[defaultMemberAccess]; }
1148 | instantiation_unnamed_error error { $$ = MkClassDefDeclaration(MkDeclarationClassInst($1)); $$.loc = $1.loc; $$.decl.loc = $$.loc; $$.memberAccess = memberAccessStack[defaultMemberAccess]; }
1149 | guess_instantiation_named { $$ = MkClassDefDeclaration(MkDeclarationClassInst($1)); $$.loc = $1.loc; $$.decl.loc = $$.loc; $$.memberAccess = memberAccessStack[defaultMemberAccess]; }
1150 | instantiation_unnamed { $$ = MkClassDefDeclaration(MkDeclarationClassInst($1)); $$.loc = $1.loc; $$.decl.loc = $$.loc; $$.memberAccess = memberAccessStack[defaultMemberAccess]; }
1152 | member_access class_function_definition_error { $$ = MkClassDefFunction($2); $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++; $$.memberAccess = $1; }
1153 | member_access guess_instantiation_named_error error { $$ = MkClassDefDeclaration(MkDeclarationClassInst($2)); $$.loc = @$; $$.decl.loc = $$.loc; $$.memberAccess = $1; }
1154 | member_access instantiation_unnamed_error error { $$ = MkClassDefDeclaration(MkDeclarationClassInst($2)); $$.loc = @$; $$.decl.loc = $$.loc; $$.memberAccess = $1; }
1155 | member_access guess_instantiation_named { $$ = MkClassDefDeclaration(MkDeclarationClassInst($2)); $$.loc = @$; $$.decl.loc = $$.loc; $$.memberAccess = $1; }
1156 | member_access instantiation_unnamed { $$ = MkClassDefDeclaration(MkDeclarationClassInst($2)); $$.loc = @$; $$.decl.loc = $$.loc; $$.memberAccess = $1; }
1158 | default_property_list_error { $$ = MkClassDefDefaultProperty($1); $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++; }
1161 struct_declaration_list:
1162 struct_declaration { $$ = MkList(); ListAdd($$, $1); }
1163 | struct_declaration_list struct_declaration { $$ = $1; ListAdd($1, $2); }
1164 | struct_declaration_list_error struct_declaration { $$ = $1; ListAdd($1, $2); }
1167 struct_declaration_list_error:
1168 struct_declaration_error { $$ = MkList(); ListAdd($$, $1); }
1169 | struct_declaration_list error
1170 | struct_declaration_list_error error
1171 | struct_declaration_list struct_declaration_error { $$ = $1; ListAdd($$, $2); }
1172 | struct_declaration_list_error struct_declaration_error { $$ = $1; ListAdd($$, $2); }
1176 declaration_specifiers { $$ = MkTemplateDatatype($1, null); }
1177 | declaration_specifiers abstract_declarator { $$ = MkTemplateDatatype($1, $2); }
1178 | identifier { $$ = MkTemplateDatatype(MkListOne(MkSpecifierName($1.string)), null); FreeIdentifier($1); }
1181 template_type_argument:
1182 template_datatype { $$ = MkTemplateTypeArgument($1); }
1185 template_type_parameter:
1186 CLASS identifier { $$ = MkTypeTemplateParameter($2, null, null); }
1187 | CLASS identifier '=' template_type_argument { $$ = MkTypeTemplateParameter($2, null, $4); }
1188 | CLASS identifier ':' template_datatype { $$ = MkTypeTemplateParameter($2, $4, null); }
1189 | CLASS identifier ':' template_datatype '=' template_type_argument { $$ = MkTypeTemplateParameter($2, $4, $6); }
1190 | CLASS base_strict_type_name { $$ = MkTypeTemplateParameter(MkIdentifier($2), null, null); delete $2; }
1191 | CLASS base_strict_type_name '=' template_type_argument { $$ = MkTypeTemplateParameter(MkIdentifier($2), null, $4); }
1192 | CLASS base_strict_type_name ':' template_datatype { $$ = MkTypeTemplateParameter(MkIdentifier($2), $4, null); }
1193 | CLASS base_strict_type_name ':' template_datatype '=' template_type_argument { $$ = MkTypeTemplateParameter(MkIdentifier($2), $4, $6); }
1196 template_identifier_argument:
1197 identifier { $$ = MkTemplateIdentifierArgument($1); }
1200 template_identifier_parameter:
1201 identifier { $$ = MkIdentifierTemplateParameter($1, dataMember, null); }
1202 | identifier '=' template_identifier_argument { $$ = MkIdentifierTemplateParameter($1, dataMember, $3); }
1205 template_expression_argument:
1206 constant_expression { $$ = MkTemplateExpressionArgument($1); }
1209 template_expression_parameter:
1210 template_datatype identifier { $$ = MkExpressionTemplateParameter($2, $1, null); }
1211 | template_datatype identifier '=' template_expression_argument { $$ = MkExpressionTemplateParameter($2, $1, $4); }
1215 template_type_parameter
1216 | template_identifier_parameter
1217 | template_expression_parameter
1220 template_parameters_list:
1221 template_parameter { $$ = MkList(); ListAdd($$, $1); }
1222 | template_parameters_list ',' template_parameter { $$ = $1; ListAdd($1, $3); }
1226 template_expression_argument
1227 | template_identifier_argument
1228 | template_type_argument
1229 | identifier '=' template_expression_argument { $$ = $3; $$.name = $1; $$.loc = @$; }
1230 | identifier '=' template_identifier_argument { $$ = $3; $$.name = $1; $$.loc = @$; }
1231 | identifier '=' template_type_argument { $$ = $3; $$.name = $1; $$.loc = @$; }
1232 | template_datatype '=' template_expression_argument
1235 if($1.specifiers && $1.specifiers->first)
1237 Specifier spec = $1.specifiers->first;
1238 if(spec.type == nameSpecifier)
1239 $$.name = MkIdentifier(spec.name);
1241 FreeTemplateDataType($1);
1244 | template_datatype '=' template_identifier_argument
1247 if($1.specifiers && $1.specifiers->first)
1249 Specifier spec = $1.specifiers->first;
1250 if(spec.type == nameSpecifier)
1251 $$.name = MkIdentifier(spec.name);
1253 FreeTemplateDataType($1);
1256 | template_datatype '=' template_type_argument
1259 if($1.specifiers && $1.specifiers->first)
1261 Specifier spec = $1.specifiers->first;
1262 if(spec.type == nameSpecifier)
1263 $$.name = MkIdentifier(spec.name);
1265 FreeTemplateDataType($1);
1270 template_arguments_list:
1271 template_argument { $$ = MkList(); ListAdd($$, $1); }
1272 | template_arguments_list ',' template_argument { $$ = $1; ListAdd($1, $3); }
1278 if(curContext != globalContext)
1279 PopContext(curContext);
1284 class_entry identifier { $1; $$ = DeclClassAddNameSpace(globalContext.nextID++, $2.string); FreeIdentifier($2); $$.nameLoc = @2; memberAccessStack[++defaultMemberAccess] = privateAccess; }
1285 | class_entry base_strict_type
1287 $1; $$ = DeclClass(globalContext.nextID++, $2.name);
1290 ++defaultMemberAccess;
1291 memberAccessStack[defaultMemberAccess] = privateAccess;
1293 | identifier class_entry identifier { $2; $$ = DeclClassAddNameSpace(globalContext.nextID++, $3.string); FreeIdentifier($1); FreeIdentifier($3); $$.nameLoc = @3; $$.isRemote = true; memberAccessStack[++defaultMemberAccess] = privateAccess; }
1294 | identifier class_entry base_strict_type { $2; $$ = DeclClass(globalContext.nextID++, $3.name); FreeIdentifier($1); $$.nameLoc = @3; $$.isRemote = true; FreeSpecifier($3); memberAccessStack[++defaultMemberAccess] = privateAccess; }
1296 | class_entry identifier '<' template_parameters_list '>' { $1; $$ = DeclClassAddNameSpace(globalContext.nextID++, $2.string); $$.templateParams = $4; FreeIdentifier($2); $$.nameLoc = @2; memberAccessStack[++defaultMemberAccess] = privateAccess; }
1297 | class_entry base_strict_type '<' template_parameters_list '>'
1299 $1; $$ = DeclClass(globalContext.nextID++, $2.name);
1300 $$.templateParams = $4;
1303 ++defaultMemberAccess;
1304 memberAccessStack[defaultMemberAccess] = privateAccess;
1306 | identifier class_entry identifier '<' template_parameters_list '>' { $2; $$ = DeclClassAddNameSpace(globalContext.nextID++, $3.string); $$.templateParams = $5; FreeIdentifier($1); FreeIdentifier($3); $$.nameLoc = @3; $$.isRemote = true; memberAccessStack[++defaultMemberAccess] = privateAccess; }
1307 | identifier class_entry base_strict_type '<' template_parameters_list '>' { $2; $$ = DeclClass(globalContext.nextID++, $3.name); $$.templateParams = $5; FreeIdentifier($1); $$.nameLoc = @3; $$.isRemote = true; FreeSpecifier($3); memberAccessStack[++defaultMemberAccess] = privateAccess; }
1317 // Added this for unit classes...
1320 $$ = $1; $$.definitions = MkList(); $$.blockStart = @2; $$.loc = @$; $$.endid = globalContext.nextID++;
1322 PopContext(curContext);
1325 | class_decl '{' '}'
1327 $$ = MkClass($1, null, MkList()); $$.blockStart = @2; $$.loc = @$; $$.endid = globalContext.nextID++;
1329 PopContext(curContext);
1331 | class_head '{' '}'
1333 $$ = $1; $$.definitions = MkList(); $$.blockStart = @2; $$.loc = @$; $$.endid = globalContext.nextID++;
1335 PopContext(curContext);
1338 | class_entry identifier ';'
1340 $1; $$ = MkClass(DeclClassAddNameSpace(0, $2.string), null, null); FreeIdentifier($2);
1342 PopContext(curContext);
1344 | class_entry type ';'
1346 $1; $$ = MkClass(DeclClass(0, $2.name), null, null); FreeSpecifier($2);
1348 PopContext(curContext);
1353 class_decl ':' inheritance_specifiers
1355 $$ = MkClass($1, $3, null);
1360 class_decl '{' struct_declaration_list_error
1362 $$ = MkClass($1, null, $3); $$.deleteWatchable = deleteWatchable; deleteWatchable = false; $$.blockStart = @2; $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++; $$.endid = globalContext.nextID++;
1364 PopContext(curContext);
1366 | class_head '{' struct_declaration_list_error
1368 $$ = $1; $$.definitions = $3; $$.deleteWatchable = deleteWatchable; deleteWatchable = false; $$.blockStart = @2; $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++; $$.endid = globalContext.nextID++;
1370 PopContext(curContext);
1372 | class_decl '{' struct_declaration_list
1374 $$ = MkClass($1, null, $3); $$.deleteWatchable = deleteWatchable; deleteWatchable = false; $$.blockStart = @2; $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++; $$.endid = globalContext.nextID++;
1376 PopContext(curContext);
1378 | class_head '{' struct_declaration_list
1380 $$ = $1; $$.definitions = $3; $$.deleteWatchable = deleteWatchable; deleteWatchable = false; $$.blockStart = @2; $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++; $$.endid = globalContext.nextID++;
1382 PopContext(curContext);
1384 | class_decl '{' error
1386 $$ = MkClass($1, null, MkList()); $$.deleteWatchable = deleteWatchable; deleteWatchable = false; $$.blockStart = @2; $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++; $$.endid = globalContext.nextID++;
1388 PopContext(curContext);
1390 | class_head '{' error
1392 $$ = $1; $$.definitions = MkList(); $$.deleteWatchable = deleteWatchable; deleteWatchable = false; $$.blockStart = @2; $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++; $$.endid = globalContext.nextID++;
1394 PopContext(curContext);
1398 /**** EXPRESSIONS ********************************************************************/
1402 { $$ = MkIdentifier(yytext); $$.loc = @1; }
1406 simple_primary_expression
1407 | '(' expression ')'
1408 { $$ = MkExpBrackets($2); $$.loc = @$; }
1412 string_literal { $$ = MkExpString($1); delete $1; $$.loc = @$; }
1413 | '$' string_literal { $$ = MkExpIntlString($2, null); delete $2; $$.loc = @$; }
1414 | '$' string_literal '.' string_literal { $$ = MkExpIntlString($4, $2); delete $2; delete $4; $$.loc = @$; }
1417 simple_primary_expression:
1418 identifier { $$ = MkExpIdentifier($1); $$.loc = @$; }
1419 | instantiation_unnamed { $$ = MkExpInstance($1); $$.loc = @$; }
1420 | EXTENSION '(' compound_statement ')' { $$ = MkExpExtensionCompound($3); $$.loc = @$; }
1421 | EXTENSION '(' expression ')' { $$ = MkExpExtensionExpression($3); $$.loc = @$; }
1422 | EXTENSION '(' type_name ')' initializer { $$ = MkExpExtensionInitializer($3, $5); $$.loc = @$; }
1423 | EXTENSION '(' type_name ')' '(' type_name ')' initializer { $$ = MkExpExtensionInitializer($3, MkInitializerAssignment(MkExpExtensionInitializer($6, $8))); $$.loc = @$; }
1424 | CONSTANT { $$ = MkExpConstant(yytext); $$.loc = @$; }
1426 | '(' ')' { Expression exp = MkExpDummy(); exp.loc.start = @1.end; exp.loc.end = @2.start; $$ = MkExpBrackets(MkListOne(exp)); $$.loc = @$; yyerror(); }
1427 | NEWOP new_specifiers abstract_declarator_noarray '[' constant_expression ']' { $$ = MkExpNew(MkTypeName($2,$3), $5); $$.loc = @$; }
1428 | NEWOP new_specifiers abstract_declarator_noarray '[' constant_expression_error ']' { $$ = MkExpNew(MkTypeName($2,$3), $5); $$.loc = @$; }
1429 | NEWOP new_specifiers '[' constant_expression ']' { $$ = MkExpNew(MkTypeName($2,null), $4); $$.loc = @$; }
1430 | NEWOP new_specifiers '[' constant_expression_error ']' { $$ = MkExpNew(MkTypeName($2,null), $4); $$.loc = @$; }
1431 | NEW0OP new_specifiers abstract_declarator_noarray '[' constant_expression ']' { $$ = MkExpNew0(MkTypeName($2,$3), $5); $$.loc = @$; }
1432 | NEW0OP new_specifiers abstract_declarator_noarray '[' constant_expression_error ']' { $$ = MkExpNew0(MkTypeName($2,$3), $5); $$.loc = @$; }
1433 | NEW0OP new_specifiers '[' constant_expression ']' { $$ = MkExpNew0(MkTypeName($2,null), $4); $$.loc = @$; }
1434 | NEW0OP new_specifiers '[' constant_expression_error ']' { $$ = MkExpNew0(MkTypeName($2,null), $4); $$.loc = @$; }
1435 | RENEW constant_expression renew_specifiers abstract_declarator_noarray '[' constant_expression ']' { $$ = MkExpRenew($2, MkTypeName($3,$4), $6); $$.loc = @$; }
1436 | RENEW constant_expression renew_specifiers abstract_declarator_noarray '[' constant_expression_error ']' { $$ = MkExpRenew($2, MkTypeName($3,$4), $6); $$.loc = @$; }
1437 | RENEW constant_expression renew_specifiers '[' constant_expression ']' { $$ = MkExpRenew($2, MkTypeName($3,null), $5); $$.loc = @$; }
1438 | RENEW constant_expression renew_specifiers '[' constant_expression_error ']' { $$ = MkExpRenew($2, MkTypeName($3,null), $5); $$.loc = @$; }
1439 | RENEW0 constant_expression renew_specifiers abstract_declarator_noarray '[' constant_expression ']' { $$ = MkExpRenew0($2, MkTypeName($3,$4), $6); $$.loc = @$; }
1440 | RENEW0 constant_expression renew_specifiers abstract_declarator_noarray '[' constant_expression_error ']' { $$ = MkExpRenew0($2, MkTypeName($3,$4), $6); $$.loc = @$; }
1441 | RENEW0 constant_expression renew_specifiers '[' constant_expression ']' { $$ = MkExpRenew0($2, MkTypeName($3,null), $5); $$.loc = @$; }
1442 | RENEW0 constant_expression renew_specifiers '[' constant_expression_error ']' { $$ = MkExpRenew0($2, MkTypeName($3,null), $5); $$.loc = @$; }
1443 | CLASS '(' declaration_specifiers ')' { $$ = MkExpClass($3, null); $$.loc = @$; }
1444 | CLASS '(' declaration_specifiers abstract_declarator ')' { $$ = MkExpClass($3, $4); $$.loc = @$; }
1445 | CLASS '(' identifier ')' { $$ = MkExpClass(MkListOne(MkSpecifierName($3.string)), null); FreeIdentifier($3); $$.loc = @$; }
1446 | VAARG '(' assignment_expression ',' type_name ')' { $$ = MkExpVaArg($3, $5); $$.loc = @$; }
1448 | CLASS_DATA '(' identifier ')' { $$ = MkExpClassData($3); $$.loc = @$; }
1454 | '[' argument_expression_list /*expression*/ ']' { $$ = MkExpArray($2); $$.loc = @$; }
1457 anon_instantiation_expression:
1458 instantiation_anon { $$ = MkExpInstance($1); $$.loc = @$; }
1461 anon_instantiation_expression_error:
1462 instantiation_anon_error error { $$ = MkExpInstance($1); $$.loc = @$; }
1465 primary_expression_error:
1466 '(' expression { $$ = MkExpBrackets($2); $$.loc = @$; }
1467 | '(' expression_error { $$ = MkExpBrackets($2); $$.loc = @$; }
1473 | postfix_expression '[' expression ']' { $$ = MkExpIndex($1, $3); $$.loc = @$; }
1474 | postfix_expression '[' expression_error ']' { $$ = MkExpIndex($1, $3); $$.loc = @$; }
1475 | postfix_expression '(' ')' { $$ = MkExpCall($1, MkList()); $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @3.end; $$.loc = @$; }
1476 | postfix_expression '(' argument_expression_list ')' { $$ = MkExpCall($1, $3); $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @4.end; $$.loc = @$; }
1477 | postfix_expression '(' argument_expression_list_error ')' { $$ = MkExpCall($1, $3); $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @4.end; $$.loc = @$; if($3->last) ((Expression)$3->last).loc.end = @4.start; }
1478 | postfix_expression '.' identifier { $$ = MkExpMember($1, $3); $$.loc = @$; }
1479 | postfix_expression PTR_OP identifier { $$ = MkExpPointer($1, $3); $$.loc = @$; }
1480 | postfix_expression INC_OP { $$ = MkExpOp($1, INC_OP, null); $$.loc = @$; }
1481 | postfix_expression DEC_OP { $$ = MkExpOp($1, DEC_OP, null); $$.loc = @$; }
1483 | postfix_expression_error '[' expression ']' { $$ = MkExpIndex($1, $3); $$.loc = @$; }
1484 | postfix_expression_error '[' expression_error ']' { $$ = MkExpIndex($1, $3); $$.loc = @$; }
1485 | postfix_expression_error '(' ')' { $$ = MkExpCall($1, MkList()); $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @3.end; $$.loc = @$; }
1486 | postfix_expression_error '(' argument_expression_list ')' { $$ = MkExpCall($1, $3); $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @4.end;$$.loc = @$; }
1487 | postfix_expression_error '.' identifier { $$ = MkExpMember($1, $3); $$.loc = @$; }
1488 | postfix_expression_error PTR_OP identifier { $$ = MkExpPointer($1, $3); $$.loc = @$; }
1489 | postfix_expression_error INC_OP { $$ = MkExpOp($1, INC_OP, null); $$.loc = @$; }
1490 | postfix_expression_error DEC_OP { $$ = MkExpOp($1, DEC_OP, null); $$.loc = @$; }
1493 simple_postfix_expression:
1494 simple_primary_expression
1496 | simple_postfix_expression '[' expression ']' { $$ = MkExpIndex($1, $3); $$.loc = @$; }
1497 | simple_postfix_expression '[' expression_error ']' { $$ = MkExpIndex($1, $3); $$.loc = @$; }
1498 | simple_postfix_expression '(' ')' { $$ = MkExpCall($1, MkList()); $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @3.end; $$.loc = @$; }
1499 | simple_postfix_expression '(' argument_expression_list ')' { $$ = MkExpCall($1, $3); $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @4.end; $$.loc = @$; }
1500 | simple_postfix_expression '(' argument_expression_list_error ')' { $$ = MkExpCall($1, $3); $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @4.end; $$.loc = @$; if($3->last) ((Expression)$3->last).loc.end = @4.start; }
1501 | simple_postfix_expression '.' identifier { $$ = MkExpMember($1, $3); $$.loc = @$; }
1502 | simple_postfix_expression PTR_OP identifier { $$ = MkExpPointer($1, $3); $$.loc = @$; }
1503 | simple_postfix_expression INC_OP { $$ = MkExpOp($1, INC_OP, null); $$.loc = @$; }
1504 | simple_postfix_expression DEC_OP { $$ = MkExpOp($1, DEC_OP, null); $$.loc = @$; }
1506 | simple_postfix_expression_error '[' expression ']' { $$ = MkExpIndex($1, $3); $$.loc = @$; }
1507 | simple_postfix_expression_error '[' expression_error ']' { $$ = MkExpIndex($1, $3); $$.loc = @$; }
1508 | simple_postfix_expression_error '(' ')' { $$ = MkExpCall($1, MkList()); $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @3.end; $$.loc = @$; }
1509 | simple_postfix_expression_error '(' argument_expression_list ')' { $$ = MkExpCall($1, $3); $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @4.end;$$.loc = @$; }
1510 | simple_postfix_expression_error '.' identifier { $$ = MkExpMember($1, $3); $$.loc = @$; }
1511 | simple_postfix_expression_error PTR_OP identifier { $$ = MkExpPointer($1, $3); $$.loc = @$; }
1512 | simple_postfix_expression_error INC_OP { $$ = MkExpOp($1, INC_OP, null); $$.loc = @$; }
1513 | simple_postfix_expression_error DEC_OP { $$ = MkExpOp($1, DEC_OP, null); $$.loc = @$; }
1516 argument_expression_list:
1517 assignment_expression { $$ = MkList(); ListAdd($$, $1); }
1518 | anon_instantiation_expression { $$ = MkList(); ListAdd($$, $1); }
1519 | argument_expression_list ',' assignment_expression { $$ = $1; ListAdd($1, $3); }
1520 | argument_expression_list ',' anon_instantiation_expression { $$ = $1; ListAdd($1, $3); }
1523 argument_expression_list_error:
1524 assignment_expression_error { $$ = MkList(); ListAdd($$, $1); }
1525 | anon_instantiation_expression_error { $$ = MkList(); ListAdd($$, $1); }
1526 | argument_expression_list ',' assignment_expression_error { $$ = $1; ListAdd($1, $3); }
1527 | argument_expression_list ',' anon_instantiation_expression_error { $$ = $1; ListAdd($1, $3); }
1528 | argument_expression_list ',' { Expression exp = MkExpDummy(); exp.loc.start = @2.end; exp.loc.end = @2.end; $$ = $1; ListAdd($1, exp); }
1531 common_unary_expression:
1532 INC_OP unary_expression { $$ = MkExpOp(null, INC_OP, $2); $$.loc = @$; }
1533 | DEC_OP unary_expression { $$ = MkExpOp(null, DEC_OP, $2); $$.loc = @$; }
1534 | unary_operator cast_expression { $$ = MkExpOp(null, $1, $2); $$.loc = @$; }
1535 | unary_operator anon_instantiation_expression { $$ = MkExpOp(null, $1, $2); $$.loc = @$; }
1536 | SIZEOF '(' unary_expression ')' { $$ = MkExpOp(null, SIZEOF, $3); $$.loc = @$; }
1537 | SIZEOF simple_unary_expression { $$ = MkExpOp(null, SIZEOF, $2); $$.loc = @$; }
1538 | SIZEOF '(' guess_type_name ')' { $$ = MkExpTypeSize($3); $$.loc = @$; }
1539 | SIZEOF '(' CLASS type ')' { $$ = MkExpClassSize($4); $$.loc = @$; }
1540 | SIZEOF '(' CLASS guess_type ')' { $$ = MkExpClassSize($4); $$.loc = @$; }
1542 | ALIGNOF '(' unary_expression ')' { $$ = MkExpOp(null, ALIGNOF, $3); $$.loc = @$; }
1543 | ALIGNOF simple_unary_expression { $$ = MkExpOp(null, ALIGNOF, $2); $$.loc = @$; }
1544 | ALIGNOF '(' guess_type_name ')' { $$ = MkExpTypeAlign($3); $$.loc = @$; }
1548 common_unary_expression
1549 | postfix_expression
1552 simple_unary_expression:
1553 common_unary_expression
1554 | simple_postfix_expression
1564 | DELETE { $$ = DELETE; }
1565 | _INCREF { $$ = _INCREF; }
1570 | '(' type_name ')' cast_expression { $$ = MkExpCast($2, $4); $$.loc = @$; }
1573 multiplicative_expression:
1575 | multiplicative_expression '*' cast_expression { $$ = MkExpOp($1, '*', $3); $$.loc = @$; }
1576 | multiplicative_expression '/' cast_expression { $$ = MkExpOp($1, '/', $3); $$.loc = @$; }
1577 | multiplicative_expression '%' cast_expression { $$ = MkExpOp($1, '%', $3); $$.loc = @$; }
1578 | multiplicative_expression_error '*' cast_expression { $$ = MkExpOp($1, '*', $3); $$.loc = @$; }
1579 | multiplicative_expression_error '/' cast_expression { $$ = MkExpOp($1, '/', $3); $$.loc = @$; }
1580 | multiplicative_expression_error '%' cast_expression { $$ = MkExpOp($1, '%', $3); $$.loc = @$; }
1583 additive_expression:
1584 multiplicative_expression
1585 | additive_expression '+' multiplicative_expression { $$ = MkExpOp($1, '+', $3); $$.loc = @$; }
1586 | additive_expression '-' multiplicative_expression { $$ = MkExpOp($1, '-', $3); $$.loc = @$; }
1587 | additive_expression_error '+' multiplicative_expression { $$ = MkExpOp($1, '+', $3); $$.loc = @$; }
1588 | additive_expression_error '-' multiplicative_expression { $$ = MkExpOp($1, '-', $3); $$.loc = @$; }
1593 | shift_expression LEFT_OP additive_expression { $$ = MkExpOp($1, LEFT_OP, $3); $$.loc = @$; }
1594 | shift_expression RIGHT_OP additive_expression { $$ = MkExpOp($1, RIGHT_OP, $3); $$.loc = @$; }
1595 | shift_expression_error LEFT_OP additive_expression { $$ = MkExpOp($1, LEFT_OP, $3); $$.loc = @$; }
1596 | shift_expression_error RIGHT_OP additive_expression { $$ = MkExpOp($1, RIGHT_OP, $3); $$.loc = @$; }
1599 relational_expression_smaller_than:
1600 relational_expression '<'
1607 relational_expression:
1609 | relational_expression_smaller_than /*relational_expression '<' */ shift_expression { skipErrors = false; $$ = MkExpOp($1, '<', $2/*$3*/); $$.loc = @$; }
1610 | relational_expression '>' shift_expression { $$ = MkExpOp($1, '>', $3); $$.loc = @$; }
1611 | relational_expression LE_OP shift_expression { $$ = MkExpOp($1, LE_OP, $3); $$.loc = @$; }
1612 | relational_expression GE_OP shift_expression { $$ = MkExpOp($1, GE_OP, $3); $$.loc = @$; }
1613 | relational_expression_error '<' shift_expression { $$ = MkExpOp($1, '<', $3); $$.loc = @$; }
1614 | relational_expression_error '>' shift_expression { $$ = MkExpOp($1, '>', $3); $$.loc = @$; }
1615 | relational_expression_error LE_OP shift_expression { $$ = MkExpOp($1, LE_OP, $3); $$.loc = @$; }
1616 | relational_expression_error GE_OP shift_expression { $$ = MkExpOp($1, GE_OP, $3); $$.loc = @$; }
1620 : relational_expression
1621 | equality_expression EQ_OP relational_expression { $$ = MkExpOp($1, EQ_OP, $3); $$.loc = @$; }
1622 | equality_expression NE_OP relational_expression { $$ = MkExpOp($1, NE_OP, $3); $$.loc = @$; }
1623 | equality_expression_error EQ_OP relational_expression { $$ = MkExpOp($1, EQ_OP, $3); $$.loc = @$; }
1624 | equality_expression_error NE_OP relational_expression { $$ = MkExpOp($1, NE_OP, $3); $$.loc = @$; }
1626 | equality_expression EQ_OP anon_instantiation_expression { $$ = MkExpOp($1, EQ_OP, $3); $$.loc = @$; }
1627 | equality_expression NE_OP anon_instantiation_expression { $$ = MkExpOp($1, NE_OP, $3); $$.loc = @$; }
1628 | equality_expression_error EQ_OP anon_instantiation_expression { $$ = MkExpOp($1, EQ_OP, $3); $$.loc = @$; }
1629 | equality_expression_error NE_OP anon_instantiation_expression { $$ = MkExpOp($1, NE_OP, $3); $$.loc = @$; }
1633 : equality_expression
1634 | and_expression '&' equality_expression { $$ = MkExpOp($1, '&', $3); $$.loc = @$; }
1635 | and_expression_error '&' equality_expression { $$ = MkExpOp($1, '&', $3); $$.loc = @$; }
1637 | and_expression '&' anon_instantiation_expression { $$ = MkExpOp($1, '&', $3); $$.loc = @$; }
1638 | and_expression_error '&' anon_instantiation_expression { $$ = MkExpOp($1, '&', $3); $$.loc = @$; }
1641 exclusive_or_expression
1643 | exclusive_or_expression '^' and_expression { $$ = MkExpOp($1, '^', $3); $$.loc = @$; }
1644 | exclusive_or_expression_error '^' and_expression { $$ = MkExpOp($1, '^', $3); $$.loc = @$; }
1646 | exclusive_or_expression '^' anon_instantiation_expression { $$ = MkExpOp($1, '^', $3); $$.loc = @$; }
1647 | exclusive_or_expression_error '^' anon_instantiation_expression { $$ = MkExpOp($1, '^', $3); $$.loc = @$; }
1650 inclusive_or_expression
1651 : exclusive_or_expression
1652 | inclusive_or_expression '|' exclusive_or_expression { $$ = MkExpOp($1, '|', $3); $$.loc = @$; }
1653 | inclusive_or_expression_error '|' exclusive_or_expression { $$ = MkExpOp($1, '|', $3); $$.loc = @$; }
1655 | inclusive_or_expression '|' anon_instantiation_expression { $$ = MkExpOp($1, '|', $3); $$.loc = @$; }
1656 | inclusive_or_expression_error '|' anon_instantiation_expression { $$ = MkExpOp($1, '|', $3); $$.loc = @$; }
1659 logical_and_expression
1660 : inclusive_or_expression
1661 | logical_and_expression AND_OP inclusive_or_expression { $$ = MkExpOp($1, AND_OP, $3); $$.loc = @$; }
1662 | logical_and_expression_error AND_OP inclusive_or_expression { $$ = MkExpOp($1, AND_OP, $3); $$.loc = @$; }
1665 logical_or_expression
1666 : logical_and_expression
1667 | logical_or_expression OR_OP logical_and_expression { $$ = MkExpOp($1, OR_OP, $3); $$.loc = @$; }
1668 | logical_or_expression_error OR_OP logical_and_expression { $$ = MkExpOp($1, OR_OP, $3); $$.loc = @$; }
1671 conditional_expression
1672 : logical_or_expression
1673 | logical_or_expression '?' expression ':' conditional_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1674 | logical_or_expression '?' expression_error ':' conditional_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1675 | logical_or_expression_error '?' expression ':' conditional_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1676 | logical_or_expression_error '?' expression_error ':' conditional_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1678 | logical_or_expression '?' expression_anon_inst ':' conditional_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1679 | logical_or_expression '?' expression_anon_inst_error ':' conditional_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1680 | logical_or_expression_error '?' expression_anon_inst ':' conditional_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1681 | logical_or_expression_error '?' expression_anon_inst_error ':' conditional_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1683 | logical_or_expression '?' expression ':' anon_instantiation_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1684 | logical_or_expression '?' expression_error ':' anon_instantiation_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1685 | logical_or_expression_error '?' expression ':' anon_instantiation_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1686 | logical_or_expression_error '?' expression_error ':' anon_instantiation_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1688 | logical_or_expression '?' expression_anon_inst ':' anon_instantiation_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1689 | logical_or_expression '?' expression_anon_inst_error ':' anon_instantiation_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1690 | logical_or_expression_error '?' expression_anon_inst ':' anon_instantiation_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1691 | logical_or_expression_error '?' expression_anon_inst_error ':' anon_instantiation_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1694 assignment_expression:
1695 conditional_expression
1696 | unary_expression assignment_operator assignment_expression { $$ = MkExpOp($1, $2, $3); $$.loc = @$; }
1697 | unary_expression_error assignment_operator assignment_expression { $$ = MkExpOp($1, $2, $3); $$.loc = @$; }
1698 | conditional_expression assignment_operator assignment_expression { $$ = MkExpOp($1, $2, $3); $$.loc = @$; } // TODO: Generate error here:
1699 | conditional_expression_error assignment_operator assignment_expression { $$ = MkExpOp($1, $2, $3); $$.loc = @$; } // TODO: Generate error here:
1701 | unary_expression assignment_operator anon_instantiation_expression { $$ = MkExpOp($1, $2, $3); $$.loc = @$; }
1702 | unary_expression_error assignment_operator anon_instantiation_expression { $$ = MkExpOp($1, $2, $3); $$.loc = @$; }
1703 | conditional_expression assignment_operator anon_instantiation_expression { $$ = MkExpOp($1, $2, $3); $$.loc = @$; }
1704 | conditional_expression_error assignment_operator anon_instantiation_expression { $$ = MkExpOp($1, $2, $3); $$.loc = @$; }
1707 assignment_operator:
1709 | MUL_ASSIGN { $$ = MUL_ASSIGN; }
1710 | DIV_ASSIGN { $$ = DIV_ASSIGN; }
1711 | MOD_ASSIGN { $$ = MOD_ASSIGN; }
1712 | ADD_ASSIGN { $$ = ADD_ASSIGN; }
1713 | SUB_ASSIGN { $$ = SUB_ASSIGN; }
1714 | LEFT_ASSIGN { $$ = LEFT_ASSIGN; }
1715 | RIGHT_ASSIGN { $$ = RIGHT_ASSIGN; }
1716 | AND_ASSIGN { $$ = AND_ASSIGN; }
1717 | XOR_ASSIGN { $$ = XOR_ASSIGN; }
1718 | OR_ASSIGN { $$ = OR_ASSIGN; }
1722 assignment_expression { $$ = MkList(); ListAdd($$, $1); }
1723 | expression ',' assignment_expression { $$ = $1; ListAdd($1, $3); }
1724 | expression_error ',' assignment_expression { $$ = $1; ListAdd($1, $3); }
1725 | expression_error ')'
1728 expression_anon_inst:
1729 anon_instantiation_expression { $$ = MkList(); ListAdd($$, $1); }
1730 | expression ',' anon_instantiation_expression { $$ = $1; ListAdd($1, $3); }
1731 | expression_error ',' anon_instantiation_expression { $$ = $1; ListAdd($1, $3); }
1734 postfix_expression_error:
1735 primary_expression_error
1736 | error { $$ = MkExpDummy(); $$.loc = @$; /*printf("Sorry, didn't mean that syntax error\n");*/ }
1737 | postfix_expression error
1738 | instantiation_unnamed_error error { $$ = MkExpInstance($1); $$.loc = @$; }
1740 | postfix_expression PTR_OP error { $$ = MkExpPointer($1, null); $$.loc = @$; }
1741 | postfix_expression_error PTR_OP error { $$ = MkExpPointer($1, null); $$.loc = @$; }
1743 | postfix_expression '(' argument_expression_list { $$ = MkExpCall($1, $3); $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @3.end; $$.loc = @$; $$.call.argLoc.end.charPos++;}
1744 | postfix_expression '(' argument_expression_list_error { $$ = MkExpCall($1, $3); $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @3.end; $$.loc = @$; $$.call.argLoc.end.charPos++;}
1745 /* Useless rules due to conflicts
1746 | postfix_expression '(' argument_expression_list ',' error { $$ = MkExpCall($1, $3); $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @4.end;$$.loc = @$; $$.call.argLoc.end.charPos++;}
1747 | postfix_expression '(' error { $$ = MkExpCall($1, MkList() ); @$.end = yylloc.start; $$.loc = @$; $$.call.argLoc.start = @2.start; $$.call.argLoc.end = yylloc.start; }
1749 | postfix_expression '.' error { $$ = MkExpMember($1, null); $$.loc = @$; }
1751 | postfix_expression_error '(' argument_expression_list_error { $$ = MkExpCall($1, $3); $$.loc = @$; $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @3.end; $$.call.argLoc.end.charPos++;}
1752 /* Useless rules due to conflicts
1753 | postfix_expression_error '(' argument_expression_list ',' error { $$ = MkExpCall($1, $3); $$.loc = @$; $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @4.end; $$.call.argLoc.end.charPos++;}
1754 | postfix_expression_error '(' error { $$ = MkExpCall($1, MkList() ); $$.loc = @$; $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @2.end; $$.call.argLoc.end.charPos++;}
1756 | postfix_expression_error '.' error { $$ = MkExpMember($1, null); $$.loc = @$; }
1759 simple_postfix_expression_error:
1760 error { $$ = MkExpDummy(); $$.loc = @$; }
1761 | simple_postfix_expression error
1762 | instantiation_unnamed_error error { $$ = MkExpInstance($1); $$.loc = @$; }
1764 | simple_postfix_expression PTR_OP error { $$ = MkExpPointer($1, null); $$.loc = @$; }
1765 | simple_postfix_expression_error PTR_OP error { $$ = MkExpPointer($1, null); $$.loc = @$; }
1767 | simple_postfix_expression '(' argument_expression_list { $$ = MkExpCall($1, $3); $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @3.end; $$.loc = @$; $$.call.argLoc.end.charPos++;}
1768 | simple_postfix_expression '(' argument_expression_list_error { $$ = MkExpCall($1, $3); $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @3.end; $$.loc = @$; $$.call.argLoc.end.charPos++;}
1769 /* Useless rules due to conflicts
1770 | simple_postfix_expression '(' argument_expression_list ',' error { $$ = MkExpCall($1, $3); $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @4.end;$$.loc = @$; $$.call.argLoc.end.charPos++;}
1771 | simple_postfix_expression '(' error { $$ = MkExpCall($1, MkList() ); @$.end = yylloc.start; $$.loc = @$; $$.call.argLoc.start = @2.start; $$.call.argLoc.end = yylloc.start; }
1773 | simple_postfix_expression '.' error { $$ = MkExpMember($1, null); $$.loc = @$; }
1775 | simple_postfix_expression_error '(' argument_expression_list_error { $$ = MkExpCall($1, $3); $$.loc = @$; $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @3.end; $$.call.argLoc.end.charPos++;}
1776 /* Useless rules due to conflicts
1777 | simple_postfix_expression_error '(' argument_expression_list ',' error { $$ = MkExpCall($1, $3); $$.loc = @$; $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @4.end; $$.call.argLoc.end.charPos++;}
1778 | simple_postfix_expression_error '(' error { $$ = MkExpCall($1, MkList() ); $$.loc = @$; $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @2.end; $$.call.argLoc.end.charPos++;}
1780 | simple_postfix_expression_error '.' error { $$ = MkExpMember($1, null); $$.loc = @$; }
1783 common_unary_expression_error:
1784 INC_OP unary_expression_error { $$ = MkExpOp(null, INC_OP, $2); $$.loc = @$; }
1785 | DEC_OP unary_expression_error { $$ = MkExpOp(null, DEC_OP, $2); $$.loc = @$; }
1786 | unary_operator cast_expression_error { $$ = MkExpOp(null, $1, $2); $$.loc = @$; }
1787 | unary_operator anon_instantiation_expression_error { $$ = MkExpOp(null, $1, $2); $$.loc = @$; }
1788 | SIZEOF '(' unary_expression_error { $$ = MkExpOp(null, SIZEOF, $3); $$.loc = @$; }
1789 | SIZEOF simple_unary_expression_error { $$ = MkExpOp(null, SIZEOF, $2); $$.loc = @$; }
1790 | SIZEOF '(' guess_type_name ')' error { $$ = MkExpTypeSize($3); $$.loc = @$; }
1791 | SIZEOF '(' CLASS type ')' error { $$ = MkExpClassSize($4); $$.loc = @$; }
1792 | SIZEOF '(' CLASS guess_type ')' error { $$ = MkExpClassSize($4); $$.loc = @$; }
1793 | ALIGNOF '(' unary_expression_error { $$ = MkExpOp(null, ALIGNOF, $3); $$.loc = @$; }
1794 | ALIGNOF simple_unary_expression_error { $$ = MkExpOp(null, ALIGNOF, $2); $$.loc = @$; }
1795 | ALIGNOF '(' guess_type_name ')' error { $$ = MkExpTypeAlign($3); $$.loc = @$; }
1798 unary_expression_error:
1799 common_unary_expression_error
1800 | postfix_expression_error
1803 simple_unary_expression_error:
1804 common_unary_expression_error
1805 | simple_postfix_expression_error
1809 cast_expression_error:
1810 unary_expression_error
1811 | '(' type_name ')' cast_expression_error { $$ = MkExpCast($2, $4); $$.loc = @$; }
1814 multiplicative_expression_error:
1815 cast_expression_error
1816 | multiplicative_expression '*' cast_expression_error { $$ = MkExpOp($1, '*', $3); $$.loc = @$; }
1817 | multiplicative_expression '/' cast_expression_error { $$ = MkExpOp($1, '/', $3); $$.loc = @$; }
1818 | multiplicative_expression '%' cast_expression_error { $$ = MkExpOp($1, '%', $3); $$.loc = @$; }
1819 | multiplicative_expression_error '*' cast_expression_error { $$ = MkExpOp($1, '*', $3); $$.loc = @$; }
1820 | multiplicative_expression_error '/' cast_expression_error { $$ = MkExpOp($1, '/', $3); $$.loc = @$; }
1821 | multiplicative_expression_error '%' cast_expression_error { $$ = MkExpOp($1, '%', $3); $$.loc = @$; }
1824 additive_expression_error:
1825 multiplicative_expression_error
1826 | additive_expression '+' multiplicative_expression_error { $$ = MkExpOp($1, '+', $3); $$.loc = @$; }
1827 /* Useless rules due to conflicts
1828 | additive_expression '+' error { $$ = MkExpOp($1, '+', null); $$.loc = @$; }
1830 | additive_expression '-' multiplicative_expression_error { $$ = MkExpOp($1, '-', $3); $$.loc = @$; }
1831 /* Useless rules due to conflicts
1832 | additive_expression '-' error { $$ = MkExpOp($1, '-', null); $$.loc = @$; }
1834 | additive_expression_error '+' multiplicative_expression_error { $$ = MkExpOp($1, '+', $3); $$.loc = @$; }
1835 /* Useless rules due to conflicts
1836 | additive_expression_error '+' error { $$ = MkExpOp($1, '+', null); $$.loc = @$; }
1838 | additive_expression_error '-' multiplicative_expression_error { $$ = MkExpOp($1, '-', $3); $$.loc = @$; }
1839 /* Useless rules due to conflicts
1840 | additive_expression_error '-' error { $$ = MkExpOp($1, '-', null); $$.loc = @$; }
1844 shift_expression_error:
1845 additive_expression_error
1846 | shift_expression LEFT_OP additive_expression_error { $$ = MkExpOp($1, LEFT_OP, $3); $$.loc = @$; }
1847 | shift_expression RIGHT_OP additive_expression_error { $$ = MkExpOp($1, RIGHT_OP, $3); $$.loc = @$; }
1848 | shift_expression_error LEFT_OP additive_expression_error { $$ = MkExpOp($1, LEFT_OP, $3); $$.loc = @$; }
1849 | shift_expression_error RIGHT_OP additive_expression_error { $$ = MkExpOp($1, RIGHT_OP, $3); $$.loc = @$; }
1852 relational_expression_error:
1853 shift_expression_error
1854 | relational_expression_smaller_than /*relational_expression '<' */ shift_expression_error
1856 if($1.type == identifierExp)
1858 if($1.identifier._class && !$1.identifier._class.name)
1862 strcat(name, $1.identifier.string);
1863 _DeclClass(0, name);
1866 _DeclClass(0, $1.identifier.string);
1868 // printf("Declaring Class %s\n", $1.identifier.string);
1874 fileInput.Seek(@1.start.pos, start);
1875 resetScannerPos(&@1.start);
1880 YY_STACK_PRINT (yyss, yyssp);
1884 YY_STACK_PRINT (yyss, yyssp);
1888 YY_STACK_PRINT (yyss, yyssp);
1892 YY_STACK_PRINT (yyss, yyssp);
1900 $$ = MkExpOp($1, '<', $2);
1905 | relational_expression '>' shift_expression_error { $$ = MkExpOp($1, '>', $3); $$.loc = @$; }
1906 | relational_expression LE_OP shift_expression_error { $$ = MkExpOp($1, LE_OP, $3); $$.loc = @$; }
1907 | relational_expression GE_OP shift_expression_error { $$ = MkExpOp($1, GE_OP, $3); $$.loc = @$; }
1908 | relational_expression_error '<' shift_expression_error { $$ = MkExpOp($1, '<', $3); $$.loc = @$; }
1909 | relational_expression_error '>' shift_expression_error { $$ = MkExpOp($1, '>', $3); $$.loc = @$; }
1910 | relational_expression_error LE_OP shift_expression_error { $$ = MkExpOp($1, LE_OP, $3); $$.loc = @$; }
1911 | relational_expression_error GE_OP shift_expression_error { $$ = MkExpOp($1, GE_OP, $3); $$.loc = @$; }
1914 equality_expression_error:
1915 relational_expression_error
1916 | equality_expression EQ_OP relational_expression_error { $$ = MkExpOp($1, EQ_OP, $3); $$.loc = @$; }
1917 | equality_expression NE_OP relational_expression_error { $$ = MkExpOp($1, NE_OP, $3); $$.loc = @$; }
1918 | equality_expression_error EQ_OP relational_expression_error { $$ = MkExpOp($1, EQ_OP, $3); $$.loc = @$; }
1919 | equality_expression_error NE_OP relational_expression_error { $$ = MkExpOp($1, NE_OP, $3); $$.loc = @$; }
1920 /* Useless rules due to conflicts
1921 | equality_expression EQ_OP error { $$ = MkExpOp($1, EQ_OP, MkExpDummy()); $$.loc = @$; }
1922 | equality_expression NE_OP error { $$ = MkExpOp($1, NE_OP, MkExpDummy()); $$.loc = @$; }
1923 | equality_expression_error EQ_OP error { $$ = MkExpOp($1, EQ_OP, MkExpDummy()); $$.loc = @$; }
1924 | equality_expression_error NE_OP error { $$ = MkExpOp($1, NE_OP, MkExpDummy()); $$.loc = @$; }
1926 | equality_expression EQ_OP anon_instantiation_expression_error { $$ = MkExpOp($1, EQ_OP, $3); $$.loc = @$; }
1927 | equality_expression NE_OP anon_instantiation_expression_error { $$ = MkExpOp($1, NE_OP, $3); $$.loc = @$; }
1928 | equality_expression_error EQ_OP anon_instantiation_expression_error { $$ = MkExpOp($1, EQ_OP, $3); $$.loc = @$; }
1929 | equality_expression_error NE_OP anon_instantiation_expression_error { $$ = MkExpOp($1, NE_OP, $3); $$.loc = @$; }
1932 and_expression_error:
1933 equality_expression_error
1934 | and_expression '&' equality_expression_error { $$ = MkExpOp($1, '&', $3); $$.loc = @$; }
1935 | and_expression_error '&' equality_expression_error { $$ = MkExpOp($1, '&', $3); $$.loc = @$; }
1937 | and_expression '&' anon_instantiation_expression_error { $$ = MkExpOp($1, '&', $3); $$.loc = @$; }
1938 | and_expression_error '&' anon_instantiation_expression_error { $$ = MkExpOp($1, '&', $3); $$.loc = @$; }
1941 exclusive_or_expression_error:
1942 and_expression_error
1943 | exclusive_or_expression '^' and_expression_error { $$ = MkExpOp($1, '^', $3); $$.loc = @$; }
1944 | exclusive_or_expression_error '^' and_expression_error { $$ = MkExpOp($1, '^', $3); $$.loc = @$; }
1946 | exclusive_or_expression '^' anon_instantiation_expression_error { $$ = MkExpOp($1, '^', $3); $$.loc = @$; }
1947 | exclusive_or_expression_error '^' anon_instantiation_expression_error { $$ = MkExpOp($1, '^', $3); $$.loc = @$; }
1950 inclusive_or_expression_error:
1951 exclusive_or_expression_error
1952 | inclusive_or_expression '|' exclusive_or_expression_error { $$ = MkExpOp($1, '|', $3); $$.loc = @$; }
1953 | inclusive_or_expression_error '|' exclusive_or_expression_error { $$ = MkExpOp($1, '|', $3); $$.loc = @$; }
1955 | inclusive_or_expression '|' anon_instantiation_expression_error { $$ = MkExpOp($1, '|', $3); $$.loc = @$; }
1956 | inclusive_or_expression_error '|' anon_instantiation_expression_error { $$ = MkExpOp($1, '|', $3); $$.loc = @$; }
1959 logical_and_expression_error:
1960 inclusive_or_expression_error
1961 | logical_and_expression AND_OP inclusive_or_expression_error { $$ = MkExpOp($1, AND_OP, $3); $$.loc = @$; }
1962 | logical_and_expression_error AND_OP inclusive_or_expression_error { $$ = MkExpOp($1, AND_OP, $3); $$.loc = @$; }
1965 logical_or_expression_error:
1966 logical_and_expression_error
1967 | logical_or_expression OR_OP logical_and_expression_error { $$ = MkExpOp($1, OR_OP, $3); $$.loc = @$; }
1968 | logical_or_expression_error OR_OP logical_and_expression_error { $$ = MkExpOp($1, OR_OP, $3); $$.loc = @$; }
1971 conditional_expression_error:
1972 logical_or_expression_error
1973 | logical_or_expression '?' expression ':' logical_or_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1974 | logical_or_expression '?' expression_error ':' logical_or_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1975 | logical_or_expression_error '?' expression ':' logical_or_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1976 | logical_or_expression_error '?' expression_error ':' logical_or_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1977 | logical_or_expression '?' expression ':' { $$ = MkExpCondition($1, $3, MkExpDummy()); $$.loc = @$; $$.cond.elseExp.loc = @3; }
1978 | logical_or_expression '?' expression_error ':' { $$ = MkExpCondition($1, $3, MkExpDummy()); $$.loc = @$; $$.cond.elseExp.loc = @3; }
1979 | logical_or_expression_error '?' expression ':' { $$ = MkExpCondition($1, $3, MkExpDummy()); $$.loc = @$; $$.cond.elseExp.loc = @3; }
1980 | logical_or_expression_error '?' expression_error ':' { $$ = MkExpCondition($1, $3, MkExpDummy()); $$.loc = @$; $$.cond.elseExp.loc = @3; }
1982 | logical_or_expression '?' expression_anon_inst ':' logical_or_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1983 | logical_or_expression '?' expression_anon_inst_error ':' logical_or_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1984 | logical_or_expression_error '?' expression_anon_inst ':' logical_or_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1985 | logical_or_expression_error '?' expression_anon_inst_error ':' logical_or_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1986 | logical_or_expression '?' expression_anon_inst ':' { $$ = MkExpCondition($1, $3, MkExpDummy()); $$.loc = @$; $$.cond.elseExp.loc = @3; }
1987 | logical_or_expression '?' expression_anon_inst_error ':' { $$ = MkExpCondition($1, $3, MkExpDummy()); $$.loc = @$; $$.cond.elseExp.loc = @3; }
1988 | logical_or_expression_error '?' expression_anon_inst ':' { $$ = MkExpCondition($1, $3, MkExpDummy()); $$.loc = @$; $$.cond.elseExp.loc = @3; }
1989 | logical_or_expression_error '?' expression_anon_inst_error ':' { $$ = MkExpCondition($1, $3, MkExpDummy()); $$.loc = @$; $$.cond.elseExp.loc = @3; }
1991 | logical_or_expression '?' expression ':' anon_instantiation_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1992 | logical_or_expression '?' expression_error ':' anon_instantiation_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1993 | logical_or_expression_error '?' expression ':' anon_instantiation_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1994 | logical_or_expression_error '?' expression_error ':' anon_instantiation_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1996 | logical_or_expression '?' expression_anon_inst ':' anon_instantiation_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1997 | logical_or_expression '?' expression_anon_inst_error ':' anon_instantiation_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1998 | logical_or_expression_error '?' expression_anon_inst ':' anon_instantiation_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1999 | logical_or_expression_error '?' expression_anon_inst_error ':' anon_instantiation_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
2001 | logical_or_expression '?' ':'
2003 $$ = MkExpCondition($1, MkListOne(MkExpDummy()), MkExpDummy());
2005 ((Expression)$$.cond.exp->last).loc = @2;
2006 $$.cond.elseExp.loc = @3;
2008 | logical_or_expression_error '?' ':'
2010 $$ = MkExpCondition($1, MkListOne(MkExpDummy()), MkExpDummy()); $$.loc = @$; ((Expression)$$.cond.exp->last).loc = @2; $$.cond.elseExp.loc = @3;
2012 | logical_or_expression '?'
2014 $$ = MkExpCondition($1, MkListOne(MkExpDummy()), MkExpDummy()); $$.loc = @$; ((Expression)$$.cond.exp->last).loc = @2; $$.cond.elseExp.loc = @2;
2016 | logical_or_expression_error '?'
2018 $$ = MkExpCondition($1, MkListOne(MkExpDummy()), MkExpDummy()); $$.loc = @$; ((Expression)$$.cond.exp->last).loc = @2; $$.cond.elseExp.loc = @2;
2022 assignment_expression_error:
2023 conditional_expression_error
2024 | unary_expression assignment_operator assignment_expression_error { $$ = MkExpOp($1, $2, $3); $$.loc = @$; }
2025 /* Useless rules due to conflicts
2026 | unary_expression assignment_operator error { $$ = MkExpOp($1, $2, MkExpDummy()); $$.loc = @$; $$.op.exp2.loc = @2; }
2028 | unary_expression_error assignment_operator assignment_expression_error { $$ = MkExpOp($1, $2, $3); $$.loc = @$; }
2029 /* Useless rules due to conflicts
2030 | unary_expression_error assignment_operator error { $$ = MkExpOp($1, $2, MkExpDummy()); $$.loc = @$; $$.op.exp2.loc = @2; }
2033 | unary_expression assignment_operator anon_instantiation_expression_error { $$ = MkExpOp($1, $2, $3); $$.loc = @$; }
2034 | unary_expression_error assignment_operator anon_instantiation_expression_error { $$ = MkExpOp($1, $2, $3); $$.loc = @$; }
2038 assignment_expression_error { $$ = MkList(); ListAdd($$, $1); }
2039 | assignment_expression error { $$ = MkList(); ListAdd($$, $1); }
2040 | expression ',' assignment_expression_error { $$ = $1; ListAdd($1, $3); }
2041 | expression_error ',' assignment_expression_error { $$ = $1; ListAdd($1, $3); }
2042 /* Useless rules due to conflicts
2043 | expression ',' error
2044 | expression_error ',' error
2047 | expression expression { $$ = $1; FreeList($2, FreeExpression); }
2048 | expression_error expression { $$ = $1; FreeList($2, FreeExpression); }
2049 | expression expression_error { $$ = $1; FreeList($2, FreeExpression); }
2052 expression_anon_inst_error:
2053 anon_instantiation_expression_error { $$ = MkList(); ListAdd($$, $1); }
2054 | anon_instantiation_expression error { $$ = MkList(); ListAdd($$, $1); }
2055 | expression ',' anon_instantiation_expression_error { $$ = $1; ListAdd($1, $3); }
2056 | expression_error ',' anon_instantiation_expression_error { $$ = $1; ListAdd($1, $3); }
2060 constant_expression: conditional_expression;
2062 constant_expression_error: conditional_expression_error;
2064 /**** TYPES **************************************************************************/
2065 storage_class_specifier:
2066 TYPEDEF { $$ = MkSpecifier(TYPEDEF); }
2067 | EXTERN { $$ = MkSpecifier(EXTERN); }
2068 | STATIC { $$ = MkSpecifier(STATIC); }
2069 | AUTO { $$ = MkSpecifier(AUTO); }
2070 | REGISTER { $$ = MkSpecifier(REGISTER); }
2073 external_storage_class_specifier:
2074 TYPEDEF { $$ = MkSpecifier(TYPEDEF); declMode = defaultAccess; }
2075 | EXTERN { $$ = MkSpecifier(EXTERN); }
2076 | STATIC { $$ = MkSpecifier(STATIC); declMode = staticAccess; }
2077 | AUTO { $$ = MkSpecifier(AUTO); }
2078 | REGISTER { $$ = MkSpecifier(REGISTER); }
2082 identifier { $$ = MkEnumerator($1, null); }
2083 | identifier '=' constant_expression { $$ = MkEnumerator($1, $3); }
2084 | identifier '=' constant_expression_error { $$ = MkEnumerator($1, $3); }
2088 enumerator { $$ = MkList(); ListAdd($$, $1); }
2089 | enumerator_list ',' enumerator { $$ = $1; ListAdd($1, $3); }
2090 | enumerator_list ','
2094 ENUM { memberAccessStack[++defaultMemberAccess] = publicAccess; }
2097 enum_specifier_nocompound:
2098 enum_specifier identifier { $$ = MkEnum($2, null); POP_DEFAULT_ACCESS }
2099 | enum_specifier strict_type { $$ = MkEnum(MkIdentifier($2.name), null); POP_DEFAULT_ACCESS }
2102 enum_specifier_compound:
2103 enum_specifier_compound_error '}' { $$.loc = @$; POP_DEFAULT_ACCESS $$ = $1; }
2104 | enum_specifier identifier '{' '}' { $$ = MkEnum($2, null); $$.loc = @$; POP_DEFAULT_ACCESS }
2105 | enum_specifier strict_type '{' '}' { $$ = MkEnum(MkIdentifier($2.name), null); FreeSpecifier($2); $$.loc = @$; POP_DEFAULT_ACCESS }
2108 enum_specifier_compound_error:
2109 enum_specifier '{' enumerator_list { $$ = MkEnum(null, $3); $$.loc = @$; POP_DEFAULT_ACCESS }
2110 | enum_specifier '{' error { $$ = MkEnum(null, null); $$.loc = @$; POP_DEFAULT_ACCESS }
2112 | enum_specifier identifier '{' enumerator_list { $$ = MkEnum($2, $4); $$.loc = @$; POP_DEFAULT_ACCESS }
2113 | enum_specifier identifier '{' enumerator_list error { $$ = MkEnum($2, $4); $$.loc = @$; POP_DEFAULT_ACCESS }
2114 | enum_specifier identifier '{' error { $$ = MkEnum($2, null); $$.loc = @$; POP_DEFAULT_ACCESS }
2115 | enum_specifier identifier '{' enumerator_list ';' struct_declaration_list { $$ = MkEnum($2, $4); $$.loc = @$; $$.definitions = $6; POP_DEFAULT_ACCESS }
2116 | enum_specifier identifier '{' enumerator_list ';' struct_declaration_list_error { $$ = MkEnum($2, $4); $$.loc = @$; $$.definitions = $6; POP_DEFAULT_ACCESS }
2118 | enum_specifier strict_type '{' enumerator_list { $$ = MkEnum(MkIdentifier($2.name), $4); $$.loc = @$; FreeSpecifier($2); POP_DEFAULT_ACCESS }
2119 | enum_specifier strict_type '{' enumerator_list error { $$ = MkEnum(MkIdentifier($2.name), $4); $$.loc = @$; FreeSpecifier($2); POP_DEFAULT_ACCESS }
2120 | enum_specifier strict_type '{' error { $$ = MkEnum(MkIdentifier($2.name), null); $$.loc = @$; FreeSpecifier($2); POP_DEFAULT_ACCESS }
2121 | enum_specifier strict_type '{' enumerator_list ';' struct_declaration_list { $$ = MkEnum(MkIdentifier($2.name), $4); $$.loc = @$; $$.definitions = $6; FreeSpecifier($2); POP_DEFAULT_ACCESS }
2122 | enum_specifier strict_type '{' enumerator_list ';' struct_declaration_list_error { $$ = MkEnum(MkIdentifier($2.name), $4); $$.loc = @$; $$.definitions = $6; FreeSpecifier($2); POP_DEFAULT_ACCESS }
2126 enum_specifier identifier { $$ = $2; if(declMode) DeclClassAddNameSpace(globalContext.nextID++, $2.string); }
2127 | enum_specifier strict_type { $$ = MkIdentifier($2.name); if(declMode) DeclClass(globalContext.nextID++, $2.name); FreeSpecifier($2); }
2131 enum_class_error '}' { $$ = $1; $$.loc = @$; }
2132 | enum_decl ':' inheritance_specifiers '{' '}' { $$ = MkEnum($1, null); $$.baseSpecs = $3; $$.loc = @$; POP_DEFAULT_ACCESS }
2133 | enum_decl '{' '}' { $$ = MkEnum($1, null); POP_DEFAULT_ACCESS }
2137 enum_decl ':' inheritance_specifiers '{' enumerator_list { $$ = MkEnum($1, $5); $$.baseSpecs = $3; $$.loc = @$; POP_DEFAULT_ACCESS }
2138 | enum_decl ':' inheritance_specifiers '{' enumerator_list error { $$ = MkEnum($1, $5); $$.baseSpecs = $3; $$.loc = @$; POP_DEFAULT_ACCESS }
2139 | enum_decl ':' inheritance_specifiers '{' error { $$ = MkEnum($1, null); $$.baseSpecs = $3; $$.loc = @$; POP_DEFAULT_ACCESS }
2140 | enum_decl ':' inheritance_specifiers '{' enumerator_list ';' struct_declaration_list { $$ = MkEnum($1, $5); $$.baseSpecs = $3; $$.definitions = $7; $$.loc = @$; POP_DEFAULT_ACCESS }
2141 | enum_decl ':' inheritance_specifiers '{' enumerator_list ';' struct_declaration_list_error { $$ = MkEnum($1, $5); $$.baseSpecs = $3; $$.definitions = $7; $$.loc = @$; POP_DEFAULT_ACCESS }
2142 | enum_decl ':' inheritance_specifiers '{' enumerator_list error ';' struct_declaration_list { $$ = MkEnum($1, $5); $$.baseSpecs = $3; $$.definitions = $8; $$.loc = @$; POP_DEFAULT_ACCESS }
2143 | enum_decl ':' inheritance_specifiers '{' enumerator_list error ';' struct_declaration_list_error { $$ = MkEnum($1, $5); $$.baseSpecs = $3; $$.definitions = $8; $$.loc = @$; POP_DEFAULT_ACCESS }
2144 | enum_decl ':' inheritance_specifiers '{' error ';' struct_declaration_list { $$ = MkEnum($1, null); $$.baseSpecs = $3; $$.definitions = $7; $$.loc = @$; POP_DEFAULT_ACCESS }
2145 | enum_decl ':' inheritance_specifiers '{' error ';' struct_declaration_list_error { $$ = MkEnum($1, null); $$.baseSpecs = $3; $$.definitions = $7; $$.loc = @$; POP_DEFAULT_ACCESS }
2147 | enum_specifier '{' enumerator_list { $$ = MkEnum(null, $3); $$.loc = @$; POP_DEFAULT_ACCESS }
2148 | enum_specifier '{' error { $$ = MkEnum(null, null); $$.loc = @$; POP_DEFAULT_ACCESS }
2150 | enum_decl '{' enumerator_list { $$ = MkEnum($1, $3); $$.loc = @$; POP_DEFAULT_ACCESS }
2151 | enum_decl '{' enumerator_list error { $$ = MkEnum($1, $3); $$.loc = @$; POP_DEFAULT_ACCESS }
2152 | enum_decl '{' error { $$ = MkEnum($1, null); $$.loc = @$; POP_DEFAULT_ACCESS }
2153 | enum_decl '{' enumerator_list ';' struct_declaration_list { $$ = MkEnum($1, $3); $$.definitions = $5; $$.loc = @$; POP_DEFAULT_ACCESS }
2154 | enum_decl '{' enumerator_list ';' struct_declaration_list_error { $$ = MkEnum($1, $3); $$.definitions = $5; $$.loc = @$; POP_DEFAULT_ACCESS }
2162 class_specifier_error:
2164 | struct_class_error
2168 EXT_STORAGE { $$ = MkSpecifierExtended(MkExtDeclString(CopyString(yytext))); }
2169 | ext_decl { $$ = MkSpecifierExtended($1); }
2173 CONST { $$ = MkSpecifier(CONST); }
2174 | VOLATILE { $$ = MkSpecifier(VOLATILE); }
2175 | ext_storage { $$ = $1; }
2179 type_qualifier_list:
2180 type_qualifier { $$ = MkList(); ListAdd($$, $1); }
2181 | type_qualifier_list type_qualifier { $$ = $1; ListAdd($1, $2); }
2185 VOID { $$ = MkSpecifier(VOID); }
2186 | CHAR { $$ = MkSpecifier(CHAR); }
2187 | SHORT { $$ = MkSpecifier(SHORT); }
2188 | INT { $$ = MkSpecifier(INT); }
2189 | UINT { $$ = MkSpecifier(UINT); }
2190 | INT64 { $$ = MkSpecifier(INT64); }
2191 | VALIST { $$ = MkSpecifier(VALIST); }
2192 | LONG { $$ = MkSpecifier(LONG); }
2193 | FLOAT { $$ = MkSpecifier(FLOAT); }
2194 | DOUBLE { $$ = MkSpecifier(DOUBLE); }
2195 | SIGNED { $$ = MkSpecifier(SIGNED); }
2196 | UNSIGNED { $$ = MkSpecifier(UNSIGNED); }
2197 | EXTENSION { $$ = MkSpecifier(EXTENSION); }
2198 | struct_or_union_specifier_nocompound
2199 | enum_specifier_nocompound
2201 | TYPEOF '(' assignment_expression ')' { $$ = MkSpecifierTypeOf($3); }
2202 | SUBCLASS '(' type ')' { $$ = MkSpecifierSubClass($3); }
2203 | SUBCLASS '(' identifier ')' { _DeclClass(0, $3.string); $$ = MkSpecifierSubClass(MkSpecifierName($3.string)); FreeIdentifier($3); }
2204 | THISCLASS { $$ = MkSpecifier(THISCLASS); }
2205 | TYPED_OBJECT { $$ = MkSpecifier(TYPED_OBJECT); }
2206 | ANY_OBJECT { $$ = MkSpecifier(ANY_OBJECT); }
2209 strict_type_specifier:
2210 VOID { $$ = MkSpecifier(VOID); }
2211 | CHAR { $$ = MkSpecifier(CHAR); }
2212 | SHORT { $$ = MkSpecifier(SHORT); }
2213 | INT { $$ = MkSpecifier(INT); }
2214 | UINT { $$ = MkSpecifier(UINT); }
2215 | INT64 { $$ = MkSpecifier(INT64); }
2216 | VALIST { $$ = MkSpecifier(VALIST); }
2217 | LONG { $$ = MkSpecifier(LONG); }
2218 | FLOAT { $$ = MkSpecifier(FLOAT); }
2219 | DOUBLE { $$ = MkSpecifier(DOUBLE); }
2220 | SIGNED { $$ = MkSpecifier(SIGNED); }
2221 | UNSIGNED { $$ = MkSpecifier(UNSIGNED); }
2222 | EXTENSION { $$ = MkSpecifier(EXTENSION); }
2223 | struct_or_union_specifier_nocompound
2224 | enum_specifier_nocompound
2226 | TYPEOF '(' assignment_expression ')' { $$ = MkSpecifierTypeOf($3); }
2227 | SUBCLASS '(' type ')' { $$ = MkSpecifierSubClass($3); }
2228 | SUBCLASS '(' identifier ')' { _DeclClass(0, $3.string); $$ = MkSpecifierSubClass(MkSpecifierName($3.string)); FreeIdentifier($3); }
2229 | THISCLASS { $$ = MkSpecifier(THISCLASS); }
2232 // TESTING declarator_nofunction here... For function declarations
2235 declarator_nofunction
2236 { $$ = MkStructDeclarator($1, null); $$.loc = @$; }
2237 | declarator_nofunction attrib
2238 { $$ = MkStructDeclarator($1, null); $$.structDecl.attrib = $2; $$.loc = @$; }
2239 | ':' constant_expression
2240 { $$ = MkStructDeclarator(null, $2); $$.loc = @$; }
2241 | declarator_nofunction ':' constant_expression
2242 { $$ = MkStructDeclarator($1, $3); $$.loc = @$; }
2243 | declarator_nofunction ':' constant_expression ':' constant_expression
2244 { $$ = MkStructDeclarator($1, $3); $$.structDecl.posExp = $5; $$.loc = @$; }
2245 | ':' constant_expression_error
2246 { $$ = MkStructDeclarator(null, $2); $$.loc = @$; }
2247 | declarator_nofunction ':' constant_expression_error
2248 { $$ = MkStructDeclarator($1, $3); $$.loc = @$; }
2249 | declarator_nofunction ':' constant_expression ':' constant_expression_error
2250 { $$ = MkStructDeclarator($1, $3); $$.structDecl.posExp = $5; $$.loc = @$; }
2251 | declarator_nofunction ':' constant_expression_error ':' constant_expression_error
2252 { $$ = MkStructDeclarator($1, $3); $$.structDecl.posExp = $5; $$.loc = @$; }
2253 | declarator_nofunction ':' constant_expression_error ':' constant_expression
2254 { $$ = MkStructDeclarator($1, $3); $$.structDecl.posExp = $5; $$.loc = @$; }
2257 struct_declarator_list:
2258 struct_declarator { $$ = MkList(); ListAdd($$, $1); }
2259 | struct_declarator_list ',' struct_declarator { $$ = $1; ListAdd($1, $3); }
2263 struct_or_union identifier
2265 $$ = MkStructOrUnion($1, $2, null);
2266 $$.addNameSpace = true;
2267 $$.ctx = PushContext();
2269 | struct_or_union base_strict_type
2271 $$ = MkStructOrUnion($1, MkIdentifier($2.name), null);
2272 $$.ctx = PushContext();
2275 | struct_or_union ext_decl identifier
2277 $$ = MkStructOrUnion($1, $3, null);
2278 $$.extDeclStruct = $2;
2279 $$.addNameSpace = true;
2280 $$.ctx = PushContext();
2282 | struct_or_union ext_decl base_strict_type
2284 $$ = MkStructOrUnion($1, MkIdentifier($3.name), null);
2285 $$.extDeclStruct = $2;
2286 $$.ctx = PushContext();
2291 struct_or_union_specifier_compound:
2292 struct_or_union_specifier_compound_error '}' { $$ = $1; $$.loc = @$; }
2293 | struct_entry '{' '}' { $$ = $1; $$.loc = @$; POP_DEFAULT_ACCESS PopContext(curContext); }
2294 | struct_or_union '{' '}' { $$ = MkStructOrUnion($1, null, null); $$.loc = @$; POP_DEFAULT_ACCESS }
2295 | struct_or_union ext_decl '{' '}' { $$ = MkStructOrUnion($1, null, null); $$.extDeclStruct = $2; $$.loc = @$; POP_DEFAULT_ACCESS }
2298 struct_or_union_specifier_compound_error:
2299 struct_entry '{' struct_declaration_list { $$ = $1; AddStructDefinitions($1, $3); POP_DEFAULT_ACCESS PopContext(curContext); }
2300 | struct_entry '{' struct_declaration_list_error { $$ = $1; AddStructDefinitions($1, $3); POP_DEFAULT_ACCESS PopContext(curContext); }
2301 | struct_entry '{' error { $$ = $1; POP_DEFAULT_ACCESS PopContext(curContext); }
2303 | struct_or_union '{' struct_declaration_list { $$ = MkStructOrUnion($1, null, $3); POP_DEFAULT_ACCESS }
2304 | struct_or_union '{' struct_declaration_list_error { $$ = MkStructOrUnion($1, null, $3); POP_DEFAULT_ACCESS }
2305 | struct_or_union '{' error { $$ = MkStructOrUnion($1, null, null); POP_DEFAULT_ACCESS }
2307 | struct_or_union ext_decl '{' struct_declaration_list { $$ = MkStructOrUnion($1, null, $4); $$.extDeclStruct = $2; POP_DEFAULT_ACCESS }
2308 | struct_or_union ext_decl '{' struct_declaration_list_error { $$ = MkStructOrUnion($1, null, $4); $$.extDeclStruct = $2; POP_DEFAULT_ACCESS }
2309 | struct_or_union ext_decl '{' error { $$ = MkStructOrUnion($1, null, null); $$.extDeclStruct = $2; POP_DEFAULT_ACCESS }
2312 struct_or_union_specifier_nocompound:
2313 struct_entry { $$ = $1; POP_DEFAULT_ACCESS PopContext(curContext); }
2322 ($1.addNameSpace ? DeclClassAddNameSpace : DeclClass)(globalContext.nextID++, $1.id.string);
2325 | struct_entry '<' template_parameters_list '>'
2327 Symbol symbol = ($1.addNameSpace ? DeclClassAddNameSpace : DeclClass)(globalContext.nextID++, $1.id.string);
2329 symbol.templateParams = $3;
2334 struct_decl ':' inheritance_specifiers
2338 SetupBaseSpecs(null, $3);
2343 struct_class_error '}' { $$ = $1; $$.loc = @$; }
2344 | struct_head '{' '}'
2345 { $$ = $1; POP_DEFAULT_ACCESS PopContext(curContext); }
2346 | struct_decl '{' '}' { $$ = $1; POP_DEFAULT_ACCESS PopContext(curContext); }
2347 | struct_or_union '{' '}' { $$ = MkStructOrUnion($1, null, null); POP_DEFAULT_ACCESS }
2351 struct_head '{' struct_declaration_list
2354 $$.definitions = $3;
2356 PopContext(curContext);
2358 | struct_head '{' struct_declaration_list_error
2361 $$.definitions = $3;
2363 PopContext(curContext);
2365 | struct_head '{' error
2366 { $$ = $1; POP_DEFAULT_ACCESS PopContext(curContext);}
2368 | struct_decl '{' struct_declaration_list
2370 PopContext(curContext);
2373 $$ = MkStructOrUnion($1.type, $1.id, $3);
2378 $$.definitions = $3;
2381 | struct_decl '{' struct_declaration_list_error
2383 PopContext(curContext);
2387 $$ = MkStructOrUnion($1.type, $1.id, $3);
2392 $$.definitions = $3;
2395 | struct_decl '{' error
2396 { $$ = $1; POP_DEFAULT_ACCESS PopContext(curContext); }
2398 | struct_or_union '{' struct_declaration_list
2399 { $$ = MkStructOrUnion($1, null, $3); POP_DEFAULT_ACCESS }
2400 | struct_or_union '{' struct_declaration_list_error
2401 { $$ = MkStructOrUnion($1, null, $3); POP_DEFAULT_ACCESS }
2402 | struct_or_union '{' error
2403 { $$ = MkStructOrUnion($1, null, null); POP_DEFAULT_ACCESS }
2407 STRUCT { $$ = structSpecifier; memberAccessStack[++defaultMemberAccess] = publicAccess; }
2408 | UNION { $$ = unionSpecifier; memberAccessStack[++defaultMemberAccess] = publicAccess; }
2411 specifier_qualifier_list:
2412 type_qualifier { $$ = MkList(); ListAdd($$, $1); }
2413 | specifier_qualifier_list type_qualifier { $$ = $1; ListAdd($1, $2); }
2414 | type_specifier { $$ = MkList(); ListAdd($$, $1); }
2415 | specifier_qualifier_list type_specifier { $$ = $1; ListAdd($1, $2); }
2416 | enum_specifier_compound { $$ = MkList(); ListAdd($$, $1); }
2417 | specifier_qualifier_list enum_specifier_compound { $$ = $1; ListAdd($1, $2); }
2418 | struct_or_union_specifier_compound { $$ = MkList(); ListAdd($$, $1); }
2419 | specifier_qualifier_list struct_or_union_specifier_compound { $$ = $1; ListAdd($1, $2); }
2422 guess_specifier_qualifier_list:
2423 type_qualifier { $$ = MkList(); ListAdd($$, $1); }
2424 | guess_specifier_qualifier_list type_qualifier { $$ = $1; ListAdd($1, $2); }
2425 | type_specifier { $$ = MkList(); ListAdd($$, $1); }
2426 | guess_specifier_qualifier_list type_specifier { $$ = $1; ListAdd($1, $2); }
2427 | guess_type { $$ = MkList(); ListAdd($$, $1); }
2428 | guess_specifier_qualifier_list guess_type { $$ = $1; ListAdd($1, $2); }
2429 | enum_specifier_compound { $$ = MkList(); ListAdd($$, $1); }
2430 | guess_specifier_qualifier_list enum_specifier_compound { $$ = $1; ListAdd($1, $2); }
2431 | struct_or_union_specifier_compound { $$ = MkList(); ListAdd($$, $1); }
2432 | guess_specifier_qualifier_list struct_or_union_specifier_compound { $$ = $1; ListAdd($1, $2); }
2435 declaration_specifiers:
2436 storage_class_specifier { $$ = MkList(); ListAdd($$, $1); }
2437 | declaration_specifiers storage_class_specifier { $$ = $1; ListAdd($1, $2); }
2438 | type_qualifier { $$ = MkList(); ListAdd($$, $1); }
2439 | declaration_specifiers type_qualifier { $$ = $1; ListAdd($1, $2); }
2440 | strict_type_specifier { $$ = MkList(); ListAdd($$, $1); }
2441 | declaration_specifiers strict_type_specifier { $$ = $1; ListAdd($1, $2); }
2442 | enum_specifier_compound { $$ = MkList(); ListAdd($$, $1); }
2443 | declaration_specifiers enum_specifier_compound { $$ = $1; ListAdd($1, $2); }
2444 | struct_or_union_specifier_compound { $$ = MkList(); ListAdd($$, $1); }
2445 | declaration_specifiers struct_or_union_specifier_compound { $$ = $1; ListAdd($1, $2); }
2448 guess_declaration_specifiers:
2449 storage_class_specifier { $$ = MkList(); ListAdd($$, $1); }
2450 | guess_declaration_specifiers storage_class_specifier { $$ = $1; ListAdd($1, $2); }
2451 | type_qualifier { $$ = MkList(); ListAdd($$, $1); }
2452 | guess_declaration_specifiers type_qualifier { $$ = $1; ListAdd($1, $2); }
2453 | type_specifier { $$ = MkList(); ListAdd($$, $1); }
2454 | guess_declaration_specifiers type_specifier { $$ = $1; ListAdd($1, $2); }
2455 | guess_type { $$ = MkList(); ListAdd($$, $1); }
2456 | guess_declaration_specifiers guess_type { $$ = $1; ListAdd($1, $2); }
2457 | struct_or_union_specifier_compound { $$ = MkList(); ListAdd($$, $1); }
2458 | guess_declaration_specifiers struct_or_union_specifier_compound { $$ = $1; ListAdd($1, $2); }
2459 | enum_specifier_compound { $$ = MkList(); ListAdd($$, $1); }
2460 | guess_declaration_specifiers enum_specifier_compound { $$ = $1; ListAdd($1, $2); }
2463 external_guess_declaration_specifiers:
2464 external_storage_class_specifier { $$ = MkList(); ListAdd($$, $1); }
2465 | external_guess_declaration_specifiers external_storage_class_specifier { $$ = $1; ListAdd($1, $2); }
2466 | type_qualifier { $$ = MkList(); ListAdd($$, $1); }
2467 | external_guess_declaration_specifiers type_qualifier { $$ = $1; ListAdd($1, $2); }
2468 | type_specifier { $$ = MkList(); ListAdd($$, $1); }
2469 | external_guess_declaration_specifiers type_specifier { $$ = $1; ListAdd($1, $2); }
2470 | guess_type { $$ = MkList(); ListAdd($$, $1); }
2471 | external_guess_declaration_specifiers guess_type { $$ = $1; ListAdd($1, $2); }
2472 | class_specifier { $$ = MkList(); ListAdd($$, $1); }
2473 | external_guess_declaration_specifiers class_specifier { $$ = $1; ListAdd($1, $2); }
2476 external_guess_declaration_specifiers_error:
2477 class_specifier_error { $$ = MkList(); ListAdd($$, $1); }
2478 | external_guess_declaration_specifiers class_specifier_error { $$ = $1; ListAdd($1, $2); }
2481 _inheritance_specifiers:
2482 PRIVATE { $$ = MkList(); ListAdd($$, MkSpecifier(PRIVATE)); }
2483 | PUBLIC { $$ = MkList(); ListAdd($$, MkSpecifier(PUBLIC)); }
2484 | storage_class_specifier { $$ = MkList(); ListAdd($$, $1); }
2485 | _inheritance_specifiers storage_class_specifier { $$ = $1; ListAdd($1, $2); }
2486 | type_qualifier { $$ = MkList(); ListAdd($$, $1); }
2487 | _inheritance_specifiers type_qualifier { $$ = $1; ListAdd($1, $2); }
2488 | strict_type_specifier { $$ = MkList(); ListAdd($$, $1); }
2489 | _inheritance_specifiers strict_type_specifier { $$ = $1; ListAdd($1, $2); }
2491 { _DeclClass(0, $1.string); $$ = MkListOne(MkSpecifierName($1.string)); FreeIdentifier($1); }
2492 | _inheritance_specifiers identifier { $$ = $1; _DeclClass(0, $2.string); ListAdd($1, MkSpecifierName($2.string)); FreeIdentifier($2); }
2494 | identifier '<' template_arguments_list '>'
2496 // if($1._class && !$1._class.name)
2500 strcpy(name, $1._class.name ? $1._class.name : "");
2502 strcat(name, $1.string);
2503 _DeclClass(0, name);
2506 _DeclClass(0, $1.string);
2509 ListAdd($$, MkSpecifierNameArgs($1.string, $3));
2512 | _inheritance_specifiers identifier '<' template_arguments_list '>'
2515 if($2._class && !$2._class.name)
2519 strcat(name, $2.string);
2520 _DeclClass(0, name);
2523 _DeclClass(0, $2.string);
2524 ListAdd($1, MkSpecifierNameArgs($2.string, $4));
2529 inheritance_specifiers:
2530 _inheritance_specifiers
2531 | struct_or_union { $$ = MkListOne(MkStructOrUnion($1, null, null)); POP_DEFAULT_ACCESS }
2534 property_specifiers:
2535 storage_class_specifier { $$ = MkList(); ListAdd($$, $1); }
2536 | property_specifiers storage_class_specifier { $$ = $1; ListAdd($1, $2); }
2537 | type_qualifier { $$ = MkList(); ListAdd($$, $1); }
2538 | property_specifiers type_qualifier { $$ = $1; ListAdd($1, $2); }
2539 | strict_type_specifier { $$ = MkList(); ListAdd($$, $1); }
2540 | property_specifiers strict_type_specifier { $$ = $1; ListAdd($1, $2); }
2541 | identifier { $$ = MkList(); ListAdd($$, MkSpecifierName($1.string)); FreeIdentifier($1)}
2542 | property_specifiers identifier { $$ = $1; ListAdd($1, MkSpecifierName($2.string)); FreeIdentifier($2)}
2543 | identifier '<' template_arguments_list '>'
2545 // if($1._class && !$1._class.name)
2549 strcpy(name, $1._class.name ? $1._class.name : "");
2551 strcat(name, $1.string);
2552 _DeclClass(0, name);
2555 _DeclClass(0, $1.string);
2558 ListAdd($$, MkSpecifierNameArgs($1.string, $3));
2561 | property_specifiers identifier '<' template_arguments_list '>'
2563 if($2._class && !$2._class.name)
2567 strcat(name, $2.string);
2568 _DeclClass(0, name);
2571 _DeclClass(0, $2.string);
2572 ListAdd($1, MkSpecifierNameArgs($2.string, $4));
2578 storage_class_specifier { $$ = MkList(); ListAdd($$, $1); }
2579 | renew_specifiers storage_class_specifier { $$ = $1; ListAdd($1, $2); }
2580 | type_qualifier { $$ = MkList(); ListAdd($$, $1); }
2581 | renew_specifiers type_qualifier { $$ = $1; ListAdd($1, $2); }
2582 | strict_type_specifier { $$ = MkList(); ListAdd($$, $1); }
2583 | renew_specifiers strict_type_specifier { $$ = $1; ListAdd($1, $2); }
2584 | struct_or_union_specifier_compound { $$ = MkList(); ListAdd($$, $1); }
2585 | renew_specifiers struct_or_union_specifier_compound { $$ = $1; ListAdd($1, $2); }
2586 | enum_specifier_compound { $$ = MkList(); ListAdd($$, $1); }
2587 | renew_specifiers enum_specifier_compound { $$ = $1; ListAdd($1, $2); }
2588 | identifier { $$ = MkList(); ListAdd($$, MkSpecifierName($1.string)); FreeIdentifier($1)}
2589 | renew_specifiers identifier { $$ = $1; ListAdd($1, MkSpecifierName($2.string)); FreeIdentifier($2)}
2590 | identifier '<' template_arguments_list '>'
2592 // if($1._class && !$1._class.name)
2596 strcpy(name, $1._class.name ? $1._class.name : "");
2598 strcat(name, $1.string);
2599 _DeclClass(0, name);
2602 _DeclClass(0, $1.string);
2605 ListAdd($$, MkSpecifierNameArgs($1.string, $3));
2608 | renew_specifiers identifier '<' template_arguments_list '>'
2610 if($2._class && !$2._class.name)
2614 strcat(name, $2.string);
2615 _DeclClass(0, name);
2618 _DeclClass(0, $2.string);
2619 ListAdd($1, MkSpecifierNameArgs($2.string, $4));
2625 storage_class_specifier { $$ = MkList(); ListAdd($$, $1); }
2626 | new_specifiers storage_class_specifier { $$ = $1; ListAdd($1, $2); }
2627 | type_qualifier { $$ = MkList(); ListAdd($$, $1); }
2628 | new_specifiers type_qualifier { $$ = $1; ListAdd($1, $2); }
2629 | strict_type_specifier { $$ = MkList(); ListAdd($$, $1); }
2630 | new_specifiers strict_type_specifier { $$ = $1; ListAdd($1, $2); }
2631 | struct_or_union_specifier_compound { $$ = MkList(); ListAdd($$, $1); }
2632 | new_specifiers struct_or_union_specifier_compound { $$ = $1; ListAdd($1, $2); }
2633 | enum_specifier_compound { $$ = MkList(); ListAdd($$, $1); }
2634 | new_specifiers enum_specifier_compound { $$ = $1; ListAdd($1, $2); }
2635 | identifier { $$ = MkList(); ListAdd($$, MkSpecifierName($1.string)); FreeIdentifier($1)}
2636 | new_specifiers identifier { $$ = $1; ListAdd($1, MkSpecifierName($2.string)); FreeIdentifier($2)}
2637 | identifier '<' template_arguments_list '>'
2639 // if($1._class && !$1._class.name)
2643 strcpy(name, $1._class.name ? $1._class.name : "");
2645 strcat(name, $1.string);
2646 _DeclClass(0, name);
2649 _DeclClass(0, $1.string);
2652 ListAdd($$, MkSpecifierNameArgs($1.string, $3));
2655 | new_specifiers identifier '<' template_arguments_list '>'
2657 if($2._class && !$2._class.name)
2661 strcat(name, $2.string);
2662 _DeclClass(0, name);
2665 _DeclClass(0, $2.string);
2666 ListAdd($1, MkSpecifierNameArgs($2.string, $4));
2671 identifier_list_error:
2672 identifier_list ',' error { $$ = $1; ListAdd($1, null); }
2673 | identifier_list_error ',' error { $$ = $1; ListAdd($1, null); }
2677 identifier { $$ = MkList(); ListAdd($$, MkTypeName(null, MkDeclaratorIdentifier($1))); }
2678 | identifier_list ',' identifier { $$ = $1; ListAdd($1, MkTypeName(null, MkDeclaratorIdentifier($3))); }
2679 | identifier_list_error ',' identifier { $$ = $1; ListAdd($1, MkTypeName(null, MkDeclaratorIdentifier($3))); }
2680 | parameter_list ',' identifier { $$ = $1; ListAdd($1, MkTypeName(null, MkDeclaratorIdentifier($3))); }
2681 | parameter_list_error ',' identifier { $$ = $1; ListAdd($1, MkTypeName(null, MkDeclaratorIdentifier($3))); }
2684 direct_declarator_nofunction:
2685 identifier { $$ = MkDeclaratorIdentifier($1); }
2686 | '(' declarator ')' { $$ = MkDeclaratorBrackets($2); }
2687 | direct_declarator_nofunction '[' constant_expression ']' { $$ = MkDeclaratorArray($1, $3); }
2688 | direct_declarator_nofunction '[' constant_expression_error ']' { $$ = MkDeclaratorArray($1, $3); }
2689 | direct_declarator_nofunction '[' type ']' { $$ = MkDeclaratorEnumArray($1, $3); }
2690 | direct_declarator_nofunction '[' ']' { $$ = MkDeclaratorArray($1, null); }
2693 direct_declarator_function_start:
2694 direct_declarator_nofunction '('
2697 direct_declarator_function:
2698 direct_declarator_function_start parameter_type_list ')' { $$ = MkDeclaratorFunction($1, $2); }
2699 | direct_declarator_function_start parameter_type_list_error ')' { $$ = MkDeclaratorFunction($1, $2); }
2700 | direct_declarator_function_start identifier_list ')' { $$ = MkDeclaratorFunction($1, $2); }
2701 | direct_declarator_function_start identifier_list_error ')' { $$ = MkDeclaratorFunction($1, $2); }
2702 | direct_declarator_function_start ')' { $$ = MkDeclaratorFunction($1, null); }
2705 // Tricky stuff here for overriding...
2706 direct_declarator_function_error:
2707 direct_declarator_function_start identifier_list_error
2709 $$ = MkDeclaratorFunction($1, $2);
2710 fileInput.Seek(@1.end.pos, start);
2712 resetScannerPos(&@1.end);
2713 @$.start = @1.start;
2716 | direct_declarator_function_start error
2718 $$ = MkDeclaratorFunction($1, null);
2719 fileInput.Seek(@1.end.pos, start);
2721 resetScannerPos(&@1.end);
2722 @$.start = @1.start;
2725 | direct_declarator_function_start parameter_list '('
2727 $$ = MkDeclaratorFunction($1, $2);
2728 fileInput.Seek(@1.end.pos, start);
2730 resetScannerPos(&@1.end);
2731 @$.start = @1.start;
2734 | direct_declarator_function_start guess_declaration_specifiers identifier '('
2736 $$ = MkDeclaratorFunction($1, null);
2737 fileInput.Seek(@1.end.pos, start);
2739 resetScannerPos(&@1.end);
2740 @$.start = @1.start;
2742 FreeList($2, FreeSpecifier);
2748 direct_declarator_function
2749 | direct_declarator_nofunction
2750 | ext_decl direct_declarator_function
2751 { $$ = MkDeclaratorExtended($1, $2); }
2752 | ext_decl direct_declarator_nofunction
2753 { $$ = MkDeclaratorExtended($1, $2); }
2758 ASM '(' STRING_LITERAL { $<string>$ = CopyString(yytext); } STRING_LITERAL { $<string>$ = CopyString(yytext); }
2761 strcpy(temp, "__asm__(");
2762 strcat(temp, $<string>4);
2764 strcat(temp, $<string>6);
2767 $<string>$ = CopyString(temp);
2772 EXT_DECL { $$ = MkExtDeclString(CopyString(yytext)); }
2773 | attrib { $$ = MkExtDeclAttrib($1);
2777 strcpy(temp, $<string>1);
2780 $$ = MkExtDeclString(CopyString(temp));
2782 | asm_start STRING_LITERAL { $$ = CopyString(yytext); } ')'
2785 strcpy(temp, $<string>1);
2787 strcat(temp, $<string>3);
2791 $$ = MkExtDeclString(CopyString(temp));
2797 EXT_DECL { $$ = MkExtDeclString(CopyString(yytext)); }
2798 | attrib { $$ = MkExtDeclAttrib($1); }
2799 | ASM '(' string_literal ')'
2802 strcpy(temp, "__asm__(");
2805 $$ = MkExtDeclString(CopyString(temp));
2811 ATTRIB { $<i>$ = ATTRIB; }
2812 | ATTRIB_DEP { $<i>$ = ATTRIB_DEP; }
2813 | __ATTRIB { $<i>$ = __ATTRIB; }
2818 IDENTIFIER { $$ = CopyString(yytext); }
2819 | TYPE_NAME { $$ = CopyString(yytext); }
2820 | EXT_STORAGE { $$ = CopyString(yytext); }
2821 | EXT_DECL { $$ = CopyString(yytext); }
2822 | CONST { $$ = CopyString(yytext); }
2826 attribute_word { $$ = MkAttribute($1, null); $$.loc = @$; }
2827 | attribute_word '(' expression ')' { $$ = MkAttribute($1, MkExpBrackets($3)); $$.loc = @$; }
2831 attribute { $$ = MkListOne($1); }
2832 | attribs_list attribute { ListAdd($1, $2); $$ = $1; }
2833 | attribs_list ',' attribute { ListAdd($1, $3); $$ = $1; }
2837 _attrib '(' '(' attribs_list ')' ')' { $$ = MkAttrib($<i>1, $4); $$.loc = @$; }
2838 | _attrib '(' '(' ')' ')' { $$ = MkAttrib($<i>1, null); $$.loc = @$; }
2841 direct_abstract_declarator:
2842 '(' abstract_declarator ')'
2843 { $$ = MkDeclaratorBrackets($2); }
2845 { $$ = MkDeclaratorArray(null, null); }
2846 | '[' constant_expression ']'
2847 { $$ = MkDeclaratorArray(null, $2); }
2848 | '[' constant_expression_error ']'
2849 { $$ = MkDeclaratorArray(null, $2); }
2851 { $$ = MkDeclaratorEnumArray(null, $2); }
2852 | direct_abstract_declarator '[' ']'
2853 { $$ = MkDeclaratorArray($1, null); }
2854 | direct_abstract_declarator '[' constant_expression ']'
2855 { $$ = MkDeclaratorArray($1, $3); }
2856 | direct_abstract_declarator '[' type']'
2857 { $$ = MkDeclaratorEnumArray($1, $3); }
2858 | direct_abstract_declarator '[' constant_expression_error ']'
2859 { $$ = MkDeclaratorArray($1, $3); }
2861 { $$ = MkDeclaratorFunction(null, null); }
2862 | '(' parameter_type_list ')'
2863 { $$ = MkDeclaratorFunction(null, $2); }
2864 | '(' parameter_type_list_error ')'
2865 { $$ = MkDeclaratorFunction(null, $2); }
2866 | direct_abstract_declarator '(' ')'
2867 { $$ = MkDeclaratorFunction($1, null); }
2868 | direct_abstract_declarator '(' parameter_type_list ')'
2869 { $$ = MkDeclaratorFunction($1, $3); }
2870 | direct_abstract_declarator '(' parameter_type_list_error ')'
2871 { $$ = MkDeclaratorFunction($1, $3); }
2874 direct_abstract_declarator_noarray:
2875 '(' abstract_declarator_noarray ')'
2876 { $$ = MkDeclaratorBrackets($2); }
2878 { $$ = MkDeclaratorFunction(null, null); }
2879 | '(' parameter_type_list ')'
2880 { $$ = MkDeclaratorFunction(null, $2); }
2881 | '(' parameter_type_list_error ')'
2882 { $$ = MkDeclaratorFunction(null, $2); }
2883 | direct_abstract_declarator_noarray '(' ')'
2884 { $$ = MkDeclaratorFunction($1, null); }
2885 | direct_abstract_declarator_noarray '(' parameter_type_list ')'
2886 { $$ = MkDeclaratorFunction($1, $3); }
2887 | direct_abstract_declarator_noarray '(' parameter_type_list_error ')'
2888 { $$ = MkDeclaratorFunction($1, $3); }
2892 '*' { $$ = MkPointer(null, null); }
2893 | '*' type_qualifier_list { $$ = MkPointer($2, null); }
2894 | '*' pointer { $$ = MkPointer(null, $2); }
2895 | '*' type_qualifier_list pointer { $$ = MkPointer($2, $3); }
2898 abstract_declarator:
2899 pointer { $$ = MkDeclaratorPointer($1, null); }
2900 | direct_abstract_declarator
2901 | pointer direct_abstract_declarator { $$ = MkDeclaratorPointer($1, $2); }
2902 | ext_decl pointer { $$ = MkDeclaratorExtended($1, MkDeclaratorPointer($2, null)); }
2903 | ext_decl direct_abstract_declarator { $$ = MkDeclaratorExtended($1, $2); }
2904 | ext_decl pointer direct_abstract_declarator { $$ = MkDeclaratorExtended($1, MkDeclaratorPointer($2, $3)); }
2907 abstract_declarator_noarray:
2908 pointer { $$ = MkDeclaratorPointer($1, null); }
2909 | direct_abstract_declarator_noarray
2910 | pointer direct_abstract_declarator_noarray { $$ = MkDeclaratorPointer($1, $2); }
2911 | ext_decl pointer { $$ = MkDeclaratorExtended($1, MkDeclaratorPointer($2, null)); }
2912 | ext_decl direct_abstract_declarator_noarray { $$ = MkDeclaratorExtended($1, $2); }
2913 | ext_decl pointer direct_abstract_declarator_noarray { $$ = MkDeclaratorExtended($1, MkDeclaratorPointer($2, $3)); }
2918 | pointer direct_declarator
2919 { $$ = MkDeclaratorPointer($1, $2); }
2920 | ext_decl pointer direct_declarator
2921 { $$ = MkDeclaratorExtended($1, MkDeclaratorPointer($2, $3)); }
2922 | declarator ext_decl
2923 { $$ = MkDeclaratorExtendedEnd($2, $1); }
2926 declarator_function:
2927 direct_declarator_function
2928 | pointer direct_declarator_function { $$ = MkDeclaratorPointer($1, $2); }
2929 | ext_decl direct_declarator_function { $$ = MkDeclaratorExtended($1, $2); }
2930 | ext_decl pointer direct_declarator_function { $$ = MkDeclaratorExtended($1, MkDeclaratorPointer($2, $3)); }
2931 | pointer ext_decl direct_declarator_function { $$ = MkDeclaratorPointer($1, MkDeclaratorExtended($2, $3)); }
2934 declarator_function_error:
2935 direct_declarator_function_error
2936 | pointer direct_declarator_function_error { $$ = MkDeclaratorPointer($1, $2); }
2937 | ext_decl direct_declarator_function_error { $$ = MkDeclaratorExtended($1, $2); }
2938 | ext_decl pointer direct_declarator_function_error { $$ = MkDeclaratorExtended($1, MkDeclaratorPointer($2, $3)); }
2939 | pointer ext_decl direct_declarator_function_error { $$ = MkDeclaratorPointer($1, MkDeclaratorExtended($2, $3)); }
2942 declarator_nofunction:
2943 direct_declarator_nofunction
2944 | pointer direct_declarator_nofunction { $$ = MkDeclaratorPointer($1, $2); }
2945 | ext_decl direct_declarator_nofunction { $$ = MkDeclaratorExtended($1, $2); }
2946 | ext_decl pointer direct_declarator_nofunction { $$ = MkDeclaratorExtended($1, MkDeclaratorPointer($2, $3)); }
2947 | pointer ext_decl direct_declarator_nofunction { $$ = MkDeclaratorPointer($1, MkDeclaratorExtended($2, $3)); }
2951 assignment_expression { $$ = MkInitializerAssignment($1); $$.loc = @$; }
2952 | '{' initializer_list '}' { $$ = MkInitializerList($2); $$.loc = @$; }
2953 | '{' initializer_list ',' '}'
2955 $$ = MkInitializerList($2);
2959 Expression exp = MkExpDummy();
2960 Initializer init = MkInitializerAssignment(exp);
2969 assignment_expression_error { $$ = MkInitializerAssignment($1); $$.loc = @$; }
2970 | '{' initializer_list '}' error { $$ = MkInitializerList($2); $$.loc = @$; }
2971 | '{' initializer_list { $$ = MkInitializerList($2); $$.loc = @$; }
2972 | '{' initializer_list ',' '}' error
2974 $$ = MkInitializerList($2);
2978 Expression exp = MkExpDummy();
2979 Initializer init = MkInitializerAssignment(exp);
2985 | '{' initializer_list ','
2987 $$ = MkInitializerList($2);
2991 Expression exp = MkExpDummy();
2992 Initializer init = MkInitializerAssignment(exp);
3000 initializer_condition:
3001 conditional_expression { $$ = MkInitializerAssignment($1); $$.loc = @$; }
3002 | anon_instantiation_expression
3003 { $$ = MkInitializerAssignment($1); $$.loc = @$; }
3006 initializer_condition_error:
3007 conditional_expression_error { $$ = MkInitializerAssignment($1); $$.loc = @$; }
3008 | anon_instantiation_expression_error { $$ = MkInitializerAssignment($1); $$.loc = @$; }
3012 initializer { $$ = MkList(); ListAdd($$, $1); }
3013 | initializer_error { $$ = MkList(); ListAdd($$, $1); }
3014 | initializer_list ',' initializer { $$ = $1; ListAdd($1, $3); }
3015 | initializer_list ',' initializer_error { $$ = $1; ListAdd($1, $3); }
3018 | initializer_list initializer { $$ = $1; ListAdd($1, $2); }
3019 | initializer_list initializer_error { $$ = $1; ListAdd($1, $2); }
3023 declarator { $$ = MkInitDeclarator($1, null); $$.loc = @$; }
3024 | declarator '=' initializer { $$ = MkInitDeclarator($1, $3); $$.loc = @$; $$.initializer.loc.start = @2.end; }
3027 init_declarator_error:
3028 declarator error { $$ = MkInitDeclarator($1, null); $$.loc = @$; }
3029 /* Useless rules due to conflicts
3030 | declarator '=' error { $$ = MkInitDeclarator($1, MkInitializerAssignment(MkExpDummy())); $$.loc = @$; $$.initializer.loc = @2; $$.initializer.exp.loc = @2; }
3032 | declarator '=' initializer_error { $$ = MkInitDeclarator($1, $3); $$.loc = @$; $$.initializer.loc.start = @2.end; }
3035 init_declarator_list:
3036 init_declarator { $$ = MkList(); ListAdd($$, $1); }
3037 | init_declarator_list ',' init_declarator { $$ = $1; ListAdd($1, $3); }
3038 | init_declarator_list_error ',' init_declarator { $$ = $1; ListAdd($1, $3); }
3041 init_declarator_list_error:
3042 init_declarator_error { $$ = MkList(); ListAdd($$, $1); }
3043 | init_declarator error { $$ = MkList(); ListAdd($$, $1); }
3044 | init_declarator_list ',' init_declarator_error { $$ = $1; ListAdd($1, $3); }
3045 | init_declarator_list_error ',' init_declarator_error { $$ = $1; ListAdd($1, $3); }
3049 specifier_qualifier_list { $$ = MkTypeName($1, null); }
3050 | specifier_qualifier_list abstract_declarator { $$ = MkTypeName($1, $2); }
3054 guess_specifier_qualifier_list { $$ = MkTypeName($1, null); }
3055 | guess_specifier_qualifier_list abstract_declarator { $$ = MkTypeName($1, $2); }
3058 /*** PARAMETERS **********************************************************************/
3059 parameter_declaration:
3060 guess_declaration_specifiers declarator { $$ = MkTypeName($1, $2); }
3061 | guess_declaration_specifiers abstract_declarator { $$ = MkTypeName($1, $2); }
3062 | guess_declaration_specifiers '&' { $$ = MkTypeName($1, MkDeclaratorPointer(MkPointer(null,null), null)); }
3063 | guess_declaration_specifiers '&' declarator { $$ = MkTypeName($1, MkDeclaratorPointer(MkPointer(null,null), $3)); }
3064 | guess_declaration_specifiers { $$ = MkTypeName($1, null); }
3066 { $$ = MkTypeName(MkListOne(MkSpecifier(CLASS)), null); }
3069 { $$ = MkTypeName(MkListOne(MkSpecifier(TYPED_OBJECT)), null); }
3071 { $$ = MkTypeName(MkListOne(MkSpecifier(TYPED_OBJECT)), MkDeclaratorPointer(MkPointer(null,null), null)); }
3072 | TYPED_OBJECT declarator
3073 { $$ = MkTypeName(MkListOne(MkSpecifier(TYPED_OBJECT)), $2); }
3074 | TYPED_OBJECT '&' declarator
3075 { $$ = MkTypeName(MkListOne(MkSpecifier(TYPED_OBJECT)), MkDeclaratorPointer(MkPointer(null,null), $3)); }
3077 { $$ = MkTypeName(MkListOne(MkSpecifier(ANY_OBJECT)), null); }
3078 | ANY_OBJECT declarator
3079 { $$ = MkTypeName(MkListOne(MkSpecifier(ANY_OBJECT)), $2); }
3083 parameter_declaration_error:
3084 guess_declaration_specifiers declarator error { $$ = MkTypeName($1, $2); }
3085 | guess_declaration_specifiers abstract_declarator error { $$ = MkTypeName($1, $2); }
3089 parameter_declaration { $$ = MkList(); ListAdd($$, $1); }
3090 | parameter_list ',' parameter_declaration { $$ = $1; ListAdd($1, $3); }
3091 | parameter_list error ',' parameter_declaration { $$ = $1; ListAdd($1, $4); }
3092 | parameter_list_error ',' parameter_declaration { $$ = $1; ListAdd($1, $3); }
3093 | parameter_list_error error ',' parameter_declaration { $$ = $1; ListAdd($1, $4); }
3094 | error ',' parameter_declaration { $$ = MkList(); ListAdd($$, MkTypeName(MkList(), null)); ListAdd($$, $3); }
3096 | identifier_list ',' parameter_declaration { $$ = $1; ListAdd($1, $3); }
3097 | identifier_list error ',' parameter_declaration { $$ = $1; ListAdd($1, $4); }
3098 | identifier_list_error ',' parameter_declaration { $$ = $1; ListAdd($1, $3); }
3099 | identifier_list_error error ',' parameter_declaration { $$ = $1; ListAdd($1, $4); }
3102 parameter_list_error:
3103 parameter_declaration_error { $$ = MkList(); ListAdd($$, $1); }
3104 | parameter_list ',' parameter_declaration_error { $$ = $1; ListAdd($1, $3); }
3105 | parameter_list_error ',' parameter_declaration_error { $$ = $1; ListAdd($1, $3); }
3106 | parameter_list_error error ',' parameter_declaration_error { $$ = $1; ListAdd($1, $4); }
3107 | error ',' parameter_declaration_error { $$ = MkList(); ListAdd($$, MkTypeName(MkList(), null)); ListAdd($$, $3); }
3109 | identifier_list ',' parameter_declaration_error { $$ = $1; ListAdd($1, $3); }
3110 | identifier_list_error ',' parameter_declaration_error { $$ = $1; ListAdd($1, $3); }
3111 | identifier_list_error error ',' parameter_declaration_error { $$ = $1; ListAdd($1, $4); }
3114 parameter_type_list:
3116 | parameter_list ',' ELLIPSIS { $$ = $1; ListAdd($1, MkTypeName(null, null)); }
3117 | parameter_list_error ',' ELLIPSIS { $$ = $1; ListAdd($1, MkTypeName(null, null)); }
3118 | identifier_list ',' ELLIPSIS { $$ = $1; ListAdd($1, MkTypeName(null, null)); }
3119 | identifier_list_error ',' ELLIPSIS { $$ = $1; ListAdd($1, MkTypeName(null, null)); }
3120 | error ',' ELLIPSIS { $$ = MkList(); ListAdd($$, MkTypeName(null, null)); }
3123 parameter_type_list_error:
3124 parameter_list_error
3125 | parameter_list ',' error { $$ = $1; ListAdd($1, null); }
3126 | parameter_list_error error
3129 /****** STATEMENTS *******************************************************************/
3132 | attrib { $$ = MkExpressionStmt(null); FreeAttrib($1); } // Ignoring this for now... ( For __attribute__ ((__unused__)) )
3133 | compound_statement
3134 | ';' { $$ = MkExpressionStmt(null); }
3135 | ':' { $$ = MkExpressionStmt(null); }
3136 | expression ';' { $$ = MkExpressionStmt($1); $$.loc = @$; }
3137 | selection_statement
3138 | iteration_statement
3143 | watch_definition ';'
3147 labeled_statement_error { $$ = $1; Compiler_Error($"syntax error\n"); }
3148 | iteration_statement_error { $$ = $1; Compiler_Error($"syntax error\n"); }
3149 | compound_statement_error { $$ = $1; Compiler_Error($"syntax error\n"); }
3150 | selection_statement_error { $$ = $1; Compiler_Error($"syntax error\n"); }
3151 | jump_statement_error { $$ = $1; Compiler_Error($"syntax error\n"); }
3152 | jump_statement error { $$ = $1; Compiler_Error($"syntax error\n"); }
3153 | expression_error { $$ = MkExpressionStmt($1); Compiler_Error($"syntax error\n"); $$.loc = @1; }
3157 string_literal { $$ = MkAsmField($1, null); $$.loc = @1; }
3158 | string_literal '(' assignment_expression ')' { $$ = MkAsmField($1, $3); $$.loc = @$; }
3162 asm_field { $$ = MkListOne($1); }
3163 | asm_field_list ',' asm_field { ListAdd($$, $3); }
3168 ASM type_qualifier '(' string_literal ')' ';' { $$ = MkAsmStmt($2, $4, null, null, null); $$.loc = @$; }
3169 | ASM type_qualifier '(' string_literal ':' asm_field_list ')' ';' { $$ = MkAsmStmt($2, $4, $6, null, null); $$.loc = @$; }
3170 | ASM type_qualifier '(' string_literal ':' asm_field_list ':' asm_field_list ')' ';' { $$ = MkAsmStmt($2, $4, $6, $8, null); $$.loc = @$; }
3171 | ASM type_qualifier '(' string_literal ':' asm_field_list ':' asm_field_list ':' asm_field_list ')' ';' { $$ = MkAsmStmt($2, $4, $6, $8, $10); $$.loc = @$; }
3173 | ASM type_qualifier '(' string_literal IDENTIFIER asm_field_list ')' ';' { $$ = MkAsmStmt($2, $4, null, $6, null); $$.loc = @$; }
3174 | ASM type_qualifier '(' string_literal IDENTIFIER asm_field_list ':' asm_field_list ')' ';' { $$ = MkAsmStmt($2, $4, null, $6, $8); $$.loc = @$; }
3175 | ASM type_qualifier '(' string_literal ':' asm_field_list IDENTIFIER asm_field_list ')' ';' { $$ = MkAsmStmt($2, $4, $6, null, $8); $$.loc = @$; }
3177 | ASM '(' string_literal ')' ';' { $$ = MkAsmStmt(null, $3, null, null, null); $$.loc = @$; }
3178 | ASM '(' string_literal ':' asm_field_list ')' ';' { $$ = MkAsmStmt(null, $3, $5, null, null); $$.loc = @$; }
3179 | ASM '(' string_literal ':' asm_field_list ':' asm_field_list ')' ';' { $$ = MkAsmStmt(null, $3, $5, $7, null); $$.loc = @$; }
3180 | ASM '(' string_literal ':' asm_field_list ':' asm_field_list ':' asm_field_list ')' ';' { $$ = MkAsmStmt(null, $3, $5, $7, $9); $$.loc = @$; }
3182 | ASM '(' string_literal IDENTIFIER asm_field_list ')' ';' { $$ = MkAsmStmt(null, $3, null, $5, null); $$.loc = @$; }
3183 | ASM '(' string_literal IDENTIFIER asm_field_list ':' asm_field_list ')' ';' { $$ = MkAsmStmt(null, $3, null, $5, $7); $$.loc = @$; }
3184 | ASM '(' string_literal ':' asm_field_list IDENTIFIER asm_field_list ')' ';' { $$ = MkAsmStmt(null, $3, $5, null, $7); $$.loc = @$; }
3188 identifier ':' statement { $$ = MkLabeledStmt($1, $3); $$.loc = @$; }
3189 | CASE constant_expression ':' statement { $$ = MkCaseStmt($2, $4); $$.loc = @$; $2.loc.start = @1.end; }
3190 | CASE constant_expression_error ':' statement { $$ = MkCaseStmt($2, $4); $$.loc = @$; $2.loc.start = @1.end; }
3191 | CASE ':' statement { $$ = MkCaseStmt(MkExpDummy(), $3); $$.caseStmt.exp.loc = @2; $$.loc = @$; $$.caseStmt.exp.loc.start = @1.end; }
3192 | DEFAULT ':' statement { $$ = MkCaseStmt(null, $3); $$.loc = @$; }
3195 labeled_statement_error
3196 : identifier ':' statement_error { $$ = MkLabeledStmt($1, $3); $$.loc = @$; }
3197 | CASE constant_expression ':' statement_error { $$ = MkCaseStmt($2, $4); $$.loc = @$; $2.loc.start = @1.end; }
3198 | CASE constant_expression_error ':' statement_error { $$ = MkCaseStmt($2, $4); $$.loc = @$; $2.loc.start = @1.end; }
3199 | CASE ':' statement_error { $$ = MkCaseStmt(MkExpDummy(), $3); $$.caseStmt.exp.loc = @2; $$.loc = @$; $$.caseStmt.exp.loc.start = @1.end; }
3200 | CASE ':' { $$ = MkCaseStmt(MkExpDummy(), null); $$.caseStmt.exp.loc = @2; $$.loc = @$; $$.caseStmt.exp.loc.start = @1.end; }
3201 | DEFAULT ':' statement_error { $$ = MkCaseStmt(null, $3); $$.loc = @$; }
3202 | DEFAULT ':' { $$ = MkCaseStmt(null, null); $$.loc = @$; }
3206 PUBLIC { $$ = declMode = publicAccess; }
3207 | PRIVATE { $$ = declMode = privateAccess; }
3208 | DEFAULT { $$ = declMode = defaultAccess; }
3212 PUBLIC { $$ = publicAccess; }
3213 | PRIVATE { $$ = privateAccess; }
3217 declaration_specifiers ';' { $$ = MkDeclaration($1, null); $$.loc = @$; }
3218 | declaration_specifiers init_declarator_list ';' { $$ = MkDeclaration($1, $2); $$.loc = @$; }
3219 | instantiation_named ';' { $$ = MkDeclarationInst($1); $$.loc = @$; }
3220 | declaration_error ';' { $$ = $1; }
3223 external_guess_declaration:
3224 external_guess_declaration_specifiers ';' { $$ = MkDeclaration($1, null); $$.loc = @$; }
3225 | external_guess_declaration_specifiers init_declarator_list ';' { $$ = MkDeclaration($1, $2); $$.loc = @$; }
3226 | external_guess_declaration_specifiers_error init_declarator_list ';' { $$ = MkDeclaration($1, $2); $$.loc = @$; }
3228 | external_guess_instantiation_named ';' { $$ = MkDeclarationInst($1); $$.loc = @$; }
3229 | DEFINE identifier '=' conditional_expression ';' { $$ = MkDeclarationDefine($2, $4); $$.loc = @$; }
3230 | STATIC DEFINE identifier '=' conditional_expression ';' { declMode = staticAccess; $$ = MkDeclarationDefine($3, $5); $$.loc = @$; }
3233 external_guess_declaration_error:
3234 external_guess_declaration_specifiers error { $$ = MkDeclaration($1, null); $$.loc = @$; yyerrok; }
3238 declaration_specifiers error { $$ = MkDeclaration($1, null); $$.loc = @$; }
3239 | declaration_error error {}
3241 | instantiation_named_error error { $$ = MkDeclarationInst($1); $$.loc = @$; }
3242 | instantiation_named error { $$ = MkDeclarationInst($1); $$.loc = @$; }
3243 | declaration_specifiers init_declarator_list_error { $$ = MkDeclaration($1, $2); $$.loc = @$; }
3247 declaration { $$ = MkList(); ListAdd($$, $1); /*declMode = defaultDeclMode;*/ }
3248 | declaration_list declaration { $$ = $1; ListAdd($1, $2); /*declMode = defaultDeclMode; */}
3249 | declaration_list_error declaration { $$ = $1; ListAdd($1, $2); /*declMode = defaultDeclMode; */}
3250 | declaration_list error ';' { $$ = $1; }
3253 declaration_list_error:
3254 declaration_error { $$ = MkList(); ListAdd($$, $1); }
3255 | declaration_list declaration_error { $$ = $1; ListAdd($1, $2); }
3259 statement { $$ = MkList(); ListAdd($$, $1); }
3260 | statement_list statement { $$ = $1; ListAdd($1, $2); }
3261 | statement_list_error statement { $$ = $1; ListAdd($1, $2); }
3264 statement_list_error:
3265 statement_error { $$ = MkList(); ListAdd($$, $1); }
3266 | statement_list statement_error { $$ = $1; ListAdd($1, $2); }
3267 | statement_list_error statement_error { $$ = $1; ListAdd($1, $2); }
3268 | statement_list declaration { Statement stmt = MkBadDeclStmt($2); stmt.loc = @2; yyerror(); $$ = $1; ListAdd($1, stmt); /*declMode = defaultDeclMode;*/ }
3269 | statement_list_error declaration { Statement stmt = MkBadDeclStmt($2); stmt.loc = @2; yyerror(); $$ = $1; ListAdd($1, stmt); /*declMode = defaultDeclMode;*/ }
3270 | statement_list declaration_error { Statement stmt = MkBadDeclStmt($2); stmt.loc = @2; yyerror(); $$ = $1; ListAdd($1, stmt); /*declMode = defaultDeclMode;*/ }
3271 | statement_list_error declaration_error { Statement stmt = MkBadDeclStmt($2); stmt.loc = @2; yyerror(); $$ = $1; ListAdd($1, stmt); /*declMode = defaultDeclMode;*/ }
3275 statement_list { $$ = MkCompoundStmt(null, $1); }
3276 | declaration_list { $$ = MkCompoundStmt($1, null); }
3277 | declaration_list statement_list { $$ = MkCompoundStmt($1, $2); }
3278 | declaration_list_error statement_list { $$ = MkCompoundStmt($1, $2); }
3281 compound_inside_error:
3282 statement_list_error { $$ = MkCompoundStmt(null, $1); }
3283 | declaration_list_error { $$ = MkCompoundStmt($1, null); }
3284 | declaration_list statement_list_error { $$ = MkCompoundStmt($1, $2); }
3285 | declaration_list_error statement_list_error { $$ = MkCompoundStmt($1, $2); }
3289 '{' { $<context>$ = PushContext(); }
3293 compound_statement_error '}' { $$ = $1; $$.loc = @$; }
3296 compound_statement_error:
3297 compound_start compound_inside_error
3298 { $$ = $2; $$.compound.context = $<context>1; PopContext($<context>1); $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++; }
3300 { $$ = MkCompoundStmt(null, null); $$.compound.context = $<context>1; PopContext($<context>1); $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++; }
3302 | compound_start compound_inside
3303 { $$ = $2; $$.compound.context = $<context>1; PopContext($<context>1); $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++; }
3307 expression_statement:
3308 ';' { $$ = MkExpressionStmt(null); $$.loc = @$; }
3309 | expression ';' { $$ = MkExpressionStmt($1); $$.loc = @$; }
3310 | expression_error ';' { $$ = MkExpressionStmt($1); $$.loc = @$; }
3313 selection_statement:
3314 IF '(' expression ')' statement %prec IFX { $$ = MkIfStmt($3, $5, null); $$.loc = @$; }
3315 | IF '(' expression_error ')' statement %prec IFX { $$ = MkIfStmt($3, $5, null); $$.loc = @$; }
3316 | IF '(' expression ')' statement ELSE statement { $$ = MkIfStmt($3, $5, $7); $$.loc = @$; }
3317 | IF '(' expression_error ')' statement ELSE statement { $$ = MkIfStmt($3, $5, $7); $$.loc = @$; }
3318 | SWITCH '(' expression ')' statement { $$ = MkSwitchStmt($3, $5); $$.loc = @$; }
3319 | SWITCH '(' expression_error ')' statement { $$ = MkSwitchStmt($3, $5); $$.loc = @$; }
3322 selection_statement_error:
3323 IF '(' expression_error { $$ = MkIfStmt($3, null, null); $$.loc = @$; }
3324 | selection_statement error
3327 iteration_statement:
3328 WHILE '(' expression ')' statement { $$ = MkWhileStmt($3, $5); $$.loc = @$; }
3329 | WHILE '(' expression_error statement { $$ = MkWhileStmt($3, $4); $$.loc = @$; }
3330 | WHILE '(' ')' statement { $$ = MkWhileStmt(null, $4); $$.loc = @$; }
3332 | DO statement WHILE '(' expression ')' ';' { $$ = MkDoWhileStmt($2, $5); $$.loc = @$; }
3333 | DO statement WHILE '(' expression_error ';' { $$ = MkDoWhileStmt($2, $5); $$.loc = @$; }
3335 | FOR '(' expression_statement expression_statement ')' statement { $$ = MkForStmt($3, $4, null, $6); $$.loc = @$; }
3336 | FOR '(' expression_statement ')' statement { $$ = MkForStmt($3, null, null, $5); $$.loc = @$; }
3337 | FOR '(' expression_statement expression_statement expression ')' statement { $$ = MkForStmt($3, $4, $5, $7); $$.loc = @$; }
3338 | FOR '(' expression_statement expression_statement expression_error statement { $$ = MkForStmt($3, $4, $5, $6 ); $$.loc = @$; }
3339 | FOR '(' ')' statement { $$ = MkForStmt(null, null, null, $4); $$.loc = @$; }
3341 | FOR '(' identifier ':' expression ')' statement { $$ = MkForEachStmt($3, $5, null, $7); $$.loc = @$; }
3342 | FOR '(' identifier ':' expression ';' expression ')' statement { $$ = MkForEachStmt($3, $5, $7, $9); $$.loc = @$; }
3345 iteration_statement_error:
3346 FOR '(' error { $$ = MkForStmt(null, null, null, null); $$.loc = @$; } |
3347 FOR '(' expression_error error { $$ = MkForStmt(MkExpressionStmt($3), null, null, null); $$.forStmt.init.loc = @3; $$.loc = @$; } |
3348 FOR '(' expression_statement error { $$ = MkForStmt($3, null, null, null); $$.loc = @$; } |
3349 FOR '(' expression_statement expression_error error { $$ = MkForStmt($3, MkExpressionStmt($4), null, null); $$.loc = @$; $$.forStmt.check.loc = @4; } |
3350 /* Useless rules due to conflicts
3351 FOR '(' expression_statement expression_statement error { $$ = MkForStmt($3, $4, null, null); $$.loc = @$; } |
3353 FOR '(' expression_statement expression_statement expression_error { $$ = MkForStmt($3, $4, $5, null); $$.loc = @$; } |
3354 FOR '(' expression_statement expression_statement ')' statement_error { $$ = MkForStmt($3, $4, null, $6); $$.loc = @$; } |
3355 FOR '(' expression_statement expression_statement expression ')' statement_error { $$ = MkForStmt($3, $4, $5, $7); $$.loc = @$; } |
3356 FOR '(' expression_statement expression_statement expression_error statement_error { $$ = MkForStmt($3, $4, $5, $6 ); $$.loc = @$; } |
3358 DO statement WHILE '(' expression ')' { $$ = MkDoWhileStmt($2, $5); $$.loc = @$; } |
3359 DO statement WHILE '(' expression { $$ = MkDoWhileStmt($2, $5); $$.loc = @$; } |
3360 DO statement WHILE '(' expression_error { $$ = MkDoWhileStmt($2, $5); $$.loc = @$; } |
3361 DO statement WHILE '(' { $$ = MkDoWhileStmt($2, null); $$.loc = @$; } |
3362 DO statement WHILE { $$ = MkDoWhileStmt($2, null); $$.loc = @$; } |
3363 DO statement { $$ = MkDoWhileStmt($2, null); $$.loc = @$; } |
3364 DO { $$ = MkDoWhileStmt(null, null); $$.loc = @$; } |
3367 WHILE error { $$ = MkWhileStmt(null, null); $$.loc = @$; } |
3368 /* Useless rules due to conflicts
3369 WHILE '(' error { $$ = MkWhileStmt(null, null); $$.loc = @$; } |
3371 WHILE '(' ')' error { $$ = MkWhileStmt(null, null); $$.loc = @$; } |
3372 WHILE '(' expression_error { $$ = MkWhileStmt($3, null); $$.loc = @$; } |
3373 /* Useless rules due to conflicts
3374 WHILE '(' expression_error error { $$ = MkWhileStmt($3, null); $$.loc = @$; } |
3376 WHILE '(' expression ')' statement_error { $$ = MkWhileStmt($3, $5); $$.loc = @$; } |
3377 WHILE '(' expression_error statement_error { $$ = MkWhileStmt($3, $4 ); $$.loc = @$; }
3381 GOTO identifier ';' { $$ = MkGotoStmt($2); $$.loc = @$; }
3382 | CONTINUE ';' { $$ = MkContinueStmt(); $$.loc = @$; }
3383 | BREAK ';' { $$ = MkBreakStmt(); $$.loc = @$; }
3384 | RETURN ';' { Expression exp = MkExpDummy(); $$ = MkReturnStmt(MkListOne(exp)); $$.loc = @$; exp.loc = @2; }
3385 | RETURN expression ';' { $$ = MkReturnStmt($2); $$.loc = @$; }
3386 | RETURN expression_error ';' { $$ = MkReturnStmt($2); $$.loc = @$; }
3387 | RETURN anon_instantiation_expression ';' { $$ = MkReturnStmt(MkListOne($2)); $$.loc = @$; }
3388 | RETURN anon_instantiation_expression_error ';' { $$ = MkReturnStmt(MkListOne($2)); $$.loc = @$; }
3391 jump_statement_error:
3392 RETURN expression_error { $$ = MkReturnStmt($2); $$.loc = @$; } |
3393 RETURN anon_instantiation_expression_error { $$ = MkReturnStmt(MkListOne($2)); $$.loc = @$; } |
3394 RETURN { Expression exp = MkExpDummy(); $$ = MkReturnStmt(MkListOne(exp)); $$.loc = @$; exp.loc.start = exp.loc.end = @1.end; } |
3395 GOTO { $$ = MkGotoStmt(null); $$.loc = @$; }
3398 /*************************************************************************************/
3400 function_definition:
3401 external_guess_declaration_specifiers declarator_function declaration_list compound_statement { $$ = MkFunction($1, $2, $3); ProcessFunctionBody($$, $4); $$.loc = @$; }
3402 | external_guess_declaration_specifiers declarator_function compound_statement
3403 { $$ = MkFunction($1, $2, null); ProcessFunctionBody($$, $3); $$.loc = @$; }
3405 | declarator_function declaration_list compound_statement { $$ = MkFunction(null, $1, $2); ProcessFunctionBody($$, $3); $$.loc = @$; }
3406 | declarator_function compound_statement { $$ = MkFunction(null, $1, null); ProcessFunctionBody($$, $2); $$.loc = @$;}
3408 function_definition_error:
3409 external_guess_declaration_specifiers declarator_function declaration_list compound_statement_error { $$ = MkFunction($1, $2, $3); ProcessFunctionBody($$, $4); $$.loc = @$; $$.loc.end = $4.loc.end; }
3410 | external_guess_declaration_specifiers declarator_function compound_statement_error { $$ = MkFunction($1, $2, null); ProcessFunctionBody($$, $3); $$.loc = @$; $$.loc.end = $3.loc.end; }
3411 | declarator_function declaration_list compound_statement_error { $$ = MkFunction(null, $1, $2); ProcessFunctionBody($$, $3); $$.loc = @$; $$.loc.end = $3.loc.end; }
3412 | declarator_function compound_statement_error { $$ = MkFunction(null, $1, null); ProcessFunctionBody($$, $2); $$.loc = @$; $$.loc.end = $2.loc.end; }
3416 STRING_LITERAL { $$ = CopyString(yytext); }
3417 | string_literal STRING_LITERAL
3419 int len1 = strlen($1);
3420 int len2 = strlen(yytext);
3421 $$ = new byte[len1-1 + len2-1 + 1];
3422 memcpy($$, $1, len1-1);
3423 memcpy($$ + len1-1, yytext+1, len2);
3428 external_declaration:
3429 function_definition { $$ = MkExternalFunction($1); $$.loc = @$; $1.declMode = declMode; declMode = defaultDeclMode; }
3431 { $$ = MkExternalClass($1); $$.loc = @$; $1.declMode = (declMode != defaultAccess) ? declMode : privateAccess; declMode = defaultDeclMode; }
3433 | external_guess_declaration_specifiers class
3434 { $$ = MkExternalClass($2); $$.loc = @$; $2.declMode = (declMode != defaultAccess) ? declMode : privateAccess; declMode = defaultDeclMode; FreeList($1, FreeSpecifier); }
3436 | external_guess_declaration
3437 { $$ = MkExternalDeclaration($1); $$.loc = @$; $1.declMode = declMode; declMode = defaultDeclMode; }
3438 | IMPORT string_literal { $$ = MkExternalImport($2, normalImport, (declMode != defaultAccess) ? declMode : privateAccess); $$.loc = @$; }
3439 | IMPORT STATIC string_literal { $$ = MkExternalImport($3, staticImport, (declMode != defaultAccess) ? declMode : privateAccess); $$.loc = @$; }
3440 | IMPORT identifier string_literal
3442 bool isRemote = !strcmp($2.string, "remote");
3443 $$ = MkExternalImport($3, isRemote ? remoteImport : normalImport, (declMode != defaultAccess) ? declMode : privateAccess);
3450 | ';' { $$ = null; }
3452 | declaration_mode function_definition { $$ = MkExternalFunction($2); $$.loc = @$; $2.declMode = $1; declMode = defaultDeclMode; }
3453 | declaration_mode class
3454 { $$ = MkExternalClass($2); $$.loc = @$; $2.declMode = ($1 != defaultAccess) ? $1 : privateAccess; declMode = defaultDeclMode; }
3455 | declaration_mode external_guess_declaration { $$ = MkExternalDeclaration($2); $$.loc = @$; $2.declMode = $1; declMode = defaultDeclMode; }
3456 | declaration_mode IMPORT string_literal { $$ = MkExternalImport($3, normalImport, ($1 != defaultAccess) ? $1 : privateAccess); $$.loc = @$; declMode = defaultDeclMode; }
3457 | declaration_mode IMPORT STATIC string_literal { $$ = MkExternalImport($4, staticImport, ($1 != defaultAccess) ? $1 : privateAccess); $$.loc = @$; declMode = defaultDeclMode; }
3458 | declaration_mode IMPORT identifier string_literal
3460 bool isRemote = !strcmp($3.string, "remote");
3461 $$ = MkExternalImport($4, isRemote ? remoteImport : normalImport, ($1 != defaultAccess) ? $1 : privateAccess);
3464 declMode = defaultDeclMode;
3468 | declaration_mode ':' { defaultDeclMode = $1; $$ = null; }
3469 | STATIC ':' { defaultDeclMode = staticAccess; $$ = null; }
3470 | NAMESPACE identifier { $$ = MkExternalNameSpace($2); $$.loc = @$; }
3471 | NAMESPACE strict_type { $$ = MkExternalNameSpace(MkIdentifier($2.name)); FreeSpecifier($2); $$.loc = @$; }
3472 | dbtable_definition { $$ = MkExternalDBTable($1); $$.loc = @$; $1.declMode = (declMode != defaultAccess) ? declMode : privateAccess; declMode = defaultDeclMode; }
3473 | declaration_mode dbtable_definition { $$ = MkExternalDBTable($2); $$.loc = @$; $2.declMode = ($1 != defaultAccess) ? declMode : privateAccess; declMode = defaultDeclMode; }
3476 external_declaration_error:
3477 class_error { $$ = MkExternalClass($1); $$.loc = $1.loc; $1.declMode = (declMode != defaultAccess) ? declMode : privateAccess; declMode = defaultDeclMode; }
3478 | external_guess_declaration_specifiers class_error
3480 FreeList($1, FreeSpecifier);
3481 $$ = MkExternalClass($2);
3483 $2.declMode = (declMode != defaultAccess) ? declMode : privateAccess;
3484 declMode = defaultDeclMode;
3486 | function_definition_error { $$ = MkExternalFunction($1); $$.loc = $1.loc; $1.declMode = declMode; declMode = defaultDeclMode; }
3488 | declaration_mode class_error { $$ = MkExternalClass($2); $$.loc = $2.loc; $2.declMode = ($1 != defaultAccess) ? $1 : privateAccess; declMode = defaultDeclMode; }
3489 | declaration_mode function_definition_error { $$ = MkExternalFunction($2); $$.loc = $2.loc; $2.declMode = $1; declMode = defaultDeclMode; }
3491 | external_guess_declaration_error
3492 { $$ = MkExternalDeclaration($1); $$.loc = @$; $1.declMode = declMode; declMode = defaultDeclMode; }
3493 | declaration_mode external_guess_declaration_error { $$ = MkExternalDeclaration($2); $$.loc = @$; $2.declMode = $1; declMode = defaultDeclMode; }
3496 translation_unit_error:
3497 external_declaration_error { $$ = MkList(); ListAdd($$, $1); ast = $$; }
3498 | translation_unit external_declaration_error { $$ = $1; ListAdd($1, $2); }
3499 | translation_unit_error external_declaration_error { $$ = $1; ListAdd($1, $2); }
3500 | translation_unit error
3501 | translation_unit_error error
3505 external_declaration { $$ = MkList(); ListAdd($$, $1); ast = $$; }
3506 | translation_unit external_declaration { $$ = $1; ListAdd($1, $2); }
3507 | translation_unit_error class
3508 { External _class = MkExternalClass($2); $$ = $1; ListAdd($1, _class); _class.loc = @2; $2.declMode = (declMode != defaultAccess) ? declMode : privateAccess; declMode = defaultDeclMode; }
3509 | translation_unit_error declaration_mode class
3510 { External _class = MkExternalClass($3); $$ = $1; ListAdd($1, _class); _class.loc = @3; $3.declMode = ($2 != defaultAccess) ? $2 : privateAccess; declMode = defaultDeclMode; }
3515 | translation_unit_error
3516 | { ast = MkList(); }
3520 DBTABLE string_literal identifier '{' dbfield_definition_list '}' { Symbol symbol = DeclClassAddNameSpace(globalContext.nextID++, $3.string); FreeIdentifier($3); $$ = MkDBTableDef($2, symbol, $5); }
3521 | DBTABLE string_literal strict_type '{' dbfield_definition_list '}' { Symbol symbol = DeclClass(globalContext.nextID++, $3.name); FreeSpecifier($3); $$ = MkDBTableDef($2, symbol, $5); }
3522 | DBTABLE string_literal '{' dbfield_definition_list '}' { $$ = MkDBTableDef($2, null, $4); }
3526 guess_declaration_specifiers identifier string_literal ';' { $$ = MkDBFieldEntry(MkTypeName($1, null), $2, $3); }
3530 identifier { $$ = MkDBIndexItem($1, ascending); }
3531 | '>' identifier { $$ = MkDBIndexItem($2, descending); }
3532 | '<' identifier { $$ = MkDBIndexItem($2, ascending); }
3536 dbindex_item { $$ = MkList(); ListAdd($$, $1); }
3537 | dbindex_item_list ',' dbindex_item { ListAdd($1, $3); }
3541 DBINDEX dbindex_item_list ';' { $$ = MkDBIndexEntry($2, null); }
3542 | DBINDEX dbindex_item_list identifier ';' { $$ = MkDBIndexEntry($2, $3); }
3545 dbfield_definition_list:
3546 dbfield_entry { $$ = MkList(); ListAdd($$, $1); }
3547 | dbindex_entry { $$ = MkList(); ListAdd($$, $1); }
3548 | dbfield_definition_list dbfield_entry { ListAdd($1, $2); }
3549 | dbfield_definition_list dbindex_entry { ListAdd($1, $2); }
3553 DATABASE_OPEN '(' assignment_expression ',' assignment_expression ')' { $$ = MkExpDBOpen($3, $5); }
3557 DBFIELD '(' string_literal ',' identifier ')' { $$ = MkExpDBField($3, $5); }
3561 DBINDEX '(' string_literal ',' identifier ')' { $$ = MkExpDBIndex($3, $5); }
3565 DBTABLE '(' string_literal ')' { $$ = MkExpDBTable($3); }