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--;
28 #define C89_DECL_WARNING "eC expects all declarations to precede statements in the block (C89 style)\n"
38 SpecifierType specifierType;
45 Enumerator enumerator;
46 Declarator declarator;
48 Initializer initializer;
49 InitDeclarator initDeclarator;
51 Declaration declaration;
53 FunctionDefinition function;
61 Instantiation instance;
62 MembersInit membersInit;
63 MemberInit memberInit;
64 ClassFunction classFunction;
65 ClassDefinition _class;
70 PropertyWatch propertyWatch;
71 TemplateParameter templateParameter;
72 TemplateArgument templateArgument;
73 TemplateDatatype templateDatatype;
75 DBTableEntry dbtableEntry;
76 DBIndexItem dbindexItem;
77 DBTableDef dbtableDef;
82 %type <symbol> class_decl
83 %type <specifierType> struct_or_union
84 %type <i> unary_operator assignment_operator
85 %type <declMode> member_access declaration_mode
86 %type <id> identifier enum_decl
87 %type <exp> primary_expression primary_expression_error postfix_expression unary_expression cast_expression
88 multiplicative_expression additive_expression shift_expression
89 relational_expression relational_expression_smaller_than equality_expression and_expression
90 exclusive_or_expression inclusive_or_expression logical_and_expression
91 logical_or_expression conditional_expression assignment_expression
92 constant_expression constant_expression_error
93 anon_instantiation_expression anon_instantiation_expression_error i18n_string
94 postfix_expression_error unary_expression_error cast_expression_error
95 multiplicative_expression_error additive_expression_error shift_expression_error
96 relational_expression_error equality_expression_error and_expression_error
97 exclusive_or_expression_error inclusive_or_expression_error logical_and_expression_error
98 logical_or_expression_error conditional_expression_error assignment_expression_error
99 simple_primary_expression
100 simple_postfix_expression simple_postfix_expression_error
101 common_unary_expression common_unary_expression_error
102 simple_unary_expression simple_unary_expression_error
103 database_open dbfield dbindex dbtable
105 %type <list> argument_expression_list expression expression_anon_inst expression_anon_inst_error enumerator_list type_qualifier_list
106 struct_declarator_list struct_declaration_list
107 declaration_specifiers identifier_list identifier_list_error initializer_list init_declarator_list
108 parameter_list parameter_list_error parameter_type_list parameter_type_list_error declaration_list declaration_list_error statement_list statement_list_error
109 translation_unit members_initialization_list members_initialization_list_coloned members_initialization_list_error data_member_initialization_list data_member_initialization_list_coloned
110 default_property_list data_member_initialization_list_error
111 expression_error init_declarator_list_error argument_expression_list_error default_property_list_error struct_declaration_list_error
112 translation_unit_error
113 guess_declaration_specifiers
114 external_guess_declaration_specifiers external_guess_declaration_specifiers_error
115 specifier_qualifier_list guess_specifier_qualifier_list
116 _inheritance_specifiers inheritance_specifiers property_specifiers
117 new_specifiers renew_specifiers asm_field_list
118 property_watch_list watch_property_list
119 dbindex_item_list dbfield_definition_list
120 template_arguments_list template_parameters_list attribs_list
122 %type <asmField> asm_field
123 %type <specifier> storage_class_specifier enum_specifier_compound enum_specifier_nocompound type_qualifier type_specifier class_specifier class_specifier_error
124 struct_or_union_specifier_compound struct_or_union_specifier_nocompound ext_storage type strict_type guess_type enum_class strict_type_specifier struct_class
125 struct_or_union_specifier_compound_error struct_class_error struct_decl
126 enum_specifier_compound_error enum_class_error external_storage_class_specifier
127 base_strict_type struct_head struct_entry
128 %type <enumerator> enumerator
129 %type <declarator> declarator direct_declarator direct_abstract_declarator abstract_declarator
130 direct_abstract_declarator_noarray abstract_declarator_noarray
131 struct_declarator direct_declarator_function direct_declarator_function_start declarator_function_error direct_declarator_function_error declarator_function direct_declarator_nofunction
132 direct_declarator_function_type_ok declarator_nofunction_type_ok direct_declarator_nofunction_type_ok declarator_function_type_ok direct_declarator_function_error_type_ok
133 direct_declarator_function_start_type_ok direct_declarator_type_ok declarator_type_ok declarator_function_error_type_ok
134 %type <pointer> pointer
135 %type <initializer> initializer initializer_error initializer_condition initializer_condition_error
136 %type <initDeclarator> init_declarator init_declarator_error
137 %type <typeName> type_name guess_type_name parameter_declaration parameter_declaration_error
138 %type <stmt> statement labeled_statement labeled_statement_error compound_statement compound_statement_error expression_statement
139 selection_statement selection_statement_error iteration_statement jump_statement jump_statement_error compound_inside compound_inside_error
140 iteration_statement_error statement_error asm_statement
141 stopwatching watch_definition firewatchers
143 %type <declaration> declaration declaration_error external_guess_declaration external_guess_declaration_error
144 %type <function> function_definition function_definition_error
145 %type <external> external_declaration external_declaration_error
147 %type <instance> instantiation_named instantiation_named_error instantiation_unnamed instantiation_unnamed_error guess_instantiation_named guess_instantiation_named_error external_guess_instantiation_named
148 instantiation_anon instantiation_anon_error
149 %type <memberInit> data_member_initialization data_member_initialization_error default_property default_property_error
150 %type <classFunction> class_function_definition class_function_definition_error class_function_definition_start
151 class_function_definition_start_error virtual_class_function_definition_start virtual_class_function_definition_start_error
152 constructor_function_definition_start destructor_function_definition_start
153 %type <classFunction> instance_class_function_definition instance_class_function_definition_error instance_class_function_definition_start instance_class_function_definition_start_error
154 %type <_class> class class_error class_head
155 %type <classDef> struct_declaration struct_declaration_error
156 %type <string> string_literal base_strict_type_name attribute_word
157 %type <extDecl> ext_decl
158 %type <attrib> attrib
159 %type <attribute> attribute
160 %type <prop> property property_start property_body class_property class_property_start class_property_body
161 %type <propertyWatch> property_watch self_watch_definition
163 %type <templateParameter> template_parameter template_type_parameter template_identifier_parameter template_expression_parameter
164 %type <templateArgument> template_argument template_type_argument template_identifier_argument template_expression_argument
165 %type <templateDatatype> template_datatype
167 %type <dbtableEntry> dbindex_entry dbfield_entry
168 %type <dbindexItem> dbindex_item
169 %type <dbtableDef> dbtable_definition
170 %type <context> compound_start class_entry
172 %token IDENTIFIER CONSTANT STRING_LITERAL SIZEOF
173 %token PTR_OP INC_OP DEC_OP LEFT_OP RIGHT_OP LE_OP GE_OP EQ_OP NE_OP
174 %token AND_OP OR_OP MUL_ASSIGN DIV_ASSIGN MOD_ASSIGN ADD_ASSIGN
175 %token SUB_ASSIGN LEFT_ASSIGN RIGHT_ASSIGN AND_ASSIGN
176 %token XOR_ASSIGN OR_ASSIGN TYPE_NAME
178 %token TYPEDEF EXTERN STATIC AUTO REGISTER
179 %token CHAR SHORT INT UINT INT64 LONG SIGNED UNSIGNED FLOAT DOUBLE CONST VOLATILE VOID VALIST
180 %token STRUCT UNION ENUM ELLIPSIS
182 %token CASE DEFAULT IF SWITCH WHILE DO FOR GOTO CONTINUE BREAK RETURN
186 %token CLASS THISCLASS CLASS_NAME
187 %token PROPERTY SETPROP GETPROP NEWOP RENEW DELETE EXT_DECL EXT_STORAGE IMPORT DEFINE VIRTUAL ATTRIB
188 %token PUBLIC PRIVATE
189 %token TYPED_OBJECT ANY_OBJECT _INCREF EXTENSION ASM TYPEOF
190 %token WATCH STOPWATCHING FIREWATCHERS WATCHABLE CLASS_DESIGNER CLASS_NO_EXPANSION CLASS_FIXED ISPROPSET
191 %token CLASS_DEFAULT_PROPERTY PROPERTY_CATEGORY CLASS_DATA CLASS_PROPERTY SUBCLASS NAMESPACE
192 %token NEW0OP RENEW0 VAARG
193 %token DBTABLE DBFIELD DBINDEX DATABASE_OPEN
194 %token ALIGNOF ATTRIB_DEP __ATTRIB
196 %destructor { FreeIdentifier($$); } identifier
197 %destructor { FreePointer($$); } pointer
198 %destructor { FreeExpression($$); } primary_expression primary_expression_error postfix_expression unary_expression cast_expression
199 multiplicative_expression additive_expression shift_expression
200 relational_expression equality_expression and_expression
201 exclusive_or_expression inclusive_or_expression logical_and_expression
202 logical_or_expression conditional_expression assignment_expression
203 constant_expression constant_expression_error
204 postfix_expression_error unary_expression_error cast_expression_error
205 multiplicative_expression_error additive_expression_error shift_expression_error
206 relational_expression_error equality_expression_error and_expression_error
207 exclusive_or_expression_error inclusive_or_expression_error logical_and_expression_error
208 logical_or_expression_error conditional_expression_error assignment_expression_error i18n_string
209 %destructor { FreeSpecifier($$); } storage_class_specifier enum_specifier_compound enum_specifier_nocompound type_qualifier type_specifier class_specifier class_specifier_error
210 struct_or_union_specifier_compound struct_or_union_specifier_nocompound ext_storage type strict_type guess_type enum_class strict_type_specifier struct_class
211 struct_or_union_specifier_compound_error struct_class_error struct_decl
212 enum_specifier_compound_error enum_class_error external_storage_class_specifier
213 base_strict_type struct_head struct_entry
214 %destructor { FreeEnumerator($$); } enumerator
215 %destructor { FreeDeclarator($$); } declarator direct_declarator direct_abstract_declarator abstract_declarator
216 direct_abstract_declarator_noarray abstract_declarator_noarray
217 struct_declarator direct_declarator_function direct_declarator_function_start declarator_function_error direct_declarator_function_error declarator_function direct_declarator_nofunction
218 direct_declarator_function_type_ok declarator_nofunction_type_ok direct_declarator_nofunction_type_ok declarator_function_type_ok direct_declarator_function_error_type_ok
219 direct_declarator_function_start_type_ok direct_declarator_type_ok declarator_type_ok declarator_function_error_type_ok
221 %destructor { FreeInitializer($$); } initializer initializer_error initializer_condition initializer_condition_error
222 %destructor { FreeInitDeclarator($$); } init_declarator init_declarator_error
223 %destructor { FreeTypeName($$); } type_name guess_type_name parameter_declaration parameter_declaration_error
224 %destructor { FreeStatement($$); } statement labeled_statement labeled_statement_error compound_statement compound_statement_error expression_statement
225 selection_statement selection_statement_error iteration_statement jump_statement jump_statement_error compound_inside compound_inside_error
226 iteration_statement_error statement_error
228 %destructor { FreeDeclaration($$); } declaration
229 %destructor { FreeFunction($$); } function_definition function_definition_error
230 %destructor { FreeExternal($$); } external_declaration external_declaration_error
232 %destructor { FreeInstance($$); } instantiation_named instantiation_named_error instantiation_unnamed instantiation_unnamed_error
234 %destructor { FreeMemberInit($$); } data_member_initialization data_member_initialization_error default_property default_property_error
236 %destructor { FreeClassFunction($$); } class_function_definition class_function_definition_error class_function_definition_start
237 class_function_definition_start_error virtual_class_function_definition_start virtual_class_function_definition_start_error
238 constructor_function_definition_start destructor_function_definition_start
239 instance_class_function_definition instance_class_function_definition_error instance_class_function_definition_start instance_class_function_definition_start_error
240 %destructor { Context ctx = curContext; PopContext(ctx); FreeContext(ctx); delete ctx; } class_entry
241 %destructor { Context ctx = curContext; PopContext(ctx); FreeContext(ctx); delete ctx; } class_decl
242 %destructor { FreeClass($$); } class class_error class_head
243 %destructor { FreeClassDef($$); } struct_declaration struct_declaration_error
244 %destructor { delete $$; } string_literal attribute_word base_strict_type_name
245 %destructor { FreeProperty($$); } property
247 %destructor { FreeList($$, FreeExpression); } argument_expression_list expression expression_error argument_expression_list_error
248 %destructor { FreeList($$, FreeEnumerator); } enumerator_list
249 %destructor { FreeList($$, FreeSpecifier); } type_qualifier_list specifier_qualifier_list declaration_specifiers inheritance_specifiers _inheritance_specifiers external_guess_declaration_specifiers external_guess_declaration_specifiers_error
250 guess_declaration_specifiers guess_specifier_qualifier_list
251 %destructor { FreeList($$, FreeDeclarator); } struct_declarator_list
252 %destructor { FreeList($$, FreeDeclaration); } declaration_list declaration_list_error
253 %destructor { FreeList($$, FreeInitializer); } initializer_list
254 %destructor { FreeList($$, FreeInitDeclarator); } init_declarator_list init_declarator_list_error
255 %destructor { FreeList($$, FreeTypeName); } parameter_list parameter_list_error parameter_type_list parameter_type_list_error identifier_list identifier_list_error
256 %destructor { FreeList($$, FreeStatement); } statement_list statement_list_error
257 %destructor { if($$ != ast) FreeList($$, FreeExternal); } translation_unit translation_unit_error
258 %destructor { FreeList($$, FreeClassDef); } struct_declaration_list struct_declaration_list_error
259 %destructor { FreeList($$, FreeMemberInit); } default_property_list default_property_list_error data_member_initialization_list data_member_initialization_list_coloned data_member_initialization_list_error
260 %destructor { FreeList($$, FreeMembersInit); } members_initialization_list members_initialization_list_coloned members_initialization_list_error
261 %destructor { PopContext($$); FreeContext($$); delete $$; } compound_start
262 %destructor { FreeTemplateParameter($$); } template_parameter template_type_parameter template_identifier_parameter template_expression_parameter
263 %destructor { FreeTemplateArgument($$); } template_argument template_type_argument template_identifier_argument template_expression_argument
264 %destructor { FreeTemplateDataType($$); } template_datatype
265 %destructor { FreeList($$, FreeTemplateParameter); } template_parameters_list
266 %destructor { FreeList($$, FreeTemplateArgument); } template_arguments_list
267 %destructor { } declaration_mode
268 %destructor { FreeAttrib($$); } attrib
269 %destructor { FreeExtDecl($$); } ext_decl
270 %destructor { FreeAttribute($$); } attribute
271 %destructor { FreeList($$, FreeAttribute); } attribs_list
281 // if($1._class && !$1._class.name)
285 strcpy(name, $1._class.name ? $1._class.name : "");
287 strcat(name, $1.string);
291 _DeclClass(0, $1.string);
295 fileInput.Seek(@1.start.pos, start);
296 resetScannerPos(&@1.start);
301 YY_STACK_PRINT (yyss, yyssp);
304 YY_STACK_PRINT (yyss, yyssp);
311 // if($1._class && !$1._class.name)
315 strcpy(name, $1._class.name ? $1._class.name : "");
317 strcat(name, $1.string);
321 _DeclClass(0, $1.string);
325 fileInput.Seek(@1.start.pos, start);
326 resetScannerPos(&@1.start);
331 YY_STACK_PRINT (yyss, yyssp);
334 YY_STACK_PRINT (yyss, yyssp);
338 /* | identifier '*' '<' template_arguments_list '>'
340 //if($1._class && !$1._class.name)
344 strcpy(name, $1._class.name ? $1._class.name : "");
346 strcat(name, $1.string);
350 _DeclClass(0, $1.string);
351 fileInput.Seek(@1.start.pos, start);
352 resetScannerPos(&@1.start);
357 YY_STACK_PRINT (yyss, yyssp);
360 YY_STACK_PRINT (yyss, yyssp);
366 strict_type { $$ = $1; }
367 | identifier identifier
370 // if($1._class && !$1._class.name)
374 strcpy(name, $1._class.name ? $1._class.name : "");
376 strcat(name, $1.string);
380 _DeclClass(0, $1.string);
384 fileInput.Seek(@1.start.pos, start);
385 resetScannerPos(&@1.start);
390 YY_STACK_PRINT (yyss, yyssp);
393 YY_STACK_PRINT (yyss, yyssp);
396 Location tmpLoc = yylloc; $$ = $2; yylloc = @1;
397 Compiler_Error($"Not a type: %s\n", $1.string);
398 yylloc = tmpLoc; $2.badID = $1;
405 //if($1._class && !$1._class.name)
409 strcpy(name, $1._class.name ? $1._class.name : "");
411 strcat(name, $1.string);
415 _DeclClass(0, $1.string);
416 fileInput.Seek(@1.start.pos, start);
417 resetScannerPos(&@1.start);
422 YY_STACK_PRINT (yyss, yyssp);
425 YY_STACK_PRINT (yyss, yyssp);
429 /* | strict_type '<' template_arguments_list '>' { $$ = $1; }
430 | identifier identifier '<' template_arguments_list '>'
433 // if($1._class && !$1._class.name)
437 strcpy(name, $1._class.name ? $1._class.name : "");
439 strcat(name, $1.string);
443 _DeclClass(0, $1.string);
447 fileInput.Seek(@1.start.pos, start);
448 resetScannerPos(&@1.start);
453 YY_STACK_PRINT (yyss, yyssp);
456 YY_STACK_PRINT (yyss, yyssp);
459 Location tmpLoc = yylloc; $$ = $2; yylloc = @1;
460 Compiler_Error($"Not a type: %s\n", $1.string);
461 yylloc = tmpLoc; $2.badID = $1;
467 TYPE_NAME { $$ = MkSpecifierName(yytext); }
470 base_strict_type_name:
471 TYPE_NAME { $$ = CopyString(yytext); }
475 | base_strict_type '<' template_arguments_list '>' { $$ = $1; SetClassTemplateArgs($$, $3); $$.loc = @$; }
476 | base_strict_type '<' template_arguments_list RIGHT_OP
479 SetClassTemplateArgs($$, $3);
483 fileInput.Seek(@4.end.pos, start);
484 resetScannerPos(&@4.end);
488 /* | identifier '<' template_arguments_list '>' */
489 /*| identifier '<' error
491 // if($1._class && !$1._class.name)
495 strcpy(name, $1._class.name ? $1._class.name : "");
497 strcat(name, $1.string);
501 _DeclClass(0, $1.string);
505 fileInput.Seek(@1.start.pos, start);
506 resetScannerPos(&@1.start);
511 YY_STACK_PRINT (yyss, yyssp);
514 YY_STACK_PRINT (yyss, yyssp);
517 YY_STACK_PRINT (yyss, yyssp);
520 /* $$ = MkSpecifierNameArgs($1.string, $3); $$.loc = @$; FreeIdentifier($1); */
524 class_function_definition_start:
525 guess_declaration_specifiers declarator_function_type_ok
526 { $$ = MkClassFunction($1, null, $2, null); $$.loc = @$; $$.id = ++globalContext.nextID; }
527 | declarator_function
528 { $$ = MkClassFunction(null, null, $1, null); $$.loc = @$; $$.id = ++globalContext.nextID; }
531 constructor_function_definition_start:
532 guess_declaration_specifiers '(' ')'
533 { $$ = MkClassFunction(null, null, null, null); $$.isConstructor = true; $$.loc = @$; $$.id = ++globalContext.nextID; FreeList($1, FreeSpecifier); }
536 destructor_function_definition_start:
537 '~' guess_declaration_specifiers '(' ')'
538 { $$ = MkClassFunction(null, null, null, null); $$.isDestructor = true; $$.loc = @$; $$.id = ++globalContext.nextID; FreeList($2, FreeSpecifier) }
541 virtual_class_function_definition_start:
542 VIRTUAL guess_declaration_specifiers declarator_function_type_ok
543 { $$ = MkClassFunction($2, null, $3, null); $$.isVirtual = true; $$.loc = @$; $$.id = ++globalContext.nextID; }
544 | VIRTUAL declarator_function
545 { $$ = MkClassFunction(null, null, $2, null); $$.isVirtual = true; $$.loc = @$; $$.id = ++globalContext.nextID; }
548 class_function_definition_start_error:
549 guess_declaration_specifiers declarator_function_error_type_ok
550 { $$ = MkClassFunction($1, null, $2, null); $$.loc = @$; $$.id = ++globalContext.nextID; }
551 | declarator_function_error
552 { $$ = MkClassFunction(null, null, $1, null); $$.loc = @$; $$.id = ++globalContext.nextID; }
555 virtual_class_function_definition_start_error:
556 VIRTUAL guess_declaration_specifiers declarator_function_error_type_ok
557 { $$ = MkClassFunction($2, null, $3, null); $$.isVirtual = true; $$.loc = @$; $$.id = ++globalContext.nextID; }
558 | VIRTUAL declarator_function_error
559 { $$ = MkClassFunction(null, null, $2, null); $$.isVirtual = true; $$.loc = @$; $$.id = ++globalContext.nextID; }
562 class_function_definition:
563 class_function_definition_start compound_statement
564 { ProcessClassFunctionBody($1, $2); $$.loc = @$; }
565 | virtual_class_function_definition_start compound_statement
566 { ProcessClassFunctionBody($1, $2); $$.loc = @$; }
567 | virtual_class_function_definition_start ';'
568 { ProcessClassFunctionBody($1, null); $$.loc = @$; }
569 | constructor_function_definition_start compound_statement
570 { ProcessClassFunctionBody($1, $2); $$.loc = @$; }
571 | destructor_function_definition_start compound_statement
572 { ProcessClassFunctionBody($1, $2); $$.loc = @$; }
575 | class_function_definition_start ';'
576 { ProcessClassFunctionBody($1, null); $$.loc = @$; }
579 class_function_definition_error:
580 class_function_definition_start compound_statement_error
581 { ProcessClassFunctionBody($1, $2); $$.loc = @$; $$.loc.end = $2.loc.end; }
582 | class_function_definition_start_error
583 { ProcessClassFunctionBody($1, null); $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++;}
584 | virtual_class_function_definition_start compound_statement_error
585 { ProcessClassFunctionBody($1, $2); $$.loc = @$; $$.loc.end = $2.loc.end; }
586 | virtual_class_function_definition_start_error
587 { ProcessClassFunctionBody($1, null); $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++;}
588 | virtual_class_function_definition_start_error ';'
589 { ProcessClassFunctionBody($1, null); $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++;}
592 // In Instances, return type is required to distinguish from calling the function
593 instance_class_function_definition_start:
594 declaration_specifiers declarator_function_type_ok
595 { $$ = MkClassFunction($1, null, $2, null); $$.loc = @$; $$.id = ++globalContext.nextID; }
596 | declaration_specifiers declarator_nofunction_type_ok
597 { $$ = MkClassFunction($1, null, MkDeclaratorFunction($2, null), null); $$.loc = @$; $$.id = ++globalContext.nextID; }
600 instance_class_function_definition_start_error:
601 declaration_specifiers declarator_function_error_type_ok
602 { $$ = MkClassFunction($1, null, $2, null); $$.loc = @$; $$.id = ++globalContext.nextID; }
605 instance_class_function_definition:
606 instance_class_function_definition_start compound_statement
607 { ProcessClassFunctionBody($1, $2); $$.loc = @$; }
610 instance_class_function_definition_error:
611 instance_class_function_definition_start compound_statement_error
612 { ProcessClassFunctionBody($1, $2); $$.loc = @$; $$.loc.end = $2.loc.end; $$.loc.end.charPos++; $$.loc.end.pos++;}
613 | instance_class_function_definition_start_error
614 { ProcessClassFunctionBody($1, null); $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++;}
615 | instance_class_function_definition_start
616 { ProcessClassFunctionBody($1, null); $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++;}
619 data_member_initialization:
620 postfix_expression '=' initializer_condition { $$ = MkMemberInitExp($1, $3); $$.loc = @$; $$.realLoc = @$; $$.initializer.loc.start = @2.end;}
621 | initializer_condition { $$ = MkMemberInit(null, $1); $$.loc = @$; $$.realLoc = @$;}
624 data_member_initialization_error:
625 postfix_expression '=' initializer_condition_error { $$ = MkMemberInitExp($1, $3); $$.loc = @$; $$.realLoc = @$; $$.initializer.loc.start = @2.end;}
626 | postfix_expression '=' error
628 $$ = MkMemberInitExp($1, MkInitializerAssignment(MkExpDummy()));
629 $$.loc = @$; $$.realLoc = @$; $$.initializer.loc.start = $$.initializer.loc.end = @2.end;
631 fileInput.Seek(@2.end.pos, start);
633 resetScannerPos(&@2.end);
637 | initializer_condition_error { $$ = MkMemberInit(null, $1); $$.loc = @$; $$.realLoc = @$;}
640 data_member_initialization_list:
641 data_member_initialization { $$ = MkList(); ListAdd($$, $1); }
642 | data_member_initialization_list ',' data_member_initialization
643 { ((MemberInit)$1->last).loc.end = @3.start; ListAdd($1, $3); $$ = $1; }
644 | data_member_initialization_list_error ',' data_member_initialization
645 { ((MemberInit)$1->last).loc.end = @3.start; ListAdd($1, $3); $$ = $1; }
648 data_member_initialization_list_error:
649 data_member_initialization_error { $$ = MkList(); ListAdd($$, $1); }
650 | data_member_initialization_list ',' data_member_initialization_error
651 { ((MemberInit)$1->last).loc.end = @3.start; ListAdd($1, $3); $$ = $1; }
652 | data_member_initialization_list_error ',' data_member_initialization_error
653 { ((MemberInit)$1->last).loc.end = @3.start; ListAdd($1, $3); $$ = $1; }
655 | data_member_initialization_list ',' error
656 { ((MemberInit)$1->last).loc.end = @2.end;
658 Initializer dummy = MkInitializerAssignment(MkExpDummy());
659 MemberInit memberInit = MkMemberInit(null, dummy);
660 memberInit.realLoc.start = memberInit.loc.start = dummy.loc.start = @2.end;
661 memberInit.realLoc.end = memberInit.loc.end = dummy.loc.end = @2.end;
662 ListAdd($1, memberInit);
667 data_member_initialization_list_error ',' error
668 { ((MemberInit)$1->last).loc.end = @2.end;
670 Initializer dummy = MkInitializerAssignment(MkExpDummy());
671 MemberInit memberInit = MkMemberInit(null, dummy);
672 memberInit.realLoc.start = memberInit.loc.start = dummy.loc.start = @2.end;
673 memberInit.realLoc.end = memberInit.loc.end = dummy.loc.end = @2.end;
674 ListAdd($1, memberInit);
680 Initializer dummy = MkInitializerAssignment(MkExpDummy());
681 MemberInit memberInit = MkMemberInit(null, dummy);
682 memberInit.realLoc.start = memberInit.loc.start = dummy.loc.start = @1.start;
683 memberInit.realLoc.end = memberInit.loc.end = dummy.loc.end = @1.start;
686 ListAdd($$, memberInit);
688 dummy = MkInitializerAssignment(MkExpDummy());
689 memberInit = MkMemberInit(null, dummy);
690 memberInit.realLoc.start = memberInit.loc.start = dummy.loc.start = @1.end;
691 memberInit.realLoc.end = memberInit.loc.end = dummy.loc.end = @1.end;
692 ListAdd($$, memberInit);
696 data_member_initialization_list_coloned:
697 data_member_initialization_list ';'
698 { if($1->last) ((MemberInit)$1->last).loc.end = @2.end; $$ = $1; }
699 | data_member_initialization_list_error ';'
700 { if($1->last) ((MemberInit)$1->last).loc.end = @2.end; $$ = $1; }
703 members_initialization_list_coloned:
704 data_member_initialization_list_coloned { MembersInit members = MkMembersInitList($1); $$ = MkList(); ListAdd($$, members); members.loc = @1; }
705 | instance_class_function_definition { $$ = MkList(); ListAdd($$, MkMembersInitMethod($1)); ((MembersInit)$$->last).loc = @1; }
706 | members_initialization_list_error data_member_initialization_list_coloned { MembersInit members = MkMembersInitList($2); ListAdd($$, members); members.loc = @2; $$ = $1; }
707 | members_initialization_list_error instance_class_function_definition { ListAdd($$, MkMembersInitMethod($2)); ((MembersInit)$$->last).loc = @2; $$ = $1; }
708 | members_initialization_list_coloned data_member_initialization_list_coloned { MembersInit members = MkMembersInitList($2); ListAdd($$, members); members.loc = @2; $$ = $1; }
709 | members_initialization_list_coloned instance_class_function_definition { ListAdd($$, MkMembersInitMethod($2)); ((MembersInit)$$->last).loc = @2; $$ = $1; }
710 | ';' { MembersInit members = MkMembersInitList(MkList()); $$ = MkList(); ListAdd($$, members); members.loc = @1; }
711 | members_initialization_list_error ';'
712 | members_initialization_list_coloned ';' { MembersInit members = MkMembersInitList(MkList()); ListAdd($$, members); members.loc = @2; $$ = $1; }
715 members_initialization_list:
716 members_initialization_list_coloned
717 | data_member_initialization_list { $$ = MkList(); ListAdd($$, MkMembersInitList($1)); ((MembersInit)$$->last).loc = @1; }
718 | members_initialization_list_coloned data_member_initialization_list { ListAdd($1, MkMembersInitList($2)); ((MembersInit)$$->last).loc = @2; }
719 | members_initialization_list_error data_member_initialization_list { ListAdd($1, MkMembersInitList($2)); ((MembersInit)$$->last).loc = @2; }
722 members_initialization_list_error:
723 instance_class_function_definition_error { $$ = MkList(); ListAdd($$, MkMembersInitMethod($1)); ((MembersInit)$$->last).loc = @1; }
724 | members_initialization_list instance_class_function_definition_error { ListAdd($$, MkMembersInitMethod($2)); ((MembersInit)$$->last).loc = @2; $$ = $1; }
725 | members_initialization_list_error instance_class_function_definition_error { ListAdd($$, MkMembersInitMethod($2)); ((MembersInit)$$->last).loc = @2; $$ = $1; }
726 | members_initialization_list_coloned instance_class_function_definition_error { ListAdd($$, MkMembersInitMethod($2)); ((MembersInit)$$->last).loc = @2; $$ = $1; }
727 | members_initialization_list_coloned data_member_initialization_list_error { ListAdd($$, MkMembersInitList($2)); ((MembersInit)$$->last).loc = @2; $$ = $1; }
728 | data_member_initialization_list_error { $$ = MkList(); ListAdd($$, MkMembersInitList($1)); ((MembersInit)$$->last).loc = @1; }
729 | data_member_initialization_list error { $$ = MkList(); ListAdd($$, MkMembersInitList($1)); ((MembersInit)$$->last).loc = @2; }
733 instantiation_named_error '}'
734 { $$.loc = @$; $$.insideLoc.end = @2.start; $$ = $1; }
735 | instantiation_named_error error '}'
736 { $$.loc = @$; $$.insideLoc.end = @2.start; $$ = $1; }
739 instantiation_named_error:
740 declaration_specifiers identifier '{' members_initialization_list_error
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 '{' members_initialization_list error
743 { $$ = 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++; }
744 | declaration_specifiers identifier '{' members_initialization_list
745 { $$ = 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++; }
746 | declaration_specifiers identifier '{'
747 { $$ = 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++; }
748 | declaration_specifiers identifier '{' error
749 { $$ = 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++; }
754 declaration_specifiers identifier '{' members_initialization_list '}'
755 { $$ = MkInstantiationNamed($1, MkExpIdentifier($2), $4); $$.exp.loc = @2; $$.loc = @$; $$.nameLoc = @2; $$.insideLoc.start = @3.end; $$.insideLoc.end = @5.start;}
756 | declaration_specifiers identifier '{' members_initialization_list_error '}'
757 { $$ = MkInstantiationNamed($1, MkExpIdentifier($2), $4); $$.exp.loc = @2; $$.loc = @$; $$.nameLoc = @2; $$.insideLoc.start = @3.end; $$.insideLoc.end = @5.start;}
758 | declaration_specifiers identifier '{' '}'
759 { $$ = MkInstantiationNamed($1, MkExpIdentifier($2), MkList()); $$.exp.loc = @2; $$.loc = @$; $$.nameLoc = @2; $$.insideLoc.start = @3.end; $$.insideLoc.end = @4.start;}
762 instantiation_named_error:
763 declaration_specifiers identifier '{' members_initialization_list_error
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 '{' members_initialization_list error
766 { $$ = 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++; }
767 | declaration_specifiers identifier '{' members_initialization_list
768 { $$ = 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++; }
769 | declaration_specifiers identifier '{'
770 { $$ = 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++; }
771 | declaration_specifiers identifier '{' error
772 { $$ = 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++; }
777 guess_instantiation_named:
778 guess_instantiation_named_error '}'
779 { $$.loc = @$; $$.insideLoc.end = @2.start; }
780 | guess_instantiation_named_error error '}'
781 { $$.loc = @$; $$.insideLoc.end = @2.start; }
784 guess_instantiation_named_error:
785 guess_declaration_specifiers identifier '{' members_initialization_list_error
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 '{' members_initialization_list error
788 { $$ = 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++; }
789 | guess_declaration_specifiers identifier '{' members_initialization_list
790 { $$ = 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++; }
791 | guess_declaration_specifiers identifier '{'
792 { $$ = 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++; }
793 | guess_declaration_specifiers identifier '{' error
794 { $$ = 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++; }
798 guess_instantiation_named:
799 guess_declaration_specifiers identifier '{' members_initialization_list '}'
800 { $$ = MkInstantiationNamed($1, MkExpIdentifier($2), $4);$$.exp.loc = @2; $$.loc = @$; $$.nameLoc = @2; $$.insideLoc.start = @3.end; $$.insideLoc.end = @5.start;}
801 | guess_declaration_specifiers identifier '{' members_initialization_list_error '}'
802 { $$ = MkInstantiationNamed($1, MkExpIdentifier($2), $4); $$.exp.loc = @2; $$.loc = @$; $$.nameLoc = @2; $$.insideLoc.start = @3.end; $$.insideLoc.end = @5.start;}
803 | guess_declaration_specifiers identifier '{' '}'
804 { $$ = MkInstantiationNamed($1, MkExpIdentifier($2), MkList()); $$.exp.loc = @2; $$.loc = @$; $$.nameLoc = @2; $$.insideLoc.start = @3.end; $$.insideLoc.end = @4.start;}
807 guess_instantiation_named_error:
808 guess_declaration_specifiers identifier '{' members_initialization_list_error
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 '{' members_initialization_list error
811 { $$ = 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++; }
812 | guess_declaration_specifiers identifier '{' members_initialization_list
813 { $$ = 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++; }
814 | guess_declaration_specifiers identifier '{'
815 { $$ = 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++; }
816 | guess_declaration_specifiers identifier '{' error
817 { $$ = 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++; }
821 external_guess_instantiation_named:
822 external_guess_declaration_specifiers identifier '{' members_initialization_list '}'
823 { $$ = MkInstantiationNamed($1, MkExpIdentifier($2), $4); $$.exp.loc = @2; $$.loc = @$; $$.nameLoc = @2; $$.insideLoc.start = @3.end; $$.insideLoc.end = @5.start;}
824 | external_guess_declaration_specifiers identifier '{' members_initialization_list_error '}'
825 { $$ = MkInstantiationNamed($1, MkExpIdentifier($2), $4); $$.exp.loc = @2; $$.loc = @$; $$.nameLoc = @2; $$.insideLoc.start = @3.end; $$.insideLoc.end = @5.start;}
826 | external_guess_declaration_specifiers identifier '{' '}'
827 { $$ = MkInstantiationNamed($1, MkExpIdentifier($2), MkList()); $$.exp.loc = @2; $$.loc = @$; $$.nameLoc = @2; $$.insideLoc.start = @3.end; $$.insideLoc.end = @4.start;}
830 instantiation_unnamed:
831 instantiation_unnamed_error '}'
832 { $$.loc = @$; $$.insideLoc.end = @2.start; $$ = $1; }
833 | instantiation_unnamed_error error '}'
834 { $$.loc = @$; $$.insideLoc.end = @2.start; $$ = $1; }
837 instantiation_unnamed_error:
838 strict_type '{' members_initialization_list
839 { $$ = MkInstantiation($1, null, $3); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @3.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
840 | identifier '{' members_initialization_list
841 { Location tmpLoc = yylloc; yylloc = @1;
842 yylloc = tmpLoc; $$ = MkInstantiation(MkSpecifierName($1.string), null, $3); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @3.end; FreeIdentifier($1); }
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++; }
847 { $$ = MkInstantiation($1, null, null); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @2.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
848 | strict_type '{' members_initialization_list error
849 { $$ = MkInstantiation($1, null, $3); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @3.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
850 | strict_type '{' error
851 { $$ = MkInstantiation($1, null, null); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @2.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
855 | identifier '{' members_initialization_list_error
856 { Location tmpLoc = yylloc; yylloc = @1;
857 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); }
859 { Location tmpLoc = yylloc; yylloc = @1;
860 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); }
861 | identifier '{' members_initialization_list error
862 { Location tmpLoc = yylloc; yylloc = @1;
863 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); }
864 | identifier '{' error
865 { Location tmpLoc = yylloc; yylloc = @1;
866 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); }
870 instantiation_unnamed:
871 strict_type '{' members_initialization_list '}'
872 { $$ = MkInstantiation($1, null, $3); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @4.start; }
873 | strict_type '{' members_initialization_list error '}'
874 { $$ = MkInstantiation($1, null, $3); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @5.start; }
875 | strict_type '{' members_initialization_list_error '}'
876 { $$ = MkInstantiation($1, null, $3); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @4.start; }
877 | strict_type '{' '}'
878 { $$ = MkInstantiation($1, null, MkList()); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @3.start;}
879 | strict_type '{' error '}'
880 { $$ = MkInstantiation($1, null, MkList()); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @4.start;}
883 | identifier '{' members_initialization_list '}'
884 { Location tmpLoc = yylloc; yylloc = @1;
885 yylloc = tmpLoc; $$ = MkInstantiation(MkSpecifierName($1.string), null, $3); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @4.start; FreeIdentifier($1); }
886 | identifier '{' members_initialization_list_error '}'
887 { Location tmpLoc = yylloc; yylloc = @1;
888 yylloc = tmpLoc; $$ = MkInstantiation(MkSpecifierName($1.string), null, $3); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @4.start; FreeIdentifier($1); }
889 | identifier '{' members_initialization_list error '}'
891 $$ = MkInstantiation(MkSpecifierName($1.string), null, $3); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @5.start; FreeIdentifier($1); }
893 { Location tmpLoc = yylloc; yylloc = @1;
894 yylloc = tmpLoc; $$ = MkInstantiation(MkSpecifierName($1.string), null, MkList()); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @3.start; FreeIdentifier($1);}
895 | identifier '{' error '}'
896 { Location tmpLoc = yylloc; yylloc = @1;
897 yylloc = tmpLoc; $$ = MkInstantiation(MkSpecifierName($1.string), null, MkList()); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @4.start; FreeIdentifier($1); }
901 instantiation_unnamed_error:
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++; }
905 { $$ = MkInstantiation($1, null, null); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @2.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
906 | strict_type '{' members_initialization_list error
907 { $$ = MkInstantiation($1, null, $3); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @3.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
908 | strict_type '{' error
909 { $$ = MkInstantiation($1, null, null); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @2.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
913 | identifier '{' members_initialization_list_error
914 { Location tmpLoc = yylloc; yylloc = @1;
915 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); }
917 { Location tmpLoc = yylloc; yylloc = @1;
918 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); }
919 | identifier '{' members_initialization_list error
920 { Location tmpLoc = yylloc; yylloc = @1;
921 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); }
922 | identifier '{' error
923 { Location tmpLoc = yylloc; yylloc = @1;
924 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); }
929 instantiation_anon_error '}'
930 { $$.loc = @$; $$.insideLoc.end = @2.start; }
931 | instantiation_anon_error error '}'
932 { $$.loc = @$; $$.insideLoc.end = @2.start; }
935 instantiation_anon_error:
936 '{' members_initialization_list_error
937 { $$ = MkInstantiation(null, null, $2); $$.loc = @$; $$.insideLoc.start = @1.end; $$.insideLoc.end = @2.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
938 | '{' members_initialization_list error
939 { $$ = MkInstantiation(null, null, $2); $$.loc = @$; $$.insideLoc.start = @1.end; $$.insideLoc.end = @2.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
941 { $$ = MkInstantiation(null, null, null); $$.loc = @$; $$.insideLoc.start = @1.end; $$.insideLoc.end = @1.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
943 { $$ = MkInstantiation(null, null, null); $$.loc = @$; $$.insideLoc.start = @1.end; $$.insideLoc.end = @1.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
944 | '{' members_initialization_list
945 { $$ = MkInstantiation(null, null, $2); $$.loc = @$; $$.insideLoc.start = @1.end; $$.insideLoc.end = @2.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
950 '{' members_initialization_list '}'
951 { $$ = MkInstantiation(null, null, $2); $$.loc = @$; $$.insideLoc.start = @1.end; $$.insideLoc.end = @3.start; }
952 | '{' members_initialization_list error '}'
953 { $$ = MkInstantiation(null, null, $2); $$.loc = @$; $$.insideLoc.start = @1.end; $$.insideLoc.end = @4.start; }
954 | '{' members_initialization_list_error '}'
955 { $$ = MkInstantiation(null, null, $2); $$.loc = @$; $$.insideLoc.start = @1.end; $$.insideLoc.end = @3.start; }
957 { $$ = MkInstantiation(null, null, MkList()); $$.loc = @$; $$.insideLoc.start = @1.end; $$.insideLoc.end = @2.start;}
959 { $$ = MkInstantiation(null, null, MkList()); $$.loc = @$; $$.insideLoc.start = @1.end; $$.insideLoc.end = @3.start;}
962 instantiation_anon_error:
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++; }
967 | '{' members_initialization_list error
968 { $$ = MkInstantiation(null, null, $2); $$.loc = @$; $$.insideLoc.start = @1.end; $$.insideLoc.end = @2.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
970 { $$ = MkInstantiation(null, null, null); $$.loc = @$; $$.insideLoc.start = @1.end; $$.insideLoc.end = @1.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
975 postfix_expression '=' initializer_condition { $$ = MkMemberInitExp($1, $3); $$.loc = @$; $$.realLoc = @$; }
978 default_property_error:
979 postfix_expression '=' initializer_condition_error { $$ = MkMemberInitExp($1, $3); $$.loc = @$; $$.realLoc = @$; $$.initializer.loc.start = @2.end; }
980 | postfix_expression '=' error { $$ = MkMemberInitExp($1, MkInitializerAssignment(MkExpDummy())); $$.loc = @$; $$.realLoc = @$; $$.initializer.loc.start = @2.end; $$.initializer.loc.end = @2.end; }
981 | postfix_expression error { $$ = MkMemberInitExp($1, null); $$.loc = @$; $$.realLoc = @$; }
984 default_property_list:
985 default_property { $$ = MkList(); ListAdd($$, $1); ((MemberInit)$$->last).loc = @$; }
986 | default_property_list ',' default_property { ((MemberInit)$1->last).loc.end = @3.start; ListAdd($1, $3); $$ = $1; }
987 | default_property_list_error ',' default_property { ((MemberInit)$1->last).loc.end = @3.start; ListAdd($1, $3); $$ = $1; }
990 default_property_list_error:
991 default_property_error { $$ = MkList(); ListAdd($$, $1); ((MemberInit)$$->last).loc = @$; }
992 | default_property_list ',' default_property_error { ((MemberInit)$1->last).loc.end = @3.start; ListAdd($1, $3); $$ = $1; }
993 | default_property_list_error ',' default_property_error { ((MemberInit)$1->last).loc.end = @3.start; ListAdd($1, $3); $$ = $1; }
994 | default_property_list error
998 PROPERTY property_specifiers identifier '{'
999 { $$ = MkProperty($2, null, $3, null, null); $$.loc = @$; }
1001 | PROPERTY property_specifiers abstract_declarator identifier '{'
1002 { $$ = MkProperty($2, $3, $4, null, null); $$.loc = @$; }
1004 | PROPERTY property_specifiers '{'
1005 { $$ = MkProperty($2, null, null, null, null); $$.loc = @$; }
1007 | PROPERTY property_specifiers abstract_declarator '{'
1008 { $$ = MkProperty($2, $3, null, null, null); $$.loc = @$; }
1010 | PROPERTY error '{'
1011 { $$ = MkProperty(null, null, null, null, null); $$.loc = @$; }
1016 | property_body SETPROP compound_statement
1017 { $1.setStmt = $3; }
1018 | property_body GETPROP compound_statement
1019 { $1.getStmt = $3; }
1020 | property_body ISPROPSET compound_statement
1021 { $1.issetStmt = $3; }
1022 | property_body WATCHABLE
1023 { $1.isWatchable = true; }
1024 | property_body PROPERTY_CATEGORY i18n_string
1025 { $1.category = $3; }
1029 property_body '}' { $1.loc.end = @2.end; $$ = $1; }
1032 class_property_start:
1033 CLASS_PROPERTY property_specifiers identifier '{'
1034 { $$ = MkProperty($2, null, $3, null, null); $$.loc = @$; }
1036 | CLASS_PROPERTY property_specifiers abstract_declarator identifier '{'
1037 { $$ = MkProperty($2, $3, $4, null, null); $$.loc = @$; }
1039 | CLASS_PROPERTY property_specifiers '{'
1040 { $$ = MkProperty($2, null, null, null, null); $$.loc = @$; }
1042 | CLASS_PROPERTY property_specifiers abstract_declarator '{'
1043 { $$ = MkProperty($2, $3, null, null, null); $$.loc = @$; }
1045 | CLASS_PROPERTY error '{'
1046 { $$ = MkProperty(null, null, null, null, null); $$.loc = @$; }
1049 class_property_body:
1050 class_property_start
1051 | class_property_body SETPROP compound_statement
1052 { $1.setStmt = $3; }
1053 | class_property_body GETPROP compound_statement
1054 { $1.getStmt = $3; }
1058 class_property_body '}' { $1.loc.end = @2.end; }
1061 watch_property_list:
1063 { $$ = MkListOne($1); }
1064 | watch_property_list identifier
1065 { ListAdd($1, $2); }
1069 watch_property_list compound_statement
1070 { $$ = MkPropertyWatch($1, $2); }
1071 | DELETE compound_statement
1072 { $$ = MkDeleteWatch($2); }
1075 property_watch_list:
1077 { $$ = MkListOne($1); }
1078 | property_watch_list property_watch
1079 { ListAdd($1, $2); }
1082 self_watch_definition:
1083 WATCH '(' watch_property_list ')' compound_statement
1084 { $$ = MkPropertyWatch($3, $5); }
1088 WATCH '(' assignment_expression ')' '{' property_watch_list '}'
1089 { $$ = MkWatchStmt(null, $3, $6); }
1090 | assignment_expression '.' WATCH '(' assignment_expression ')' '{' property_watch_list '}'
1091 { $$ = MkWatchStmt($1, $5, $8); }
1095 STOPWATCHING '(' assignment_expression ',' watch_property_list ')'
1096 { $$ = MkStopWatchingStmt(null, $3, $5); }
1097 | assignment_expression '.' STOPWATCHING '(' assignment_expression ',' watch_property_list ')'
1098 { $$ = MkStopWatchingStmt($1, $5, $7); }
1099 | STOPWATCHING '(' assignment_expression ')'
1100 { $$ = MkStopWatchingStmt(null, $3, null); }
1101 | assignment_expression '.' STOPWATCHING '(' assignment_expression ')'
1102 { $$ = MkStopWatchingStmt($1, $5, null); }
1107 { $$ = MkFireWatchersStmt(null, null); }
1108 | FIREWATCHERS watch_property_list
1109 { $$ = MkFireWatchersStmt(null, $2); }
1110 | postfix_expression '.' FIREWATCHERS
1111 { $$ = MkFireWatchersStmt($1, null); }
1112 | assignment_expression '.' FIREWATCHERS watch_property_list
1113 { $$ = MkFireWatchersStmt($1, $4); }
1117 struct_declaration_error ';' { $$ = $1; $$.loc.end = @2.start; }
1118 | default_property_list ';' { $$ = MkClassDefDefaultProperty($1); if($1->last) ((MemberInit)$1->last).loc.end = @2.start; $$.loc = @$; }
1119 | class_function_definition { $$ = MkClassDefFunction($1); $$.loc = @$; $$.memberAccess = memberAccessStack[defaultMemberAccess]; }
1120 | property { $$ = MkClassDefProperty($1); $$.loc = @$; globalContext.nextID++; $$.memberAccess = memberAccessStack[defaultMemberAccess]; }
1121 | member_access class_function_definition { $$ = MkClassDefFunction($2); $$.loc = @$; $$.memberAccess = $1; }
1122 | member_access property { $$ = MkClassDefProperty($2); $$.loc = @$; globalContext.nextID++; $$.memberAccess = $1; }
1123 | class_property { $$ = MkClassDefClassProperty($1); $$.loc = @$; globalContext.nextID++; }
1124 | WATCHABLE { $$ = null; deleteWatchable = true; }
1125 | CLASS_NO_EXPANSION { $$ = MkClassDefNoExpansion(); }
1126 | CLASS_FIXED { $$ = MkClassDefFixed(); }
1127 | CLASS_PROPERTY '(' identifier ')' '=' initializer_condition ';' { $$ = MkClassDefClassPropertyValue($3, $6); $$.loc = @$; }
1129 | ';' { $$ = null; }
1130 | member_access ':' { memberAccessStack[defaultMemberAccess] = $1; if(defaultMemberAccess == 0) { $$ = MkClassDefMemberAccess(); $$.memberAccess = $1; $$.loc = @$; } else $$ = null; }
1132 | member_access '(' identifier ')' { $$ = MkClassDefAccessOverride($1, $3); $$.loc = @$; }
1135 struct_declaration_error:
1136 class_function_definition_error { $$ = MkClassDefFunction($1); $$.loc = $1.loc; $$.loc.end.charPos++; $$.loc.end.pos++; $$.memberAccess = memberAccessStack[defaultMemberAccess]; }
1138 // Moved all these in here without the ';'
1139 | guess_declaration_specifiers { $$ = MkClassDefDeclaration(MkStructDeclaration($1, null, null)); $$.decl.loc = @$; $$.loc = @$; $$.memberAccess = memberAccessStack[defaultMemberAccess]; }
1140 | guess_declaration_specifiers struct_declarator_list { $$ = MkClassDefDeclaration(MkStructDeclaration($1, $2, null)); $$.decl.loc = @$; $$.loc = @$; $$.memberAccess = memberAccessStack[defaultMemberAccess]; }
1141 | member_access guess_declaration_specifiers struct_declarator_list { $$ = MkClassDefDeclaration(MkStructDeclaration($2, $3, null)); $$.decl.loc = @$; $$.loc = @$; $$.memberAccess = $1; }
1142 | member_access guess_declaration_specifiers { $$ = MkClassDefDeclaration(MkStructDeclaration($2, null, null)); $$.decl.loc = @$; $$.loc = @$; $$.memberAccess = $1; }
1143 | member_access instantiation_unnamed { $$ = MkClassDefDeclaration(MkDeclarationClassInst($2)); $$.loc = @$; $$.decl.loc = @$; $$.memberAccess = $1; }
1144 | member_access guess_instantiation_named { $$ = MkClassDefDeclaration(MkDeclarationClassInst($2)); $$.loc = @$; $$.decl.loc = @$; $$.memberAccess = $1; }
1145 | CLASS_DATA guess_declaration_specifiers struct_declarator_list { $$ = MkClassDefClassData(MkStructDeclaration($2, $3, null)); $$.decl.loc = @$; $$.loc = @$; }
1146 | self_watch_definition { $$ = MkClassDefPropertyWatch($1); $$.loc = @$; globalContext.nextID++; }
1147 | CLASS_DESIGNER identifier { $$ = MkClassDefDesigner($2.string); FreeIdentifier($2); }
1148 | CLASS_DESIGNER strict_type { $$ = MkClassDefDesigner($2.name); FreeSpecifier($2); }
1149 | CLASS_DEFAULT_PROPERTY identifier { $$ = MkClassDefDesignerDefaultProperty($2); }
1150 | instantiation_unnamed { $$ = MkClassDefDeclaration(MkDeclarationClassInst($1)); $$.loc = @$; $$.decl.loc = @$; $$.memberAccess = memberAccessStack[defaultMemberAccess]; }
1151 | guess_instantiation_named { $$ = MkClassDefDeclaration(MkDeclarationClassInst($1)); $$.loc = @$; $$.decl.loc = @$; $$.memberAccess = memberAccessStack[defaultMemberAccess]; }
1152 | default_property_list { $$ = MkClassDefDefaultProperty($1); if($1->last) ((MemberInit)$1->last).loc.end = @1.end; $$.loc = @$; }
1154 | guess_instantiation_named_error error { $$ = MkClassDefDeclaration(MkDeclarationClassInst($1)); $$.loc = $1.loc; $$.decl.loc = $$.loc; $$.memberAccess = memberAccessStack[defaultMemberAccess]; }
1155 | instantiation_unnamed_error error { $$ = MkClassDefDeclaration(MkDeclarationClassInst($1)); $$.loc = $1.loc; $$.decl.loc = $$.loc; $$.memberAccess = memberAccessStack[defaultMemberAccess]; }
1156 // | guess_instantiation_named { $$ = MkClassDefDeclaration(MkDeclarationClassInst($1)); $$.loc = $1.loc; $$.decl.loc = $$.loc; $$.memberAccess = memberAccessStack[defaultMemberAccess]; }
1157 // | instantiation_unnamed { $$ = MkClassDefDeclaration(MkDeclarationClassInst($1)); $$.loc = $1.loc; $$.decl.loc = $$.loc; $$.memberAccess = memberAccessStack[defaultMemberAccess]; }
1159 | member_access class_function_definition_error { $$ = MkClassDefFunction($2); $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++; $$.memberAccess = $1; }
1160 | member_access guess_instantiation_named_error error { $$ = MkClassDefDeclaration(MkDeclarationClassInst($2)); $$.loc = @$; $$.decl.loc = $$.loc; $$.memberAccess = $1; }
1161 | member_access instantiation_unnamed_error error { $$ = MkClassDefDeclaration(MkDeclarationClassInst($2)); $$.loc = @$; $$.decl.loc = $$.loc; $$.memberAccess = $1; }
1162 // | member_access guess_instantiation_named { $$ = MkClassDefDeclaration(MkDeclarationClassInst($2)); $$.loc = @$; $$.decl.loc = $$.loc; $$.memberAccess = $1; }
1163 // | member_access instantiation_unnamed { $$ = MkClassDefDeclaration(MkDeclarationClassInst($2)); $$.loc = @$; $$.decl.loc = $$.loc; $$.memberAccess = $1; }
1165 | default_property_list_error { $$ = MkClassDefDefaultProperty($1); $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++; }
1168 struct_declaration_list:
1169 struct_declaration { $$ = MkList(); ListAdd($$, $1); }
1170 | struct_declaration_list struct_declaration { $$ = $1; ListAdd($1, $2); }
1171 | struct_declaration_list_error struct_declaration { $$ = $1; ListAdd($1, $2); }
1174 struct_declaration_list_error:
1175 struct_declaration_error { $$ = MkList(); ListAdd($$, $1); }
1176 | struct_declaration_list error
1177 | struct_declaration_list_error error
1178 | struct_declaration_list struct_declaration_error { $$ = $1; ListAdd($$, $2); }
1179 | struct_declaration_list_error struct_declaration_error { $$ = $1; ListAdd($$, $2); }
1183 declaration_specifiers { $$ = MkTemplateDatatype($1, null); }
1184 | declaration_specifiers abstract_declarator { $$ = MkTemplateDatatype($1, $2); }
1185 | identifier { $$ = MkTemplateDatatype(MkListOne(MkSpecifierName($1.string)), null); FreeIdentifier($1); }
1188 template_type_argument:
1189 template_datatype { $$ = MkTemplateTypeArgument($1); }
1192 template_type_parameter:
1193 CLASS identifier { $$ = MkTypeTemplateParameter($2, null, null); }
1194 | CLASS identifier '=' template_type_argument { $$ = MkTypeTemplateParameter($2, null, $4); }
1195 | CLASS identifier ':' template_datatype { $$ = MkTypeTemplateParameter($2, $4, null); }
1196 | CLASS identifier ':' template_datatype '=' template_type_argument { $$ = MkTypeTemplateParameter($2, $4, $6); }
1197 | CLASS base_strict_type_name { $$ = MkTypeTemplateParameter(MkIdentifier($2), null, null); delete $2; }
1198 | CLASS base_strict_type_name '=' template_type_argument { $$ = MkTypeTemplateParameter(MkIdentifier($2), null, $4); }
1199 | CLASS base_strict_type_name ':' template_datatype { $$ = MkTypeTemplateParameter(MkIdentifier($2), $4, null); }
1200 | CLASS base_strict_type_name ':' template_datatype '=' template_type_argument { $$ = MkTypeTemplateParameter(MkIdentifier($2), $4, $6); }
1203 template_identifier_argument:
1204 identifier { $$ = MkTemplateIdentifierArgument($1); }
1207 template_identifier_parameter:
1208 identifier { $$ = MkIdentifierTemplateParameter($1, dataMember, null); }
1209 | identifier '=' template_identifier_argument { $$ = MkIdentifierTemplateParameter($1, dataMember, $3); }
1212 template_expression_argument:
1213 constant_expression { $$ = MkTemplateExpressionArgument($1); }
1216 template_expression_parameter:
1217 template_datatype identifier { $$ = MkExpressionTemplateParameter($2, $1, null); }
1218 | template_datatype identifier '=' template_expression_argument { $$ = MkExpressionTemplateParameter($2, $1, $4); }
1222 template_type_parameter
1223 | template_identifier_parameter
1224 | template_expression_parameter
1227 template_parameters_list:
1228 template_parameter { $$ = MkList(); ListAdd($$, $1); }
1229 | template_parameters_list ',' template_parameter { $$ = $1; ListAdd($1, $3); }
1233 template_expression_argument
1234 | template_identifier_argument
1235 | template_type_argument
1236 | identifier '=' template_expression_argument { $$ = $3; $$.name = $1; $$.loc = @$; }
1237 | identifier '=' template_identifier_argument { $$ = $3; $$.name = $1; $$.loc = @$; }
1238 | identifier '=' template_type_argument { $$ = $3; $$.name = $1; $$.loc = @$; }
1239 | template_datatype '=' template_expression_argument
1242 if($1.specifiers && $1.specifiers->first)
1244 Specifier spec = $1.specifiers->first;
1245 if(spec.type == nameSpecifier)
1246 $$.name = MkIdentifier(spec.name);
1248 FreeTemplateDataType($1);
1251 | template_datatype '=' template_identifier_argument
1254 if($1.specifiers && $1.specifiers->first)
1256 Specifier spec = $1.specifiers->first;
1257 if(spec.type == nameSpecifier)
1258 $$.name = MkIdentifier(spec.name);
1260 FreeTemplateDataType($1);
1263 | template_datatype '=' template_type_argument
1266 if($1.specifiers && $1.specifiers->first)
1268 Specifier spec = $1.specifiers->first;
1269 if(spec.type == nameSpecifier)
1270 $$.name = MkIdentifier(spec.name);
1272 FreeTemplateDataType($1);
1277 template_arguments_list:
1278 template_argument { $$ = MkList(); ListAdd($$, $1); }
1279 | template_arguments_list ',' template_argument { $$ = $1; ListAdd($1, $3); }
1285 if(curContext != globalContext)
1286 PopContext(curContext);
1291 class_entry identifier { $1; $$ = DeclClassAddNameSpace(globalContext.nextID++, $2.string); FreeIdentifier($2); $$.nameLoc = @2; memberAccessStack[++defaultMemberAccess] = privateAccess; }
1292 | class_entry base_strict_type
1294 $1; $$ = DeclClass(globalContext.nextID++, $2.name);
1297 ++defaultMemberAccess;
1298 memberAccessStack[defaultMemberAccess] = privateAccess;
1300 | identifier class_entry identifier { $2; $$ = DeclClassAddNameSpace(globalContext.nextID++, $3.string); FreeIdentifier($1); FreeIdentifier($3); $$.nameLoc = @3; $$.isRemote = true; memberAccessStack[++defaultMemberAccess] = privateAccess; }
1301 | identifier class_entry base_strict_type { $2; $$ = DeclClass(globalContext.nextID++, $3.name); FreeIdentifier($1); $$.nameLoc = @3; $$.isRemote = true; FreeSpecifier($3); memberAccessStack[++defaultMemberAccess] = privateAccess; }
1303 | class_entry identifier '<' template_parameters_list '>' { $1; $$ = DeclClassAddNameSpace(globalContext.nextID++, $2.string); $$.templateParams = $4; FreeIdentifier($2); $$.nameLoc = @2; memberAccessStack[++defaultMemberAccess] = privateAccess; }
1304 | class_entry base_strict_type '<' template_parameters_list '>'
1306 $1; $$ = DeclClass(globalContext.nextID++, $2.name);
1307 $$.templateParams = $4;
1310 ++defaultMemberAccess;
1311 memberAccessStack[defaultMemberAccess] = privateAccess;
1313 | 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; }
1314 | 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; }
1324 // Added this for unit classes...
1327 $$ = $1; $$.definitions = MkList(); $$.blockStart = @2; $$.loc = @$; $$.endid = globalContext.nextID++;
1329 PopContext(curContext);
1332 | class_decl '{' '}'
1334 $$ = MkClass($1, null, MkList()); $$.blockStart = @2; $$.loc = @$; $$.endid = globalContext.nextID++;
1336 PopContext(curContext);
1338 | class_head '{' '}'
1340 $$ = $1; $$.definitions = MkList(); $$.blockStart = @2; $$.loc = @$; $$.endid = globalContext.nextID++;
1342 PopContext(curContext);
1345 | class_entry identifier ';'
1347 $1; $$ = MkClass(DeclClassAddNameSpace(0, $2.string), null, null); FreeIdentifier($2);
1349 PopContext(curContext);
1351 | class_entry type ';'
1353 $1; $$ = MkClass(DeclClass(0, $2.name), null, null); FreeSpecifier($2);
1355 PopContext(curContext);
1360 class_decl ':' inheritance_specifiers
1362 $$ = MkClass($1, $3, null);
1367 class_decl '{' struct_declaration_list_error
1369 $$ = MkClass($1, null, $3); $$.deleteWatchable = deleteWatchable; deleteWatchable = false; $$.blockStart = @2; $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++; $$.endid = globalContext.nextID++;
1371 PopContext(curContext);
1373 | class_head '{' struct_declaration_list_error
1375 $$ = $1; $$.definitions = $3; $$.deleteWatchable = deleteWatchable; deleteWatchable = false; $$.blockStart = @2; $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++; $$.endid = globalContext.nextID++;
1377 PopContext(curContext);
1379 | class_decl '{' struct_declaration_list
1381 $$ = MkClass($1, null, $3); $$.deleteWatchable = deleteWatchable; deleteWatchable = false; $$.blockStart = @2; $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++; $$.endid = globalContext.nextID++;
1383 PopContext(curContext);
1385 | class_head '{' struct_declaration_list
1387 $$ = $1; $$.definitions = $3; $$.deleteWatchable = deleteWatchable; deleteWatchable = false; $$.blockStart = @2; $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++; $$.endid = globalContext.nextID++;
1389 PopContext(curContext);
1391 | class_decl '{' error
1393 $$ = MkClass($1, null, MkList()); $$.deleteWatchable = deleteWatchable; deleteWatchable = false; $$.blockStart = @2; $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++; $$.endid = globalContext.nextID++;
1395 PopContext(curContext);
1397 | class_head '{' error
1399 $$ = $1; $$.definitions = MkList(); $$.deleteWatchable = deleteWatchable; deleteWatchable = false; $$.blockStart = @2; $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++; $$.endid = globalContext.nextID++;
1401 PopContext(curContext);
1405 /**** EXPRESSIONS ********************************************************************/
1409 { $$ = MkIdentifier(yytext); $$.loc = @1; }
1413 simple_primary_expression
1414 | '(' expression ')'
1415 { $$ = MkExpBrackets($2); $$.loc = @$; }
1419 string_literal { $$ = MkExpString($1); delete $1; $$.loc = @$; }
1420 | '$' string_literal { $$ = MkExpIntlString($2, null); delete $2; $$.loc = @$; }
1421 | '$' string_literal '.' string_literal { $$ = MkExpIntlString($4, $2); delete $2; delete $4; $$.loc = @$; }
1424 simple_primary_expression:
1425 identifier { $$ = MkExpIdentifier($1); $$.loc = @$; }
1426 | instantiation_unnamed { $$ = MkExpInstance($1); $$.loc = @$; }
1427 | EXTENSION '(' compound_statement ')' { $$ = MkExpExtensionCompound($3); $$.loc = @$; }
1428 | EXTENSION '(' expression ')' { $$ = MkExpExtensionExpression($3); $$.loc = @$; }
1429 | EXTENSION '(' type_name ')' initializer { $$ = MkExpExtensionInitializer($3, $5); $$.loc = @$; }
1430 | EXTENSION '(' type_name ')' '(' type_name ')' initializer { $$ = MkExpExtensionInitializer($3, MkInitializerAssignment(MkExpExtensionInitializer($6, $8))); $$.loc = @$; }
1431 | CONSTANT { $$ = MkExpConstant(yytext); $$.loc = @$; }
1433 | '(' ')' { Expression exp = MkExpDummy(); exp.loc.start = @1.end; exp.loc.end = @2.start; $$ = MkExpBrackets(MkListOne(exp)); $$.loc = @$; yyerror(); }
1434 | NEWOP new_specifiers abstract_declarator_noarray '[' constant_expression ']' { $$ = MkExpNew(MkTypeName($2,$3), $5); $$.loc = @$; }
1435 | NEWOP new_specifiers abstract_declarator_noarray '[' constant_expression_error ']' { $$ = MkExpNew(MkTypeName($2,$3), $5); $$.loc = @$; }
1436 | NEWOP new_specifiers '[' constant_expression ']' { $$ = MkExpNew(MkTypeName($2,null), $4); $$.loc = @$; }
1437 | NEWOP new_specifiers '[' constant_expression_error ']' { $$ = MkExpNew(MkTypeName($2,null), $4); $$.loc = @$; }
1438 | NEW0OP new_specifiers abstract_declarator_noarray '[' constant_expression ']' { $$ = MkExpNew0(MkTypeName($2,$3), $5); $$.loc = @$; }
1439 | NEW0OP new_specifiers abstract_declarator_noarray '[' constant_expression_error ']' { $$ = MkExpNew0(MkTypeName($2,$3), $5); $$.loc = @$; }
1440 | NEW0OP new_specifiers '[' constant_expression ']' { $$ = MkExpNew0(MkTypeName($2,null), $4); $$.loc = @$; }
1441 | NEW0OP new_specifiers '[' constant_expression_error ']' { $$ = MkExpNew0(MkTypeName($2,null), $4); $$.loc = @$; }
1442 | RENEW constant_expression renew_specifiers abstract_declarator_noarray '[' constant_expression ']' { $$ = MkExpRenew($2, MkTypeName($3,$4), $6); $$.loc = @$; }
1443 | RENEW constant_expression renew_specifiers abstract_declarator_noarray '[' constant_expression_error ']' { $$ = MkExpRenew($2, MkTypeName($3,$4), $6); $$.loc = @$; }
1444 | RENEW constant_expression renew_specifiers '[' constant_expression ']' { $$ = MkExpRenew($2, MkTypeName($3,null), $5); $$.loc = @$; }
1445 | RENEW constant_expression renew_specifiers '[' constant_expression_error ']' { $$ = MkExpRenew($2, MkTypeName($3,null), $5); $$.loc = @$; }
1446 | RENEW0 constant_expression renew_specifiers abstract_declarator_noarray '[' constant_expression ']' { $$ = MkExpRenew0($2, MkTypeName($3,$4), $6); $$.loc = @$; }
1447 | RENEW0 constant_expression renew_specifiers abstract_declarator_noarray '[' constant_expression_error ']' { $$ = MkExpRenew0($2, MkTypeName($3,$4), $6); $$.loc = @$; }
1448 | RENEW0 constant_expression renew_specifiers '[' constant_expression ']' { $$ = MkExpRenew0($2, MkTypeName($3,null), $5); $$.loc = @$; }
1449 | RENEW0 constant_expression renew_specifiers '[' constant_expression_error ']' { $$ = MkExpRenew0($2, MkTypeName($3,null), $5); $$.loc = @$; }
1450 | CLASS '(' declaration_specifiers ')' { $$ = MkExpClass($3, null); $$.loc = @$; }
1451 | CLASS '(' declaration_specifiers abstract_declarator ')' { $$ = MkExpClass($3, $4); $$.loc = @$; }
1452 | CLASS '(' identifier ')' { $$ = MkExpClass(MkListOne(MkSpecifierName($3.string)), null); FreeIdentifier($3); $$.loc = @$; }
1453 | VAARG '(' assignment_expression ',' type_name ')' { $$ = MkExpVaArg($3, $5); $$.loc = @$; }
1455 | CLASS_DATA '(' identifier ')' { $$ = MkExpClassData($3); $$.loc = @$; }
1461 | '[' argument_expression_list /*expression*/ ']' { $$ = MkExpArray($2); $$.loc = @$; }
1464 anon_instantiation_expression:
1465 instantiation_anon { $$ = MkExpInstance($1); $$.loc = @$; }
1468 anon_instantiation_expression_error:
1469 instantiation_anon_error error { $$ = MkExpInstance($1); $$.loc = @$; }
1472 primary_expression_error:
1473 '(' expression { $$ = MkExpBrackets($2); $$.loc = @$; }
1474 | '(' expression_error { $$ = MkExpBrackets($2); $$.loc = @$; }
1480 | postfix_expression '[' expression ']' { $$ = MkExpIndex($1, $3); $$.loc = @$; }
1481 | postfix_expression '[' expression_error ']' { $$ = MkExpIndex($1, $3); $$.loc = @$; }
1482 | postfix_expression '(' ')' { $$ = MkExpCall($1, MkList()); $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @3.end; $$.loc = @$; }
1483 | postfix_expression '(' argument_expression_list ')' { $$ = MkExpCall($1, $3); $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @4.end; $$.loc = @$; }
1484 | 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; }
1485 | postfix_expression '.' identifier { $$ = MkExpMember($1, $3); $$.loc = @$; }
1486 | postfix_expression PTR_OP identifier { $$ = MkExpPointer($1, $3); $$.loc = @$; }
1487 | postfix_expression INC_OP { $$ = MkExpOp($1, INC_OP, null); $$.loc = @$; }
1488 | postfix_expression DEC_OP { $$ = MkExpOp($1, DEC_OP, null); $$.loc = @$; }
1490 | postfix_expression_error '[' expression ']' { $$ = MkExpIndex($1, $3); $$.loc = @$; }
1491 | postfix_expression_error '[' expression_error ']' { $$ = MkExpIndex($1, $3); $$.loc = @$; }
1492 | postfix_expression_error '(' ')' { $$ = MkExpCall($1, MkList()); $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @3.end; $$.loc = @$; }
1493 | postfix_expression_error '(' argument_expression_list ')' { $$ = MkExpCall($1, $3); $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @4.end;$$.loc = @$; }
1494 | postfix_expression_error '.' identifier { $$ = MkExpMember($1, $3); $$.loc = @$; }
1495 | postfix_expression_error PTR_OP identifier { $$ = MkExpPointer($1, $3); $$.loc = @$; }
1496 | postfix_expression_error INC_OP { $$ = MkExpOp($1, INC_OP, null); $$.loc = @$; }
1497 | postfix_expression_error DEC_OP { $$ = MkExpOp($1, DEC_OP, null); $$.loc = @$; }
1500 simple_postfix_expression:
1501 simple_primary_expression
1503 | simple_postfix_expression '[' expression ']' { $$ = MkExpIndex($1, $3); $$.loc = @$; }
1504 | simple_postfix_expression '[' expression_error ']' { $$ = MkExpIndex($1, $3); $$.loc = @$; }
1505 | simple_postfix_expression '(' ')' { $$ = MkExpCall($1, MkList()); $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @3.end; $$.loc = @$; }
1506 | simple_postfix_expression '(' argument_expression_list ')' { $$ = MkExpCall($1, $3); $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @4.end; $$.loc = @$; }
1507 | 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; }
1508 | simple_postfix_expression '.' identifier { $$ = MkExpMember($1, $3); $$.loc = @$; }
1509 | simple_postfix_expression PTR_OP identifier { $$ = MkExpPointer($1, $3); $$.loc = @$; }
1510 | simple_postfix_expression INC_OP { $$ = MkExpOp($1, INC_OP, null); $$.loc = @$; }
1511 | simple_postfix_expression DEC_OP { $$ = MkExpOp($1, DEC_OP, null); $$.loc = @$; }
1513 | simple_postfix_expression_error '[' expression ']' { $$ = MkExpIndex($1, $3); $$.loc = @$; }
1514 | simple_postfix_expression_error '[' expression_error ']' { $$ = MkExpIndex($1, $3); $$.loc = @$; }
1515 | simple_postfix_expression_error '(' ')' { $$ = MkExpCall($1, MkList()); $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @3.end; $$.loc = @$; }
1516 | simple_postfix_expression_error '(' argument_expression_list ')' { $$ = MkExpCall($1, $3); $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @4.end;$$.loc = @$; }
1517 | simple_postfix_expression_error '.' identifier { $$ = MkExpMember($1, $3); $$.loc = @$; }
1518 | simple_postfix_expression_error PTR_OP identifier { $$ = MkExpPointer($1, $3); $$.loc = @$; }
1519 | simple_postfix_expression_error INC_OP { $$ = MkExpOp($1, INC_OP, null); $$.loc = @$; }
1520 | simple_postfix_expression_error DEC_OP { $$ = MkExpOp($1, DEC_OP, null); $$.loc = @$; }
1523 argument_expression_list:
1524 assignment_expression { $$ = MkList(); ListAdd($$, $1); }
1525 | anon_instantiation_expression { $$ = MkList(); ListAdd($$, $1); }
1526 | argument_expression_list ',' assignment_expression { $$ = $1; ListAdd($1, $3); }
1527 | argument_expression_list ',' anon_instantiation_expression { $$ = $1; ListAdd($1, $3); }
1530 argument_expression_list_error:
1531 assignment_expression_error { $$ = MkList(); ListAdd($$, $1); }
1532 | anon_instantiation_expression_error { $$ = MkList(); ListAdd($$, $1); }
1533 | argument_expression_list ',' assignment_expression_error { $$ = $1; ListAdd($1, $3); }
1534 | argument_expression_list ',' anon_instantiation_expression_error { $$ = $1; ListAdd($1, $3); }
1535 | argument_expression_list ',' { Expression exp = MkExpDummy(); exp.loc.start = @2.end; exp.loc.end = @2.end; $$ = $1; ListAdd($1, exp); }
1538 common_unary_expression:
1539 INC_OP unary_expression { $$ = MkExpOp(null, INC_OP, $2); $$.loc = @$; }
1540 | DEC_OP unary_expression { $$ = MkExpOp(null, DEC_OP, $2); $$.loc = @$; }
1541 | unary_operator cast_expression { $$ = MkExpOp(null, $1, $2); $$.loc = @$; }
1542 | unary_operator anon_instantiation_expression { $$ = MkExpOp(null, $1, $2); $$.loc = @$; }
1543 | SIZEOF '(' unary_expression ')' { $$ = MkExpOp(null, SIZEOF, $3); $$.loc = @$; }
1544 | SIZEOF simple_unary_expression { $$ = MkExpOp(null, SIZEOF, $2); $$.loc = @$; }
1545 | SIZEOF '(' guess_type_name ')' { $$ = MkExpTypeSize($3); $$.loc = @$; }
1546 | SIZEOF '(' CLASS type ')' { $$ = MkExpClassSize($4); $$.loc = @$; }
1547 | SIZEOF '(' CLASS guess_type ')' { $$ = MkExpClassSize($4); $$.loc = @$; }
1549 | ALIGNOF '(' unary_expression ')' { $$ = MkExpOp(null, ALIGNOF, $3); $$.loc = @$; }
1550 | ALIGNOF simple_unary_expression { $$ = MkExpOp(null, ALIGNOF, $2); $$.loc = @$; }
1551 | ALIGNOF '(' guess_type_name ')' { $$ = MkExpTypeAlign($3); $$.loc = @$; }
1555 common_unary_expression
1556 | postfix_expression
1559 simple_unary_expression:
1560 common_unary_expression
1561 | simple_postfix_expression
1571 | DELETE { $$ = DELETE; }
1572 | _INCREF { $$ = _INCREF; }
1577 | '(' type_name ')' cast_expression { $$ = MkExpCast($2, $4); $$.loc = @$; }
1580 multiplicative_expression:
1582 | multiplicative_expression '*' cast_expression { $$ = MkExpOp($1, '*', $3); $$.loc = @$; }
1583 | multiplicative_expression '/' cast_expression { $$ = MkExpOp($1, '/', $3); $$.loc = @$; }
1584 | multiplicative_expression '%' cast_expression { $$ = MkExpOp($1, '%', $3); $$.loc = @$; }
1585 | multiplicative_expression_error '*' cast_expression { $$ = MkExpOp($1, '*', $3); $$.loc = @$; }
1586 | multiplicative_expression_error '/' cast_expression { $$ = MkExpOp($1, '/', $3); $$.loc = @$; }
1587 | multiplicative_expression_error '%' cast_expression { $$ = MkExpOp($1, '%', $3); $$.loc = @$; }
1590 additive_expression:
1591 multiplicative_expression
1592 | additive_expression '+' multiplicative_expression { $$ = MkExpOp($1, '+', $3); $$.loc = @$; }
1593 | additive_expression '-' multiplicative_expression { $$ = MkExpOp($1, '-', $3); $$.loc = @$; }
1594 | additive_expression_error '+' multiplicative_expression { $$ = MkExpOp($1, '+', $3); $$.loc = @$; }
1595 | additive_expression_error '-' multiplicative_expression { $$ = MkExpOp($1, '-', $3); $$.loc = @$; }
1600 | shift_expression LEFT_OP additive_expression { $$ = MkExpOp($1, LEFT_OP, $3); $$.loc = @$; }
1601 | shift_expression RIGHT_OP additive_expression { $$ = MkExpOp($1, RIGHT_OP, $3); $$.loc = @$; }
1602 | shift_expression_error LEFT_OP additive_expression { $$ = MkExpOp($1, LEFT_OP, $3); $$.loc = @$; }
1603 | shift_expression_error RIGHT_OP additive_expression { $$ = MkExpOp($1, RIGHT_OP, $3); $$.loc = @$; }
1606 relational_expression_smaller_than:
1607 relational_expression '<'
1614 relational_expression:
1616 | relational_expression_smaller_than /*relational_expression '<' */ shift_expression { skipErrors = false; $$ = MkExpOp($1, '<', $2/*$3*/); $$.loc = @$; }
1617 | relational_expression '>' shift_expression { $$ = MkExpOp($1, '>', $3); $$.loc = @$; }
1618 | relational_expression LE_OP shift_expression { $$ = MkExpOp($1, LE_OP, $3); $$.loc = @$; }
1619 | relational_expression GE_OP shift_expression { $$ = MkExpOp($1, GE_OP, $3); $$.loc = @$; }
1620 | relational_expression_error '<' shift_expression { $$ = MkExpOp($1, '<', $3); $$.loc = @$; }
1621 | relational_expression_error '>' shift_expression { $$ = MkExpOp($1, '>', $3); $$.loc = @$; }
1622 | relational_expression_error LE_OP shift_expression { $$ = MkExpOp($1, LE_OP, $3); $$.loc = @$; }
1623 | relational_expression_error GE_OP shift_expression { $$ = MkExpOp($1, GE_OP, $3); $$.loc = @$; }
1627 : relational_expression
1628 | equality_expression EQ_OP relational_expression { $$ = MkExpOp($1, EQ_OP, $3); $$.loc = @$; }
1629 | equality_expression NE_OP relational_expression { $$ = MkExpOp($1, NE_OP, $3); $$.loc = @$; }
1630 | equality_expression_error EQ_OP relational_expression { $$ = MkExpOp($1, EQ_OP, $3); $$.loc = @$; }
1631 | equality_expression_error NE_OP relational_expression { $$ = MkExpOp($1, NE_OP, $3); $$.loc = @$; }
1633 | equality_expression EQ_OP anon_instantiation_expression { $$ = MkExpOp($1, EQ_OP, $3); $$.loc = @$; }
1634 | equality_expression NE_OP anon_instantiation_expression { $$ = MkExpOp($1, NE_OP, $3); $$.loc = @$; }
1635 | equality_expression_error EQ_OP anon_instantiation_expression { $$ = MkExpOp($1, EQ_OP, $3); $$.loc = @$; }
1636 | equality_expression_error NE_OP anon_instantiation_expression { $$ = MkExpOp($1, NE_OP, $3); $$.loc = @$; }
1640 : equality_expression
1641 | and_expression '&' equality_expression { $$ = MkExpOp($1, '&', $3); $$.loc = @$; }
1642 | and_expression_error '&' equality_expression { $$ = MkExpOp($1, '&', $3); $$.loc = @$; }
1644 | and_expression '&' anon_instantiation_expression { $$ = MkExpOp($1, '&', $3); $$.loc = @$; }
1645 | and_expression_error '&' anon_instantiation_expression { $$ = MkExpOp($1, '&', $3); $$.loc = @$; }
1648 exclusive_or_expression
1650 | exclusive_or_expression '^' and_expression { $$ = MkExpOp($1, '^', $3); $$.loc = @$; }
1651 | exclusive_or_expression_error '^' and_expression { $$ = MkExpOp($1, '^', $3); $$.loc = @$; }
1653 | exclusive_or_expression '^' anon_instantiation_expression { $$ = MkExpOp($1, '^', $3); $$.loc = @$; }
1654 | exclusive_or_expression_error '^' anon_instantiation_expression { $$ = MkExpOp($1, '^', $3); $$.loc = @$; }
1657 inclusive_or_expression
1658 : exclusive_or_expression
1659 | inclusive_or_expression '|' exclusive_or_expression { $$ = MkExpOp($1, '|', $3); $$.loc = @$; }
1660 | inclusive_or_expression_error '|' exclusive_or_expression { $$ = MkExpOp($1, '|', $3); $$.loc = @$; }
1662 | inclusive_or_expression '|' anon_instantiation_expression { $$ = MkExpOp($1, '|', $3); $$.loc = @$; }
1663 | inclusive_or_expression_error '|' anon_instantiation_expression { $$ = MkExpOp($1, '|', $3); $$.loc = @$; }
1666 logical_and_expression
1667 : inclusive_or_expression
1668 | logical_and_expression AND_OP inclusive_or_expression { $$ = MkExpOp($1, AND_OP, $3); $$.loc = @$; }
1669 | logical_and_expression_error AND_OP inclusive_or_expression { $$ = MkExpOp($1, AND_OP, $3); $$.loc = @$; }
1672 logical_or_expression
1673 : logical_and_expression
1674 | logical_or_expression OR_OP logical_and_expression { $$ = MkExpOp($1, OR_OP, $3); $$.loc = @$; }
1675 | logical_or_expression_error OR_OP logical_and_expression { $$ = MkExpOp($1, OR_OP, $3); $$.loc = @$; }
1678 conditional_expression
1679 : logical_or_expression
1680 | logical_or_expression '?' expression ':' conditional_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1681 | logical_or_expression '?' expression_error ':' conditional_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1682 | logical_or_expression_error '?' expression ':' conditional_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1683 | logical_or_expression_error '?' expression_error ':' conditional_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1685 | logical_or_expression '?' expression_anon_inst ':' conditional_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1686 | logical_or_expression '?' expression_anon_inst_error ':' conditional_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1687 | logical_or_expression_error '?' expression_anon_inst ':' conditional_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1688 | logical_or_expression_error '?' expression_anon_inst_error ':' conditional_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1690 | logical_or_expression '?' expression ':' anon_instantiation_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1691 | logical_or_expression '?' expression_error ':' anon_instantiation_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1692 | logical_or_expression_error '?' expression ':' anon_instantiation_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1693 | logical_or_expression_error '?' expression_error ':' anon_instantiation_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1695 | logical_or_expression '?' expression_anon_inst ':' anon_instantiation_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1696 | logical_or_expression '?' expression_anon_inst_error ':' anon_instantiation_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1697 | logical_or_expression_error '?' expression_anon_inst ':' anon_instantiation_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1698 | logical_or_expression_error '?' expression_anon_inst_error ':' anon_instantiation_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1701 assignment_expression:
1702 conditional_expression
1703 | unary_expression assignment_operator assignment_expression { $$ = MkExpOp($1, $2, $3); $$.loc = @$; }
1704 | unary_expression_error assignment_operator assignment_expression { $$ = MkExpOp($1, $2, $3); $$.loc = @$; }
1705 | conditional_expression assignment_operator assignment_expression { $$ = MkExpOp($1, $2, $3); $$.loc = @$; } // TODO: Generate error here:
1706 | conditional_expression_error assignment_operator assignment_expression { $$ = MkExpOp($1, $2, $3); $$.loc = @$; } // TODO: Generate error here:
1708 | unary_expression assignment_operator anon_instantiation_expression { $$ = MkExpOp($1, $2, $3); $$.loc = @$; }
1709 | unary_expression_error assignment_operator anon_instantiation_expression { $$ = MkExpOp($1, $2, $3); $$.loc = @$; }
1710 | conditional_expression assignment_operator anon_instantiation_expression { $$ = MkExpOp($1, $2, $3); $$.loc = @$; }
1711 | conditional_expression_error assignment_operator anon_instantiation_expression { $$ = MkExpOp($1, $2, $3); $$.loc = @$; }
1714 assignment_operator:
1716 | MUL_ASSIGN { $$ = MUL_ASSIGN; }
1717 | DIV_ASSIGN { $$ = DIV_ASSIGN; }
1718 | MOD_ASSIGN { $$ = MOD_ASSIGN; }
1719 | ADD_ASSIGN { $$ = ADD_ASSIGN; }
1720 | SUB_ASSIGN { $$ = SUB_ASSIGN; }
1721 | LEFT_ASSIGN { $$ = LEFT_ASSIGN; }
1722 | RIGHT_ASSIGN { $$ = RIGHT_ASSIGN; }
1723 | AND_ASSIGN { $$ = AND_ASSIGN; }
1724 | XOR_ASSIGN { $$ = XOR_ASSIGN; }
1725 | OR_ASSIGN { $$ = OR_ASSIGN; }
1729 assignment_expression { $$ = MkList(); ListAdd($$, $1); }
1730 | expression ',' assignment_expression { $$ = $1; ListAdd($1, $3); }
1731 | expression_error ',' assignment_expression { $$ = $1; ListAdd($1, $3); }
1732 | expression_error ')'
1735 expression_anon_inst:
1736 anon_instantiation_expression { $$ = MkList(); ListAdd($$, $1); }
1737 | expression ',' anon_instantiation_expression { $$ = $1; ListAdd($1, $3); }
1738 | expression_error ',' anon_instantiation_expression { $$ = $1; ListAdd($1, $3); }
1741 postfix_expression_error:
1742 primary_expression_error
1743 | error { $$ = MkExpDummy(); $$.loc = @$; /*printf("Sorry, didn't mean that syntax error\n");*/ }
1744 | postfix_expression error
1745 | instantiation_unnamed_error error { $$ = MkExpInstance($1); $$.loc = @$; }
1747 | postfix_expression PTR_OP error { $$ = MkExpPointer($1, null); $$.loc = @$; }
1748 | postfix_expression_error PTR_OP error { $$ = MkExpPointer($1, null); $$.loc = @$; }
1750 | postfix_expression '(' argument_expression_list { $$ = MkExpCall($1, $3); $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @3.end; $$.loc = @$; $$.call.argLoc.end.charPos++;}
1751 | postfix_expression '(' argument_expression_list_error { $$ = MkExpCall($1, $3); $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @3.end; $$.loc = @$; $$.call.argLoc.end.charPos++;}
1752 /* Useless rules due to conflicts
1753 | postfix_expression '(' argument_expression_list ',' error { $$ = MkExpCall($1, $3); $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @4.end;$$.loc = @$; $$.call.argLoc.end.charPos++;}
1754 | postfix_expression '(' error { $$ = MkExpCall($1, MkList() ); @$.end = yylloc.start; $$.loc = @$; $$.call.argLoc.start = @2.start; $$.call.argLoc.end = yylloc.start; }
1756 | postfix_expression '.' error { $$ = MkExpMember($1, null); $$.loc = @$; }
1758 | 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++;}
1759 /* Useless rules due to conflicts
1760 | 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++;}
1761 | postfix_expression_error '(' error { $$ = MkExpCall($1, MkList() ); $$.loc = @$; $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @2.end; $$.call.argLoc.end.charPos++;}
1763 | postfix_expression_error '.' error { $$ = MkExpMember($1, null); $$.loc = @$; }
1766 simple_postfix_expression_error:
1767 error { $$ = MkExpDummy(); $$.loc = @$; }
1768 | simple_postfix_expression error
1769 | instantiation_unnamed_error error { $$ = MkExpInstance($1); $$.loc = @$; }
1771 | simple_postfix_expression PTR_OP error { $$ = MkExpPointer($1, null); $$.loc = @$; }
1772 | simple_postfix_expression_error PTR_OP error { $$ = MkExpPointer($1, null); $$.loc = @$; }
1774 | simple_postfix_expression '(' argument_expression_list { $$ = MkExpCall($1, $3); $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @3.end; $$.loc = @$; $$.call.argLoc.end.charPos++;}
1775 | 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++;}
1776 /* Useless rules due to conflicts
1777 | 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++;}
1778 | simple_postfix_expression '(' error { $$ = MkExpCall($1, MkList() ); @$.end = yylloc.start; $$.loc = @$; $$.call.argLoc.start = @2.start; $$.call.argLoc.end = yylloc.start; }
1780 | simple_postfix_expression '.' error { $$ = MkExpMember($1, null); $$.loc = @$; }
1782 | 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++;}
1783 /* Useless rules due to conflicts
1784 | 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++;}
1785 | simple_postfix_expression_error '(' error { $$ = MkExpCall($1, MkList() ); $$.loc = @$; $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @2.end; $$.call.argLoc.end.charPos++;}
1787 | simple_postfix_expression_error '.' error { $$ = MkExpMember($1, null); $$.loc = @$; }
1790 common_unary_expression_error:
1791 INC_OP unary_expression_error { $$ = MkExpOp(null, INC_OP, $2); $$.loc = @$; }
1792 | DEC_OP unary_expression_error { $$ = MkExpOp(null, DEC_OP, $2); $$.loc = @$; }
1793 | unary_operator cast_expression_error { $$ = MkExpOp(null, $1, $2); $$.loc = @$; }
1794 | unary_operator anon_instantiation_expression_error { $$ = MkExpOp(null, $1, $2); $$.loc = @$; }
1795 | SIZEOF '(' unary_expression_error { $$ = MkExpOp(null, SIZEOF, $3); $$.loc = @$; }
1796 | SIZEOF simple_unary_expression_error { $$ = MkExpOp(null, SIZEOF, $2); $$.loc = @$; }
1797 | SIZEOF '(' guess_type_name ')' error { $$ = MkExpTypeSize($3); $$.loc = @$; }
1798 | SIZEOF '(' CLASS type ')' error { $$ = MkExpClassSize($4); $$.loc = @$; }
1799 | SIZEOF '(' CLASS guess_type ')' error { $$ = MkExpClassSize($4); $$.loc = @$; }
1800 | ALIGNOF '(' unary_expression_error { $$ = MkExpOp(null, ALIGNOF, $3); $$.loc = @$; }
1801 | ALIGNOF simple_unary_expression_error { $$ = MkExpOp(null, ALIGNOF, $2); $$.loc = @$; }
1802 | ALIGNOF '(' guess_type_name ')' error { $$ = MkExpTypeAlign($3); $$.loc = @$; }
1805 unary_expression_error:
1806 common_unary_expression_error
1807 | postfix_expression_error
1810 simple_unary_expression_error:
1811 common_unary_expression_error
1812 | simple_postfix_expression_error
1816 cast_expression_error:
1817 unary_expression_error
1818 | '(' type_name ')' cast_expression_error { $$ = MkExpCast($2, $4); $$.loc = @$; }
1821 multiplicative_expression_error:
1822 cast_expression_error
1823 | multiplicative_expression '*' cast_expression_error { $$ = MkExpOp($1, '*', $3); $$.loc = @$; }
1824 | multiplicative_expression '/' cast_expression_error { $$ = MkExpOp($1, '/', $3); $$.loc = @$; }
1825 | multiplicative_expression '%' cast_expression_error { $$ = MkExpOp($1, '%', $3); $$.loc = @$; }
1826 | multiplicative_expression_error '*' cast_expression_error { $$ = MkExpOp($1, '*', $3); $$.loc = @$; }
1827 | multiplicative_expression_error '/' cast_expression_error { $$ = MkExpOp($1, '/', $3); $$.loc = @$; }
1828 | multiplicative_expression_error '%' cast_expression_error { $$ = MkExpOp($1, '%', $3); $$.loc = @$; }
1831 additive_expression_error:
1832 multiplicative_expression_error
1833 | additive_expression '+' multiplicative_expression_error { $$ = MkExpOp($1, '+', $3); $$.loc = @$; }
1834 /* Useless rules due to conflicts
1835 | additive_expression '+' error { $$ = MkExpOp($1, '+', null); $$.loc = @$; }
1837 | additive_expression '-' multiplicative_expression_error { $$ = MkExpOp($1, '-', $3); $$.loc = @$; }
1838 /* Useless rules due to conflicts
1839 | additive_expression '-' error { $$ = MkExpOp($1, '-', null); $$.loc = @$; }
1841 | additive_expression_error '+' multiplicative_expression_error { $$ = MkExpOp($1, '+', $3); $$.loc = @$; }
1842 /* Useless rules due to conflicts
1843 | additive_expression_error '+' error { $$ = MkExpOp($1, '+', null); $$.loc = @$; }
1845 | additive_expression_error '-' multiplicative_expression_error { $$ = MkExpOp($1, '-', $3); $$.loc = @$; }
1846 /* Useless rules due to conflicts
1847 | additive_expression_error '-' error { $$ = MkExpOp($1, '-', null); $$.loc = @$; }
1851 shift_expression_error:
1852 additive_expression_error
1853 | shift_expression LEFT_OP additive_expression_error { $$ = MkExpOp($1, LEFT_OP, $3); $$.loc = @$; }
1854 | shift_expression RIGHT_OP additive_expression_error { $$ = MkExpOp($1, RIGHT_OP, $3); $$.loc = @$; }
1855 | shift_expression_error LEFT_OP additive_expression_error { $$ = MkExpOp($1, LEFT_OP, $3); $$.loc = @$; }
1856 | shift_expression_error RIGHT_OP additive_expression_error { $$ = MkExpOp($1, RIGHT_OP, $3); $$.loc = @$; }
1859 relational_expression_error:
1860 shift_expression_error
1861 | relational_expression_smaller_than /*relational_expression '<' */ shift_expression_error
1863 if($1.type == identifierExp)
1865 if($1.identifier._class && !$1.identifier._class.name)
1869 strcat(name, $1.identifier.string);
1870 _DeclClass(0, name);
1873 _DeclClass(0, $1.identifier.string);
1875 // printf("Declaring Class %s\n", $1.identifier.string);
1881 fileInput.Seek(@1.start.pos, start);
1882 resetScannerPos(&@1.start);
1887 YY_STACK_PRINT (yyss, yyssp);
1891 YY_STACK_PRINT (yyss, yyssp);
1895 YY_STACK_PRINT (yyss, yyssp);
1899 YY_STACK_PRINT (yyss, yyssp);
1907 $$ = MkExpOp($1, '<', $2);
1912 | relational_expression '>' shift_expression_error { $$ = MkExpOp($1, '>', $3); $$.loc = @$; }
1913 | relational_expression LE_OP shift_expression_error { $$ = MkExpOp($1, LE_OP, $3); $$.loc = @$; }
1914 | relational_expression GE_OP shift_expression_error { $$ = MkExpOp($1, GE_OP, $3); $$.loc = @$; }
1915 | relational_expression_error '<' shift_expression_error { $$ = MkExpOp($1, '<', $3); $$.loc = @$; }
1916 | relational_expression_error '>' shift_expression_error { $$ = MkExpOp($1, '>', $3); $$.loc = @$; }
1917 | relational_expression_error LE_OP shift_expression_error { $$ = MkExpOp($1, LE_OP, $3); $$.loc = @$; }
1918 | relational_expression_error GE_OP shift_expression_error { $$ = MkExpOp($1, GE_OP, $3); $$.loc = @$; }
1921 equality_expression_error:
1922 relational_expression_error
1923 | equality_expression EQ_OP relational_expression_error { $$ = MkExpOp($1, EQ_OP, $3); $$.loc = @$; }
1924 | equality_expression NE_OP relational_expression_error { $$ = MkExpOp($1, NE_OP, $3); $$.loc = @$; }
1925 | equality_expression_error EQ_OP relational_expression_error { $$ = MkExpOp($1, EQ_OP, $3); $$.loc = @$; }
1926 | equality_expression_error NE_OP relational_expression_error { $$ = MkExpOp($1, NE_OP, $3); $$.loc = @$; }
1927 /* Useless rules due to conflicts
1928 | equality_expression EQ_OP error { $$ = MkExpOp($1, EQ_OP, MkExpDummy()); $$.loc = @$; }
1929 | equality_expression NE_OP error { $$ = MkExpOp($1, NE_OP, MkExpDummy()); $$.loc = @$; }
1930 | equality_expression_error EQ_OP error { $$ = MkExpOp($1, EQ_OP, MkExpDummy()); $$.loc = @$; }
1931 | equality_expression_error NE_OP error { $$ = MkExpOp($1, NE_OP, MkExpDummy()); $$.loc = @$; }
1933 | equality_expression EQ_OP anon_instantiation_expression_error { $$ = MkExpOp($1, EQ_OP, $3); $$.loc = @$; }
1934 | equality_expression NE_OP anon_instantiation_expression_error { $$ = MkExpOp($1, NE_OP, $3); $$.loc = @$; }
1935 | equality_expression_error EQ_OP anon_instantiation_expression_error { $$ = MkExpOp($1, EQ_OP, $3); $$.loc = @$; }
1936 | equality_expression_error NE_OP anon_instantiation_expression_error { $$ = MkExpOp($1, NE_OP, $3); $$.loc = @$; }
1939 and_expression_error:
1940 equality_expression_error
1941 | and_expression '&' equality_expression_error { $$ = MkExpOp($1, '&', $3); $$.loc = @$; }
1942 | and_expression_error '&' equality_expression_error { $$ = MkExpOp($1, '&', $3); $$.loc = @$; }
1944 | and_expression '&' anon_instantiation_expression_error { $$ = MkExpOp($1, '&', $3); $$.loc = @$; }
1945 | and_expression_error '&' anon_instantiation_expression_error { $$ = MkExpOp($1, '&', $3); $$.loc = @$; }
1948 exclusive_or_expression_error:
1949 and_expression_error
1950 | exclusive_or_expression '^' and_expression_error { $$ = MkExpOp($1, '^', $3); $$.loc = @$; }
1951 | exclusive_or_expression_error '^' and_expression_error { $$ = MkExpOp($1, '^', $3); $$.loc = @$; }
1953 | exclusive_or_expression '^' anon_instantiation_expression_error { $$ = MkExpOp($1, '^', $3); $$.loc = @$; }
1954 | exclusive_or_expression_error '^' anon_instantiation_expression_error { $$ = MkExpOp($1, '^', $3); $$.loc = @$; }
1957 inclusive_or_expression_error:
1958 exclusive_or_expression_error
1959 | inclusive_or_expression '|' exclusive_or_expression_error { $$ = MkExpOp($1, '|', $3); $$.loc = @$; }
1960 | inclusive_or_expression_error '|' exclusive_or_expression_error { $$ = MkExpOp($1, '|', $3); $$.loc = @$; }
1962 | inclusive_or_expression '|' anon_instantiation_expression_error { $$ = MkExpOp($1, '|', $3); $$.loc = @$; }
1963 | inclusive_or_expression_error '|' anon_instantiation_expression_error { $$ = MkExpOp($1, '|', $3); $$.loc = @$; }
1966 logical_and_expression_error:
1967 inclusive_or_expression_error
1968 | logical_and_expression AND_OP inclusive_or_expression_error { $$ = MkExpOp($1, AND_OP, $3); $$.loc = @$; }
1969 | logical_and_expression_error AND_OP inclusive_or_expression_error { $$ = MkExpOp($1, AND_OP, $3); $$.loc = @$; }
1972 logical_or_expression_error:
1973 logical_and_expression_error
1974 | logical_or_expression OR_OP logical_and_expression_error { $$ = MkExpOp($1, OR_OP, $3); $$.loc = @$; }
1975 | logical_or_expression_error OR_OP logical_and_expression_error { $$ = MkExpOp($1, OR_OP, $3); $$.loc = @$; }
1978 conditional_expression_error:
1979 logical_or_expression_error
1980 | logical_or_expression '?' expression ':' logical_or_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1981 | logical_or_expression '?' expression_error ':' logical_or_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1982 | logical_or_expression_error '?' expression ':' logical_or_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1983 | logical_or_expression_error '?' expression_error ':' logical_or_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1984 | logical_or_expression '?' expression ':' { $$ = MkExpCondition($1, $3, MkExpDummy()); $$.loc = @$; $$.cond.elseExp.loc = @3; }
1985 | logical_or_expression '?' expression_error ':' { $$ = MkExpCondition($1, $3, MkExpDummy()); $$.loc = @$; $$.cond.elseExp.loc = @3; }
1986 | logical_or_expression_error '?' expression ':' { $$ = MkExpCondition($1, $3, MkExpDummy()); $$.loc = @$; $$.cond.elseExp.loc = @3; }
1987 | logical_or_expression_error '?' expression_error ':' { $$ = MkExpCondition($1, $3, MkExpDummy()); $$.loc = @$; $$.cond.elseExp.loc = @3; }
1989 | logical_or_expression '?' expression_anon_inst ':' logical_or_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1990 | logical_or_expression '?' expression_anon_inst_error ':' logical_or_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1991 | logical_or_expression_error '?' expression_anon_inst ':' logical_or_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1992 | logical_or_expression_error '?' expression_anon_inst_error ':' logical_or_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1993 | logical_or_expression '?' expression_anon_inst ':' { $$ = MkExpCondition($1, $3, MkExpDummy()); $$.loc = @$; $$.cond.elseExp.loc = @3; }
1994 | logical_or_expression '?' expression_anon_inst_error ':' { $$ = MkExpCondition($1, $3, MkExpDummy()); $$.loc = @$; $$.cond.elseExp.loc = @3; }
1995 | logical_or_expression_error '?' expression_anon_inst ':' { $$ = MkExpCondition($1, $3, MkExpDummy()); $$.loc = @$; $$.cond.elseExp.loc = @3; }
1996 | logical_or_expression_error '?' expression_anon_inst_error ':' { $$ = MkExpCondition($1, $3, MkExpDummy()); $$.loc = @$; $$.cond.elseExp.loc = @3; }
1998 | logical_or_expression '?' expression ':' anon_instantiation_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1999 | logical_or_expression '?' expression_error ':' anon_instantiation_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
2000 | logical_or_expression_error '?' expression ':' anon_instantiation_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
2001 | logical_or_expression_error '?' expression_error ':' anon_instantiation_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
2003 | logical_or_expression '?' expression_anon_inst ':' anon_instantiation_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
2004 | logical_or_expression '?' expression_anon_inst_error ':' anon_instantiation_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
2005 | logical_or_expression_error '?' expression_anon_inst ':' anon_instantiation_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
2006 | logical_or_expression_error '?' expression_anon_inst_error ':' anon_instantiation_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
2008 | logical_or_expression '?' ':'
2010 $$ = MkExpCondition($1, MkListOne(MkExpDummy()), MkExpDummy());
2012 ((Expression)$$.cond.exp->last).loc = @2;
2013 $$.cond.elseExp.loc = @3;
2015 | logical_or_expression_error '?' ':'
2017 $$ = MkExpCondition($1, MkListOne(MkExpDummy()), MkExpDummy()); $$.loc = @$; ((Expression)$$.cond.exp->last).loc = @2; $$.cond.elseExp.loc = @3;
2019 | logical_or_expression '?'
2021 $$ = MkExpCondition($1, MkListOne(MkExpDummy()), MkExpDummy()); $$.loc = @$; ((Expression)$$.cond.exp->last).loc = @2; $$.cond.elseExp.loc = @2;
2023 | logical_or_expression_error '?'
2025 $$ = MkExpCondition($1, MkListOne(MkExpDummy()), MkExpDummy()); $$.loc = @$; ((Expression)$$.cond.exp->last).loc = @2; $$.cond.elseExp.loc = @2;
2029 assignment_expression_error:
2030 conditional_expression_error
2031 | unary_expression assignment_operator assignment_expression_error { $$ = MkExpOp($1, $2, $3); $$.loc = @$; }
2032 /* Useless rules due to conflicts
2033 | unary_expression assignment_operator error { $$ = MkExpOp($1, $2, MkExpDummy()); $$.loc = @$; $$.op.exp2.loc = @2; }
2035 | unary_expression_error assignment_operator assignment_expression_error { $$ = MkExpOp($1, $2, $3); $$.loc = @$; }
2036 /* Useless rules due to conflicts
2037 | unary_expression_error assignment_operator error { $$ = MkExpOp($1, $2, MkExpDummy()); $$.loc = @$; $$.op.exp2.loc = @2; }
2040 | unary_expression assignment_operator anon_instantiation_expression_error { $$ = MkExpOp($1, $2, $3); $$.loc = @$; }
2041 | unary_expression_error assignment_operator anon_instantiation_expression_error { $$ = MkExpOp($1, $2, $3); $$.loc = @$; }
2045 assignment_expression_error { $$ = MkList(); ListAdd($$, $1); }
2046 | assignment_expression error { $$ = MkList(); ListAdd($$, $1); }
2047 | expression ',' assignment_expression_error { $$ = $1; ListAdd($1, $3); }
2048 | expression_error ',' assignment_expression_error { $$ = $1; ListAdd($1, $3); }
2049 /* Useless rules due to conflicts
2050 | expression ',' error
2051 | expression_error ',' error
2054 | expression expression { $$ = $1; FreeList($2, FreeExpression); }
2055 | expression_error expression { $$ = $1; FreeList($2, FreeExpression); }
2056 | expression expression_error { $$ = $1; FreeList($2, FreeExpression); }
2059 expression_anon_inst_error:
2060 anon_instantiation_expression_error { $$ = MkList(); ListAdd($$, $1); }
2061 | anon_instantiation_expression error { $$ = MkList(); ListAdd($$, $1); }
2062 | expression ',' anon_instantiation_expression_error { $$ = $1; ListAdd($1, $3); }
2063 | expression_error ',' anon_instantiation_expression_error { $$ = $1; ListAdd($1, $3); }
2067 constant_expression: conditional_expression;
2069 constant_expression_error: conditional_expression_error;
2071 /**** TYPES **************************************************************************/
2072 storage_class_specifier:
2073 TYPEDEF { $$ = MkSpecifier(TYPEDEF); }
2074 | EXTERN { $$ = MkSpecifier(EXTERN); }
2075 | STATIC { $$ = MkSpecifier(STATIC); }
2076 | AUTO { $$ = MkSpecifier(AUTO); }
2077 | REGISTER { $$ = MkSpecifier(REGISTER); }
2080 external_storage_class_specifier:
2081 TYPEDEF { $$ = MkSpecifier(TYPEDEF); declMode = defaultAccess; }
2082 | EXTERN { $$ = MkSpecifier(EXTERN); }
2083 | STATIC { $$ = MkSpecifier(STATIC); declMode = staticAccess; }
2084 | AUTO { $$ = MkSpecifier(AUTO); }
2085 | REGISTER { $$ = MkSpecifier(REGISTER); }
2089 identifier { $$ = MkEnumerator($1, null); }
2090 | identifier '=' constant_expression { $$ = MkEnumerator($1, $3); }
2091 | identifier '=' constant_expression_error { $$ = MkEnumerator($1, $3); }
2095 enumerator { $$ = MkList(); ListAdd($$, $1); }
2096 | enumerator_list ',' enumerator { $$ = $1; ListAdd($1, $3); }
2097 | enumerator_list ','
2101 ENUM { memberAccessStack[++defaultMemberAccess] = publicAccess; }
2104 enum_specifier_nocompound:
2105 enum_specifier identifier { $$ = MkEnum($2, null); POP_DEFAULT_ACCESS }
2106 | enum_specifier strict_type { $$ = MkEnum(MkIdentifier($2.name), null); POP_DEFAULT_ACCESS }
2109 enum_specifier_compound:
2110 enum_specifier_compound_error '}' { $$.loc = @$; POP_DEFAULT_ACCESS $$ = $1; }
2111 | enum_specifier identifier '{' '}' { $$ = MkEnum($2, null); $$.loc = @$; POP_DEFAULT_ACCESS }
2112 | enum_specifier strict_type '{' '}' { $$ = MkEnum(MkIdentifier($2.name), null); FreeSpecifier($2); $$.loc = @$; POP_DEFAULT_ACCESS }
2115 enum_specifier_compound_error:
2116 enum_specifier '{' enumerator_list { $$ = MkEnum(null, $3); $$.loc = @$; POP_DEFAULT_ACCESS }
2117 | enum_specifier '{' error { $$ = MkEnum(null, null); $$.loc = @$; POP_DEFAULT_ACCESS }
2119 | enum_specifier identifier '{' enumerator_list { $$ = MkEnum($2, $4); $$.loc = @$; POP_DEFAULT_ACCESS }
2120 | enum_specifier identifier '{' enumerator_list error { $$ = MkEnum($2, $4); $$.loc = @$; POP_DEFAULT_ACCESS }
2121 | enum_specifier identifier '{' error { $$ = MkEnum($2, null); $$.loc = @$; POP_DEFAULT_ACCESS }
2122 | enum_specifier identifier '{' enumerator_list ';' struct_declaration_list { $$ = MkEnum($2, $4); $$.loc = @$; $$.definitions = $6; POP_DEFAULT_ACCESS }
2123 | enum_specifier identifier '{' enumerator_list ';' struct_declaration_list_error { $$ = MkEnum($2, $4); $$.loc = @$; $$.definitions = $6; POP_DEFAULT_ACCESS }
2125 | enum_specifier strict_type '{' enumerator_list { $$ = MkEnum(MkIdentifier($2.name), $4); $$.loc = @$; FreeSpecifier($2); POP_DEFAULT_ACCESS }
2126 | enum_specifier strict_type '{' enumerator_list error { $$ = MkEnum(MkIdentifier($2.name), $4); $$.loc = @$; FreeSpecifier($2); POP_DEFAULT_ACCESS }
2127 | enum_specifier strict_type '{' error { $$ = MkEnum(MkIdentifier($2.name), null); $$.loc = @$; FreeSpecifier($2); POP_DEFAULT_ACCESS }
2128 | enum_specifier strict_type '{' enumerator_list ';' struct_declaration_list { $$ = MkEnum(MkIdentifier($2.name), $4); $$.loc = @$; $$.definitions = $6; FreeSpecifier($2); POP_DEFAULT_ACCESS }
2129 | enum_specifier strict_type '{' enumerator_list ';' struct_declaration_list_error { $$ = MkEnum(MkIdentifier($2.name), $4); $$.loc = @$; $$.definitions = $6; FreeSpecifier($2); POP_DEFAULT_ACCESS }
2133 enum_specifier identifier { $$ = $2; if(declMode) DeclClassAddNameSpace(globalContext.nextID++, $2.string); }
2134 | enum_specifier strict_type { $$ = MkIdentifier($2.name); if(declMode) DeclClass(globalContext.nextID++, $2.name); FreeSpecifier($2); }
2138 enum_class_error '}' { $$ = $1; $$.loc = @$; }
2139 | enum_decl ':' inheritance_specifiers '{' '}' { $$ = MkEnum($1, null); $$.baseSpecs = $3; $$.loc = @$; POP_DEFAULT_ACCESS }
2140 | enum_decl '{' '}' { $$ = MkEnum($1, null); POP_DEFAULT_ACCESS }
2144 enum_decl ':' inheritance_specifiers '{' enumerator_list { $$ = MkEnum($1, $5); $$.baseSpecs = $3; $$.loc = @$; POP_DEFAULT_ACCESS }
2145 | enum_decl ':' inheritance_specifiers '{' enumerator_list error { $$ = MkEnum($1, $5); $$.baseSpecs = $3; $$.loc = @$; POP_DEFAULT_ACCESS }
2146 | enum_decl ':' inheritance_specifiers '{' error { $$ = MkEnum($1, null); $$.baseSpecs = $3; $$.loc = @$; POP_DEFAULT_ACCESS }
2147 | enum_decl ':' inheritance_specifiers '{' enumerator_list ';' struct_declaration_list { $$ = MkEnum($1, $5); $$.baseSpecs = $3; $$.definitions = $7; $$.loc = @$; POP_DEFAULT_ACCESS }
2148 | enum_decl ':' inheritance_specifiers '{' enumerator_list ';' struct_declaration_list_error { $$ = MkEnum($1, $5); $$.baseSpecs = $3; $$.definitions = $7; $$.loc = @$; POP_DEFAULT_ACCESS }
2149 | enum_decl ':' inheritance_specifiers '{' enumerator_list error ';' struct_declaration_list { $$ = MkEnum($1, $5); $$.baseSpecs = $3; $$.definitions = $8; $$.loc = @$; POP_DEFAULT_ACCESS }
2150 | enum_decl ':' inheritance_specifiers '{' enumerator_list error ';' struct_declaration_list_error { $$ = MkEnum($1, $5); $$.baseSpecs = $3; $$.definitions = $8; $$.loc = @$; POP_DEFAULT_ACCESS }
2151 | enum_decl ':' inheritance_specifiers '{' error ';' struct_declaration_list { $$ = MkEnum($1, null); $$.baseSpecs = $3; $$.definitions = $7; $$.loc = @$; POP_DEFAULT_ACCESS }
2152 | enum_decl ':' inheritance_specifiers '{' error ';' struct_declaration_list_error { $$ = MkEnum($1, null); $$.baseSpecs = $3; $$.definitions = $7; $$.loc = @$; POP_DEFAULT_ACCESS }
2154 | enum_specifier '{' enumerator_list { $$ = MkEnum(null, $3); $$.loc = @$; POP_DEFAULT_ACCESS }
2155 | enum_specifier '{' error { $$ = MkEnum(null, null); $$.loc = @$; POP_DEFAULT_ACCESS }
2157 | enum_decl '{' enumerator_list { $$ = MkEnum($1, $3); $$.loc = @$; POP_DEFAULT_ACCESS }
2158 | enum_decl '{' enumerator_list error { $$ = MkEnum($1, $3); $$.loc = @$; POP_DEFAULT_ACCESS }
2159 | enum_decl '{' error { $$ = MkEnum($1, null); $$.loc = @$; POP_DEFAULT_ACCESS }
2160 | enum_decl '{' enumerator_list ';' struct_declaration_list { $$ = MkEnum($1, $3); $$.definitions = $5; $$.loc = @$; POP_DEFAULT_ACCESS }
2161 | enum_decl '{' enumerator_list ';' struct_declaration_list_error { $$ = MkEnum($1, $3); $$.definitions = $5; $$.loc = @$; POP_DEFAULT_ACCESS }
2169 class_specifier_error:
2171 | struct_class_error
2175 ext_decl { $$ = MkSpecifierExtended($1); }
2179 CONST { $$ = MkSpecifier(CONST); }
2180 | VOLATILE { $$ = MkSpecifier(VOLATILE); }
2181 | ext_storage { $$ = $1; }
2185 type_qualifier_list:
2186 type_qualifier { $$ = MkList(); ListAdd($$, $1); }
2187 | type_qualifier_list type_qualifier { $$ = $1; ListAdd($1, $2); }
2191 VOID { $$ = MkSpecifier(VOID); }
2192 | CHAR { $$ = MkSpecifier(CHAR); }
2193 | SHORT { $$ = MkSpecifier(SHORT); }
2194 | INT { $$ = MkSpecifier(INT); }
2195 | UINT { $$ = MkSpecifier(UINT); }
2196 | INT64 { $$ = MkSpecifier(INT64); }
2197 | VALIST { $$ = MkSpecifier(VALIST); }
2198 | LONG { $$ = MkSpecifier(LONG); }
2199 | FLOAT { $$ = MkSpecifier(FLOAT); }
2200 | DOUBLE { $$ = MkSpecifier(DOUBLE); }
2201 | SIGNED { $$ = MkSpecifier(SIGNED); }
2202 | UNSIGNED { $$ = MkSpecifier(UNSIGNED); }
2203 | EXTENSION { $$ = MkSpecifier(EXTENSION); }
2204 | struct_or_union_specifier_nocompound
2205 | enum_specifier_nocompound
2207 | TYPEOF '(' assignment_expression ')' { $$ = MkSpecifierTypeOf($3); }
2208 | SUBCLASS '(' type ')' { $$ = MkSpecifierSubClass($3); }
2209 | SUBCLASS '(' identifier ')' { _DeclClass(0, $3.string); $$ = MkSpecifierSubClass(MkSpecifierName($3.string)); FreeIdentifier($3); }
2210 | THISCLASS { $$ = MkSpecifier(THISCLASS); }
2211 | TYPED_OBJECT { $$ = MkSpecifier(TYPED_OBJECT); }
2212 | ANY_OBJECT { $$ = MkSpecifier(ANY_OBJECT); }
2215 strict_type_specifier:
2216 VOID { $$ = MkSpecifier(VOID); }
2217 | CHAR { $$ = MkSpecifier(CHAR); }
2218 | SHORT { $$ = MkSpecifier(SHORT); }
2219 | INT { $$ = MkSpecifier(INT); }
2220 | UINT { $$ = MkSpecifier(UINT); }
2221 | INT64 { $$ = MkSpecifier(INT64); }
2222 | VALIST { $$ = MkSpecifier(VALIST); }
2223 | LONG { $$ = MkSpecifier(LONG); }
2224 | FLOAT { $$ = MkSpecifier(FLOAT); }
2225 | DOUBLE { $$ = MkSpecifier(DOUBLE); }
2226 | SIGNED { $$ = MkSpecifier(SIGNED); }
2227 | UNSIGNED { $$ = MkSpecifier(UNSIGNED); }
2228 | EXTENSION { $$ = MkSpecifier(EXTENSION); }
2229 | struct_or_union_specifier_nocompound
2230 | enum_specifier_nocompound
2232 | TYPEOF '(' assignment_expression ')' { $$ = MkSpecifierTypeOf($3); }
2233 | SUBCLASS '(' type ')' { $$ = MkSpecifierSubClass($3); }
2234 | SUBCLASS '(' identifier ')' { _DeclClass(0, $3.string); $$ = MkSpecifierSubClass(MkSpecifierName($3.string)); FreeIdentifier($3); }
2235 | THISCLASS { $$ = MkSpecifier(THISCLASS); }
2238 // TESTING declarator_nofunction here... For function declarations
2241 declarator_nofunction_type_ok
2242 { $$ = MkStructDeclarator($1, null); $$.loc = @$; }
2243 | declarator_nofunction_type_ok attrib
2244 { $$ = MkStructDeclarator($1, null); $$.structDecl.attrib = $2; $$.loc = @$; }
2245 | ':' constant_expression
2246 { $$ = MkStructDeclarator(null, $2); $$.loc = @$; }
2247 | declarator_nofunction_type_ok ':' constant_expression
2248 { $$ = MkStructDeclarator($1, $3); $$.loc = @$; }
2249 | declarator_nofunction_type_ok ':' constant_expression ':' constant_expression
2250 { $$ = MkStructDeclarator($1, $3); $$.structDecl.posExp = $5; $$.loc = @$; }
2251 | ':' constant_expression_error
2252 { $$ = MkStructDeclarator(null, $2); $$.loc = @$; }
2253 | declarator_nofunction_type_ok ':' constant_expression_error
2254 { $$ = MkStructDeclarator($1, $3); $$.loc = @$; }
2255 | declarator_nofunction_type_ok ':' constant_expression ':' constant_expression_error
2256 { $$ = MkStructDeclarator($1, $3); $$.structDecl.posExp = $5; $$.loc = @$; }
2257 | declarator_nofunction_type_ok ':' constant_expression_error ':' constant_expression_error
2258 { $$ = MkStructDeclarator($1, $3); $$.structDecl.posExp = $5; $$.loc = @$; }
2259 | declarator_nofunction_type_ok ':' constant_expression_error ':' constant_expression
2260 { $$ = MkStructDeclarator($1, $3); $$.structDecl.posExp = $5; $$.loc = @$; }
2263 struct_declarator_list:
2264 struct_declarator { $$ = MkList(); ListAdd($$, $1); }
2265 | struct_declarator_list ',' struct_declarator { $$ = $1; ListAdd($1, $3); }
2269 struct_or_union identifier
2271 $$ = MkStructOrUnion($1, $2, null);
2272 $$.addNameSpace = true;
2273 $$.ctx = PushContext();
2275 | struct_or_union base_strict_type
2277 $$ = MkStructOrUnion($1, MkIdentifier($2.name), null);
2278 $$.ctx = PushContext();
2281 | struct_or_union ext_decl identifier
2283 $$ = MkStructOrUnion($1, $3, null);
2284 $$.extDeclStruct = $2;
2285 $$.addNameSpace = true;
2286 $$.ctx = PushContext();
2288 | struct_or_union ext_decl base_strict_type
2290 $$ = MkStructOrUnion($1, MkIdentifier($3.name), null);
2291 $$.extDeclStruct = $2;
2292 $$.ctx = PushContext();
2297 struct_or_union_specifier_compound:
2298 struct_or_union_specifier_compound_error '}' { $$ = $1; $$.loc = @$; }
2299 | struct_entry '{' '}' { $$ = $1; $$.loc = @$; POP_DEFAULT_ACCESS PopContext(curContext); }
2300 | struct_or_union '{' '}' { $$ = MkStructOrUnion($1, null, null); $$.loc = @$; POP_DEFAULT_ACCESS }
2301 | struct_or_union ext_decl '{' '}' { $$ = MkStructOrUnion($1, null, null); $$.extDeclStruct = $2; $$.loc = @$; POP_DEFAULT_ACCESS }
2304 struct_or_union_specifier_compound_error:
2305 struct_entry '{' struct_declaration_list { $$ = $1; AddStructDefinitions($1, $3); POP_DEFAULT_ACCESS PopContext(curContext); }
2306 | struct_entry '{' struct_declaration_list_error { $$ = $1; AddStructDefinitions($1, $3); POP_DEFAULT_ACCESS PopContext(curContext); }
2307 | struct_entry '{' error { $$ = $1; POP_DEFAULT_ACCESS PopContext(curContext); }
2309 | struct_or_union '{' struct_declaration_list { $$ = MkStructOrUnion($1, null, $3); POP_DEFAULT_ACCESS }
2310 | struct_or_union '{' struct_declaration_list_error { $$ = MkStructOrUnion($1, null, $3); POP_DEFAULT_ACCESS }
2311 | struct_or_union '{' error { $$ = MkStructOrUnion($1, null, null); POP_DEFAULT_ACCESS }
2313 | struct_or_union ext_decl '{' struct_declaration_list { $$ = MkStructOrUnion($1, null, $4); $$.extDeclStruct = $2; POP_DEFAULT_ACCESS }
2314 | struct_or_union ext_decl '{' struct_declaration_list_error { $$ = MkStructOrUnion($1, null, $4); $$.extDeclStruct = $2; POP_DEFAULT_ACCESS }
2315 | struct_or_union ext_decl '{' error { $$ = MkStructOrUnion($1, null, null); $$.extDeclStruct = $2; POP_DEFAULT_ACCESS }
2318 struct_or_union_specifier_nocompound:
2319 struct_entry { $$ = $1; POP_DEFAULT_ACCESS PopContext(curContext); }
2328 ($1.addNameSpace ? DeclClassAddNameSpace : DeclClass)(globalContext.nextID++, $1.id.string);
2331 | struct_entry '<' template_parameters_list '>'
2333 Symbol symbol = ($1.addNameSpace ? DeclClassAddNameSpace : DeclClass)(globalContext.nextID++, $1.id.string);
2335 symbol.templateParams = $3;
2340 struct_decl ':' inheritance_specifiers
2344 SetupBaseSpecs(null, $3);
2349 struct_class_error '}' { $$ = $1; $$.loc = @$; }
2350 | struct_head '{' '}'
2351 { $$ = $1; POP_DEFAULT_ACCESS PopContext(curContext); }
2352 | struct_decl '{' '}' { $$ = $1; POP_DEFAULT_ACCESS PopContext(curContext); }
2353 | struct_or_union '{' '}' { $$ = MkStructOrUnion($1, null, null); POP_DEFAULT_ACCESS }
2357 struct_head '{' struct_declaration_list
2360 $$.definitions = $3;
2362 PopContext(curContext);
2364 | struct_head '{' struct_declaration_list_error
2367 $$.definitions = $3;
2369 PopContext(curContext);
2371 | struct_head '{' error
2372 { $$ = $1; POP_DEFAULT_ACCESS PopContext(curContext);}
2374 | struct_decl '{' struct_declaration_list
2376 PopContext(curContext);
2379 $$ = MkStructOrUnion($1.type, $1.id, $3);
2384 $$.definitions = $3;
2387 | struct_decl '{' struct_declaration_list_error
2389 PopContext(curContext);
2393 $$ = MkStructOrUnion($1.type, $1.id, $3);
2398 $$.definitions = $3;
2401 | struct_decl '{' error
2402 { $$ = $1; POP_DEFAULT_ACCESS PopContext(curContext); }
2404 | struct_or_union '{' struct_declaration_list
2405 { $$ = MkStructOrUnion($1, null, $3); POP_DEFAULT_ACCESS }
2406 | struct_or_union '{' struct_declaration_list_error
2407 { $$ = MkStructOrUnion($1, null, $3); POP_DEFAULT_ACCESS }
2408 | struct_or_union '{' error
2409 { $$ = MkStructOrUnion($1, null, null); POP_DEFAULT_ACCESS }
2413 STRUCT { $$ = structSpecifier; memberAccessStack[++defaultMemberAccess] = publicAccess; }
2414 | UNION { $$ = unionSpecifier; memberAccessStack[++defaultMemberAccess] = publicAccess; }
2417 specifier_qualifier_list:
2418 type_qualifier { $$ = MkList(); ListAdd($$, $1); }
2419 | specifier_qualifier_list type_qualifier { $$ = $1; ListAdd($1, $2); }
2420 | type_specifier { $$ = MkList(); ListAdd($$, $1); }
2421 | specifier_qualifier_list type_specifier { $$ = $1; ListAdd($1, $2); }
2422 | enum_specifier_compound { $$ = MkList(); ListAdd($$, $1); }
2423 | specifier_qualifier_list enum_specifier_compound { $$ = $1; ListAdd($1, $2); }
2424 | struct_or_union_specifier_compound { $$ = MkList(); ListAdd($$, $1); }
2425 | specifier_qualifier_list struct_or_union_specifier_compound { $$ = $1; ListAdd($1, $2); }
2428 guess_specifier_qualifier_list:
2429 type_qualifier { $$ = MkList(); ListAdd($$, $1); }
2430 | guess_specifier_qualifier_list type_qualifier { $$ = $1; ListAdd($1, $2); }
2431 | type_specifier { $$ = MkList(); ListAdd($$, $1); }
2432 | guess_specifier_qualifier_list type_specifier { $$ = $1; ListAdd($1, $2); }
2433 | guess_type { $$ = MkList(); ListAdd($$, $1); }
2434 | guess_specifier_qualifier_list guess_type { $$ = $1; ListAdd($1, $2); }
2435 | enum_specifier_compound { $$ = MkList(); ListAdd($$, $1); }
2436 | guess_specifier_qualifier_list enum_specifier_compound { $$ = $1; ListAdd($1, $2); }
2437 | struct_or_union_specifier_compound { $$ = MkList(); ListAdd($$, $1); }
2438 | guess_specifier_qualifier_list struct_or_union_specifier_compound { $$ = $1; ListAdd($1, $2); }
2441 declaration_specifiers:
2442 storage_class_specifier { $$ = MkList(); ListAdd($$, $1); }
2443 | declaration_specifiers storage_class_specifier { $$ = $1; ListAdd($1, $2); }
2444 | type_qualifier { $$ = MkList(); ListAdd($$, $1); }
2445 | declaration_specifiers type_qualifier { $$ = $1; ListAdd($1, $2); }
2446 | strict_type_specifier { $$ = MkList(); ListAdd($$, $1); }
2447 | declaration_specifiers strict_type_specifier { $$ = $1; ListAdd($1, $2); }
2448 | enum_specifier_compound { $$ = MkList(); ListAdd($$, $1); }
2449 | declaration_specifiers enum_specifier_compound { $$ = $1; ListAdd($1, $2); }
2450 | struct_or_union_specifier_compound { $$ = MkList(); ListAdd($$, $1); }
2451 | declaration_specifiers struct_or_union_specifier_compound { $$ = $1; ListAdd($1, $2); }
2454 guess_declaration_specifiers:
2455 storage_class_specifier { $$ = MkList(); ListAdd($$, $1); }
2456 | guess_declaration_specifiers storage_class_specifier { $$ = $1; ListAdd($1, $2); }
2457 | type_qualifier { $$ = MkList(); ListAdd($$, $1); }
2458 | guess_declaration_specifiers type_qualifier { $$ = $1; ListAdd($1, $2); }
2459 | type_specifier { $$ = MkList(); ListAdd($$, $1); }
2460 | guess_declaration_specifiers type_specifier { $$ = $1; ListAdd($1, $2); }
2461 | guess_type { $$ = MkList(); ListAdd($$, $1); }
2462 | guess_declaration_specifiers guess_type { $$ = $1; ListAdd($1, $2); }
2463 | struct_or_union_specifier_compound { $$ = MkList(); ListAdd($$, $1); }
2464 | guess_declaration_specifiers struct_or_union_specifier_compound { $$ = $1; ListAdd($1, $2); }
2465 | enum_specifier_compound { $$ = MkList(); ListAdd($$, $1); }
2466 | guess_declaration_specifiers enum_specifier_compound { $$ = $1; ListAdd($1, $2); }
2469 external_guess_declaration_specifiers:
2470 external_storage_class_specifier { $$ = MkList(); ListAdd($$, $1); }
2471 | external_guess_declaration_specifiers external_storage_class_specifier { $$ = $1; ListAdd($1, $2); }
2472 | type_qualifier { $$ = MkList(); ListAdd($$, $1); }
2473 | external_guess_declaration_specifiers type_qualifier { $$ = $1; ListAdd($1, $2); }
2474 | type_specifier { $$ = MkList(); ListAdd($$, $1); }
2475 | external_guess_declaration_specifiers type_specifier { $$ = $1; ListAdd($1, $2); }
2476 | guess_type { $$ = MkList(); ListAdd($$, $1); }
2477 | external_guess_declaration_specifiers guess_type { $$ = $1; ListAdd($1, $2); }
2478 | class_specifier { $$ = MkList(); ListAdd($$, $1); }
2479 | external_guess_declaration_specifiers class_specifier { $$ = $1; ListAdd($1, $2); }
2482 external_guess_declaration_specifiers_error:
2483 class_specifier_error { $$ = MkList(); ListAdd($$, $1); }
2484 | external_guess_declaration_specifiers class_specifier_error { $$ = $1; ListAdd($1, $2); }
2487 _inheritance_specifiers:
2488 PRIVATE { $$ = MkList(); ListAdd($$, MkSpecifier(PRIVATE)); }
2489 | PUBLIC { $$ = MkList(); ListAdd($$, MkSpecifier(PUBLIC)); }
2490 | storage_class_specifier { $$ = MkList(); ListAdd($$, $1); }
2491 | _inheritance_specifiers storage_class_specifier { $$ = $1; ListAdd($1, $2); }
2492 | type_qualifier { $$ = MkList(); ListAdd($$, $1); }
2493 | _inheritance_specifiers type_qualifier { $$ = $1; ListAdd($1, $2); }
2494 | strict_type_specifier { $$ = MkList(); ListAdd($$, $1); }
2495 | _inheritance_specifiers strict_type_specifier { $$ = $1; ListAdd($1, $2); }
2497 { _DeclClass(0, $1.string); $$ = MkListOne(MkSpecifierName($1.string)); FreeIdentifier($1); }
2498 | _inheritance_specifiers identifier { $$ = $1; _DeclClass(0, $2.string); ListAdd($1, MkSpecifierName($2.string)); FreeIdentifier($2); }
2500 | identifier '<' template_arguments_list '>'
2502 // if($1._class && !$1._class.name)
2506 strcpy(name, $1._class.name ? $1._class.name : "");
2508 strcat(name, $1.string);
2509 _DeclClass(0, name);
2512 _DeclClass(0, $1.string);
2515 ListAdd($$, MkSpecifierNameArgs($1.string, $3));
2518 | _inheritance_specifiers identifier '<' template_arguments_list '>'
2521 if($2._class && !$2._class.name)
2525 strcat(name, $2.string);
2526 _DeclClass(0, name);
2529 _DeclClass(0, $2.string);
2530 ListAdd($1, MkSpecifierNameArgs($2.string, $4));
2535 inheritance_specifiers:
2536 _inheritance_specifiers
2537 | struct_or_union { $$ = MkListOne(MkStructOrUnion($1, null, null)); POP_DEFAULT_ACCESS }
2540 property_specifiers:
2541 storage_class_specifier { $$ = MkList(); ListAdd($$, $1); }
2542 | property_specifiers storage_class_specifier { $$ = $1; ListAdd($1, $2); }
2543 | type_qualifier { $$ = MkList(); ListAdd($$, $1); }
2544 | property_specifiers type_qualifier { $$ = $1; ListAdd($1, $2); }
2545 | strict_type_specifier { $$ = MkList(); ListAdd($$, $1); }
2546 | property_specifiers strict_type_specifier { $$ = $1; ListAdd($1, $2); }
2547 | identifier { $$ = MkList(); ListAdd($$, MkSpecifierName($1.string)); FreeIdentifier($1)}
2548 | property_specifiers identifier { $$ = $1; ListAdd($1, MkSpecifierName($2.string)); FreeIdentifier($2)}
2549 | identifier '<' template_arguments_list '>'
2551 // if($1._class && !$1._class.name)
2555 strcpy(name, $1._class.name ? $1._class.name : "");
2557 strcat(name, $1.string);
2558 _DeclClass(0, name);
2561 _DeclClass(0, $1.string);
2564 ListAdd($$, MkSpecifierNameArgs($1.string, $3));
2567 | property_specifiers identifier '<' template_arguments_list '>'
2569 if($2._class && !$2._class.name)
2573 strcat(name, $2.string);
2574 _DeclClass(0, name);
2577 _DeclClass(0, $2.string);
2578 ListAdd($1, MkSpecifierNameArgs($2.string, $4));
2584 storage_class_specifier { $$ = MkList(); ListAdd($$, $1); }
2585 | renew_specifiers storage_class_specifier { $$ = $1; ListAdd($1, $2); }
2586 | type_qualifier { $$ = MkList(); ListAdd($$, $1); }
2587 | renew_specifiers type_qualifier { $$ = $1; ListAdd($1, $2); }
2588 | strict_type_specifier { $$ = MkList(); ListAdd($$, $1); }
2589 | renew_specifiers strict_type_specifier { $$ = $1; ListAdd($1, $2); }
2590 | struct_or_union_specifier_compound { $$ = MkList(); ListAdd($$, $1); }
2591 | renew_specifiers struct_or_union_specifier_compound { $$ = $1; ListAdd($1, $2); }
2592 | enum_specifier_compound { $$ = MkList(); ListAdd($$, $1); }
2593 | renew_specifiers enum_specifier_compound { $$ = $1; ListAdd($1, $2); }
2594 | identifier { $$ = MkList(); ListAdd($$, MkSpecifierName($1.string)); FreeIdentifier($1)}
2595 | renew_specifiers identifier { $$ = $1; ListAdd($1, MkSpecifierName($2.string)); FreeIdentifier($2)}
2596 | identifier '<' template_arguments_list '>'
2598 // if($1._class && !$1._class.name)
2602 strcpy(name, $1._class.name ? $1._class.name : "");
2604 strcat(name, $1.string);
2605 _DeclClass(0, name);
2608 _DeclClass(0, $1.string);
2611 ListAdd($$, MkSpecifierNameArgs($1.string, $3));
2614 | renew_specifiers identifier '<' template_arguments_list '>'
2616 if($2._class && !$2._class.name)
2620 strcat(name, $2.string);
2621 _DeclClass(0, name);
2624 _DeclClass(0, $2.string);
2625 ListAdd($1, MkSpecifierNameArgs($2.string, $4));
2631 storage_class_specifier { $$ = MkList(); ListAdd($$, $1); }
2632 | new_specifiers storage_class_specifier { $$ = $1; ListAdd($1, $2); }
2633 | type_qualifier { $$ = MkList(); ListAdd($$, $1); }
2634 | new_specifiers type_qualifier { $$ = $1; ListAdd($1, $2); }
2635 | strict_type_specifier { $$ = MkList(); ListAdd($$, $1); }
2636 | new_specifiers strict_type_specifier { $$ = $1; ListAdd($1, $2); }
2637 | struct_or_union_specifier_compound { $$ = MkList(); ListAdd($$, $1); }
2638 | new_specifiers struct_or_union_specifier_compound { $$ = $1; ListAdd($1, $2); }
2639 | enum_specifier_compound { $$ = MkList(); ListAdd($$, $1); }
2640 | new_specifiers enum_specifier_compound { $$ = $1; ListAdd($1, $2); }
2641 | identifier { $$ = MkList(); ListAdd($$, MkSpecifierName($1.string)); FreeIdentifier($1)}
2642 | new_specifiers identifier { $$ = $1; ListAdd($1, MkSpecifierName($2.string)); FreeIdentifier($2)}
2643 | identifier '<' template_arguments_list '>'
2645 // if($1._class && !$1._class.name)
2649 strcpy(name, $1._class.name ? $1._class.name : "");
2651 strcat(name, $1.string);
2652 _DeclClass(0, name);
2655 _DeclClass(0, $1.string);
2658 ListAdd($$, MkSpecifierNameArgs($1.string, $3));
2661 | new_specifiers identifier '<' template_arguments_list '>'
2663 if($2._class && !$2._class.name)
2667 strcat(name, $2.string);
2668 _DeclClass(0, name);
2671 _DeclClass(0, $2.string);
2672 ListAdd($1, MkSpecifierNameArgs($2.string, $4));
2677 identifier_list_error:
2678 identifier_list ',' error { $$ = $1; ListAdd($1, null); }
2679 | identifier_list_error ',' error { $$ = $1; ListAdd($1, null); }
2683 identifier { $$ = MkList(); ListAdd($$, MkTypeName(null, MkDeclaratorIdentifier($1))); }
2684 | identifier_list ',' identifier { $$ = $1; ListAdd($1, MkTypeName(null, MkDeclaratorIdentifier($3))); }
2685 | identifier_list_error ',' identifier { $$ = $1; ListAdd($1, MkTypeName(null, MkDeclaratorIdentifier($3))); }
2686 | parameter_list ',' identifier { $$ = $1; ListAdd($1, MkTypeName(null, MkDeclaratorIdentifier($3))); }
2687 | parameter_list_error ',' identifier { $$ = $1; ListAdd($1, MkTypeName(null, MkDeclaratorIdentifier($3))); }
2690 direct_declarator_nofunction_type_ok:
2691 direct_declarator_nofunction
2694 char * colon = RSearchString($1.name, "::", strlen($1.name), true, false);
2695 String s = colon ? colon + 2 : $1.name;
2696 $$ = MkDeclaratorIdentifier(MkIdentifier(s));
2699 | UINT { $$ = MkDeclaratorIdentifier(MkIdentifier("uint")); }
2700 // These rules need to be reviewed in lights of prototypes with types only...
2701 | base_strict_type '[' constant_expression ']'
2704 char * colon = RSearchString($1.name, "::", strlen($1.name), true, false);
2705 String s = colon ? colon + 2 : $1.name;
2706 decl = MkDeclaratorIdentifier(MkIdentifier(s));
2708 $$ = MkDeclaratorArray(decl, $3);
2710 | base_strict_type '[' constant_expression_error ']'
2713 char * colon = RSearchString($1.name, "::", strlen($1.name), true, false);
2714 String s = colon ? colon + 2 : $1.name;
2715 decl = MkDeclaratorIdentifier(MkIdentifier(s));
2717 $$ = MkDeclaratorArray(decl, $3);
2719 | base_strict_type '[' type ']'
2722 char * colon = RSearchString($1.name, "::", strlen($1.name), true, false);
2723 String s = colon ? colon + 2 : $1.name;
2724 decl = MkDeclaratorIdentifier(MkIdentifier(s));
2726 $$ = MkDeclaratorEnumArray(decl, $3);
2728 | base_strict_type '[' ']'
2731 char * colon = RSearchString($1.name, "::", strlen($1.name), true, false);
2732 String s = colon ? colon + 2 : $1.name;
2733 decl = MkDeclaratorIdentifier(MkIdentifier(s));
2735 $$ = MkDeclaratorEnumArray(decl, null);
2737 | direct_declarator_nofunction_type_ok '[' constant_expression ']' { $$ = MkDeclaratorArray($1, $3); }
2738 | direct_declarator_nofunction_type_ok '[' constant_expression_error ']' { $$ = MkDeclaratorArray($1, $3); }
2739 | direct_declarator_nofunction_type_ok '[' type ']' { $$ = MkDeclaratorEnumArray($1, $3); }
2740 | direct_declarator_nofunction_type_ok '[' ']' { $$ = MkDeclaratorArray($1, null); }
2743 direct_declarator_nofunction:
2744 identifier { $$ = MkDeclaratorIdentifier($1); }
2745 | '(' declarator ')' { $$ = MkDeclaratorBrackets($2); }
2746 | '(' ext_decl declarator ')' { $$ = MkDeclaratorBrackets(MkDeclaratorExtended($2, $3)); }
2747 | '(' declarator_type_ok ')' { $$ = MkDeclaratorBrackets($2); }
2748 | '(' ext_decl declarator_type_ok ')' { $$ = MkDeclaratorBrackets(MkDeclaratorExtended($2, $3)); }
2749 | direct_declarator_nofunction '[' constant_expression ']' { $$ = MkDeclaratorArray($1, $3); }
2750 | direct_declarator_nofunction '[' constant_expression_error ']' { $$ = MkDeclaratorArray($1, $3); }
2751 | direct_declarator_nofunction '[' type ']' { $$ = MkDeclaratorEnumArray($1, $3); }
2752 | direct_declarator_nofunction '[' ']' { $$ = MkDeclaratorArray($1, null); }
2755 direct_declarator_function_start:
2756 direct_declarator_nofunction '('
2759 direct_declarator_function:
2760 direct_declarator_function_start parameter_type_list ')' { $$ = MkDeclaratorFunction($1, $2); }
2761 | direct_declarator_function_start parameter_type_list_error ')' { $$ = MkDeclaratorFunction($1, $2); }
2762 | direct_declarator_function_start identifier_list ')' { $$ = MkDeclaratorFunction($1, $2); }
2763 | direct_declarator_function_start identifier_list_error ')' { $$ = MkDeclaratorFunction($1, $2); }
2764 | direct_declarator_function_start ')' { $$ = MkDeclaratorFunction($1, null); }
2767 // Tricky stuff here for overriding...
2768 direct_declarator_function_error:
2769 direct_declarator_function_start identifier_list_error
2771 $$ = MkDeclaratorFunction($1, $2);
2772 fileInput.Seek(@1.end.pos, start);
2774 resetScannerPos(&@1.end);
2775 @$.start = @1.start;
2778 | direct_declarator_function_start error
2780 $$ = MkDeclaratorFunction($1, null);
2781 fileInput.Seek(@1.end.pos, start);
2783 resetScannerPos(&@1.end);
2784 @$.start = @1.start;
2787 | direct_declarator_function_start parameter_list '('
2789 $$ = MkDeclaratorFunction($1, $2);
2790 fileInput.Seek(@1.end.pos, start);
2792 resetScannerPos(&@1.end);
2793 @$.start = @1.start;
2796 | direct_declarator_function_start guess_declaration_specifiers identifier '('
2798 $$ = MkDeclaratorFunction($1, null);
2799 fileInput.Seek(@1.end.pos, start);
2801 resetScannerPos(&@1.end);
2802 @$.start = @1.start;
2804 FreeList($2, FreeSpecifier);
2810 direct_declarator_function
2811 | direct_declarator_nofunction
2815 direct_declarator_function_start_type_ok:
2816 direct_declarator_nofunction_type_ok '('
2819 direct_declarator_function_type_ok:
2820 direct_declarator_function_start_type_ok parameter_type_list ')' { $$ = MkDeclaratorFunction($1, $2); }
2821 | direct_declarator_function_start_type_ok parameter_type_list_error ')' { $$ = MkDeclaratorFunction($1, $2); }
2822 | direct_declarator_function_start_type_ok identifier_list ')' { $$ = MkDeclaratorFunction($1, $2); }
2823 | direct_declarator_function_start_type_ok identifier_list_error ')' { $$ = MkDeclaratorFunction($1, $2); }
2824 | direct_declarator_function_start_type_ok ')' { $$ = MkDeclaratorFunction($1, null); }
2827 // Tricky stuff here for overriding...
2828 direct_declarator_function_error_type_ok:
2829 direct_declarator_function_start_type_ok identifier_list_error
2831 $$ = MkDeclaratorFunction($1, $2);
2832 fileInput.Seek(@1.end.pos, start);
2834 resetScannerPos(&@1.end);
2835 @$.start = @1.start;
2838 | direct_declarator_function_start_type_ok error
2840 $$ = MkDeclaratorFunction($1, null);
2841 fileInput.Seek(@1.end.pos, start);
2843 resetScannerPos(&@1.end);
2844 @$.start = @1.start;
2847 | direct_declarator_function_start_type_ok parameter_list '('
2849 $$ = MkDeclaratorFunction($1, $2);
2850 fileInput.Seek(@1.end.pos, start);
2852 resetScannerPos(&@1.end);
2853 @$.start = @1.start;
2856 | direct_declarator_function_start_type_ok guess_declaration_specifiers identifier '('
2858 $$ = MkDeclaratorFunction($1, null);
2859 fileInput.Seek(@1.end.pos, start);
2861 resetScannerPos(&@1.end);
2862 @$.start = @1.start;
2864 FreeList($2, FreeSpecifier);
2869 direct_declarator_type_ok:
2870 direct_declarator_function_type_ok
2871 | direct_declarator_nofunction_type_ok
2873 | ext_decl direct_declarator_function_type_ok
2874 { $$ = MkDeclaratorExtended($1, $2); }
2875 | ext_decl direct_declarator_nofunction_type_ok
2876 { $$ = MkDeclaratorExtended($1, $2); }
2881 ASM '(' STRING_LITERAL { $<string>$ = CopyString(yytext); } STRING_LITERAL { $<string>$ = CopyString(yytext); }
2884 strcpy(temp, "__asm__(");
2885 strcat(temp, $<string>4);
2887 strcat(temp, $<string>6);
2890 $<string>$ = CopyString(temp);
2895 EXT_DECL { $$ = MkExtDeclString(CopyString(yytext)); }
2896 | attrib { $$ = MkExtDeclAttrib($1);
2900 strcpy(temp, $<string>1);
2903 $$ = MkExtDeclString(CopyString(temp));
2905 | asm_start STRING_LITERAL { $$ = CopyString(yytext); } ')'
2908 strcpy(temp, $<string>1);
2910 strcat(temp, $<string>3);
2914 $$ = MkExtDeclString(CopyString(temp));
2920 EXT_DECL { $$ = MkExtDeclString(CopyString(yytext)); }
2921 | EXT_STORAGE { $$ = MkExtDeclString(CopyString(yytext)); }
2922 | attrib { $$ = MkExtDeclAttrib($1); }
2923 | ASM '(' string_literal ')'
2926 strcpy(temp, "__asm__(");
2929 $$ = MkExtDeclString(CopyString(temp));
2935 ATTRIB { $<i>$ = ATTRIB; }
2936 | ATTRIB_DEP { $<i>$ = ATTRIB_DEP; }
2937 | __ATTRIB { $<i>$ = __ATTRIB; }
2942 IDENTIFIER { $$ = CopyString(yytext); }
2943 | TYPE_NAME { $$ = CopyString(yytext); }
2944 | EXT_STORAGE { $$ = CopyString(yytext); }
2945 | EXT_DECL { $$ = CopyString(yytext); }
2946 | CONST { $$ = CopyString(yytext); }
2950 attribute_word { $$ = MkAttribute($1, null); $$.loc = @$; }
2951 | attribute_word '(' expression ')' { $$ = MkAttribute($1, MkExpBrackets($3)); $$.loc = @$; }
2955 attribute { $$ = MkListOne($1); }
2956 | attribs_list attribute { ListAdd($1, $2); $$ = $1; }
2957 | attribs_list ',' attribute { ListAdd($1, $3); $$ = $1; }
2961 _attrib '(' '(' attribs_list ')' ')' { $$ = MkAttrib($<i>1, $4); $$.loc = @$; }
2962 | _attrib '(' '(' ')' ')' { $$ = MkAttrib($<i>1, null); $$.loc = @$; }
2965 direct_abstract_declarator:
2966 '(' abstract_declarator ')' { $$ = MkDeclaratorBrackets($2); }
2967 | '(' ext_decl abstract_declarator ')' { $$ = MkDeclaratorBrackets(MkDeclaratorExtended($2, $3)); }
2968 | '[' ']' { $$ = MkDeclaratorArray(null, null); }
2969 | '[' constant_expression ']' { $$ = MkDeclaratorArray(null, $2); }
2970 | '[' constant_expression_error ']' { $$ = MkDeclaratorArray(null, $2); }
2971 | '[' type ']' { $$ = MkDeclaratorEnumArray(null, $2); }
2972 | direct_abstract_declarator '[' ']' { $$ = MkDeclaratorArray($1, null); }
2973 | direct_abstract_declarator '[' constant_expression ']' { $$ = MkDeclaratorArray($1, $3); }
2974 | direct_abstract_declarator '[' type']' { $$ = MkDeclaratorEnumArray($1, $3); }
2975 | direct_abstract_declarator '[' constant_expression_error ']' { $$ = MkDeclaratorArray($1, $3); }
2976 | '(' ')' { $$ = MkDeclaratorFunction(null, null); }
2977 | '(' parameter_type_list ')' { $$ = MkDeclaratorFunction(null, $2); }
2978 | '(' parameter_type_list_error ')' { $$ = MkDeclaratorFunction(null, $2); }
2979 | direct_abstract_declarator '(' ')' { $$ = MkDeclaratorFunction($1, null); }
2980 | direct_abstract_declarator '(' parameter_type_list ')' { $$ = MkDeclaratorFunction($1, $3); }
2981 | direct_abstract_declarator '(' parameter_type_list_error ')' { $$ = MkDeclaratorFunction($1, $3); }
2984 direct_abstract_declarator_noarray:
2985 '(' abstract_declarator_noarray ')' { $$ = MkDeclaratorBrackets($2); }
2986 | '(' ext_decl abstract_declarator_noarray ')' { $$ = MkDeclaratorBrackets(MkDeclaratorExtended($2, $3)); }
2987 | '(' ')' { $$ = MkDeclaratorFunction(null, null); }
2988 | '(' parameter_type_list ')' { $$ = MkDeclaratorFunction(null, $2); }
2989 | '(' parameter_type_list_error ')' { $$ = MkDeclaratorFunction(null, $2); }
2990 | direct_abstract_declarator_noarray '(' ')' { $$ = MkDeclaratorFunction($1, null); }
2991 | direct_abstract_declarator_noarray '(' parameter_type_list ')' { $$ = MkDeclaratorFunction($1, $3); }
2992 | direct_abstract_declarator_noarray '(' parameter_type_list_error ')' { $$ = MkDeclaratorFunction($1, $3); }
2996 '*' { $$ = MkPointer(null, null); }
2997 | '*' type_qualifier_list { $$ = MkPointer($2, null); }
2998 | '*' pointer { $$ = MkPointer(null, $2); }
2999 | '*' type_qualifier_list pointer { $$ = MkPointer($2, $3); }
3002 abstract_declarator:
3003 pointer { $$ = MkDeclaratorPointer($1, null); }
3004 | direct_abstract_declarator
3005 | pointer direct_abstract_declarator { $$ = MkDeclaratorPointer($1, $2); }
3006 | ext_decl pointer { $$ = MkDeclaratorExtended($1, MkDeclaratorPointer($2, null)); }
3007 | ext_decl pointer direct_abstract_declarator { $$ = MkDeclaratorExtended($1, MkDeclaratorPointer($2, $3)); }
3010 abstract_declarator_noarray:
3011 pointer { $$ = MkDeclaratorPointer($1, null); }
3012 | direct_abstract_declarator_noarray
3013 | pointer direct_abstract_declarator_noarray { $$ = MkDeclaratorPointer($1, $2); }
3014 | ext_decl pointer { $$ = MkDeclaratorExtended($1, MkDeclaratorPointer($2, null)); }
3015 | ext_decl pointer direct_abstract_declarator_noarray { $$ = MkDeclaratorExtended($1, MkDeclaratorPointer($2, $3)); }
3020 | pointer direct_declarator
3021 { $$ = MkDeclaratorPointer($1, $2); }
3022 | ext_decl pointer direct_declarator
3023 { $$ = MkDeclaratorExtended($1, MkDeclaratorPointer($2, $3)); }
3024 | declarator ext_decl
3025 { $$ = MkDeclaratorExtendedEnd($2, $1); }
3026 | declarator_nofunction_type_ok ext_decl
3027 { $$ = MkDeclaratorExtendedEnd($2, $1); }
3031 direct_declarator_type_ok
3032 | pointer direct_declarator_type_ok
3033 { $$ = MkDeclaratorPointer($1, $2); }
3034 | ext_decl pointer direct_declarator_type_ok
3035 { $$ = MkDeclaratorExtended($1, MkDeclaratorPointer($2, $3)); }
3036 | declarator_type_ok ext_decl
3037 { $$ = MkDeclaratorExtendedEnd($2, $1); }
3040 declarator_function:
3041 direct_declarator_function
3042 | pointer direct_declarator_function { $$ = MkDeclaratorPointer($1, $2); }
3043 | ext_decl pointer direct_declarator_function { $$ = MkDeclaratorExtended($1, MkDeclaratorPointer($2, $3)); }
3044 | pointer ext_decl direct_declarator_function { $$ = MkDeclaratorPointer($1, MkDeclaratorExtended($2, $3)); }
3047 declarator_function_error:
3048 direct_declarator_function_error
3049 | pointer direct_declarator_function_error { $$ = MkDeclaratorPointer($1, $2); }
3050 | ext_decl pointer direct_declarator_function_error { $$ = MkDeclaratorExtended($1, MkDeclaratorPointer($2, $3)); }
3051 | pointer ext_decl direct_declarator_function_error { $$ = MkDeclaratorPointer($1, MkDeclaratorExtended($2, $3)); }
3054 declarator_function_type_ok:
3055 direct_declarator_function_type_ok
3056 | pointer direct_declarator_function_type_ok { $$ = MkDeclaratorPointer($1, $2); }
3057 | ext_decl pointer direct_declarator_function_type_ok { $$ = MkDeclaratorExtended($1, MkDeclaratorPointer($2, $3)); }
3058 | pointer ext_decl direct_declarator_function_type_ok { $$ = MkDeclaratorPointer($1, MkDeclaratorExtended($2, $3)); }
3061 declarator_function_error_type_ok:
3062 direct_declarator_function_error_type_ok
3063 | pointer direct_declarator_function_error_type_ok { $$ = MkDeclaratorPointer($1, $2); }
3064 | ext_decl pointer direct_declarator_function_error_type_ok { $$ = MkDeclaratorExtended($1, MkDeclaratorPointer($2, $3)); }
3065 | pointer ext_decl direct_declarator_function_error_type_ok { $$ = MkDeclaratorPointer($1, MkDeclaratorExtended($2, $3)); }
3068 declarator_nofunction_type_ok:
3069 direct_declarator_nofunction_type_ok
3070 | pointer direct_declarator_nofunction_type_ok { $$ = MkDeclaratorPointer($1, $2); }
3071 | ext_decl pointer direct_declarator_nofunction_type_ok { $$ = MkDeclaratorExtended($1, MkDeclaratorPointer($2, $3)); }
3072 | pointer ext_decl direct_declarator_nofunction_type_ok { $$ = MkDeclaratorPointer($1, MkDeclaratorExtended($2, $3)); }
3076 assignment_expression { $$ = MkInitializerAssignment($1); $$.loc = @$; }
3077 | '{' initializer_list '}' { $$ = MkInitializerList($2); $$.loc = @$; }
3078 | '{' initializer_list ',' '}'
3080 $$ = MkInitializerList($2);
3084 Expression exp = MkExpDummy();
3085 Initializer init = MkInitializerAssignment(exp);
3094 assignment_expression_error { $$ = MkInitializerAssignment($1); $$.loc = @$; }
3095 | '{' initializer_list '}' error { $$ = MkInitializerList($2); $$.loc = @$; }
3096 | '{' initializer_list { $$ = MkInitializerList($2); $$.loc = @$; }
3097 | '{' initializer_list ',' '}' error
3099 $$ = MkInitializerList($2);
3103 Expression exp = MkExpDummy();
3104 Initializer init = MkInitializerAssignment(exp);
3110 | '{' initializer_list ','
3112 $$ = MkInitializerList($2);
3116 Expression exp = MkExpDummy();
3117 Initializer init = MkInitializerAssignment(exp);
3125 initializer_condition:
3126 conditional_expression { $$ = MkInitializerAssignment($1); $$.loc = @$; }
3127 | anon_instantiation_expression
3128 { $$ = MkInitializerAssignment($1); $$.loc = @$; }
3131 initializer_condition_error:
3132 conditional_expression_error { $$ = MkInitializerAssignment($1); $$.loc = @$; }
3133 | anon_instantiation_expression_error { $$ = MkInitializerAssignment($1); $$.loc = @$; }
3137 initializer { $$ = MkList(); ListAdd($$, $1); }
3138 | initializer_error { $$ = MkList(); ListAdd($$, $1); }
3139 | initializer_list ',' initializer { $$ = $1; ListAdd($1, $3); }
3140 | initializer_list ',' initializer_error { $$ = $1; ListAdd($1, $3); }
3143 | initializer_list initializer { $$ = $1; ListAdd($1, $2); }
3144 | initializer_list initializer_error { $$ = $1; ListAdd($1, $2); }
3148 declarator { $$ = MkInitDeclarator($1, null); $$.loc = @$; }
3149 | declarator_type_ok { $$ = MkInitDeclarator($1, null); $$.loc = @$; }
3150 | declarator '=' initializer { $$ = MkInitDeclarator($1, $3); $$.loc = @$; $$.initializer.loc.start = @2.end; }
3153 init_declarator_error:
3154 declarator error { $$ = MkInitDeclarator($1, null); $$.loc = @$; }
3155 /* Useless rules due to conflicts
3156 | declarator '=' error { $$ = MkInitDeclarator($1, MkInitializerAssignment(MkExpDummy())); $$.loc = @$; $$.initializer.loc = @2; $$.initializer.exp.loc = @2; }
3158 | declarator '=' initializer_error { $$ = MkInitDeclarator($1, $3); $$.loc = @$; $$.initializer.loc.start = @2.end; }
3161 init_declarator_list:
3162 init_declarator { $$ = MkList(); ListAdd($$, $1); }
3163 | init_declarator_list ',' init_declarator { $$ = $1; ListAdd($1, $3); }
3164 | UINT ',' init_declarator { $$ = MkList(); ListAdd($$, MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier("uint")), null)); ListAdd($$, $3); }
3165 | INT64 ',' init_declarator { $$ = MkList(); ListAdd($$, MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier("int64")), null)); ListAdd($$, $3); }
3166 | base_strict_type ',' init_declarator
3168 char * colon = RSearchString($1.name, "::", strlen($1.name), true, false);
3169 String s = colon ? colon + 2 : $1.name;
3171 ListAdd($$, MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier(s)), null));
3175 | init_declarator_list_error ',' init_declarator { $$ = $1; ListAdd($1, $3); }
3176 /*| base_strict_type ',' init_declarator
3183 init_declarator_list_error:
3184 init_declarator_error { $$ = MkList(); ListAdd($$, $1); }
3185 | init_declarator error { $$ = MkList(); ListAdd($$, $1); }
3186 | init_declarator_list ',' init_declarator_error { $$ = $1; ListAdd($1, $3); }
3187 | init_declarator_list_error ',' init_declarator_error { $$ = $1; ListAdd($1, $3); }
3191 specifier_qualifier_list { $$ = MkTypeName($1, null); }
3192 | specifier_qualifier_list abstract_declarator { $$ = MkTypeName($1, $2); }
3196 guess_specifier_qualifier_list { $$ = MkTypeName($1, null); }
3197 | guess_specifier_qualifier_list abstract_declarator { $$ = MkTypeName($1, $2); }
3200 /*** PARAMETERS **********************************************************************/
3201 parameter_declaration:
3202 guess_declaration_specifiers declarator_type_ok { $$ = MkTypeName($1, $2); }
3203 | guess_declaration_specifiers abstract_declarator { $$ = MkTypeName($1, $2); }
3204 | guess_declaration_specifiers '&' { $$ = MkTypeName($1, MkDeclaratorPointer(MkPointer(null,null), null)); }
3205 | guess_declaration_specifiers '&' declarator_type_ok { $$ = MkTypeName($1, MkDeclaratorPointer(MkPointer(null,null), $3)); }
3206 | guess_declaration_specifiers { $$ = MkTypeNameGuessDecl($1, null); }
3208 { $$ = MkTypeName(MkListOne(MkSpecifier(CLASS)), null); }
3211 { $$ = MkTypeName(MkListOne(MkSpecifier(TYPED_OBJECT)), null); }
3213 { $$ = MkTypeName(MkListOne(MkSpecifier(TYPED_OBJECT)), MkDeclaratorPointer(MkPointer(null,null), null)); }
3214 | TYPED_OBJECT declarator
3215 { $$ = MkTypeName(MkListOne(MkSpecifier(TYPED_OBJECT)), $2); }
3216 | TYPED_OBJECT '&' declarator
3217 { $$ = MkTypeName(MkListOne(MkSpecifier(TYPED_OBJECT)), MkDeclaratorPointer(MkPointer(null,null), $3)); }
3219 { $$ = MkTypeName(MkListOne(MkSpecifier(ANY_OBJECT)), null); }
3220 | ANY_OBJECT declarator
3221 { $$ = MkTypeName(MkListOne(MkSpecifier(ANY_OBJECT)), $2); }
3225 parameter_declaration_error:
3226 guess_declaration_specifiers declarator_type_ok error { $$ = MkTypeName($1, $2); }
3227 | guess_declaration_specifiers abstract_declarator error { $$ = MkTypeName($1, $2); }
3231 parameter_declaration { $$ = MkList(); ListAdd($$, $1); }
3232 | parameter_list ',' parameter_declaration { $$ = $1; ListAdd($1, $3); }
3233 | parameter_list error ',' parameter_declaration { $$ = $1; ListAdd($1, $4); }
3234 | parameter_list_error ',' parameter_declaration { $$ = $1; ListAdd($1, $3); }
3235 | parameter_list_error error ',' parameter_declaration { $$ = $1; ListAdd($1, $4); }
3236 | error ',' parameter_declaration { $$ = MkList(); ListAdd($$, MkTypeName(MkList(), null)); ListAdd($$, $3); }
3238 | identifier_list ',' parameter_declaration { $$ = $1; ListAdd($1, $3); }
3239 | identifier_list error ',' parameter_declaration { $$ = $1; ListAdd($1, $4); }
3240 | identifier_list_error ',' parameter_declaration { $$ = $1; ListAdd($1, $3); }
3241 | identifier_list_error error ',' parameter_declaration { $$ = $1; ListAdd($1, $4); }
3244 parameter_list_error:
3245 parameter_declaration_error { $$ = MkList(); ListAdd($$, $1); }
3246 | parameter_list ',' parameter_declaration_error { $$ = $1; ListAdd($1, $3); }
3247 | parameter_list_error ',' parameter_declaration_error { $$ = $1; ListAdd($1, $3); }
3248 | parameter_list_error error ',' parameter_declaration_error { $$ = $1; ListAdd($1, $4); }
3249 | error ',' parameter_declaration_error { $$ = MkList(); ListAdd($$, MkTypeName(MkList(), null)); ListAdd($$, $3); }
3251 | identifier_list ',' parameter_declaration_error { $$ = $1; ListAdd($1, $3); }
3252 | identifier_list_error ',' parameter_declaration_error { $$ = $1; ListAdd($1, $3); }
3253 | identifier_list_error error ',' parameter_declaration_error { $$ = $1; ListAdd($1, $4); }
3256 parameter_type_list:
3258 | parameter_list ',' ELLIPSIS { $$ = $1; ListAdd($1, MkTypeName(null, null)); }
3259 | parameter_list_error ',' ELLIPSIS { $$ = $1; ListAdd($1, MkTypeName(null, null)); }
3260 | identifier_list ',' ELLIPSIS { $$ = $1; ListAdd($1, MkTypeName(null, null)); }
3261 | identifier_list_error ',' ELLIPSIS { $$ = $1; ListAdd($1, MkTypeName(null, null)); }
3262 | error ',' ELLIPSIS { $$ = MkList(); ListAdd($$, MkTypeName(null, null)); }
3265 parameter_type_list_error:
3266 parameter_list_error
3267 | parameter_list ',' error { $$ = $1; ListAdd($1, null); }
3268 | parameter_list_error error
3271 /****** STATEMENTS *******************************************************************/
3274 | attrib { $$ = MkExpressionStmt(null); FreeAttrib($1); } // Ignoring this for now... ( For __attribute__ ((__unused__)) )
3275 | compound_statement
3276 | ';' { $$ = MkExpressionStmt(null); }
3277 | ':' { $$ = MkExpressionStmt(null); }
3278 | expression ';' { $$ = MkExpressionStmt($1); $$.loc = @$; }
3279 | selection_statement
3280 | iteration_statement
3285 | watch_definition ';'
3289 labeled_statement_error { $$ = $1; Compiler_Error($"syntax error\n"); }
3290 | iteration_statement_error { $$ = $1; Compiler_Error($"syntax error\n"); }
3291 | compound_statement_error { $$ = $1; Compiler_Error($"syntax error\n"); }
3292 | selection_statement_error { $$ = $1; Compiler_Error($"syntax error\n"); }
3293 | jump_statement_error { $$ = $1; Compiler_Error($"syntax error\n"); }
3294 | jump_statement error { $$ = $1; Compiler_Error($"syntax error\n"); }
3295 | expression_error { $$ = MkExpressionStmt($1); Compiler_Error($"syntax error\n"); $$.loc = @1; }
3299 string_literal { $$ = MkAsmField($1, null); $$.loc = @1; }
3300 | string_literal '(' assignment_expression ')' { $$ = MkAsmField($1, $3); $$.loc = @$; }
3304 asm_field { $$ = MkListOne($1); }
3305 | asm_field_list ',' asm_field { ListAdd($$, $3); }
3310 ASM type_qualifier '(' string_literal ')' ';' { $$ = MkAsmStmt($2, $4, null, null, null); $$.loc = @$; }
3311 | ASM type_qualifier '(' string_literal ':' asm_field_list ')' ';' { $$ = MkAsmStmt($2, $4, $6, null, null); $$.loc = @$; }
3312 | ASM type_qualifier '(' string_literal ':' asm_field_list ':' asm_field_list ')' ';' { $$ = MkAsmStmt($2, $4, $6, $8, null); $$.loc = @$; }
3313 | ASM type_qualifier '(' string_literal ':' asm_field_list ':' asm_field_list ':' asm_field_list ')' ';' { $$ = MkAsmStmt($2, $4, $6, $8, $10); $$.loc = @$; }
3315 | ASM type_qualifier '(' string_literal IDENTIFIER asm_field_list ')' ';' { $$ = MkAsmStmt($2, $4, null, $6, null); $$.loc = @$; }
3316 | ASM type_qualifier '(' string_literal IDENTIFIER asm_field_list ':' asm_field_list ')' ';' { $$ = MkAsmStmt($2, $4, null, $6, $8); $$.loc = @$; }
3317 | ASM type_qualifier '(' string_literal ':' asm_field_list IDENTIFIER asm_field_list ')' ';' { $$ = MkAsmStmt($2, $4, $6, null, $8); $$.loc = @$; }
3319 | ASM '(' string_literal ')' ';' { $$ = MkAsmStmt(null, $3, null, null, null); $$.loc = @$; }
3320 | ASM '(' string_literal ':' asm_field_list ')' ';' { $$ = MkAsmStmt(null, $3, $5, null, null); $$.loc = @$; }
3321 | ASM '(' string_literal ':' asm_field_list ':' asm_field_list ')' ';' { $$ = MkAsmStmt(null, $3, $5, $7, null); $$.loc = @$; }
3322 | ASM '(' string_literal ':' asm_field_list ':' asm_field_list ':' asm_field_list ')' ';' { $$ = MkAsmStmt(null, $3, $5, $7, $9); $$.loc = @$; }
3324 | ASM '(' string_literal IDENTIFIER asm_field_list ')' ';' { $$ = MkAsmStmt(null, $3, null, $5, null); $$.loc = @$; }
3325 | ASM '(' string_literal IDENTIFIER asm_field_list ':' asm_field_list ')' ';' { $$ = MkAsmStmt(null, $3, null, $5, $7); $$.loc = @$; }
3326 | ASM '(' string_literal ':' asm_field_list IDENTIFIER asm_field_list ')' ';' { $$ = MkAsmStmt(null, $3, $5, null, $7); $$.loc = @$; }
3330 identifier ':' statement { $$ = MkLabeledStmt($1, $3); $$.loc = @$; }
3331 | CASE constant_expression ':' statement { $$ = MkCaseStmt($2, $4); $$.loc = @$; $2.loc.start = @1.end; }
3332 | CASE constant_expression_error ':' statement { $$ = MkCaseStmt($2, $4); $$.loc = @$; $2.loc.start = @1.end; }
3333 | CASE ':' statement { $$ = MkCaseStmt(MkExpDummy(), $3); $$.caseStmt.exp.loc = @2; $$.loc = @$; $$.caseStmt.exp.loc.start = @1.end; }
3334 | DEFAULT ':' statement { $$ = MkCaseStmt(null, $3); $$.loc = @$; }
3337 labeled_statement_error
3338 : identifier ':' statement_error { $$ = MkLabeledStmt($1, $3); $$.loc = @$; }
3339 | CASE constant_expression ':' statement_error { $$ = MkCaseStmt($2, $4); $$.loc = @$; $2.loc.start = @1.end; }
3340 | CASE constant_expression_error ':' statement_error { $$ = MkCaseStmt($2, $4); $$.loc = @$; $2.loc.start = @1.end; }
3341 | CASE ':' statement_error { $$ = MkCaseStmt(MkExpDummy(), $3); $$.caseStmt.exp.loc = @2; $$.loc = @$; $$.caseStmt.exp.loc.start = @1.end; }
3342 | CASE ':' { $$ = MkCaseStmt(MkExpDummy(), null); $$.caseStmt.exp.loc = @2; $$.loc = @$; $$.caseStmt.exp.loc.start = @1.end; }
3343 | DEFAULT ':' statement_error { $$ = MkCaseStmt(null, $3); $$.loc = @$; }
3344 | DEFAULT ':' { $$ = MkCaseStmt(null, null); $$.loc = @$; }
3348 PUBLIC { $$ = declMode = publicAccess; }
3349 | PRIVATE { $$ = declMode = privateAccess; }
3350 | DEFAULT { $$ = declMode = defaultAccess; }
3354 PUBLIC { $$ = publicAccess; }
3355 | PRIVATE { $$ = privateAccess; }
3359 declaration_specifiers ';' { $$ = MkDeclaration($1, null); $$.loc = @$; }
3360 | declaration_specifiers init_declarator_list ';' { $$ = MkDeclaration($1, $2); $$.loc = @$; }
3361 | instantiation_named ';' { $$ = MkDeclarationInst($1); $$.loc = @$; }
3362 | declaration_error ';' { $$ = $1; }
3365 external_guess_declaration:
3366 external_guess_declaration_specifiers ';' { $$ = MkDeclaration($1, null); $$.loc = @$; }
3367 | external_guess_declaration_specifiers init_declarator_list ';' { $$ = MkDeclaration($1, $2); $$.loc = @$; }
3368 | external_guess_declaration_specifiers_error init_declarator_list ';' { $$ = MkDeclaration($1, $2); $$.loc = @$; }
3370 | external_guess_instantiation_named ';' { $$ = MkDeclarationInst($1); $$.loc = @$; }
3371 | DEFINE identifier '=' conditional_expression ';' { $$ = MkDeclarationDefine($2, $4); $$.loc = @$; }
3372 | STATIC DEFINE identifier '=' conditional_expression ';' { declMode = staticAccess; $$ = MkDeclarationDefine($3, $5); $$.loc = @$; }
3375 external_guess_declaration_error:
3376 external_guess_declaration_specifiers error { $$ = MkDeclaration($1, null); $$.loc = @$; yyerrok; }
3380 declaration_specifiers error { $$ = MkDeclaration($1, null); $$.loc = @$; }
3381 | declaration_error error {}
3383 | instantiation_named_error error { $$ = MkDeclarationInst($1); $$.loc = @$; }
3384 | instantiation_named error { $$ = MkDeclarationInst($1); $$.loc = @$; }
3385 | declaration_specifiers init_declarator_list_error { $$ = MkDeclaration($1, $2); $$.loc = @$; }
3389 declaration { $$ = MkList(); ListAdd($$, $1); /*declMode = defaultDeclMode;*/ }
3390 | declaration_list declaration { $$ = $1; ListAdd($1, $2); /*declMode = defaultDeclMode; */}
3391 | declaration_list_error declaration { $$ = $1; ListAdd($1, $2); /*declMode = defaultDeclMode; */}
3392 | declaration_list error ';' { $$ = $1; }
3395 declaration_list_error:
3396 declaration_error { $$ = MkList(); ListAdd($$, $1); }
3397 | declaration_list declaration_error { $$ = $1; ListAdd($1, $2); }
3401 statement { $$ = MkList(); ListAdd($$, $1); }
3402 | statement_list statement { $$ = $1; ListAdd($1, $2); }
3403 | statement_list_error statement { $$ = $1; ListAdd($1, $2); }
3406 statement_list_error:
3407 statement_error { $$ = MkList(); ListAdd($$, $1); }
3408 | statement_list statement_error { $$ = $1; ListAdd($1, $2); }
3409 | statement_list_error statement_error { $$ = $1; ListAdd($1, $2); }
3410 | statement_list declaration { Statement stmt = MkBadDeclStmt($2); stmt.loc = @2; Compiler_Warning(C89_DECL_WARNING); $$ = $1; ListAdd($1, stmt); /*declMode = defaultDeclMode;*/ }
3411 | statement_list_error declaration { Statement stmt = MkBadDeclStmt($2); stmt.loc = @2; Compiler_Warning(C89_DECL_WARNING); $$ = $1; ListAdd($1, stmt); /*declMode = defaultDeclMode;*/ }
3412 | statement_list declaration_error { Statement stmt = MkBadDeclStmt($2); stmt.loc = @2; Compiler_Warning(C89_DECL_WARNING); $$ = $1; ListAdd($1, stmt); /*declMode = defaultDeclMode;*/ }
3413 | statement_list_error declaration_error { Statement stmt = MkBadDeclStmt($2); stmt.loc = @2; Compiler_Warning(C89_DECL_WARNING); $$ = $1; ListAdd($1, stmt); /*declMode = defaultDeclMode;*/ }
3417 statement_list { $$ = MkCompoundStmt(null, $1); }
3418 | declaration_list { $$ = MkCompoundStmt($1, null); }
3419 | declaration_list statement_list { $$ = MkCompoundStmt($1, $2); }
3420 | declaration_list_error statement_list { $$ = MkCompoundStmt($1, $2); }
3423 compound_inside_error:
3424 statement_list_error { $$ = MkCompoundStmt(null, $1); }
3425 | declaration_list_error { $$ = MkCompoundStmt($1, null); }
3426 | declaration_list statement_list_error { $$ = MkCompoundStmt($1, $2); }
3427 | declaration_list_error statement_list_error { $$ = MkCompoundStmt($1, $2); }
3431 '{' { $<context>$ = PushContext(); }
3435 compound_statement_error '}' { $$ = $1; $$.loc = @$; }
3438 compound_statement_error:
3439 compound_start compound_inside_error
3440 { $$ = $2; $$.compound.context = $<context>1; PopContext($<context>1); $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++; }
3442 { $$ = MkCompoundStmt(null, null); $$.compound.context = $<context>1; PopContext($<context>1); $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++; }
3444 | compound_start compound_inside
3445 { $$ = $2; $$.compound.context = $<context>1; PopContext($<context>1); $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++; }
3449 expression_statement:
3450 ';' { $$ = MkExpressionStmt(null); $$.loc = @$; }
3451 | expression ';' { $$ = MkExpressionStmt($1); $$.loc = @$; }
3452 | expression_error ';' { $$ = MkExpressionStmt($1); $$.loc = @$; }
3455 selection_statement:
3456 IF '(' expression ')' statement %prec IFX { $$ = MkIfStmt($3, $5, null); $$.loc = @$; }
3457 | IF '(' expression_error ')' statement %prec IFX { $$ = MkIfStmt($3, $5, null); $$.loc = @$; }
3458 | IF '(' expression ')' statement ELSE statement { $$ = MkIfStmt($3, $5, $7); $$.loc = @$; }
3459 | IF '(' expression_error ')' statement ELSE statement { $$ = MkIfStmt($3, $5, $7); $$.loc = @$; }
3460 | SWITCH '(' expression ')' statement { $$ = MkSwitchStmt($3, $5); $$.loc = @$; }
3461 | SWITCH '(' expression_error ')' statement { $$ = MkSwitchStmt($3, $5); $$.loc = @$; }
3464 selection_statement_error:
3465 IF '(' expression_error { $$ = MkIfStmt($3, null, null); $$.loc = @$; }
3466 | selection_statement error
3469 iteration_statement:
3470 WHILE '(' expression ')' statement { $$ = MkWhileStmt($3, $5); $$.loc = @$; }
3471 | WHILE '(' expression_error statement { $$ = MkWhileStmt($3, $4); $$.loc = @$; }
3472 | WHILE '(' ')' statement { $$ = MkWhileStmt(null, $4); $$.loc = @$; }
3474 | DO statement WHILE '(' expression ')' ';' { $$ = MkDoWhileStmt($2, $5); $$.loc = @$; }
3475 | DO statement WHILE '(' expression_error ';' { $$ = MkDoWhileStmt($2, $5); $$.loc = @$; }
3477 | FOR '(' expression_statement expression_statement ')' statement { $$ = MkForStmt($3, $4, null, $6); $$.loc = @$; }
3478 | FOR '(' expression_statement ')' statement { $$ = MkForStmt($3, null, null, $5); $$.loc = @$; }
3479 | FOR '(' expression_statement expression_statement expression ')' statement { $$ = MkForStmt($3, $4, $5, $7); $$.loc = @$; }
3480 | FOR '(' expression_statement expression_statement expression_error statement { $$ = MkForStmt($3, $4, $5, $6 ); $$.loc = @$; }
3481 | FOR '(' ')' statement { $$ = MkForStmt(null, null, null, $4); $$.loc = @$; }
3483 | FOR '(' identifier ':' expression ')' statement { $$ = MkForEachStmt($3, $5, null, $7); $$.loc = @$; }
3484 | FOR '(' identifier ':' expression ';' expression ')' statement { $$ = MkForEachStmt($3, $5, $7, $9); $$.loc = @$; }
3487 iteration_statement_error:
3488 FOR '(' error { $$ = MkForStmt(null, null, null, null); $$.loc = @$; } |
3489 FOR '(' expression_error error { $$ = MkForStmt(MkExpressionStmt($3), null, null, null); $$.forStmt.init.loc = @3; $$.loc = @$; } |
3490 FOR '(' expression_statement error { $$ = MkForStmt($3, null, null, null); $$.loc = @$; } |
3491 FOR '(' expression_statement expression_error error { $$ = MkForStmt($3, MkExpressionStmt($4), null, null); $$.loc = @$; $$.forStmt.check.loc = @4; } |
3492 /* Useless rules due to conflicts
3493 FOR '(' expression_statement expression_statement error { $$ = MkForStmt($3, $4, null, null); $$.loc = @$; } |
3495 FOR '(' expression_statement expression_statement expression_error { $$ = MkForStmt($3, $4, $5, null); $$.loc = @$; } |
3496 FOR '(' expression_statement expression_statement ')' statement_error { $$ = MkForStmt($3, $4, null, $6); $$.loc = @$; } |
3497 FOR '(' expression_statement expression_statement expression ')' statement_error { $$ = MkForStmt($3, $4, $5, $7); $$.loc = @$; } |
3498 FOR '(' expression_statement expression_statement expression_error statement_error { $$ = MkForStmt($3, $4, $5, $6 ); $$.loc = @$; } |
3500 DO statement WHILE '(' expression ')' { $$ = MkDoWhileStmt($2, $5); $$.loc = @$; } |
3501 DO statement WHILE '(' expression { $$ = MkDoWhileStmt($2, $5); $$.loc = @$; } |
3502 DO statement WHILE '(' expression_error { $$ = MkDoWhileStmt($2, $5); $$.loc = @$; } |
3503 DO statement WHILE '(' { $$ = MkDoWhileStmt($2, null); $$.loc = @$; } |
3504 DO statement WHILE { $$ = MkDoWhileStmt($2, null); $$.loc = @$; } |
3505 DO statement { $$ = MkDoWhileStmt($2, null); $$.loc = @$; } |
3506 DO { $$ = MkDoWhileStmt(null, null); $$.loc = @$; } |
3509 WHILE error { $$ = MkWhileStmt(null, null); $$.loc = @$; } |
3510 /* Useless rules due to conflicts
3511 WHILE '(' error { $$ = MkWhileStmt(null, null); $$.loc = @$; } |
3513 WHILE '(' ')' error { $$ = MkWhileStmt(null, null); $$.loc = @$; } |
3514 WHILE '(' expression_error { $$ = MkWhileStmt($3, null); $$.loc = @$; } |
3515 /* Useless rules due to conflicts
3516 WHILE '(' expression_error error { $$ = MkWhileStmt($3, null); $$.loc = @$; } |
3518 WHILE '(' expression ')' statement_error { $$ = MkWhileStmt($3, $5); $$.loc = @$; } |
3519 WHILE '(' expression_error statement_error { $$ = MkWhileStmt($3, $4 ); $$.loc = @$; }
3523 GOTO identifier ';' { $$ = MkGotoStmt($2); $$.loc = @$; }
3524 | CONTINUE ';' { $$ = MkContinueStmt(); $$.loc = @$; }
3525 | BREAK ';' { $$ = MkBreakStmt(); $$.loc = @$; }
3526 | RETURN ';' { Expression exp = MkExpDummy(); $$ = MkReturnStmt(MkListOne(exp)); $$.loc = @$; exp.loc = @2; }
3527 | RETURN expression ';' { $$ = MkReturnStmt($2); $$.loc = @$; }
3528 | RETURN expression_error ';' { $$ = MkReturnStmt($2); $$.loc = @$; }
3529 | RETURN anon_instantiation_expression ';' { $$ = MkReturnStmt(MkListOne($2)); $$.loc = @$; }
3530 | RETURN anon_instantiation_expression_error ';' { $$ = MkReturnStmt(MkListOne($2)); $$.loc = @$; }
3533 jump_statement_error:
3534 RETURN expression_error { $$ = MkReturnStmt($2); $$.loc = @$; } |
3535 RETURN anon_instantiation_expression_error { $$ = MkReturnStmt(MkListOne($2)); $$.loc = @$; } |
3536 RETURN { Expression exp = MkExpDummy(); $$ = MkReturnStmt(MkListOne(exp)); $$.loc = @$; exp.loc.start = exp.loc.end = @1.end; } |
3537 GOTO { $$ = MkGotoStmt(null); $$.loc = @$; }
3540 /*************************************************************************************/
3542 function_definition:
3543 external_guess_declaration_specifiers declarator_function declaration_list compound_statement { $$ = MkFunction($1, $2, $3); ProcessFunctionBody($$, $4); $$.loc = @$; }
3544 | external_guess_declaration_specifiers declarator_function compound_statement
3545 { $$ = MkFunction($1, $2, null); ProcessFunctionBody($$, $3); $$.loc = @$; }
3546 | external_guess_declaration_specifiers declarator_function_type_ok declaration_list compound_statement { $$ = MkFunction($1, $2, $3); ProcessFunctionBody($$, $4); $$.loc = @$; }
3547 | external_guess_declaration_specifiers declarator_function_type_ok compound_statement
3548 { $$ = MkFunction($1, $2, null); ProcessFunctionBody($$, $3); $$.loc = @$; }
3550 | declarator_function declaration_list compound_statement { $$ = MkFunction(null, $1, $2); ProcessFunctionBody($$, $3); $$.loc = @$; }
3551 | declarator_function compound_statement { $$ = MkFunction(null, $1, null); ProcessFunctionBody($$, $2); $$.loc = @$;}
3553 function_definition_error:
3554 external_guess_declaration_specifiers declarator_function declaration_list compound_statement_error { $$ = MkFunction($1, $2, $3); ProcessFunctionBody($$, $4); $$.loc = @$; $$.loc.end = $4.loc.end; }
3555 | external_guess_declaration_specifiers declarator_function compound_statement_error { $$ = MkFunction($1, $2, null); ProcessFunctionBody($$, $3); $$.loc = @$; $$.loc.end = $3.loc.end; }
3556 | external_guess_declaration_specifiers declarator_function_type_ok declaration_list compound_statement_error { $$ = MkFunction($1, $2, $3); ProcessFunctionBody($$, $4); $$.loc = @$; $$.loc.end = $4.loc.end; }
3557 | external_guess_declaration_specifiers declarator_function_type_ok compound_statement_error { $$ = MkFunction($1, $2, null); ProcessFunctionBody($$, $3); $$.loc = @$; $$.loc.end = $3.loc.end; }
3558 | declarator_function declaration_list compound_statement_error { $$ = MkFunction(null, $1, $2); ProcessFunctionBody($$, $3); $$.loc = @$; $$.loc.end = $3.loc.end; }
3559 | declarator_function compound_statement_error { $$ = MkFunction(null, $1, null); ProcessFunctionBody($$, $2); $$.loc = @$; $$.loc.end = $2.loc.end; }
3563 STRING_LITERAL { $$ = CopyString(yytext); }
3564 | string_literal STRING_LITERAL
3566 int len1 = strlen($1);
3567 int len2 = strlen(yytext);
3568 $$ = new byte[len1-1 + len2-1 + 1];
3569 memcpy($$, $1, len1-1);
3570 memcpy($$ + len1-1, yytext+1, len2);
3575 external_declaration:
3576 function_definition { $$ = MkExternalFunction($1); $$.loc = @$; $1.declMode = declMode; declMode = defaultDeclMode; }
3578 { $$ = MkExternalClass($1); $$.loc = @$; $1.declMode = (declMode != defaultAccess) ? declMode : privateAccess; declMode = defaultDeclMode; }
3580 | external_guess_declaration_specifiers class
3581 { $$ = MkExternalClass($2); $$.loc = @$; $2.declMode = (declMode != defaultAccess) ? declMode : privateAccess; declMode = defaultDeclMode; FreeList($1, FreeSpecifier); }
3583 | external_guess_declaration
3584 { $$ = MkExternalDeclaration($1); $$.loc = @$; $1.declMode = declMode; declMode = defaultDeclMode; }
3585 | IMPORT string_literal { $$ = MkExternalImport($2, normalImport, (declMode != defaultAccess) ? declMode : privateAccess); $$.loc = @$; }
3586 | IMPORT STATIC string_literal { $$ = MkExternalImport($3, staticImport, (declMode != defaultAccess) ? declMode : privateAccess); $$.loc = @$; }
3587 | IMPORT identifier string_literal
3589 bool isRemote = !strcmp($2.string, "remote");
3590 $$ = MkExternalImport($3, isRemote ? remoteImport : normalImport, (declMode != defaultAccess) ? declMode : privateAccess);
3597 | ';' { $$ = null; }
3599 | declaration_mode function_definition { $$ = MkExternalFunction($2); $$.loc = @$; $2.declMode = $1; declMode = defaultDeclMode; }
3600 | declaration_mode class
3601 { $$ = MkExternalClass($2); $$.loc = @$; $2.declMode = ($1 != defaultAccess) ? $1 : privateAccess; declMode = defaultDeclMode; }
3602 | declaration_mode external_guess_declaration { $$ = MkExternalDeclaration($2); $$.loc = @$; $2.declMode = $1; declMode = defaultDeclMode; }
3603 | declaration_mode IMPORT string_literal { $$ = MkExternalImport($3, normalImport, ($1 != defaultAccess) ? $1 : privateAccess); $$.loc = @$; declMode = defaultDeclMode; }
3604 | declaration_mode IMPORT STATIC string_literal { $$ = MkExternalImport($4, staticImport, ($1 != defaultAccess) ? $1 : privateAccess); $$.loc = @$; declMode = defaultDeclMode; }
3605 | declaration_mode IMPORT identifier string_literal
3607 bool isRemote = !strcmp($3.string, "remote");
3608 $$ = MkExternalImport($4, isRemote ? remoteImport : normalImport, ($1 != defaultAccess) ? $1 : privateAccess);
3611 declMode = defaultDeclMode;
3615 | declaration_mode ':' { defaultDeclMode = $1; $$ = null; }
3616 | STATIC ':' { defaultDeclMode = staticAccess; $$ = null; }
3617 | NAMESPACE identifier { $$ = MkExternalNameSpace($2); $$.loc = @$; }
3618 | NAMESPACE strict_type { $$ = MkExternalNameSpace(MkIdentifier($2.name)); FreeSpecifier($2); $$.loc = @$; }
3619 | dbtable_definition { $$ = MkExternalDBTable($1); $$.loc = @$; $1.declMode = (declMode != defaultAccess) ? declMode : privateAccess; declMode = defaultDeclMode; }
3620 | declaration_mode dbtable_definition { $$ = MkExternalDBTable($2); $$.loc = @$; $2.declMode = ($1 != defaultAccess) ? declMode : privateAccess; declMode = defaultDeclMode; }
3623 external_declaration_error:
3624 class_error { $$ = MkExternalClass($1); $$.loc = $1.loc; $1.declMode = (declMode != defaultAccess) ? declMode : privateAccess; declMode = defaultDeclMode; }
3625 | external_guess_declaration_specifiers class_error
3627 FreeList($1, FreeSpecifier);
3628 $$ = MkExternalClass($2);
3630 $2.declMode = (declMode != defaultAccess) ? declMode : privateAccess;
3631 declMode = defaultDeclMode;
3633 | function_definition_error { $$ = MkExternalFunction($1); $$.loc = $1.loc; $1.declMode = declMode; declMode = defaultDeclMode; }
3635 | declaration_mode class_error { $$ = MkExternalClass($2); $$.loc = $2.loc; $2.declMode = ($1 != defaultAccess) ? $1 : privateAccess; declMode = defaultDeclMode; }
3636 | declaration_mode function_definition_error { $$ = MkExternalFunction($2); $$.loc = $2.loc; $2.declMode = $1; declMode = defaultDeclMode; }
3638 | external_guess_declaration_error
3639 { $$ = MkExternalDeclaration($1); $$.loc = @$; $1.declMode = declMode; declMode = defaultDeclMode; }
3640 | declaration_mode external_guess_declaration_error { $$ = MkExternalDeclaration($2); $$.loc = @$; $2.declMode = $1; declMode = defaultDeclMode; }
3643 translation_unit_error:
3644 external_declaration_error { $$ = MkList(); ListAdd($$, $1); ast = $$; }
3645 | translation_unit external_declaration_error { $$ = $1; ListAdd($1, $2); }
3646 | translation_unit_error external_declaration_error { $$ = $1; ListAdd($1, $2); }
3647 | translation_unit error
3648 | translation_unit_error error
3652 external_declaration { $$ = MkList(); ListAdd($$, $1); ast = $$; }
3653 | translation_unit external_declaration { $$ = $1; ListAdd($1, $2); }
3654 | translation_unit_error class
3655 { External _class = MkExternalClass($2); $$ = $1; ListAdd($1, _class); _class.loc = @2; $2.declMode = (declMode != defaultAccess) ? declMode : privateAccess; declMode = defaultDeclMode; }
3656 | translation_unit_error declaration_mode class
3657 { External _class = MkExternalClass($3); $$ = $1; ListAdd($1, _class); _class.loc = @3; $3.declMode = ($2 != defaultAccess) ? $2 : privateAccess; declMode = defaultDeclMode; }
3662 | translation_unit_error
3663 | { ast = MkList(); }
3667 DBTABLE string_literal identifier '{' dbfield_definition_list '}' { Symbol symbol = DeclClassAddNameSpace(globalContext.nextID++, $3.string); FreeIdentifier($3); $$ = MkDBTableDef($2, symbol, $5); }
3668 | DBTABLE string_literal strict_type '{' dbfield_definition_list '}' { Symbol symbol = DeclClass(globalContext.nextID++, $3.name); FreeSpecifier($3); $$ = MkDBTableDef($2, symbol, $5); }
3669 | DBTABLE string_literal '{' dbfield_definition_list '}' { $$ = MkDBTableDef($2, null, $4); }
3673 guess_declaration_specifiers identifier string_literal ';' { $$ = MkDBFieldEntry(MkTypeName($1, null), $2, $3); }
3677 identifier { $$ = MkDBIndexItem($1, ascending); }
3678 | '>' identifier { $$ = MkDBIndexItem($2, descending); }
3679 | '<' identifier { $$ = MkDBIndexItem($2, ascending); }
3683 dbindex_item { $$ = MkList(); ListAdd($$, $1); }
3684 | dbindex_item_list ',' dbindex_item { ListAdd($1, $3); }
3688 DBINDEX dbindex_item_list ';' { $$ = MkDBIndexEntry($2, null); }
3689 | DBINDEX dbindex_item_list identifier ';' { $$ = MkDBIndexEntry($2, $3); }
3692 dbfield_definition_list:
3693 dbfield_entry { $$ = MkList(); ListAdd($$, $1); }
3694 | dbindex_entry { $$ = MkList(); ListAdd($$, $1); }
3695 | dbfield_definition_list dbfield_entry { ListAdd($1, $2); }
3696 | dbfield_definition_list dbindex_entry { ListAdd($1, $2); }
3700 DATABASE_OPEN '(' assignment_expression ',' assignment_expression ')' { $$ = MkExpDBOpen($3, $5); }
3704 DBFIELD '(' string_literal ',' identifier ')' { $$ = MkExpDBField($3, $5); }
3708 DBINDEX '(' string_literal ',' identifier ')' { $$ = MkExpDBIndex($3, $5); }
3712 DBTABLE '(' string_literal ')' { $$ = MkExpDBTable($3); }