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 guess_declaration_specifiers { $$ = MkTemplateDatatype($1, null); }
1184 | guess_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); }
1191 // Explicitly copied the rules here to handle:
1192 // ast.ec: Map<List<Location>> intlStrings { };
1194 // LinkList.ec: class LinkList<bool circ = false>
1196 guess_declaration_specifiers { $$ = MkTemplateTypeArgument(MkTemplateDatatype($1, null)); }
1197 | guess_declaration_specifiers abstract_declarator { $$ = MkTemplateTypeArgument(MkTemplateDatatype($1, $2)); }
1200 template_type_parameter:
1201 CLASS identifier { $$ = MkTypeTemplateParameter($2, null, null); }
1202 | CLASS identifier '=' template_type_argument { $$ = MkTypeTemplateParameter($2, null, $4); }
1203 | CLASS identifier ':' template_datatype { $$ = MkTypeTemplateParameter($2, $4, null); }
1204 | CLASS identifier ':' template_datatype '=' template_type_argument { $$ = MkTypeTemplateParameter($2, $4, $6); }
1205 | CLASS base_strict_type_name { $$ = MkTypeTemplateParameter(MkIdentifier($2), null, null); delete $2; }
1206 | CLASS base_strict_type_name '=' template_type_argument { $$ = MkTypeTemplateParameter(MkIdentifier($2), null, $4); }
1207 | CLASS base_strict_type_name ':' template_datatype { $$ = MkTypeTemplateParameter(MkIdentifier($2), $4, null); }
1208 | CLASS base_strict_type_name ':' template_datatype '=' template_type_argument { $$ = MkTypeTemplateParameter(MkIdentifier($2), $4, $6); }
1211 template_identifier_argument:
1212 identifier { $$ = MkTemplateIdentifierArgument($1); }
1215 template_identifier_parameter:
1216 identifier { $$ = MkIdentifierTemplateParameter($1, dataMember, null); }
1217 | identifier '=' template_identifier_argument { $$ = MkIdentifierTemplateParameter($1, dataMember, $3); }
1220 template_expression_argument:
1221 shift_expression /*constant_expression*/ { $$ = MkTemplateExpressionArgument($1); }
1224 template_expression_parameter:
1226 template_datatype identifier { $$ = MkExpressionTemplateParameter($2, $1, null); }
1227 | template_datatype identifier '=' template_expression_argument { $$ = MkExpressionTemplateParameter($2, $1, $4); }
1229 guess_declaration_specifiers identifier '=' template_expression_argument { $$ = MkExpressionTemplateParameter($2, MkTemplateDatatype($1, null), $4); }
1230 | guess_declaration_specifiers abstract_declarator identifier '=' template_expression_argument { $$ = MkExpressionTemplateParameter($3, MkTemplateDatatype($1, $2), $5); }
1234 template_type_parameter
1235 | template_identifier_parameter
1236 | template_expression_parameter
1239 template_parameters_list:
1240 template_parameter { $$ = MkList(); ListAdd($$, $1); }
1241 | template_parameters_list ',' template_parameter { $$ = $1; ListAdd($1, $3); }
1245 template_expression_argument
1246 | template_identifier_argument
1247 | template_type_argument
1248 | identifier '=' template_expression_argument { $$ = $3; $$.name = $1; $$.loc = @$; }
1249 | identifier '=' template_identifier_argument { $$ = $3; $$.name = $1; $$.loc = @$; }
1250 | identifier '=' template_type_argument { $$ = $3; $$.name = $1; $$.loc = @$; }
1251 /*| template_datatype '=' template_expression_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_identifier_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);
1275 | template_datatype '=' template_type_argument
1278 if($1.specifiers && $1.specifiers->first)
1280 Specifier spec = $1.specifiers->first;
1281 if(spec.type == nameSpecifier)
1282 $$.name = MkIdentifier(spec.name);
1284 FreeTemplateDataType($1);
1289 template_arguments_list:
1290 template_argument { $$ = MkList(); ListAdd($$, $1); }
1291 | template_arguments_list ',' template_argument { $$ = $1; ListAdd($1, $3); }
1297 if(curContext != globalContext)
1298 PopContext(curContext);
1303 class_entry identifier { $1; $$ = DeclClassAddNameSpace(globalContext.nextID++, $2.string); FreeIdentifier($2); $$.nameLoc = @2; memberAccessStack[++defaultMemberAccess] = privateAccess; }
1304 | class_entry base_strict_type
1306 $1; $$ = DeclClass(globalContext.nextID++, $2.name);
1309 ++defaultMemberAccess;
1310 memberAccessStack[defaultMemberAccess] = privateAccess;
1312 | identifier class_entry identifier { $2; $$ = DeclClassAddNameSpace(globalContext.nextID++, $3.string); FreeIdentifier($1); FreeIdentifier($3); $$.nameLoc = @3; $$.isRemote = true; memberAccessStack[++defaultMemberAccess] = privateAccess; }
1313 | identifier class_entry base_strict_type { $2; $$ = DeclClass(globalContext.nextID++, $3.name); FreeIdentifier($1); $$.nameLoc = @3; $$.isRemote = true; FreeSpecifier($3); memberAccessStack[++defaultMemberAccess] = privateAccess; }
1315 | class_entry identifier '<' template_parameters_list '>' { $1; $$ = DeclClassAddNameSpace(globalContext.nextID++, $2.string); $$.templateParams = $4; FreeIdentifier($2); $$.nameLoc = @2; memberAccessStack[++defaultMemberAccess] = privateAccess; }
1316 | class_entry base_strict_type '<' template_parameters_list '>'
1318 $1; $$ = DeclClass(globalContext.nextID++, $2.name);
1319 $$.templateParams = $4;
1322 ++defaultMemberAccess;
1323 memberAccessStack[defaultMemberAccess] = privateAccess;
1325 | 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; }
1326 | 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; }
1337 // Added this for unit classes...
1340 $$ = $1; $$.definitions = MkList(); $$.blockStart = @2; $$.loc = @$; $$.endid = globalContext.nextID++;
1342 PopContext(curContext);
1345 | class_decl '{' '}'
1347 $$ = MkClass($1, null, MkList()); $$.blockStart = @2; $$.loc = @$; $$.endid = globalContext.nextID++;
1349 PopContext(curContext);
1351 | class_head '{' '}'
1353 $$ = $1; $$.definitions = MkList(); $$.blockStart = @2; $$.loc = @$; $$.endid = globalContext.nextID++;
1355 PopContext(curContext);
1358 | class_entry identifier ';'
1360 $1; $$ = MkClass(DeclClassAddNameSpace(0, $2.string), null, null); FreeIdentifier($2);
1362 PopContext(curContext);
1364 | class_entry type ';'
1366 $1; $$ = MkClass(DeclClass(0, $2.name), null, null); FreeSpecifier($2);
1368 PopContext(curContext);
1373 class_decl ':' inheritance_specifiers
1375 $$ = MkClass($1, $3, null);
1380 class_decl '{' struct_declaration_list_error
1382 $$ = MkClass($1, null, $3); $$.deleteWatchable = deleteWatchable; deleteWatchable = false; $$.blockStart = @2; $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++; $$.endid = globalContext.nextID++;
1384 PopContext(curContext);
1386 | class_head '{' struct_declaration_list_error
1388 $$ = $1; $$.definitions = $3; $$.deleteWatchable = deleteWatchable; deleteWatchable = false; $$.blockStart = @2; $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++; $$.endid = globalContext.nextID++;
1390 PopContext(curContext);
1392 | class_decl '{' struct_declaration_list
1394 $$ = MkClass($1, null, $3); $$.deleteWatchable = deleteWatchable; deleteWatchable = false; $$.blockStart = @2; $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++; $$.endid = globalContext.nextID++;
1396 PopContext(curContext);
1398 | class_head '{' struct_declaration_list
1400 $$ = $1; $$.definitions = $3; $$.deleteWatchable = deleteWatchable; deleteWatchable = false; $$.blockStart = @2; $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++; $$.endid = globalContext.nextID++;
1402 PopContext(curContext);
1404 | class_decl '{' error
1406 $$ = MkClass($1, null, MkList()); $$.deleteWatchable = deleteWatchable; deleteWatchable = false; $$.blockStart = @2; $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++; $$.endid = globalContext.nextID++;
1408 PopContext(curContext);
1410 | class_head '{' error
1412 $$ = $1; $$.definitions = MkList(); $$.deleteWatchable = deleteWatchable; deleteWatchable = false; $$.blockStart = @2; $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++; $$.endid = globalContext.nextID++;
1414 PopContext(curContext);
1418 /**** EXPRESSIONS ********************************************************************/
1422 { $$ = MkIdentifier(yytext); $$.loc = @1; }
1426 simple_primary_expression
1427 | '(' expression ')'
1428 { $$ = MkExpBrackets($2); $$.loc = @$; }
1432 string_literal { $$ = MkExpString($1); delete $1; $$.loc = @$; }
1433 | '$' string_literal { $$ = MkExpIntlString($2, null); delete $2; $$.loc = @$; }
1434 | '$' string_literal '.' string_literal { $$ = MkExpIntlString($4, $2); delete $2; delete $4; $$.loc = @$; }
1437 simple_primary_expression:
1438 identifier { $$ = MkExpIdentifier($1); $$.loc = @$; }
1439 | instantiation_unnamed { $$ = MkExpInstance($1); $$.loc = @$; }
1440 | EXTENSION '(' compound_statement ')' { $$ = MkExpExtensionCompound($3); $$.loc = @$; }
1441 | EXTENSION '(' expression ')' { $$ = MkExpExtensionExpression($3); $$.loc = @$; }
1442 | EXTENSION '(' type_name ')' initializer { $$ = MkExpExtensionInitializer($3, $5); $$.loc = @$; }
1443 | EXTENSION '(' type_name ')' '(' type_name ')' initializer { $$ = MkExpExtensionInitializer($3, MkInitializerAssignment(MkExpExtensionInitializer($6, $8))); $$.loc = @$; }
1444 | CONSTANT { $$ = MkExpConstant(yytext); $$.loc = @$; }
1446 | '(' ')' { Expression exp = MkExpDummy(); exp.loc.start = @1.end; exp.loc.end = @2.start; $$ = MkExpBrackets(MkListOne(exp)); $$.loc = @$; yyerror(); }
1447 | NEWOP new_specifiers abstract_declarator_noarray '[' constant_expression ']' { $$ = MkExpNew(MkTypeName($2,$3), $5); $$.loc = @$; }
1448 | NEWOP new_specifiers abstract_declarator_noarray '[' constant_expression_error ']' { $$ = MkExpNew(MkTypeName($2,$3), $5); $$.loc = @$; }
1449 | NEWOP new_specifiers '[' constant_expression ']' { $$ = MkExpNew(MkTypeName($2,null), $4); $$.loc = @$; }
1450 | NEWOP new_specifiers '[' constant_expression_error ']' { $$ = MkExpNew(MkTypeName($2,null), $4); $$.loc = @$; }
1451 | NEW0OP new_specifiers abstract_declarator_noarray '[' constant_expression ']' { $$ = MkExpNew0(MkTypeName($2,$3), $5); $$.loc = @$; }
1452 | NEW0OP new_specifiers abstract_declarator_noarray '[' constant_expression_error ']' { $$ = MkExpNew0(MkTypeName($2,$3), $5); $$.loc = @$; }
1453 | NEW0OP new_specifiers '[' constant_expression ']' { $$ = MkExpNew0(MkTypeName($2,null), $4); $$.loc = @$; }
1454 | NEW0OP new_specifiers '[' constant_expression_error ']' { $$ = MkExpNew0(MkTypeName($2,null), $4); $$.loc = @$; }
1455 | RENEW constant_expression renew_specifiers abstract_declarator_noarray '[' constant_expression ']' { $$ = MkExpRenew($2, MkTypeName($3,$4), $6); $$.loc = @$; }
1456 | RENEW constant_expression renew_specifiers abstract_declarator_noarray '[' constant_expression_error ']' { $$ = MkExpRenew($2, MkTypeName($3,$4), $6); $$.loc = @$; }
1457 | RENEW constant_expression renew_specifiers '[' constant_expression ']' { $$ = MkExpRenew($2, MkTypeName($3,null), $5); $$.loc = @$; }
1458 | RENEW constant_expression renew_specifiers '[' constant_expression_error ']' { $$ = MkExpRenew($2, MkTypeName($3,null), $5); $$.loc = @$; }
1459 | RENEW0 constant_expression renew_specifiers abstract_declarator_noarray '[' constant_expression ']' { $$ = MkExpRenew0($2, MkTypeName($3,$4), $6); $$.loc = @$; }
1460 | RENEW0 constant_expression renew_specifiers abstract_declarator_noarray '[' constant_expression_error ']' { $$ = MkExpRenew0($2, MkTypeName($3,$4), $6); $$.loc = @$; }
1461 | RENEW0 constant_expression renew_specifiers '[' constant_expression ']' { $$ = MkExpRenew0($2, MkTypeName($3,null), $5); $$.loc = @$; }
1462 | RENEW0 constant_expression renew_specifiers '[' constant_expression_error ']' { $$ = MkExpRenew0($2, MkTypeName($3,null), $5); $$.loc = @$; }
1463 | CLASS '(' declaration_specifiers ')' { $$ = MkExpClass($3, null); $$.loc = @$; }
1464 | CLASS '(' declaration_specifiers abstract_declarator ')' { $$ = MkExpClass($3, $4); $$.loc = @$; }
1465 | CLASS '(' identifier ')' { $$ = MkExpClass(MkListOne(MkSpecifierName($3.string)), null); FreeIdentifier($3); $$.loc = @$; }
1466 | VAARG '(' assignment_expression ',' type_name ')' { $$ = MkExpVaArg($3, $5); $$.loc = @$; }
1468 | CLASS_DATA '(' identifier ')' { $$ = MkExpClassData($3); $$.loc = @$; }
1474 | '[' argument_expression_list /*expression*/ ']' { $$ = MkExpArray($2); $$.loc = @$; }
1477 anon_instantiation_expression:
1478 instantiation_anon { $$ = MkExpInstance($1); $$.loc = @$; }
1481 anon_instantiation_expression_error:
1482 instantiation_anon_error error { $$ = MkExpInstance($1); $$.loc = @$; }
1485 primary_expression_error:
1486 '(' expression { $$ = MkExpBrackets($2); $$.loc = @$; }
1487 | '(' expression_error { $$ = MkExpBrackets($2); $$.loc = @$; }
1493 | postfix_expression '[' expression ']' { $$ = MkExpIndex($1, $3); $$.loc = @$; }
1494 | postfix_expression '[' expression_error ']' { $$ = MkExpIndex($1, $3); $$.loc = @$; }
1495 | postfix_expression '(' ')' { $$ = MkExpCall($1, MkList()); $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @3.end; $$.loc = @$; }
1496 | postfix_expression '(' argument_expression_list ')' { $$ = MkExpCall($1, $3); $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @4.end; $$.loc = @$; }
1497 | 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; }
1498 | postfix_expression '.' identifier { $$ = MkExpMember($1, $3); $$.loc = @$; }
1499 | postfix_expression PTR_OP identifier { $$ = MkExpPointer($1, $3); $$.loc = @$; }
1500 | postfix_expression INC_OP { $$ = MkExpOp($1, INC_OP, null); $$.loc = @$; }
1501 | postfix_expression DEC_OP { $$ = MkExpOp($1, DEC_OP, null); $$.loc = @$; }
1503 | postfix_expression_error '[' expression ']' { $$ = MkExpIndex($1, $3); $$.loc = @$; }
1504 | postfix_expression_error '[' expression_error ']' { $$ = MkExpIndex($1, $3); $$.loc = @$; }
1505 | postfix_expression_error '(' ')' { $$ = MkExpCall($1, MkList()); $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @3.end; $$.loc = @$; }
1506 | postfix_expression_error '(' argument_expression_list ')' { $$ = MkExpCall($1, $3); $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @4.end;$$.loc = @$; }
1507 | postfix_expression_error '.' identifier { $$ = MkExpMember($1, $3); $$.loc = @$; }
1508 | postfix_expression_error PTR_OP identifier { $$ = MkExpPointer($1, $3); $$.loc = @$; }
1509 | postfix_expression_error INC_OP { $$ = MkExpOp($1, INC_OP, null); $$.loc = @$; }
1510 | postfix_expression_error DEC_OP { $$ = MkExpOp($1, DEC_OP, null); $$.loc = @$; }
1513 simple_postfix_expression:
1514 simple_primary_expression
1516 | simple_postfix_expression '[' expression ']' { $$ = MkExpIndex($1, $3); $$.loc = @$; }
1517 | simple_postfix_expression '[' expression_error ']' { $$ = MkExpIndex($1, $3); $$.loc = @$; }
1518 | simple_postfix_expression '(' ')' { $$ = MkExpCall($1, MkList()); $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @3.end; $$.loc = @$; }
1519 | simple_postfix_expression '(' argument_expression_list ')' { $$ = MkExpCall($1, $3); $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @4.end; $$.loc = @$; }
1520 | 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; }
1521 | simple_postfix_expression '.' identifier { $$ = MkExpMember($1, $3); $$.loc = @$; }
1522 | simple_postfix_expression PTR_OP identifier { $$ = MkExpPointer($1, $3); $$.loc = @$; }
1523 | simple_postfix_expression INC_OP { $$ = MkExpOp($1, INC_OP, null); $$.loc = @$; }
1524 | simple_postfix_expression DEC_OP { $$ = MkExpOp($1, DEC_OP, null); $$.loc = @$; }
1526 | simple_postfix_expression_error '[' expression ']' { $$ = MkExpIndex($1, $3); $$.loc = @$; }
1527 | simple_postfix_expression_error '[' expression_error ']' { $$ = MkExpIndex($1, $3); $$.loc = @$; }
1528 | simple_postfix_expression_error '(' ')' { $$ = MkExpCall($1, MkList()); $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @3.end; $$.loc = @$; }
1529 | simple_postfix_expression_error '(' argument_expression_list ')' { $$ = MkExpCall($1, $3); $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @4.end;$$.loc = @$; }
1530 | simple_postfix_expression_error '.' identifier { $$ = MkExpMember($1, $3); $$.loc = @$; }
1531 | simple_postfix_expression_error PTR_OP identifier { $$ = MkExpPointer($1, $3); $$.loc = @$; }
1532 | simple_postfix_expression_error INC_OP { $$ = MkExpOp($1, INC_OP, null); $$.loc = @$; }
1533 | simple_postfix_expression_error DEC_OP { $$ = MkExpOp($1, DEC_OP, null); $$.loc = @$; }
1536 argument_expression_list:
1537 assignment_expression { $$ = MkList(); ListAdd($$, $1); }
1538 | anon_instantiation_expression { $$ = MkList(); ListAdd($$, $1); }
1539 | argument_expression_list ',' assignment_expression { $$ = $1; ListAdd($1, $3); }
1540 | argument_expression_list ',' anon_instantiation_expression { $$ = $1; ListAdd($1, $3); }
1543 argument_expression_list_error:
1544 assignment_expression_error { $$ = MkList(); ListAdd($$, $1); }
1545 | anon_instantiation_expression_error { $$ = MkList(); ListAdd($$, $1); }
1546 | argument_expression_list ',' assignment_expression_error { $$ = $1; ListAdd($1, $3); }
1547 | argument_expression_list ',' anon_instantiation_expression_error { $$ = $1; ListAdd($1, $3); }
1548 | argument_expression_list ',' { Expression exp = MkExpDummy(); exp.loc.start = @2.end; exp.loc.end = @2.end; $$ = $1; ListAdd($1, exp); }
1551 common_unary_expression:
1552 INC_OP unary_expression { $$ = MkExpOp(null, INC_OP, $2); $$.loc = @$; }
1553 | DEC_OP unary_expression { $$ = MkExpOp(null, DEC_OP, $2); $$.loc = @$; }
1554 | unary_operator cast_expression { $$ = MkExpOp(null, $1, $2); $$.loc = @$; }
1555 | unary_operator anon_instantiation_expression { $$ = MkExpOp(null, $1, $2); $$.loc = @$; }
1556 | SIZEOF '(' unary_expression ')' { $$ = MkExpOp(null, SIZEOF, $3); $$.loc = @$; }
1557 | SIZEOF simple_unary_expression { $$ = MkExpOp(null, SIZEOF, $2); $$.loc = @$; }
1558 | SIZEOF '(' guess_type_name ')' { $$ = MkExpTypeSize($3); $$.loc = @$; }
1559 | SIZEOF '(' CLASS type ')' { $$ = MkExpClassSize($4); $$.loc = @$; }
1560 | SIZEOF '(' CLASS guess_type ')' { $$ = MkExpClassSize($4); $$.loc = @$; }
1562 | ALIGNOF '(' unary_expression ')' { $$ = MkExpOp(null, ALIGNOF, $3); $$.loc = @$; }
1563 | ALIGNOF simple_unary_expression { $$ = MkExpOp(null, ALIGNOF, $2); $$.loc = @$; }
1564 | ALIGNOF '(' guess_type_name ')' { $$ = MkExpTypeAlign($3); $$.loc = @$; }
1568 common_unary_expression
1569 | postfix_expression
1572 simple_unary_expression:
1573 common_unary_expression
1574 | simple_postfix_expression
1584 | DELETE { $$ = DELETE; }
1585 | _INCREF { $$ = _INCREF; }
1590 | '(' type_name ')' cast_expression { $$ = MkExpCast($2, $4); $$.loc = @$; }
1593 multiplicative_expression:
1595 | multiplicative_expression '*' cast_expression { $$ = MkExpOp($1, '*', $3); $$.loc = @$; }
1596 | multiplicative_expression '/' cast_expression { $$ = MkExpOp($1, '/', $3); $$.loc = @$; }
1597 | multiplicative_expression '%' cast_expression { $$ = MkExpOp($1, '%', $3); $$.loc = @$; }
1598 | multiplicative_expression_error '*' cast_expression { $$ = MkExpOp($1, '*', $3); $$.loc = @$; }
1599 | multiplicative_expression_error '/' cast_expression { $$ = MkExpOp($1, '/', $3); $$.loc = @$; }
1600 | multiplicative_expression_error '%' cast_expression { $$ = MkExpOp($1, '%', $3); $$.loc = @$; }
1603 additive_expression:
1604 multiplicative_expression
1605 | additive_expression '+' multiplicative_expression { $$ = MkExpOp($1, '+', $3); $$.loc = @$; }
1606 | additive_expression '-' multiplicative_expression { $$ = MkExpOp($1, '-', $3); $$.loc = @$; }
1607 | additive_expression_error '+' multiplicative_expression { $$ = MkExpOp($1, '+', $3); $$.loc = @$; }
1608 | additive_expression_error '-' multiplicative_expression { $$ = MkExpOp($1, '-', $3); $$.loc = @$; }
1613 | shift_expression LEFT_OP additive_expression { $$ = MkExpOp($1, LEFT_OP, $3); $$.loc = @$; }
1614 | shift_expression RIGHT_OP additive_expression { $$ = MkExpOp($1, RIGHT_OP, $3); $$.loc = @$; }
1615 | shift_expression_error LEFT_OP additive_expression { $$ = MkExpOp($1, LEFT_OP, $3); $$.loc = @$; }
1616 | shift_expression_error RIGHT_OP additive_expression { $$ = MkExpOp($1, RIGHT_OP, $3); $$.loc = @$; }
1619 relational_expression_smaller_than:
1620 relational_expression '<'
1627 relational_expression:
1629 | relational_expression_smaller_than /*relational_expression '<' */ shift_expression { skipErrors = false; $$ = MkExpOp($1, '<', $2/*$3*/); $$.loc = @$; }
1630 | relational_expression '>' shift_expression { $$ = MkExpOp($1, '>', $3); $$.loc = @$; }
1631 | relational_expression LE_OP shift_expression { $$ = MkExpOp($1, LE_OP, $3); $$.loc = @$; }
1632 | relational_expression GE_OP shift_expression { $$ = MkExpOp($1, GE_OP, $3); $$.loc = @$; }
1633 | relational_expression_error '<' shift_expression { $$ = MkExpOp($1, '<', $3); $$.loc = @$; }
1634 | relational_expression_error '>' shift_expression { $$ = MkExpOp($1, '>', $3); $$.loc = @$; }
1635 | relational_expression_error LE_OP shift_expression { $$ = MkExpOp($1, LE_OP, $3); $$.loc = @$; }
1636 | relational_expression_error GE_OP shift_expression { $$ = MkExpOp($1, GE_OP, $3); $$.loc = @$; }
1640 : relational_expression
1641 | equality_expression EQ_OP relational_expression { $$ = MkExpOp($1, EQ_OP, $3); $$.loc = @$; }
1642 | equality_expression NE_OP relational_expression { $$ = MkExpOp($1, NE_OP, $3); $$.loc = @$; }
1643 | equality_expression_error EQ_OP relational_expression { $$ = MkExpOp($1, EQ_OP, $3); $$.loc = @$; }
1644 | equality_expression_error NE_OP relational_expression { $$ = MkExpOp($1, NE_OP, $3); $$.loc = @$; }
1646 | equality_expression EQ_OP anon_instantiation_expression { $$ = MkExpOp($1, EQ_OP, $3); $$.loc = @$; }
1647 | equality_expression NE_OP anon_instantiation_expression { $$ = MkExpOp($1, NE_OP, $3); $$.loc = @$; }
1648 | equality_expression_error EQ_OP anon_instantiation_expression { $$ = MkExpOp($1, EQ_OP, $3); $$.loc = @$; }
1649 | equality_expression_error NE_OP anon_instantiation_expression { $$ = MkExpOp($1, NE_OP, $3); $$.loc = @$; }
1653 : equality_expression
1654 | and_expression '&' equality_expression { $$ = MkExpOp($1, '&', $3); $$.loc = @$; }
1655 | and_expression_error '&' equality_expression { $$ = MkExpOp($1, '&', $3); $$.loc = @$; }
1657 | and_expression '&' anon_instantiation_expression { $$ = MkExpOp($1, '&', $3); $$.loc = @$; }
1658 | and_expression_error '&' anon_instantiation_expression { $$ = MkExpOp($1, '&', $3); $$.loc = @$; }
1661 exclusive_or_expression
1663 | exclusive_or_expression '^' and_expression { $$ = MkExpOp($1, '^', $3); $$.loc = @$; }
1664 | exclusive_or_expression_error '^' and_expression { $$ = MkExpOp($1, '^', $3); $$.loc = @$; }
1666 | exclusive_or_expression '^' anon_instantiation_expression { $$ = MkExpOp($1, '^', $3); $$.loc = @$; }
1667 | exclusive_or_expression_error '^' anon_instantiation_expression { $$ = MkExpOp($1, '^', $3); $$.loc = @$; }
1670 inclusive_or_expression
1671 : exclusive_or_expression
1672 | inclusive_or_expression '|' exclusive_or_expression { $$ = MkExpOp($1, '|', $3); $$.loc = @$; }
1673 | inclusive_or_expression_error '|' exclusive_or_expression { $$ = MkExpOp($1, '|', $3); $$.loc = @$; }
1675 | inclusive_or_expression '|' anon_instantiation_expression { $$ = MkExpOp($1, '|', $3); $$.loc = @$; }
1676 | inclusive_or_expression_error '|' anon_instantiation_expression { $$ = MkExpOp($1, '|', $3); $$.loc = @$; }
1679 logical_and_expression
1680 : inclusive_or_expression
1681 | logical_and_expression AND_OP inclusive_or_expression { $$ = MkExpOp($1, AND_OP, $3); $$.loc = @$; }
1682 | logical_and_expression_error AND_OP inclusive_or_expression { $$ = MkExpOp($1, AND_OP, $3); $$.loc = @$; }
1685 logical_or_expression
1686 : logical_and_expression
1687 | logical_or_expression OR_OP logical_and_expression { $$ = MkExpOp($1, OR_OP, $3); $$.loc = @$; }
1688 | logical_or_expression_error OR_OP logical_and_expression { $$ = MkExpOp($1, OR_OP, $3); $$.loc = @$; }
1691 conditional_expression
1692 : logical_or_expression
1693 | logical_or_expression '?' expression ':' conditional_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1694 | logical_or_expression '?' expression_error ':' conditional_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1695 | logical_or_expression_error '?' expression ':' conditional_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1696 | logical_or_expression_error '?' expression_error ':' conditional_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1698 | logical_or_expression '?' expression_anon_inst ':' conditional_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1699 | logical_or_expression '?' expression_anon_inst_error ':' conditional_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1700 | logical_or_expression_error '?' expression_anon_inst ':' conditional_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1701 | logical_or_expression_error '?' expression_anon_inst_error ':' conditional_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1703 | logical_or_expression '?' expression ':' anon_instantiation_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1704 | logical_or_expression '?' expression_error ':' anon_instantiation_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1705 | logical_or_expression_error '?' expression ':' anon_instantiation_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1706 | logical_or_expression_error '?' expression_error ':' anon_instantiation_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1708 | logical_or_expression '?' expression_anon_inst ':' anon_instantiation_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1709 | logical_or_expression '?' expression_anon_inst_error ':' anon_instantiation_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1710 | logical_or_expression_error '?' expression_anon_inst ':' anon_instantiation_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1711 | logical_or_expression_error '?' expression_anon_inst_error ':' anon_instantiation_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1714 assignment_expression:
1715 conditional_expression
1716 | unary_expression assignment_operator assignment_expression { $$ = MkExpOp($1, $2, $3); $$.loc = @$; }
1717 | unary_expression_error assignment_operator assignment_expression { $$ = MkExpOp($1, $2, $3); $$.loc = @$; }
1718 | conditional_expression assignment_operator assignment_expression { $$ = MkExpOp($1, $2, $3); $$.loc = @$; } // TODO: Generate error here:
1719 | conditional_expression_error assignment_operator assignment_expression { $$ = MkExpOp($1, $2, $3); $$.loc = @$; } // TODO: Generate error here:
1721 | unary_expression assignment_operator anon_instantiation_expression { $$ = MkExpOp($1, $2, $3); $$.loc = @$; }
1722 | unary_expression_error assignment_operator anon_instantiation_expression { $$ = MkExpOp($1, $2, $3); $$.loc = @$; }
1723 | conditional_expression assignment_operator anon_instantiation_expression { $$ = MkExpOp($1, $2, $3); $$.loc = @$; }
1724 | conditional_expression_error assignment_operator anon_instantiation_expression { $$ = MkExpOp($1, $2, $3); $$.loc = @$; }
1727 assignment_operator:
1729 | MUL_ASSIGN { $$ = MUL_ASSIGN; }
1730 | DIV_ASSIGN { $$ = DIV_ASSIGN; }
1731 | MOD_ASSIGN { $$ = MOD_ASSIGN; }
1732 | ADD_ASSIGN { $$ = ADD_ASSIGN; }
1733 | SUB_ASSIGN { $$ = SUB_ASSIGN; }
1734 | LEFT_ASSIGN { $$ = LEFT_ASSIGN; }
1735 | RIGHT_ASSIGN { $$ = RIGHT_ASSIGN; }
1736 | AND_ASSIGN { $$ = AND_ASSIGN; }
1737 | XOR_ASSIGN { $$ = XOR_ASSIGN; }
1738 | OR_ASSIGN { $$ = OR_ASSIGN; }
1742 assignment_expression { $$ = MkList(); ListAdd($$, $1); }
1743 | expression ',' assignment_expression { $$ = $1; ListAdd($1, $3); }
1744 | expression_error ',' assignment_expression { $$ = $1; ListAdd($1, $3); }
1745 | expression_error ')'
1748 expression_anon_inst:
1749 anon_instantiation_expression { $$ = MkList(); ListAdd($$, $1); }
1750 | expression ',' anon_instantiation_expression { $$ = $1; ListAdd($1, $3); }
1751 | expression_error ',' anon_instantiation_expression { $$ = $1; ListAdd($1, $3); }
1754 postfix_expression_error:
1755 primary_expression_error
1756 | error { $$ = MkExpDummy(); $$.loc = @$; /*printf("Sorry, didn't mean that syntax error\n");*/ }
1757 | postfix_expression error
1758 | instantiation_unnamed_error error { $$ = MkExpInstance($1); $$.loc = @$; }
1760 | postfix_expression PTR_OP error { $$ = MkExpPointer($1, null); $$.loc = @$; }
1761 | postfix_expression_error PTR_OP error { $$ = MkExpPointer($1, null); $$.loc = @$; }
1763 | postfix_expression '(' argument_expression_list { $$ = MkExpCall($1, $3); $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @3.end; $$.loc = @$; $$.call.argLoc.end.charPos++;}
1764 | postfix_expression '(' argument_expression_list_error { $$ = MkExpCall($1, $3); $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @3.end; $$.loc = @$; $$.call.argLoc.end.charPos++;}
1765 /* Useless rules due to conflicts
1766 | postfix_expression '(' argument_expression_list ',' error { $$ = MkExpCall($1, $3); $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @4.end;$$.loc = @$; $$.call.argLoc.end.charPos++;}
1767 | postfix_expression '(' error { $$ = MkExpCall($1, MkList() ); @$.end = yylloc.start; $$.loc = @$; $$.call.argLoc.start = @2.start; $$.call.argLoc.end = yylloc.start; }
1769 | postfix_expression '.' error { $$ = MkExpMember($1, null); $$.loc = @$; }
1771 | 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++;}
1772 /* Useless rules due to conflicts
1773 | 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++;}
1774 | postfix_expression_error '(' error { $$ = MkExpCall($1, MkList() ); $$.loc = @$; $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @2.end; $$.call.argLoc.end.charPos++;}
1776 | postfix_expression_error '.' error { $$ = MkExpMember($1, null); $$.loc = @$; }
1779 simple_postfix_expression_error:
1780 error { $$ = MkExpDummy(); $$.loc = @$; }
1781 | simple_postfix_expression error
1782 | instantiation_unnamed_error error { $$ = MkExpInstance($1); $$.loc = @$; }
1784 | simple_postfix_expression PTR_OP error { $$ = MkExpPointer($1, null); $$.loc = @$; }
1785 | simple_postfix_expression_error PTR_OP error { $$ = MkExpPointer($1, null); $$.loc = @$; }
1787 | simple_postfix_expression '(' argument_expression_list { $$ = MkExpCall($1, $3); $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @3.end; $$.loc = @$; $$.call.argLoc.end.charPos++;}
1788 | 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++;}
1789 /* Useless rules due to conflicts
1790 | 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++;}
1791 | simple_postfix_expression '(' error { $$ = MkExpCall($1, MkList() ); @$.end = yylloc.start; $$.loc = @$; $$.call.argLoc.start = @2.start; $$.call.argLoc.end = yylloc.start; }
1793 | simple_postfix_expression '.' error { $$ = MkExpMember($1, null); $$.loc = @$; }
1795 | 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++;}
1796 /* Useless rules due to conflicts
1797 | 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++;}
1798 | simple_postfix_expression_error '(' error { $$ = MkExpCall($1, MkList() ); $$.loc = @$; $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @2.end; $$.call.argLoc.end.charPos++;}
1800 | simple_postfix_expression_error '.' error { $$ = MkExpMember($1, null); $$.loc = @$; }
1803 common_unary_expression_error:
1804 INC_OP unary_expression_error { $$ = MkExpOp(null, INC_OP, $2); $$.loc = @$; }
1805 | DEC_OP unary_expression_error { $$ = MkExpOp(null, DEC_OP, $2); $$.loc = @$; }
1806 | unary_operator cast_expression_error { $$ = MkExpOp(null, $1, $2); $$.loc = @$; }
1807 | unary_operator anon_instantiation_expression_error { $$ = MkExpOp(null, $1, $2); $$.loc = @$; }
1808 | SIZEOF '(' unary_expression_error { $$ = MkExpOp(null, SIZEOF, $3); $$.loc = @$; }
1809 | SIZEOF simple_unary_expression_error { $$ = MkExpOp(null, SIZEOF, $2); $$.loc = @$; }
1810 | SIZEOF '(' guess_type_name ')' error { $$ = MkExpTypeSize($3); $$.loc = @$; }
1811 | SIZEOF '(' CLASS type ')' error { $$ = MkExpClassSize($4); $$.loc = @$; }
1812 | SIZEOF '(' CLASS guess_type ')' error { $$ = MkExpClassSize($4); $$.loc = @$; }
1813 | ALIGNOF '(' unary_expression_error { $$ = MkExpOp(null, ALIGNOF, $3); $$.loc = @$; }
1814 | ALIGNOF simple_unary_expression_error { $$ = MkExpOp(null, ALIGNOF, $2); $$.loc = @$; }
1815 | ALIGNOF '(' guess_type_name ')' error { $$ = MkExpTypeAlign($3); $$.loc = @$; }
1818 unary_expression_error:
1819 common_unary_expression_error
1820 | postfix_expression_error
1823 simple_unary_expression_error:
1824 common_unary_expression_error
1825 | simple_postfix_expression_error
1829 cast_expression_error:
1830 unary_expression_error
1831 | '(' type_name ')' cast_expression_error { $$ = MkExpCast($2, $4); $$.loc = @$; }
1834 multiplicative_expression_error:
1835 cast_expression_error
1836 | multiplicative_expression '*' cast_expression_error { $$ = MkExpOp($1, '*', $3); $$.loc = @$; }
1837 | multiplicative_expression '/' cast_expression_error { $$ = MkExpOp($1, '/', $3); $$.loc = @$; }
1838 | multiplicative_expression '%' cast_expression_error { $$ = MkExpOp($1, '%', $3); $$.loc = @$; }
1839 | multiplicative_expression_error '*' cast_expression_error { $$ = MkExpOp($1, '*', $3); $$.loc = @$; }
1840 | multiplicative_expression_error '/' cast_expression_error { $$ = MkExpOp($1, '/', $3); $$.loc = @$; }
1841 | multiplicative_expression_error '%' cast_expression_error { $$ = MkExpOp($1, '%', $3); $$.loc = @$; }
1844 additive_expression_error:
1845 multiplicative_expression_error
1846 | additive_expression '+' multiplicative_expression_error { $$ = MkExpOp($1, '+', $3); $$.loc = @$; }
1847 /* Useless rules due to conflicts
1848 | additive_expression '+' error { $$ = MkExpOp($1, '+', null); $$.loc = @$; }
1850 | additive_expression '-' multiplicative_expression_error { $$ = MkExpOp($1, '-', $3); $$.loc = @$; }
1851 /* Useless rules due to conflicts
1852 | additive_expression '-' error { $$ = MkExpOp($1, '-', null); $$.loc = @$; }
1854 | additive_expression_error '+' multiplicative_expression_error { $$ = MkExpOp($1, '+', $3); $$.loc = @$; }
1855 /* Useless rules due to conflicts
1856 | additive_expression_error '+' error { $$ = MkExpOp($1, '+', null); $$.loc = @$; }
1858 | additive_expression_error '-' multiplicative_expression_error { $$ = MkExpOp($1, '-', $3); $$.loc = @$; }
1859 /* Useless rules due to conflicts
1860 | additive_expression_error '-' error { $$ = MkExpOp($1, '-', null); $$.loc = @$; }
1864 shift_expression_error:
1865 additive_expression_error
1866 | shift_expression LEFT_OP additive_expression_error { $$ = MkExpOp($1, LEFT_OP, $3); $$.loc = @$; }
1867 | shift_expression RIGHT_OP additive_expression_error { $$ = MkExpOp($1, RIGHT_OP, $3); $$.loc = @$; }
1868 | shift_expression_error LEFT_OP additive_expression_error { $$ = MkExpOp($1, LEFT_OP, $3); $$.loc = @$; }
1869 | shift_expression_error RIGHT_OP additive_expression_error { $$ = MkExpOp($1, RIGHT_OP, $3); $$.loc = @$; }
1872 relational_expression_error:
1873 shift_expression_error
1874 | relational_expression_smaller_than /*relational_expression '<' */ shift_expression_error
1876 if($1.type == identifierExp)
1878 if($1.identifier._class && !$1.identifier._class.name)
1882 strcat(name, $1.identifier.string);
1883 _DeclClass(0, name);
1886 _DeclClass(0, $1.identifier.string);
1888 // printf("Declaring Class %s\n", $1.identifier.string);
1894 fileInput.Seek(@1.start.pos, start);
1895 resetScannerPos(&@1.start);
1900 YY_STACK_PRINT (yyss, yyssp);
1904 YY_STACK_PRINT (yyss, yyssp);
1908 YY_STACK_PRINT (yyss, yyssp);
1912 YY_STACK_PRINT (yyss, yyssp);
1920 $$ = MkExpOp($1, '<', $2);
1925 | relational_expression '>' shift_expression_error { $$ = MkExpOp($1, '>', $3); $$.loc = @$; }
1926 | relational_expression LE_OP shift_expression_error { $$ = MkExpOp($1, LE_OP, $3); $$.loc = @$; }
1927 | relational_expression GE_OP shift_expression_error { $$ = MkExpOp($1, GE_OP, $3); $$.loc = @$; }
1928 | relational_expression_error '<' shift_expression_error { $$ = MkExpOp($1, '<', $3); $$.loc = @$; }
1929 | relational_expression_error '>' shift_expression_error { $$ = MkExpOp($1, '>', $3); $$.loc = @$; }
1930 | relational_expression_error LE_OP shift_expression_error { $$ = MkExpOp($1, LE_OP, $3); $$.loc = @$; }
1931 | relational_expression_error GE_OP shift_expression_error { $$ = MkExpOp($1, GE_OP, $3); $$.loc = @$; }
1934 equality_expression_error:
1935 relational_expression_error
1936 | equality_expression EQ_OP relational_expression_error { $$ = MkExpOp($1, EQ_OP, $3); $$.loc = @$; }
1937 | equality_expression NE_OP relational_expression_error { $$ = MkExpOp($1, NE_OP, $3); $$.loc = @$; }
1938 | equality_expression_error EQ_OP relational_expression_error { $$ = MkExpOp($1, EQ_OP, $3); $$.loc = @$; }
1939 | equality_expression_error NE_OP relational_expression_error { $$ = MkExpOp($1, NE_OP, $3); $$.loc = @$; }
1940 /* Useless rules due to conflicts
1941 | equality_expression EQ_OP error { $$ = MkExpOp($1, EQ_OP, MkExpDummy()); $$.loc = @$; }
1942 | equality_expression NE_OP error { $$ = MkExpOp($1, NE_OP, MkExpDummy()); $$.loc = @$; }
1943 | equality_expression_error EQ_OP error { $$ = MkExpOp($1, EQ_OP, MkExpDummy()); $$.loc = @$; }
1944 | equality_expression_error NE_OP error { $$ = MkExpOp($1, NE_OP, MkExpDummy()); $$.loc = @$; }
1946 | equality_expression EQ_OP anon_instantiation_expression_error { $$ = MkExpOp($1, EQ_OP, $3); $$.loc = @$; }
1947 | equality_expression NE_OP anon_instantiation_expression_error { $$ = MkExpOp($1, NE_OP, $3); $$.loc = @$; }
1948 | equality_expression_error EQ_OP anon_instantiation_expression_error { $$ = MkExpOp($1, EQ_OP, $3); $$.loc = @$; }
1949 | equality_expression_error NE_OP anon_instantiation_expression_error { $$ = MkExpOp($1, NE_OP, $3); $$.loc = @$; }
1952 and_expression_error:
1953 equality_expression_error
1954 | and_expression '&' equality_expression_error { $$ = MkExpOp($1, '&', $3); $$.loc = @$; }
1955 | and_expression_error '&' equality_expression_error { $$ = MkExpOp($1, '&', $3); $$.loc = @$; }
1957 | and_expression '&' anon_instantiation_expression_error { $$ = MkExpOp($1, '&', $3); $$.loc = @$; }
1958 | and_expression_error '&' anon_instantiation_expression_error { $$ = MkExpOp($1, '&', $3); $$.loc = @$; }
1961 exclusive_or_expression_error:
1962 and_expression_error
1963 | exclusive_or_expression '^' and_expression_error { $$ = MkExpOp($1, '^', $3); $$.loc = @$; }
1964 | exclusive_or_expression_error '^' and_expression_error { $$ = MkExpOp($1, '^', $3); $$.loc = @$; }
1966 | exclusive_or_expression '^' anon_instantiation_expression_error { $$ = MkExpOp($1, '^', $3); $$.loc = @$; }
1967 | exclusive_or_expression_error '^' anon_instantiation_expression_error { $$ = MkExpOp($1, '^', $3); $$.loc = @$; }
1970 inclusive_or_expression_error:
1971 exclusive_or_expression_error
1972 | inclusive_or_expression '|' exclusive_or_expression_error { $$ = MkExpOp($1, '|', $3); $$.loc = @$; }
1973 | inclusive_or_expression_error '|' exclusive_or_expression_error { $$ = MkExpOp($1, '|', $3); $$.loc = @$; }
1975 | inclusive_or_expression '|' anon_instantiation_expression_error { $$ = MkExpOp($1, '|', $3); $$.loc = @$; }
1976 | inclusive_or_expression_error '|' anon_instantiation_expression_error { $$ = MkExpOp($1, '|', $3); $$.loc = @$; }
1979 logical_and_expression_error:
1980 inclusive_or_expression_error
1981 | logical_and_expression AND_OP inclusive_or_expression_error { $$ = MkExpOp($1, AND_OP, $3); $$.loc = @$; }
1982 | logical_and_expression_error AND_OP inclusive_or_expression_error { $$ = MkExpOp($1, AND_OP, $3); $$.loc = @$; }
1985 logical_or_expression_error:
1986 logical_and_expression_error
1987 | logical_or_expression OR_OP logical_and_expression_error { $$ = MkExpOp($1, OR_OP, $3); $$.loc = @$; }
1988 | logical_or_expression_error OR_OP logical_and_expression_error { $$ = MkExpOp($1, OR_OP, $3); $$.loc = @$; }
1991 conditional_expression_error:
1992 logical_or_expression_error
1993 | logical_or_expression '?' expression ':' logical_or_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1994 | logical_or_expression '?' expression_error ':' logical_or_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1995 | logical_or_expression_error '?' expression ':' logical_or_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1996 | logical_or_expression_error '?' expression_error ':' logical_or_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1997 | logical_or_expression '?' expression ':' { $$ = MkExpCondition($1, $3, MkExpDummy()); $$.loc = @$; $$.cond.elseExp.loc = @3; }
1998 | logical_or_expression '?' expression_error ':' { $$ = MkExpCondition($1, $3, MkExpDummy()); $$.loc = @$; $$.cond.elseExp.loc = @3; }
1999 | logical_or_expression_error '?' expression ':' { $$ = MkExpCondition($1, $3, MkExpDummy()); $$.loc = @$; $$.cond.elseExp.loc = @3; }
2000 | logical_or_expression_error '?' expression_error ':' { $$ = MkExpCondition($1, $3, MkExpDummy()); $$.loc = @$; $$.cond.elseExp.loc = @3; }
2002 | logical_or_expression '?' expression_anon_inst ':' logical_or_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
2003 | logical_or_expression '?' expression_anon_inst_error ':' logical_or_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
2004 | logical_or_expression_error '?' expression_anon_inst ':' logical_or_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
2005 | logical_or_expression_error '?' expression_anon_inst_error ':' logical_or_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
2006 | logical_or_expression '?' expression_anon_inst ':' { $$ = MkExpCondition($1, $3, MkExpDummy()); $$.loc = @$; $$.cond.elseExp.loc = @3; }
2007 | logical_or_expression '?' expression_anon_inst_error ':' { $$ = MkExpCondition($1, $3, MkExpDummy()); $$.loc = @$; $$.cond.elseExp.loc = @3; }
2008 | logical_or_expression_error '?' expression_anon_inst ':' { $$ = MkExpCondition($1, $3, MkExpDummy()); $$.loc = @$; $$.cond.elseExp.loc = @3; }
2009 | logical_or_expression_error '?' expression_anon_inst_error ':' { $$ = MkExpCondition($1, $3, MkExpDummy()); $$.loc = @$; $$.cond.elseExp.loc = @3; }
2011 | logical_or_expression '?' expression ':' anon_instantiation_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
2012 | logical_or_expression '?' expression_error ':' anon_instantiation_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
2013 | logical_or_expression_error '?' expression ':' anon_instantiation_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
2014 | logical_or_expression_error '?' expression_error ':' anon_instantiation_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
2016 | logical_or_expression '?' expression_anon_inst ':' anon_instantiation_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
2017 | logical_or_expression '?' expression_anon_inst_error ':' anon_instantiation_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
2018 | logical_or_expression_error '?' expression_anon_inst ':' anon_instantiation_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
2019 | logical_or_expression_error '?' expression_anon_inst_error ':' anon_instantiation_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
2021 | logical_or_expression '?' ':'
2023 $$ = MkExpCondition($1, MkListOne(MkExpDummy()), MkExpDummy());
2025 ((Expression)$$.cond.exp->last).loc = @2;
2026 $$.cond.elseExp.loc = @3;
2028 | logical_or_expression_error '?' ':'
2030 $$ = MkExpCondition($1, MkListOne(MkExpDummy()), MkExpDummy()); $$.loc = @$; ((Expression)$$.cond.exp->last).loc = @2; $$.cond.elseExp.loc = @3;
2032 | logical_or_expression '?'
2034 $$ = MkExpCondition($1, MkListOne(MkExpDummy()), MkExpDummy()); $$.loc = @$; ((Expression)$$.cond.exp->last).loc = @2; $$.cond.elseExp.loc = @2;
2036 | logical_or_expression_error '?'
2038 $$ = MkExpCondition($1, MkListOne(MkExpDummy()), MkExpDummy()); $$.loc = @$; ((Expression)$$.cond.exp->last).loc = @2; $$.cond.elseExp.loc = @2;
2042 assignment_expression_error:
2043 conditional_expression_error
2044 | unary_expression assignment_operator assignment_expression_error { $$ = MkExpOp($1, $2, $3); $$.loc = @$; }
2045 /* Useless rules due to conflicts
2046 | unary_expression assignment_operator error { $$ = MkExpOp($1, $2, MkExpDummy()); $$.loc = @$; $$.op.exp2.loc = @2; }
2048 | unary_expression_error assignment_operator assignment_expression_error { $$ = MkExpOp($1, $2, $3); $$.loc = @$; }
2049 /* Useless rules due to conflicts
2050 | unary_expression_error assignment_operator error { $$ = MkExpOp($1, $2, MkExpDummy()); $$.loc = @$; $$.op.exp2.loc = @2; }
2053 | unary_expression assignment_operator anon_instantiation_expression_error { $$ = MkExpOp($1, $2, $3); $$.loc = @$; }
2054 | unary_expression_error assignment_operator anon_instantiation_expression_error { $$ = MkExpOp($1, $2, $3); $$.loc = @$; }
2058 assignment_expression_error { $$ = MkList(); ListAdd($$, $1); }
2059 | assignment_expression error { $$ = MkList(); ListAdd($$, $1); }
2060 | expression ',' assignment_expression_error { $$ = $1; ListAdd($1, $3); }
2061 | expression_error ',' assignment_expression_error { $$ = $1; ListAdd($1, $3); }
2062 /* Useless rules due to conflicts
2063 | expression ',' error
2064 | expression_error ',' error
2067 | expression expression { $$ = $1; FreeList($2, FreeExpression); }
2068 | expression_error expression { $$ = $1; FreeList($2, FreeExpression); }
2069 | expression expression_error { $$ = $1; FreeList($2, FreeExpression); }
2072 expression_anon_inst_error:
2073 anon_instantiation_expression_error { $$ = MkList(); ListAdd($$, $1); }
2074 | anon_instantiation_expression error { $$ = MkList(); ListAdd($$, $1); }
2075 | expression ',' anon_instantiation_expression_error { $$ = $1; ListAdd($1, $3); }
2076 | expression_error ',' anon_instantiation_expression_error { $$ = $1; ListAdd($1, $3); }
2080 constant_expression: conditional_expression;
2082 constant_expression_error: conditional_expression_error;
2084 /**** TYPES **************************************************************************/
2085 storage_class_specifier:
2086 TYPEDEF { $$ = MkSpecifier(TYPEDEF); }
2087 | EXTERN { $$ = MkSpecifier(EXTERN); }
2088 | STATIC { $$ = MkSpecifier(STATIC); }
2089 | AUTO { $$ = MkSpecifier(AUTO); }
2090 | REGISTER { $$ = MkSpecifier(REGISTER); }
2093 external_storage_class_specifier:
2094 TYPEDEF { $$ = MkSpecifier(TYPEDEF); declMode = defaultAccess; }
2095 | EXTERN { $$ = MkSpecifier(EXTERN); }
2096 | STATIC { $$ = MkSpecifier(STATIC); declMode = staticAccess; }
2097 | AUTO { $$ = MkSpecifier(AUTO); }
2098 | REGISTER { $$ = MkSpecifier(REGISTER); }
2102 identifier { $$ = MkEnumerator($1, null); }
2103 | identifier '=' constant_expression { $$ = MkEnumerator($1, $3); }
2104 | identifier '=' constant_expression_error { $$ = MkEnumerator($1, $3); }
2108 enumerator { $$ = MkList(); ListAdd($$, $1); }
2109 | enumerator_list ',' enumerator { $$ = $1; ListAdd($1, $3); }
2110 | enumerator_list ','
2114 ENUM { memberAccessStack[++defaultMemberAccess] = publicAccess; }
2117 enum_specifier_nocompound:
2118 enum_specifier identifier { $$ = MkEnum($2, null); POP_DEFAULT_ACCESS }
2119 | enum_specifier strict_type { $$ = MkEnum(MkIdentifier($2.name), null); POP_DEFAULT_ACCESS }
2122 enum_specifier_compound:
2123 enum_specifier_compound_error '}' { $$.loc = @$; POP_DEFAULT_ACCESS $$ = $1; }
2124 | enum_specifier identifier '{' '}' { $$ = MkEnum($2, null); $$.loc = @$; POP_DEFAULT_ACCESS }
2125 | enum_specifier strict_type '{' '}' { $$ = MkEnum(MkIdentifier($2.name), null); FreeSpecifier($2); $$.loc = @$; POP_DEFAULT_ACCESS }
2128 enum_specifier_compound_error:
2129 enum_specifier '{' enumerator_list { $$ = MkEnum(null, $3); $$.loc = @$; POP_DEFAULT_ACCESS }
2130 | enum_specifier '{' error { $$ = MkEnum(null, null); $$.loc = @$; POP_DEFAULT_ACCESS }
2132 | enum_specifier identifier '{' enumerator_list { $$ = MkEnum($2, $4); $$.loc = @$; POP_DEFAULT_ACCESS }
2133 | enum_specifier identifier '{' enumerator_list error { $$ = MkEnum($2, $4); $$.loc = @$; POP_DEFAULT_ACCESS }
2134 | enum_specifier identifier '{' error { $$ = MkEnum($2, null); $$.loc = @$; POP_DEFAULT_ACCESS }
2135 | enum_specifier identifier '{' enumerator_list ';' struct_declaration_list { $$ = MkEnum($2, $4); $$.loc = @$; $$.definitions = $6; POP_DEFAULT_ACCESS }
2136 | enum_specifier identifier '{' enumerator_list ';' struct_declaration_list_error { $$ = MkEnum($2, $4); $$.loc = @$; $$.definitions = $6; POP_DEFAULT_ACCESS }
2138 | enum_specifier strict_type '{' enumerator_list { $$ = MkEnum(MkIdentifier($2.name), $4); $$.loc = @$; FreeSpecifier($2); POP_DEFAULT_ACCESS }
2139 | enum_specifier strict_type '{' enumerator_list error { $$ = MkEnum(MkIdentifier($2.name), $4); $$.loc = @$; FreeSpecifier($2); POP_DEFAULT_ACCESS }
2140 | enum_specifier strict_type '{' error { $$ = MkEnum(MkIdentifier($2.name), null); $$.loc = @$; FreeSpecifier($2); POP_DEFAULT_ACCESS }
2141 | enum_specifier strict_type '{' enumerator_list ';' struct_declaration_list { $$ = MkEnum(MkIdentifier($2.name), $4); $$.loc = @$; $$.definitions = $6; FreeSpecifier($2); POP_DEFAULT_ACCESS }
2142 | enum_specifier strict_type '{' enumerator_list ';' struct_declaration_list_error { $$ = MkEnum(MkIdentifier($2.name), $4); $$.loc = @$; $$.definitions = $6; FreeSpecifier($2); POP_DEFAULT_ACCESS }
2146 enum_specifier identifier { $$ = $2; if(declMode) DeclClassAddNameSpace(globalContext.nextID++, $2.string); }
2147 | enum_specifier strict_type { $$ = MkIdentifier($2.name); if(declMode) DeclClass(globalContext.nextID++, $2.name); FreeSpecifier($2); }
2151 enum_class_error '}' { $$ = $1; $$.loc = @$; }
2152 | enum_decl ':' inheritance_specifiers '{' '}' { $$ = MkEnum($1, null); $$.baseSpecs = $3; $$.loc = @$; POP_DEFAULT_ACCESS }
2153 | enum_decl '{' '}' { $$ = MkEnum($1, null); POP_DEFAULT_ACCESS }
2157 enum_decl ':' inheritance_specifiers '{' enumerator_list { $$ = MkEnum($1, $5); $$.baseSpecs = $3; $$.loc = @$; POP_DEFAULT_ACCESS }
2158 | enum_decl ':' inheritance_specifiers '{' enumerator_list error { $$ = MkEnum($1, $5); $$.baseSpecs = $3; $$.loc = @$; POP_DEFAULT_ACCESS }
2159 | enum_decl ':' inheritance_specifiers '{' error { $$ = MkEnum($1, null); $$.baseSpecs = $3; $$.loc = @$; POP_DEFAULT_ACCESS }
2160 | enum_decl ':' inheritance_specifiers '{' enumerator_list ';' struct_declaration_list { $$ = MkEnum($1, $5); $$.baseSpecs = $3; $$.definitions = $7; $$.loc = @$; POP_DEFAULT_ACCESS }
2161 | enum_decl ':' inheritance_specifiers '{' enumerator_list ';' struct_declaration_list_error { $$ = MkEnum($1, $5); $$.baseSpecs = $3; $$.definitions = $7; $$.loc = @$; POP_DEFAULT_ACCESS }
2162 | enum_decl ':' inheritance_specifiers '{' enumerator_list error ';' struct_declaration_list { $$ = MkEnum($1, $5); $$.baseSpecs = $3; $$.definitions = $8; $$.loc = @$; POP_DEFAULT_ACCESS }
2163 | enum_decl ':' inheritance_specifiers '{' enumerator_list error ';' struct_declaration_list_error { $$ = MkEnum($1, $5); $$.baseSpecs = $3; $$.definitions = $8; $$.loc = @$; POP_DEFAULT_ACCESS }
2164 | enum_decl ':' inheritance_specifiers '{' error ';' struct_declaration_list { $$ = MkEnum($1, null); $$.baseSpecs = $3; $$.definitions = $7; $$.loc = @$; POP_DEFAULT_ACCESS }
2165 | enum_decl ':' inheritance_specifiers '{' error ';' struct_declaration_list_error { $$ = MkEnum($1, null); $$.baseSpecs = $3; $$.definitions = $7; $$.loc = @$; POP_DEFAULT_ACCESS }
2167 | enum_specifier '{' enumerator_list { $$ = MkEnum(null, $3); $$.loc = @$; POP_DEFAULT_ACCESS }
2168 | enum_specifier '{' error { $$ = MkEnum(null, null); $$.loc = @$; POP_DEFAULT_ACCESS }
2170 | enum_decl '{' enumerator_list { $$ = MkEnum($1, $3); $$.loc = @$; POP_DEFAULT_ACCESS }
2171 | enum_decl '{' enumerator_list error { $$ = MkEnum($1, $3); $$.loc = @$; POP_DEFAULT_ACCESS }
2172 | enum_decl '{' error { $$ = MkEnum($1, null); $$.loc = @$; POP_DEFAULT_ACCESS }
2173 | enum_decl '{' enumerator_list ';' struct_declaration_list { $$ = MkEnum($1, $3); $$.definitions = $5; $$.loc = @$; POP_DEFAULT_ACCESS }
2174 | enum_decl '{' enumerator_list ';' struct_declaration_list_error { $$ = MkEnum($1, $3); $$.definitions = $5; $$.loc = @$; POP_DEFAULT_ACCESS }
2182 class_specifier_error:
2184 | struct_class_error
2188 ext_decl { $$ = MkSpecifierExtended($1); }
2192 CONST { $$ = MkSpecifier(CONST); }
2193 | VOLATILE { $$ = MkSpecifier(VOLATILE); }
2194 | ext_storage { $$ = $1; }
2198 type_qualifier_list:
2199 type_qualifier { $$ = MkList(); ListAdd($$, $1); }
2200 | type_qualifier_list type_qualifier { $$ = $1; ListAdd($1, $2); }
2204 VOID { $$ = MkSpecifier(VOID); }
2205 | CHAR { $$ = MkSpecifier(CHAR); }
2206 | SHORT { $$ = MkSpecifier(SHORT); }
2207 | INT { $$ = MkSpecifier(INT); }
2208 | UINT { $$ = MkSpecifier(UINT); }
2209 | INT64 { $$ = MkSpecifier(INT64); }
2210 | VALIST { $$ = MkSpecifier(VALIST); }
2211 | LONG { $$ = MkSpecifier(LONG); }
2212 | FLOAT { $$ = MkSpecifier(FLOAT); }
2213 | DOUBLE { $$ = MkSpecifier(DOUBLE); }
2214 | SIGNED { $$ = MkSpecifier(SIGNED); }
2215 | UNSIGNED { $$ = MkSpecifier(UNSIGNED); }
2216 | EXTENSION { $$ = MkSpecifier(EXTENSION); }
2217 | struct_or_union_specifier_nocompound
2218 | enum_specifier_nocompound
2220 | TYPEOF '(' assignment_expression ')' { $$ = MkSpecifierTypeOf($3); }
2221 | SUBCLASS '(' type ')' { $$ = MkSpecifierSubClass($3); }
2222 | SUBCLASS '(' identifier ')' { _DeclClass(0, $3.string); $$ = MkSpecifierSubClass(MkSpecifierName($3.string)); FreeIdentifier($3); }
2223 | THISCLASS { $$ = MkSpecifier(THISCLASS); }
2224 | TYPED_OBJECT { $$ = MkSpecifier(TYPED_OBJECT); }
2225 | ANY_OBJECT { $$ = MkSpecifier(ANY_OBJECT); }
2228 strict_type_specifier:
2229 VOID { $$ = MkSpecifier(VOID); }
2230 | CHAR { $$ = MkSpecifier(CHAR); }
2231 | SHORT { $$ = MkSpecifier(SHORT); }
2232 | INT { $$ = MkSpecifier(INT); }
2233 | UINT { $$ = MkSpecifier(UINT); }
2234 | INT64 { $$ = MkSpecifier(INT64); }
2235 | VALIST { $$ = MkSpecifier(VALIST); }
2236 | LONG { $$ = MkSpecifier(LONG); }
2237 | FLOAT { $$ = MkSpecifier(FLOAT); }
2238 | DOUBLE { $$ = MkSpecifier(DOUBLE); }
2239 | SIGNED { $$ = MkSpecifier(SIGNED); }
2240 | UNSIGNED { $$ = MkSpecifier(UNSIGNED); }
2241 | EXTENSION { $$ = MkSpecifier(EXTENSION); }
2242 | struct_or_union_specifier_nocompound
2243 | enum_specifier_nocompound
2245 | TYPEOF '(' assignment_expression ')' { $$ = MkSpecifierTypeOf($3); }
2246 | SUBCLASS '(' type ')' { $$ = MkSpecifierSubClass($3); }
2247 | SUBCLASS '(' identifier ')' { _DeclClass(0, $3.string); $$ = MkSpecifierSubClass(MkSpecifierName($3.string)); FreeIdentifier($3); }
2248 | THISCLASS { $$ = MkSpecifier(THISCLASS); }
2251 // TESTING declarator_nofunction here... For function declarations
2254 declarator_nofunction_type_ok
2255 { $$ = MkStructDeclarator($1, null); $$.loc = @$; }
2256 | declarator_nofunction_type_ok attrib
2257 { $$ = MkStructDeclarator($1, null); $$.structDecl.attrib = $2; $$.loc = @$; }
2258 | ':' constant_expression
2259 { $$ = MkStructDeclarator(null, $2); $$.loc = @$; }
2260 | declarator_nofunction_type_ok ':' constant_expression
2261 { $$ = MkStructDeclarator($1, $3); $$.loc = @$; }
2262 | declarator_nofunction_type_ok ':' constant_expression ':' constant_expression
2263 { $$ = MkStructDeclarator($1, $3); $$.structDecl.posExp = $5; $$.loc = @$; }
2264 | ':' constant_expression_error
2265 { $$ = MkStructDeclarator(null, $2); $$.loc = @$; }
2266 | declarator_nofunction_type_ok ':' constant_expression_error
2267 { $$ = MkStructDeclarator($1, $3); $$.loc = @$; }
2268 | declarator_nofunction_type_ok ':' constant_expression ':' constant_expression_error
2269 { $$ = MkStructDeclarator($1, $3); $$.structDecl.posExp = $5; $$.loc = @$; }
2270 | declarator_nofunction_type_ok ':' constant_expression_error ':' constant_expression_error
2271 { $$ = MkStructDeclarator($1, $3); $$.structDecl.posExp = $5; $$.loc = @$; }
2272 | declarator_nofunction_type_ok ':' constant_expression_error ':' constant_expression
2273 { $$ = MkStructDeclarator($1, $3); $$.structDecl.posExp = $5; $$.loc = @$; }
2276 struct_declarator_list:
2277 struct_declarator { $$ = MkList(); ListAdd($$, $1); }
2278 | struct_declarator_list ',' struct_declarator { $$ = $1; ListAdd($1, $3); }
2282 struct_or_union identifier
2284 $$ = MkStructOrUnion($1, $2, null);
2285 $$.addNameSpace = true;
2286 $$.ctx = PushContext();
2288 | struct_or_union base_strict_type
2290 $$ = MkStructOrUnion($1, MkIdentifier($2.name), null);
2291 $$.ctx = PushContext();
2294 | struct_or_union ext_decl identifier
2296 $$ = MkStructOrUnion($1, $3, null);
2297 $$.extDeclStruct = $2;
2298 $$.addNameSpace = true;
2299 $$.ctx = PushContext();
2301 | struct_or_union ext_decl base_strict_type
2303 $$ = MkStructOrUnion($1, MkIdentifier($3.name), null);
2304 $$.extDeclStruct = $2;
2305 $$.ctx = PushContext();
2310 struct_or_union_specifier_compound:
2311 struct_or_union_specifier_compound_error '}' { $$ = $1; $$.loc = @$; }
2312 | struct_entry '{' '}' { $$ = $1; $$.loc = @$; POP_DEFAULT_ACCESS PopContext(curContext); }
2313 | struct_or_union '{' '}' { $$ = MkStructOrUnion($1, null, null); $$.loc = @$; POP_DEFAULT_ACCESS }
2314 | struct_or_union ext_decl '{' '}' { $$ = MkStructOrUnion($1, null, null); $$.extDeclStruct = $2; $$.loc = @$; POP_DEFAULT_ACCESS }
2317 struct_or_union_specifier_compound_error:
2318 struct_entry '{' struct_declaration_list { $$ = $1; AddStructDefinitions($1, $3); POP_DEFAULT_ACCESS PopContext(curContext); }
2319 | struct_entry '{' struct_declaration_list_error { $$ = $1; AddStructDefinitions($1, $3); POP_DEFAULT_ACCESS PopContext(curContext); }
2320 | struct_entry '{' error { $$ = $1; POP_DEFAULT_ACCESS PopContext(curContext); }
2322 | struct_or_union '{' struct_declaration_list { $$ = MkStructOrUnion($1, null, $3); POP_DEFAULT_ACCESS }
2323 | struct_or_union '{' struct_declaration_list_error { $$ = MkStructOrUnion($1, null, $3); POP_DEFAULT_ACCESS }
2324 | struct_or_union '{' error { $$ = MkStructOrUnion($1, null, null); POP_DEFAULT_ACCESS }
2326 | struct_or_union ext_decl '{' struct_declaration_list { $$ = MkStructOrUnion($1, null, $4); $$.extDeclStruct = $2; POP_DEFAULT_ACCESS }
2327 | struct_or_union ext_decl '{' struct_declaration_list_error { $$ = MkStructOrUnion($1, null, $4); $$.extDeclStruct = $2; POP_DEFAULT_ACCESS }
2328 | struct_or_union ext_decl '{' error { $$ = MkStructOrUnion($1, null, null); $$.extDeclStruct = $2; POP_DEFAULT_ACCESS }
2331 struct_or_union_specifier_nocompound:
2332 struct_entry { $$ = $1; POP_DEFAULT_ACCESS PopContext(curContext); }
2341 ($1.addNameSpace ? DeclClassAddNameSpace : DeclClass)(globalContext.nextID++, $1.id.string);
2344 | struct_entry '<' template_parameters_list '>'
2346 Symbol symbol = ($1.addNameSpace ? DeclClassAddNameSpace : DeclClass)(globalContext.nextID++, $1.id.string);
2348 symbol.templateParams = $3;
2353 struct_decl ':' inheritance_specifiers
2357 SetupBaseSpecs(null, $3);
2362 struct_class_error '}' { $$ = $1; $$.loc = @$; }
2363 | struct_head '{' '}'
2364 { $$ = $1; POP_DEFAULT_ACCESS PopContext(curContext); }
2365 | struct_decl '{' '}' { $$ = $1; POP_DEFAULT_ACCESS PopContext(curContext); }
2366 | struct_or_union '{' '}' { $$ = MkStructOrUnion($1, null, null); POP_DEFAULT_ACCESS }
2370 struct_head '{' struct_declaration_list
2373 $$.definitions = $3;
2375 PopContext(curContext);
2377 | struct_head '{' struct_declaration_list_error
2380 $$.definitions = $3;
2382 PopContext(curContext);
2384 | struct_head '{' error
2385 { $$ = $1; POP_DEFAULT_ACCESS PopContext(curContext);}
2387 | struct_decl '{' struct_declaration_list
2389 PopContext(curContext);
2392 $$ = MkStructOrUnion($1.type, $1.id, $3);
2397 $$.definitions = $3;
2400 | struct_decl '{' struct_declaration_list_error
2402 PopContext(curContext);
2406 $$ = MkStructOrUnion($1.type, $1.id, $3);
2411 $$.definitions = $3;
2414 | struct_decl '{' error
2415 { $$ = $1; POP_DEFAULT_ACCESS PopContext(curContext); }
2417 | struct_or_union '{' struct_declaration_list
2418 { $$ = MkStructOrUnion($1, null, $3); POP_DEFAULT_ACCESS }
2419 | struct_or_union '{' struct_declaration_list_error
2420 { $$ = MkStructOrUnion($1, null, $3); POP_DEFAULT_ACCESS }
2421 | struct_or_union '{' error
2422 { $$ = MkStructOrUnion($1, null, null); POP_DEFAULT_ACCESS }
2426 STRUCT { $$ = structSpecifier; memberAccessStack[++defaultMemberAccess] = publicAccess; }
2427 | UNION { $$ = unionSpecifier; memberAccessStack[++defaultMemberAccess] = publicAccess; }
2430 specifier_qualifier_list:
2431 type_qualifier { $$ = MkList(); ListAdd($$, $1); }
2432 | specifier_qualifier_list type_qualifier { $$ = $1; ListAdd($1, $2); }
2433 | type_specifier { $$ = MkList(); ListAdd($$, $1); }
2434 | specifier_qualifier_list type_specifier { $$ = $1; ListAdd($1, $2); }
2435 | enum_specifier_compound { $$ = MkList(); ListAdd($$, $1); }
2436 | specifier_qualifier_list enum_specifier_compound { $$ = $1; ListAdd($1, $2); }
2437 | struct_or_union_specifier_compound { $$ = MkList(); ListAdd($$, $1); }
2438 | specifier_qualifier_list struct_or_union_specifier_compound { $$ = $1; ListAdd($1, $2); }
2441 guess_specifier_qualifier_list:
2442 type_qualifier { $$ = MkList(); ListAdd($$, $1); }
2443 | guess_specifier_qualifier_list type_qualifier { $$ = $1; ListAdd($1, $2); }
2444 | type_specifier { $$ = MkList(); ListAdd($$, $1); }
2445 | guess_specifier_qualifier_list type_specifier { $$ = $1; ListAdd($1, $2); }
2446 | guess_type { $$ = MkList(); ListAdd($$, $1); }
2447 | guess_specifier_qualifier_list guess_type { $$ = $1; ListAdd($1, $2); }
2448 | enum_specifier_compound { $$ = MkList(); ListAdd($$, $1); }
2449 | guess_specifier_qualifier_list enum_specifier_compound { $$ = $1; ListAdd($1, $2); }
2450 | struct_or_union_specifier_compound { $$ = MkList(); ListAdd($$, $1); }
2451 | guess_specifier_qualifier_list struct_or_union_specifier_compound { $$ = $1; ListAdd($1, $2); }
2454 declaration_specifiers:
2455 storage_class_specifier { $$ = MkList(); ListAdd($$, $1); }
2456 | declaration_specifiers storage_class_specifier { $$ = $1; ListAdd($1, $2); }
2457 | type_qualifier { $$ = MkList(); ListAdd($$, $1); }
2458 | declaration_specifiers type_qualifier { $$ = $1; ListAdd($1, $2); }
2459 | strict_type_specifier { $$ = MkList(); ListAdd($$, $1); }
2460 | declaration_specifiers strict_type_specifier { $$ = $1; ListAdd($1, $2); }
2461 | enum_specifier_compound { $$ = MkList(); ListAdd($$, $1); }
2462 | declaration_specifiers enum_specifier_compound { $$ = $1; ListAdd($1, $2); }
2463 | struct_or_union_specifier_compound { $$ = MkList(); ListAdd($$, $1); }
2464 | declaration_specifiers struct_or_union_specifier_compound { $$ = $1; ListAdd($1, $2); }
2467 guess_declaration_specifiers:
2468 storage_class_specifier { $$ = MkList(); ListAdd($$, $1); }
2469 | guess_declaration_specifiers storage_class_specifier { $$ = $1; ListAdd($1, $2); }
2470 | type_qualifier { $$ = MkList(); ListAdd($$, $1); }
2471 | guess_declaration_specifiers type_qualifier { $$ = $1; ListAdd($1, $2); }
2472 | type_specifier { $$ = MkList(); ListAdd($$, $1); }
2473 | guess_declaration_specifiers type_specifier { $$ = $1; ListAdd($1, $2); }
2474 | guess_type { $$ = MkList(); ListAdd($$, $1); }
2475 | guess_declaration_specifiers guess_type { $$ = $1; ListAdd($1, $2); }
2476 | struct_or_union_specifier_compound { $$ = MkList(); ListAdd($$, $1); }
2477 | guess_declaration_specifiers struct_or_union_specifier_compound { $$ = $1; ListAdd($1, $2); }
2478 | enum_specifier_compound { $$ = MkList(); ListAdd($$, $1); }
2479 | guess_declaration_specifiers enum_specifier_compound { $$ = $1; ListAdd($1, $2); }
2482 external_guess_declaration_specifiers:
2483 external_storage_class_specifier { $$ = MkList(); ListAdd($$, $1); }
2484 | external_guess_declaration_specifiers external_storage_class_specifier { $$ = $1; ListAdd($1, $2); }
2485 | type_qualifier { $$ = MkList(); ListAdd($$, $1); }
2486 | external_guess_declaration_specifiers type_qualifier { $$ = $1; ListAdd($1, $2); }
2487 | type_specifier { $$ = MkList(); ListAdd($$, $1); }
2488 | external_guess_declaration_specifiers type_specifier { $$ = $1; ListAdd($1, $2); }
2489 | guess_type { $$ = MkList(); ListAdd($$, $1); }
2490 | external_guess_declaration_specifiers guess_type { $$ = $1; ListAdd($1, $2); }
2491 | class_specifier { $$ = MkList(); ListAdd($$, $1); }
2492 | external_guess_declaration_specifiers class_specifier { $$ = $1; ListAdd($1, $2); }
2495 external_guess_declaration_specifiers_error:
2496 class_specifier_error { $$ = MkList(); ListAdd($$, $1); }
2497 | external_guess_declaration_specifiers class_specifier_error { $$ = $1; ListAdd($1, $2); }
2500 _inheritance_specifiers:
2501 PRIVATE { $$ = MkList(); ListAdd($$, MkSpecifier(PRIVATE)); }
2502 | PUBLIC { $$ = MkList(); ListAdd($$, MkSpecifier(PUBLIC)); }
2503 | storage_class_specifier { $$ = MkList(); ListAdd($$, $1); }
2504 | _inheritance_specifiers storage_class_specifier { $$ = $1; ListAdd($1, $2); }
2505 | type_qualifier { $$ = MkList(); ListAdd($$, $1); }
2506 | _inheritance_specifiers type_qualifier { $$ = $1; ListAdd($1, $2); }
2507 | strict_type_specifier { $$ = MkList(); ListAdd($$, $1); }
2508 | _inheritance_specifiers strict_type_specifier { $$ = $1; ListAdd($1, $2); }
2510 { _DeclClass(0, $1.string); $$ = MkListOne(MkSpecifierName($1.string)); FreeIdentifier($1); }
2511 | _inheritance_specifiers identifier { $$ = $1; _DeclClass(0, $2.string); ListAdd($1, MkSpecifierName($2.string)); FreeIdentifier($2); }
2513 | identifier '<' template_arguments_list '>'
2515 // if($1._class && !$1._class.name)
2519 strcpy(name, $1._class.name ? $1._class.name : "");
2521 strcat(name, $1.string);
2522 _DeclClass(0, name);
2525 _DeclClass(0, $1.string);
2528 ListAdd($$, MkSpecifierNameArgs($1.string, $3));
2531 | _inheritance_specifiers identifier '<' template_arguments_list '>'
2534 if($2._class && !$2._class.name)
2538 strcat(name, $2.string);
2539 _DeclClass(0, name);
2542 _DeclClass(0, $2.string);
2543 ListAdd($1, MkSpecifierNameArgs($2.string, $4));
2548 inheritance_specifiers:
2549 _inheritance_specifiers
2550 | struct_or_union { $$ = MkListOne(MkStructOrUnion($1, null, null)); POP_DEFAULT_ACCESS }
2553 property_specifiers:
2554 storage_class_specifier { $$ = MkList(); ListAdd($$, $1); }
2555 | property_specifiers storage_class_specifier { $$ = $1; ListAdd($1, $2); }
2556 | type_qualifier { $$ = MkList(); ListAdd($$, $1); }
2557 | property_specifiers type_qualifier { $$ = $1; ListAdd($1, $2); }
2558 | strict_type_specifier { $$ = MkList(); ListAdd($$, $1); }
2559 | property_specifiers strict_type_specifier { $$ = $1; ListAdd($1, $2); }
2560 | identifier { $$ = MkList(); ListAdd($$, MkSpecifierName($1.string)); FreeIdentifier($1)}
2561 | property_specifiers identifier { $$ = $1; ListAdd($1, MkSpecifierName($2.string)); FreeIdentifier($2)}
2562 | identifier '<' template_arguments_list '>'
2564 // if($1._class && !$1._class.name)
2568 strcpy(name, $1._class.name ? $1._class.name : "");
2570 strcat(name, $1.string);
2571 _DeclClass(0, name);
2574 _DeclClass(0, $1.string);
2577 ListAdd($$, MkSpecifierNameArgs($1.string, $3));
2580 | property_specifiers identifier '<' template_arguments_list '>'
2582 if($2._class && !$2._class.name)
2586 strcat(name, $2.string);
2587 _DeclClass(0, name);
2590 _DeclClass(0, $2.string);
2591 ListAdd($1, MkSpecifierNameArgs($2.string, $4));
2597 storage_class_specifier { $$ = MkList(); ListAdd($$, $1); }
2598 | renew_specifiers storage_class_specifier { $$ = $1; ListAdd($1, $2); }
2599 | type_qualifier { $$ = MkList(); ListAdd($$, $1); }
2600 | renew_specifiers type_qualifier { $$ = $1; ListAdd($1, $2); }
2601 | strict_type_specifier { $$ = MkList(); ListAdd($$, $1); }
2602 | renew_specifiers strict_type_specifier { $$ = $1; ListAdd($1, $2); }
2603 | struct_or_union_specifier_compound { $$ = MkList(); ListAdd($$, $1); }
2604 | renew_specifiers struct_or_union_specifier_compound { $$ = $1; ListAdd($1, $2); }
2605 | enum_specifier_compound { $$ = MkList(); ListAdd($$, $1); }
2606 | renew_specifiers enum_specifier_compound { $$ = $1; ListAdd($1, $2); }
2607 | identifier { $$ = MkList(); ListAdd($$, MkSpecifierName($1.string)); FreeIdentifier($1)}
2608 | renew_specifiers identifier { $$ = $1; ListAdd($1, MkSpecifierName($2.string)); FreeIdentifier($2)}
2609 | identifier '<' template_arguments_list '>'
2611 // if($1._class && !$1._class.name)
2615 strcpy(name, $1._class.name ? $1._class.name : "");
2617 strcat(name, $1.string);
2618 _DeclClass(0, name);
2621 _DeclClass(0, $1.string);
2624 ListAdd($$, MkSpecifierNameArgs($1.string, $3));
2627 | renew_specifiers identifier '<' template_arguments_list '>'
2629 if($2._class && !$2._class.name)
2633 strcat(name, $2.string);
2634 _DeclClass(0, name);
2637 _DeclClass(0, $2.string);
2638 ListAdd($1, MkSpecifierNameArgs($2.string, $4));
2644 storage_class_specifier { $$ = MkList(); ListAdd($$, $1); }
2645 | new_specifiers storage_class_specifier { $$ = $1; ListAdd($1, $2); }
2646 | type_qualifier { $$ = MkList(); ListAdd($$, $1); }
2647 | new_specifiers type_qualifier { $$ = $1; ListAdd($1, $2); }
2648 | strict_type_specifier { $$ = MkList(); ListAdd($$, $1); }
2649 | new_specifiers strict_type_specifier { $$ = $1; ListAdd($1, $2); }
2650 | struct_or_union_specifier_compound { $$ = MkList(); ListAdd($$, $1); }
2651 | new_specifiers struct_or_union_specifier_compound { $$ = $1; ListAdd($1, $2); }
2652 | enum_specifier_compound { $$ = MkList(); ListAdd($$, $1); }
2653 | new_specifiers enum_specifier_compound { $$ = $1; ListAdd($1, $2); }
2654 | identifier { $$ = MkList(); ListAdd($$, MkSpecifierName($1.string)); FreeIdentifier($1)}
2655 | new_specifiers identifier { $$ = $1; ListAdd($1, MkSpecifierName($2.string)); FreeIdentifier($2)}
2656 | identifier '<' template_arguments_list '>'
2658 // if($1._class && !$1._class.name)
2662 strcpy(name, $1._class.name ? $1._class.name : "");
2664 strcat(name, $1.string);
2665 _DeclClass(0, name);
2668 _DeclClass(0, $1.string);
2671 ListAdd($$, MkSpecifierNameArgs($1.string, $3));
2674 | new_specifiers identifier '<' template_arguments_list '>'
2676 if($2._class && !$2._class.name)
2680 strcat(name, $2.string);
2681 _DeclClass(0, name);
2684 _DeclClass(0, $2.string);
2685 ListAdd($1, MkSpecifierNameArgs($2.string, $4));
2690 identifier_list_error:
2691 identifier_list ',' error { $$ = $1; ListAdd($1, null); }
2692 | identifier_list_error ',' error { $$ = $1; ListAdd($1, null); }
2696 identifier { $$ = MkList(); ListAdd($$, MkTypeName(null, MkDeclaratorIdentifier($1))); }
2697 | identifier_list ',' identifier { $$ = $1; ListAdd($1, MkTypeName(null, MkDeclaratorIdentifier($3))); }
2698 | identifier_list_error ',' identifier { $$ = $1; ListAdd($1, MkTypeName(null, MkDeclaratorIdentifier($3))); }
2699 | parameter_list ',' identifier { $$ = $1; ListAdd($1, MkTypeName(null, MkDeclaratorIdentifier($3))); }
2700 | parameter_list_error ',' identifier { $$ = $1; ListAdd($1, MkTypeName(null, MkDeclaratorIdentifier($3))); }
2703 direct_declarator_nofunction_type_ok:
2704 direct_declarator_nofunction
2707 char * colon = RSearchString($1.name, "::", strlen($1.name), true, false);
2708 String s = colon ? colon + 2 : $1.name;
2709 $$ = MkDeclaratorIdentifier(MkIdentifier(s));
2712 | UINT { $$ = MkDeclaratorIdentifier(MkIdentifier("uint")); }
2713 // These rules need to be reviewed in lights of prototypes with types only...
2714 | base_strict_type '[' constant_expression ']'
2717 char * colon = RSearchString($1.name, "::", strlen($1.name), true, false);
2718 String s = colon ? colon + 2 : $1.name;
2719 decl = MkDeclaratorIdentifier(MkIdentifier(s));
2721 $$ = MkDeclaratorArray(decl, $3);
2723 | base_strict_type '[' constant_expression_error ']'
2726 char * colon = RSearchString($1.name, "::", strlen($1.name), true, false);
2727 String s = colon ? colon + 2 : $1.name;
2728 decl = MkDeclaratorIdentifier(MkIdentifier(s));
2730 $$ = MkDeclaratorArray(decl, $3);
2732 | base_strict_type '[' type ']'
2735 char * colon = RSearchString($1.name, "::", strlen($1.name), true, false);
2736 String s = colon ? colon + 2 : $1.name;
2737 decl = MkDeclaratorIdentifier(MkIdentifier(s));
2739 $$ = MkDeclaratorEnumArray(decl, $3);
2741 | base_strict_type '[' ']'
2744 char * colon = RSearchString($1.name, "::", strlen($1.name), true, false);
2745 String s = colon ? colon + 2 : $1.name;
2746 decl = MkDeclaratorIdentifier(MkIdentifier(s));
2748 $$ = MkDeclaratorEnumArray(decl, null);
2750 | direct_declarator_nofunction_type_ok '[' constant_expression ']' { $$ = MkDeclaratorArray($1, $3); }
2751 | direct_declarator_nofunction_type_ok '[' constant_expression_error ']' { $$ = MkDeclaratorArray($1, $3); }
2752 | direct_declarator_nofunction_type_ok '[' type ']' { $$ = MkDeclaratorEnumArray($1, $3); }
2753 | direct_declarator_nofunction_type_ok '[' ']' { $$ = MkDeclaratorArray($1, null); }
2756 direct_declarator_nofunction:
2757 identifier { $$ = MkDeclaratorIdentifier($1); }
2758 | '(' declarator ')' { $$ = MkDeclaratorBrackets($2); }
2759 | '(' ext_decl declarator ')' { $$ = MkDeclaratorBrackets(MkDeclaratorExtended($2, $3)); }
2760 | '(' declarator_type_ok ')' { $$ = MkDeclaratorBrackets($2); }
2761 | '(' ext_decl declarator_type_ok ')' { $$ = MkDeclaratorBrackets(MkDeclaratorExtended($2, $3)); }
2762 | direct_declarator_nofunction '[' constant_expression ']' { $$ = MkDeclaratorArray($1, $3); }
2763 | direct_declarator_nofunction '[' constant_expression_error ']' { $$ = MkDeclaratorArray($1, $3); }
2764 | direct_declarator_nofunction '[' type ']' { $$ = MkDeclaratorEnumArray($1, $3); }
2765 | direct_declarator_nofunction '[' ']' { $$ = MkDeclaratorArray($1, null); }
2768 direct_declarator_function_start:
2769 direct_declarator_nofunction '('
2772 direct_declarator_function:
2773 direct_declarator_function_start parameter_type_list ')' { $$ = MkDeclaratorFunction($1, $2); }
2774 | direct_declarator_function_start parameter_type_list_error ')' { $$ = MkDeclaratorFunction($1, $2); }
2775 | direct_declarator_function_start identifier_list ')' { $$ = MkDeclaratorFunction($1, $2); }
2776 | direct_declarator_function_start identifier_list_error ')' { $$ = MkDeclaratorFunction($1, $2); }
2777 | direct_declarator_function_start ')' { $$ = MkDeclaratorFunction($1, null); }
2780 // Tricky stuff here for overriding...
2781 direct_declarator_function_error:
2782 direct_declarator_function_start identifier_list_error
2784 $$ = MkDeclaratorFunction($1, $2);
2785 fileInput.Seek(@1.end.pos, start);
2787 resetScannerPos(&@1.end);
2788 @$.start = @1.start;
2791 | direct_declarator_function_start error
2793 $$ = MkDeclaratorFunction($1, null);
2794 fileInput.Seek(@1.end.pos, start);
2796 resetScannerPos(&@1.end);
2797 @$.start = @1.start;
2800 | direct_declarator_function_start parameter_list '('
2802 $$ = MkDeclaratorFunction($1, $2);
2803 fileInput.Seek(@1.end.pos, start);
2805 resetScannerPos(&@1.end);
2806 @$.start = @1.start;
2809 | direct_declarator_function_start guess_declaration_specifiers identifier '('
2811 $$ = MkDeclaratorFunction($1, null);
2812 fileInput.Seek(@1.end.pos, start);
2814 resetScannerPos(&@1.end);
2815 @$.start = @1.start;
2817 FreeList($2, FreeSpecifier);
2823 direct_declarator_function
2824 | direct_declarator_nofunction
2828 direct_declarator_function_start_type_ok:
2829 direct_declarator_nofunction_type_ok '('
2832 direct_declarator_function_type_ok:
2833 direct_declarator_function_start_type_ok parameter_type_list ')' { $$ = MkDeclaratorFunction($1, $2); }
2834 | direct_declarator_function_start_type_ok parameter_type_list_error ')' { $$ = MkDeclaratorFunction($1, $2); }
2835 | direct_declarator_function_start_type_ok identifier_list ')' { $$ = MkDeclaratorFunction($1, $2); }
2836 | direct_declarator_function_start_type_ok identifier_list_error ')' { $$ = MkDeclaratorFunction($1, $2); }
2837 | direct_declarator_function_start_type_ok ')' { $$ = MkDeclaratorFunction($1, null); }
2840 // Tricky stuff here for overriding...
2841 direct_declarator_function_error_type_ok:
2842 direct_declarator_function_start_type_ok identifier_list_error
2844 $$ = MkDeclaratorFunction($1, $2);
2845 fileInput.Seek(@1.end.pos, start);
2847 resetScannerPos(&@1.end);
2848 @$.start = @1.start;
2851 | direct_declarator_function_start_type_ok error
2853 $$ = MkDeclaratorFunction($1, null);
2854 fileInput.Seek(@1.end.pos, start);
2856 resetScannerPos(&@1.end);
2857 @$.start = @1.start;
2860 | direct_declarator_function_start_type_ok parameter_list '('
2862 $$ = MkDeclaratorFunction($1, $2);
2863 fileInput.Seek(@1.end.pos, start);
2865 resetScannerPos(&@1.end);
2866 @$.start = @1.start;
2869 | direct_declarator_function_start_type_ok guess_declaration_specifiers identifier '('
2871 $$ = MkDeclaratorFunction($1, null);
2872 fileInput.Seek(@1.end.pos, start);
2874 resetScannerPos(&@1.end);
2875 @$.start = @1.start;
2877 FreeList($2, FreeSpecifier);
2882 direct_declarator_type_ok:
2883 direct_declarator_function_type_ok
2884 | direct_declarator_nofunction_type_ok
2886 | ext_decl direct_declarator_function_type_ok
2887 { $$ = MkDeclaratorExtended($1, $2); }
2888 | ext_decl direct_declarator_nofunction_type_ok
2889 { $$ = MkDeclaratorExtended($1, $2); }
2894 ASM '(' STRING_LITERAL { $<string>$ = CopyString(yytext); } STRING_LITERAL { $<string>$ = CopyString(yytext); }
2897 strcpy(temp, "__asm__(");
2898 strcat(temp, $<string>4);
2900 strcat(temp, $<string>6);
2903 $<string>$ = CopyString(temp);
2908 EXT_DECL { $$ = MkExtDeclString(CopyString(yytext)); }
2909 | attrib { $$ = MkExtDeclAttrib($1);
2913 strcpy(temp, $<string>1);
2916 $$ = MkExtDeclString(CopyString(temp));
2918 | asm_start STRING_LITERAL { $$ = CopyString(yytext); } ')'
2921 strcpy(temp, $<string>1);
2923 strcat(temp, $<string>3);
2927 $$ = MkExtDeclString(CopyString(temp));
2933 EXT_DECL { $$ = MkExtDeclString(CopyString(yytext)); }
2934 | EXT_STORAGE { $$ = MkExtDeclString(CopyString(yytext)); }
2935 | attrib { $$ = MkExtDeclAttrib($1); }
2936 | ASM '(' string_literal ')'
2939 strcpy(temp, "__asm__(");
2942 $$ = MkExtDeclString(CopyString(temp));
2948 ATTRIB { $<i>$ = ATTRIB; }
2949 | ATTRIB_DEP { $<i>$ = ATTRIB_DEP; }
2950 | __ATTRIB { $<i>$ = __ATTRIB; }
2955 IDENTIFIER { $$ = CopyString(yytext); }
2956 | TYPE_NAME { $$ = CopyString(yytext); }
2957 | EXT_STORAGE { $$ = CopyString(yytext); }
2958 | EXT_DECL { $$ = CopyString(yytext); }
2959 | CONST { $$ = CopyString(yytext); }
2963 attribute_word { $$ = MkAttribute($1, null); $$.loc = @$; }
2964 | attribute_word '(' expression ')' { $$ = MkAttribute($1, MkExpBrackets($3)); $$.loc = @$; }
2968 attribute { $$ = MkListOne($1); }
2969 | attribs_list attribute { ListAdd($1, $2); $$ = $1; }
2970 | attribs_list ',' attribute { ListAdd($1, $3); $$ = $1; }
2974 _attrib '(' '(' attribs_list ')' ')' { $$ = MkAttrib($<i>1, $4); $$.loc = @$; }
2975 | _attrib '(' '(' ')' ')' { $$ = MkAttrib($<i>1, null); $$.loc = @$; }
2978 direct_abstract_declarator:
2979 '(' abstract_declarator ')' { $$ = MkDeclaratorBrackets($2); }
2980 | '(' ext_decl abstract_declarator ')' { $$ = MkDeclaratorBrackets(MkDeclaratorExtended($2, $3)); }
2981 | '[' ']' { $$ = MkDeclaratorArray(null, null); }
2982 | '[' constant_expression ']' { $$ = MkDeclaratorArray(null, $2); }
2983 | '[' constant_expression_error ']' { $$ = MkDeclaratorArray(null, $2); }
2984 | '[' type ']' { $$ = MkDeclaratorEnumArray(null, $2); }
2985 | direct_abstract_declarator '[' ']' { $$ = MkDeclaratorArray($1, null); }
2986 | direct_abstract_declarator '[' constant_expression ']' { $$ = MkDeclaratorArray($1, $3); }
2987 | direct_abstract_declarator '[' type']' { $$ = MkDeclaratorEnumArray($1, $3); }
2988 | direct_abstract_declarator '[' constant_expression_error ']' { $$ = MkDeclaratorArray($1, $3); }
2989 | '(' ')' { $$ = MkDeclaratorFunction(null, null); }
2990 | '(' parameter_type_list ')' { $$ = MkDeclaratorFunction(null, $2); }
2991 | '(' parameter_type_list_error ')' { $$ = MkDeclaratorFunction(null, $2); }
2992 | direct_abstract_declarator '(' ')' { $$ = MkDeclaratorFunction($1, null); }
2993 | direct_abstract_declarator '(' parameter_type_list ')' { $$ = MkDeclaratorFunction($1, $3); }
2994 | direct_abstract_declarator '(' parameter_type_list_error ')' { $$ = MkDeclaratorFunction($1, $3); }
2997 direct_abstract_declarator_noarray:
2998 '(' abstract_declarator_noarray ')' { $$ = MkDeclaratorBrackets($2); }
2999 | '(' ext_decl abstract_declarator_noarray ')' { $$ = MkDeclaratorBrackets(MkDeclaratorExtended($2, $3)); }
3000 | '(' ')' { $$ = MkDeclaratorFunction(null, null); }
3001 | '(' parameter_type_list ')' { $$ = MkDeclaratorFunction(null, $2); }
3002 | '(' parameter_type_list_error ')' { $$ = MkDeclaratorFunction(null, $2); }
3003 | direct_abstract_declarator_noarray '(' ')' { $$ = MkDeclaratorFunction($1, null); }
3004 | direct_abstract_declarator_noarray '(' parameter_type_list ')' { $$ = MkDeclaratorFunction($1, $3); }
3005 | direct_abstract_declarator_noarray '(' parameter_type_list_error ')' { $$ = MkDeclaratorFunction($1, $3); }
3009 '*' { $$ = MkPointer(null, null); }
3010 | '*' type_qualifier_list { $$ = MkPointer($2, null); }
3011 | '*' pointer { $$ = MkPointer(null, $2); }
3012 | '*' type_qualifier_list pointer { $$ = MkPointer($2, $3); }
3015 abstract_declarator:
3016 pointer { $$ = MkDeclaratorPointer($1, null); }
3017 | direct_abstract_declarator
3018 | pointer direct_abstract_declarator { $$ = MkDeclaratorPointer($1, $2); }
3019 | ext_decl pointer { $$ = MkDeclaratorExtended($1, MkDeclaratorPointer($2, null)); }
3020 | ext_decl pointer direct_abstract_declarator { $$ = MkDeclaratorExtended($1, MkDeclaratorPointer($2, $3)); }
3023 abstract_declarator_noarray:
3024 pointer { $$ = MkDeclaratorPointer($1, null); }
3025 | direct_abstract_declarator_noarray
3026 | pointer direct_abstract_declarator_noarray { $$ = MkDeclaratorPointer($1, $2); }
3027 | ext_decl pointer { $$ = MkDeclaratorExtended($1, MkDeclaratorPointer($2, null)); }
3028 | ext_decl pointer direct_abstract_declarator_noarray { $$ = MkDeclaratorExtended($1, MkDeclaratorPointer($2, $3)); }
3033 | pointer direct_declarator
3034 { $$ = MkDeclaratorPointer($1, $2); }
3035 | ext_decl pointer direct_declarator
3036 { $$ = MkDeclaratorExtended($1, MkDeclaratorPointer($2, $3)); }
3037 | declarator ext_decl
3038 { $$ = MkDeclaratorExtendedEnd($2, $1); }
3039 | declarator_nofunction_type_ok ext_decl
3040 { $$ = MkDeclaratorExtendedEnd($2, $1); }
3044 direct_declarator_type_ok
3045 | pointer direct_declarator_type_ok
3046 { $$ = MkDeclaratorPointer($1, $2); }
3047 | ext_decl pointer direct_declarator_type_ok
3048 { $$ = MkDeclaratorExtended($1, MkDeclaratorPointer($2, $3)); }
3049 | declarator_type_ok ext_decl
3050 { $$ = MkDeclaratorExtendedEnd($2, $1); }
3053 declarator_function:
3054 direct_declarator_function
3055 | pointer direct_declarator_function { $$ = MkDeclaratorPointer($1, $2); }
3056 | ext_decl pointer direct_declarator_function { $$ = MkDeclaratorExtended($1, MkDeclaratorPointer($2, $3)); }
3057 | pointer ext_decl direct_declarator_function { $$ = MkDeclaratorPointer($1, MkDeclaratorExtended($2, $3)); }
3060 declarator_function_error:
3061 direct_declarator_function_error
3062 | pointer direct_declarator_function_error { $$ = MkDeclaratorPointer($1, $2); }
3063 | ext_decl pointer direct_declarator_function_error { $$ = MkDeclaratorExtended($1, MkDeclaratorPointer($2, $3)); }
3064 | pointer ext_decl direct_declarator_function_error { $$ = MkDeclaratorPointer($1, MkDeclaratorExtended($2, $3)); }
3067 declarator_function_type_ok:
3068 direct_declarator_function_type_ok
3069 | pointer direct_declarator_function_type_ok { $$ = MkDeclaratorPointer($1, $2); }
3070 | ext_decl pointer direct_declarator_function_type_ok { $$ = MkDeclaratorExtended($1, MkDeclaratorPointer($2, $3)); }
3071 | pointer ext_decl direct_declarator_function_type_ok { $$ = MkDeclaratorPointer($1, MkDeclaratorExtended($2, $3)); }
3074 declarator_function_error_type_ok:
3075 direct_declarator_function_error_type_ok
3076 | pointer direct_declarator_function_error_type_ok { $$ = MkDeclaratorPointer($1, $2); }
3077 | ext_decl pointer direct_declarator_function_error_type_ok { $$ = MkDeclaratorExtended($1, MkDeclaratorPointer($2, $3)); }
3078 | pointer ext_decl direct_declarator_function_error_type_ok { $$ = MkDeclaratorPointer($1, MkDeclaratorExtended($2, $3)); }
3081 declarator_nofunction_type_ok:
3082 direct_declarator_nofunction_type_ok
3083 | pointer direct_declarator_nofunction_type_ok { $$ = MkDeclaratorPointer($1, $2); }
3084 | ext_decl pointer direct_declarator_nofunction_type_ok { $$ = MkDeclaratorExtended($1, MkDeclaratorPointer($2, $3)); }
3085 | pointer ext_decl direct_declarator_nofunction_type_ok { $$ = MkDeclaratorPointer($1, MkDeclaratorExtended($2, $3)); }
3089 assignment_expression { $$ = MkInitializerAssignment($1); $$.loc = @$; }
3090 | '{' initializer_list '}' { $$ = MkInitializerList($2); $$.loc = @$; }
3091 | '{' initializer_list ',' '}'
3093 $$ = MkInitializerList($2);
3097 Expression exp = MkExpDummy();
3098 Initializer init = MkInitializerAssignment(exp);
3107 assignment_expression_error { $$ = MkInitializerAssignment($1); $$.loc = @$; }
3108 | '{' initializer_list '}' error { $$ = MkInitializerList($2); $$.loc = @$; }
3109 | '{' initializer_list { $$ = MkInitializerList($2); $$.loc = @$; }
3110 | '{' initializer_list ',' '}' error
3112 $$ = MkInitializerList($2);
3116 Expression exp = MkExpDummy();
3117 Initializer init = MkInitializerAssignment(exp);
3123 | '{' initializer_list ','
3125 $$ = MkInitializerList($2);
3129 Expression exp = MkExpDummy();
3130 Initializer init = MkInitializerAssignment(exp);
3138 initializer_condition:
3139 conditional_expression { $$ = MkInitializerAssignment($1); $$.loc = @$; }
3140 | anon_instantiation_expression
3141 { $$ = MkInitializerAssignment($1); $$.loc = @$; }
3144 initializer_condition_error:
3145 conditional_expression_error { $$ = MkInitializerAssignment($1); $$.loc = @$; }
3146 | anon_instantiation_expression_error { $$ = MkInitializerAssignment($1); $$.loc = @$; }
3150 initializer { $$ = MkList(); ListAdd($$, $1); }
3151 | initializer_error { $$ = MkList(); ListAdd($$, $1); }
3152 | initializer_list ',' initializer { $$ = $1; ListAdd($1, $3); }
3153 | initializer_list ',' initializer_error { $$ = $1; ListAdd($1, $3); }
3156 | initializer_list initializer { $$ = $1; ListAdd($1, $2); }
3157 | initializer_list initializer_error { $$ = $1; ListAdd($1, $2); }
3161 declarator { $$ = MkInitDeclarator($1, null); $$.loc = @$; }
3162 | declarator_type_ok { $$ = MkInitDeclarator($1, null); $$.loc = @$; }
3163 | declarator '=' initializer { $$ = MkInitDeclarator($1, $3); $$.loc = @$; $$.initializer.loc.start = @2.end; }
3166 init_declarator_error:
3167 declarator error { $$ = MkInitDeclarator($1, null); $$.loc = @$; }
3168 /* Useless rules due to conflicts
3169 | declarator '=' error { $$ = MkInitDeclarator($1, MkInitializerAssignment(MkExpDummy())); $$.loc = @$; $$.initializer.loc = @2; $$.initializer.exp.loc = @2; }
3171 | declarator '=' initializer_error { $$ = MkInitDeclarator($1, $3); $$.loc = @$; $$.initializer.loc.start = @2.end; }
3174 init_declarator_list:
3175 init_declarator { $$ = MkList(); ListAdd($$, $1); }
3176 | init_declarator_list ',' init_declarator { $$ = $1; ListAdd($1, $3); }
3177 | UINT ',' init_declarator { $$ = MkList(); ListAdd($$, MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier("uint")), null)); ListAdd($$, $3); }
3178 | INT64 ',' init_declarator { $$ = MkList(); ListAdd($$, MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier("int64")), null)); ListAdd($$, $3); }
3179 | base_strict_type ',' init_declarator
3181 char * colon = RSearchString($1.name, "::", strlen($1.name), true, false);
3182 String s = colon ? colon + 2 : $1.name;
3184 ListAdd($$, MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier(s)), null));
3188 | init_declarator_list_error ',' init_declarator { $$ = $1; ListAdd($1, $3); }
3189 /*| base_strict_type ',' init_declarator
3196 init_declarator_list_error:
3197 init_declarator_error { $$ = MkList(); ListAdd($$, $1); }
3198 | init_declarator error { $$ = MkList(); ListAdd($$, $1); }
3199 | init_declarator_list ',' init_declarator_error { $$ = $1; ListAdd($1, $3); }
3200 | init_declarator_list_error ',' init_declarator_error { $$ = $1; ListAdd($1, $3); }
3204 specifier_qualifier_list { $$ = MkTypeName($1, null); }
3205 | specifier_qualifier_list abstract_declarator { $$ = MkTypeName($1, $2); }
3209 guess_specifier_qualifier_list { $$ = MkTypeName($1, null); }
3210 | guess_specifier_qualifier_list abstract_declarator { $$ = MkTypeName($1, $2); }
3213 /*** PARAMETERS **********************************************************************/
3214 parameter_declaration:
3215 guess_declaration_specifiers declarator_type_ok { $$ = MkTypeName($1, $2); }
3216 | guess_declaration_specifiers abstract_declarator { $$ = MkTypeName($1, $2); }
3217 | guess_declaration_specifiers '&' { $$ = MkTypeName($1, MkDeclaratorPointer(MkPointer(null,null), null)); }
3218 | guess_declaration_specifiers '&' declarator_type_ok { $$ = MkTypeName($1, MkDeclaratorPointer(MkPointer(null,null), $3)); }
3219 | guess_declaration_specifiers { $$ = MkTypeNameGuessDecl($1, null); }
3221 { $$ = MkTypeName(MkListOne(MkSpecifier(CLASS)), null); }
3224 { $$ = MkTypeName(MkListOne(MkSpecifier(TYPED_OBJECT)), null); }
3226 { $$ = MkTypeName(MkListOne(MkSpecifier(TYPED_OBJECT)), MkDeclaratorPointer(MkPointer(null,null), null)); }
3227 | TYPED_OBJECT declarator
3228 { $$ = MkTypeName(MkListOne(MkSpecifier(TYPED_OBJECT)), $2); }
3229 | TYPED_OBJECT '&' declarator
3230 { $$ = MkTypeName(MkListOne(MkSpecifier(TYPED_OBJECT)), MkDeclaratorPointer(MkPointer(null,null), $3)); }
3232 { $$ = MkTypeName(MkListOne(MkSpecifier(ANY_OBJECT)), null); }
3233 | ANY_OBJECT declarator
3234 { $$ = MkTypeName(MkListOne(MkSpecifier(ANY_OBJECT)), $2); }
3238 parameter_declaration_error:
3239 guess_declaration_specifiers declarator_type_ok error { $$ = MkTypeName($1, $2); }
3240 | guess_declaration_specifiers abstract_declarator error { $$ = MkTypeName($1, $2); }
3244 parameter_declaration { $$ = MkList(); ListAdd($$, $1); }
3245 | parameter_list ',' parameter_declaration { $$ = $1; ListAdd($1, $3); }
3246 | parameter_list error ',' parameter_declaration { $$ = $1; ListAdd($1, $4); }
3247 | parameter_list_error ',' parameter_declaration { $$ = $1; ListAdd($1, $3); }
3248 | parameter_list_error error ',' parameter_declaration { $$ = $1; ListAdd($1, $4); }
3249 | error ',' parameter_declaration { $$ = MkList(); ListAdd($$, MkTypeName(MkList(), null)); ListAdd($$, $3); }
3251 | identifier_list ',' parameter_declaration { $$ = $1; ListAdd($1, $3); }
3252 | identifier_list error ',' parameter_declaration { $$ = $1; ListAdd($1, $4); }
3253 | identifier_list_error ',' parameter_declaration { $$ = $1; ListAdd($1, $3); }
3254 | identifier_list_error error ',' parameter_declaration { $$ = $1; ListAdd($1, $4); }
3257 parameter_list_error:
3258 parameter_declaration_error { $$ = MkList(); ListAdd($$, $1); }
3259 | parameter_list ',' parameter_declaration_error { $$ = $1; ListAdd($1, $3); }
3260 | parameter_list_error ',' parameter_declaration_error { $$ = $1; ListAdd($1, $3); }
3261 | parameter_list_error error ',' parameter_declaration_error { $$ = $1; ListAdd($1, $4); }
3262 | error ',' parameter_declaration_error { $$ = MkList(); ListAdd($$, MkTypeName(MkList(), null)); ListAdd($$, $3); }
3264 | identifier_list ',' parameter_declaration_error { $$ = $1; ListAdd($1, $3); }
3265 | identifier_list_error ',' parameter_declaration_error { $$ = $1; ListAdd($1, $3); }
3266 | identifier_list_error error ',' parameter_declaration_error { $$ = $1; ListAdd($1, $4); }
3269 parameter_type_list:
3271 | parameter_list ',' ELLIPSIS { $$ = $1; ListAdd($1, MkTypeName(null, null)); }
3272 | parameter_list_error ',' ELLIPSIS { $$ = $1; ListAdd($1, MkTypeName(null, null)); }
3273 | identifier_list ',' ELLIPSIS { $$ = $1; ListAdd($1, MkTypeName(null, null)); }
3274 | identifier_list_error ',' ELLIPSIS { $$ = $1; ListAdd($1, MkTypeName(null, null)); }
3275 | error ',' ELLIPSIS { $$ = MkList(); ListAdd($$, MkTypeName(null, null)); }
3278 parameter_type_list_error:
3279 parameter_list_error
3280 | parameter_list ',' error { $$ = $1; ListAdd($1, null); }
3281 | parameter_list_error error
3284 /****** STATEMENTS *******************************************************************/
3287 | attrib { $$ = MkExpressionStmt(null); FreeAttrib($1); } // Ignoring this for now... ( For __attribute__ ((__unused__)) )
3288 | compound_statement
3289 | ';' { $$ = MkExpressionStmt(null); }
3290 | ':' { $$ = MkExpressionStmt(null); }
3291 | expression ';' { $$ = MkExpressionStmt($1); $$.loc = @$; }
3292 | selection_statement
3293 | iteration_statement
3298 | watch_definition ';'
3302 labeled_statement_error { $$ = $1; Compiler_Error($"syntax error\n"); }
3303 | iteration_statement_error { $$ = $1; Compiler_Error($"syntax error\n"); }
3304 | compound_statement_error { $$ = $1; Compiler_Error($"syntax error\n"); }
3305 | selection_statement_error { $$ = $1; Compiler_Error($"syntax error\n"); }
3306 | jump_statement_error { $$ = $1; Compiler_Error($"syntax error\n"); }
3307 | jump_statement error { $$ = $1; Compiler_Error($"syntax error\n"); }
3308 | expression_error { $$ = MkExpressionStmt($1); Compiler_Error($"syntax error\n"); $$.loc = @1; }
3312 string_literal { $$ = MkAsmField($1, null); $$.loc = @1; }
3313 | string_literal '(' assignment_expression ')' { $$ = MkAsmField($1, $3); $$.loc = @$; }
3317 asm_field { $$ = MkListOne($1); }
3318 | asm_field_list ',' asm_field { ListAdd($$, $3); }
3323 ASM type_qualifier '(' string_literal ')' ';' { $$ = MkAsmStmt($2, $4, null, null, null); $$.loc = @$; }
3324 | ASM type_qualifier '(' string_literal ':' asm_field_list ')' ';' { $$ = MkAsmStmt($2, $4, $6, null, null); $$.loc = @$; }
3325 | ASM type_qualifier '(' string_literal ':' asm_field_list ':' asm_field_list ')' ';' { $$ = MkAsmStmt($2, $4, $6, $8, null); $$.loc = @$; }
3326 | ASM type_qualifier '(' string_literal ':' asm_field_list ':' asm_field_list ':' asm_field_list ')' ';' { $$ = MkAsmStmt($2, $4, $6, $8, $10); $$.loc = @$; }
3328 | ASM type_qualifier '(' string_literal IDENTIFIER asm_field_list ')' ';' { $$ = MkAsmStmt($2, $4, null, $6, null); $$.loc = @$; }
3329 | ASM type_qualifier '(' string_literal IDENTIFIER asm_field_list ':' asm_field_list ')' ';' { $$ = MkAsmStmt($2, $4, null, $6, $8); $$.loc = @$; }
3330 | ASM type_qualifier '(' string_literal ':' asm_field_list IDENTIFIER asm_field_list ')' ';' { $$ = MkAsmStmt($2, $4, $6, null, $8); $$.loc = @$; }
3332 | ASM '(' string_literal ')' ';' { $$ = MkAsmStmt(null, $3, null, null, null); $$.loc = @$; }
3333 | ASM '(' string_literal ':' asm_field_list ')' ';' { $$ = MkAsmStmt(null, $3, $5, null, null); $$.loc = @$; }
3334 | ASM '(' string_literal ':' asm_field_list ':' asm_field_list ')' ';' { $$ = MkAsmStmt(null, $3, $5, $7, null); $$.loc = @$; }
3335 | ASM '(' string_literal ':' asm_field_list ':' asm_field_list ':' asm_field_list ')' ';' { $$ = MkAsmStmt(null, $3, $5, $7, $9); $$.loc = @$; }
3337 | ASM '(' string_literal IDENTIFIER asm_field_list ')' ';' { $$ = MkAsmStmt(null, $3, null, $5, null); $$.loc = @$; }
3338 | ASM '(' string_literal IDENTIFIER asm_field_list ':' asm_field_list ')' ';' { $$ = MkAsmStmt(null, $3, null, $5, $7); $$.loc = @$; }
3339 | ASM '(' string_literal ':' asm_field_list IDENTIFIER asm_field_list ')' ';' { $$ = MkAsmStmt(null, $3, $5, null, $7); $$.loc = @$; }
3343 identifier ':' statement { $$ = MkLabeledStmt($1, $3); $$.loc = @$; }
3344 | CASE constant_expression ':' statement { $$ = MkCaseStmt($2, $4); $$.loc = @$; $2.loc.start = @1.end; }
3345 | CASE constant_expression_error ':' statement { $$ = MkCaseStmt($2, $4); $$.loc = @$; $2.loc.start = @1.end; }
3346 | CASE ':' statement { $$ = MkCaseStmt(MkExpDummy(), $3); $$.caseStmt.exp.loc = @2; $$.loc = @$; $$.caseStmt.exp.loc.start = @1.end; }
3347 | DEFAULT ':' statement { $$ = MkCaseStmt(null, $3); $$.loc = @$; }
3350 labeled_statement_error
3351 : identifier ':' statement_error { $$ = MkLabeledStmt($1, $3); $$.loc = @$; }
3352 | CASE constant_expression ':' statement_error { $$ = MkCaseStmt($2, $4); $$.loc = @$; $2.loc.start = @1.end; }
3353 | CASE constant_expression_error ':' statement_error { $$ = MkCaseStmt($2, $4); $$.loc = @$; $2.loc.start = @1.end; }
3354 | CASE ':' statement_error { $$ = MkCaseStmt(MkExpDummy(), $3); $$.caseStmt.exp.loc = @2; $$.loc = @$; $$.caseStmt.exp.loc.start = @1.end; }
3355 | CASE ':' { $$ = MkCaseStmt(MkExpDummy(), null); $$.caseStmt.exp.loc = @2; $$.loc = @$; $$.caseStmt.exp.loc.start = @1.end; }
3356 | DEFAULT ':' statement_error { $$ = MkCaseStmt(null, $3); $$.loc = @$; }
3357 | DEFAULT ':' { $$ = MkCaseStmt(null, null); $$.loc = @$; }
3361 PUBLIC { $$ = declMode = publicAccess; }
3362 | PRIVATE { $$ = declMode = privateAccess; }
3363 | DEFAULT { $$ = declMode = defaultAccess; }
3367 PUBLIC { $$ = publicAccess; }
3368 | PRIVATE { $$ = privateAccess; }
3372 declaration_specifiers ';' { $$ = MkDeclaration($1, null); $$.loc = @$; }
3373 | declaration_specifiers init_declarator_list ';' { $$ = MkDeclaration($1, $2); $$.loc = @$; }
3374 | instantiation_named ';' { $$ = MkDeclarationInst($1); $$.loc = @$; }
3375 | declaration_error ';' { $$ = $1; }
3378 external_guess_declaration:
3379 external_guess_declaration_specifiers ';' { $$ = MkDeclaration($1, null); $$.loc = @$; }
3380 | external_guess_declaration_specifiers init_declarator_list ';' { $$ = MkDeclaration($1, $2); $$.loc = @$; }
3381 | external_guess_declaration_specifiers_error init_declarator_list ';' { $$ = MkDeclaration($1, $2); $$.loc = @$; }
3383 | external_guess_instantiation_named ';' { $$ = MkDeclarationInst($1); $$.loc = @$; }
3384 | DEFINE identifier '=' conditional_expression ';' { $$ = MkDeclarationDefine($2, $4); $$.loc = @$; }
3385 | STATIC DEFINE identifier '=' conditional_expression ';' { declMode = staticAccess; $$ = MkDeclarationDefine($3, $5); $$.loc = @$; }
3388 external_guess_declaration_error:
3389 external_guess_declaration_specifiers error { $$ = MkDeclaration($1, null); $$.loc = @$; yyerrok; }
3393 declaration_specifiers error { $$ = MkDeclaration($1, null); $$.loc = @$; }
3394 | declaration_error error {}
3396 | instantiation_named_error error { $$ = MkDeclarationInst($1); $$.loc = @$; }
3397 | instantiation_named error { $$ = MkDeclarationInst($1); $$.loc = @$; }
3398 | declaration_specifiers init_declarator_list_error { $$ = MkDeclaration($1, $2); $$.loc = @$; }
3402 declaration { $$ = MkList(); ListAdd($$, $1); /*declMode = defaultDeclMode;*/ }
3403 | declaration_list declaration { $$ = $1; ListAdd($1, $2); /*declMode = defaultDeclMode; */}
3404 | declaration_list_error declaration { $$ = $1; ListAdd($1, $2); /*declMode = defaultDeclMode; */}
3405 | declaration_list error ';' { $$ = $1; }
3408 declaration_list_error:
3409 declaration_error { $$ = MkList(); ListAdd($$, $1); }
3410 | declaration_list declaration_error { $$ = $1; ListAdd($1, $2); }
3414 statement { $$ = MkList(); ListAdd($$, $1); }
3415 | statement_list statement { $$ = $1; ListAdd($1, $2); }
3416 | statement_list_error statement { $$ = $1; ListAdd($1, $2); }
3419 statement_list_error:
3420 statement_error { $$ = MkList(); ListAdd($$, $1); }
3421 | statement_list statement_error { $$ = $1; ListAdd($1, $2); }
3422 | statement_list_error statement_error { $$ = $1; ListAdd($1, $2); }
3423 | statement_list declaration { Statement stmt = MkBadDeclStmt($2); stmt.loc = @2; Compiler_Warning(C89_DECL_WARNING); $$ = $1; ListAdd($1, stmt); /*declMode = defaultDeclMode;*/ }
3424 | statement_list_error declaration { Statement stmt = MkBadDeclStmt($2); stmt.loc = @2; Compiler_Warning(C89_DECL_WARNING); $$ = $1; ListAdd($1, stmt); /*declMode = defaultDeclMode;*/ }
3425 | statement_list declaration_error { Statement stmt = MkBadDeclStmt($2); stmt.loc = @2; Compiler_Warning(C89_DECL_WARNING); $$ = $1; ListAdd($1, stmt); /*declMode = defaultDeclMode;*/ }
3426 | statement_list_error declaration_error { Statement stmt = MkBadDeclStmt($2); stmt.loc = @2; Compiler_Warning(C89_DECL_WARNING); $$ = $1; ListAdd($1, stmt); /*declMode = defaultDeclMode;*/ }
3430 statement_list { $$ = MkCompoundStmt(null, $1); }
3431 | declaration_list { $$ = MkCompoundStmt($1, null); }
3432 | declaration_list statement_list { $$ = MkCompoundStmt($1, $2); }
3433 | declaration_list_error statement_list { $$ = MkCompoundStmt($1, $2); }
3436 compound_inside_error:
3437 statement_list_error { $$ = MkCompoundStmt(null, $1); }
3438 | declaration_list_error { $$ = MkCompoundStmt($1, null); }
3439 | declaration_list statement_list_error { $$ = MkCompoundStmt($1, $2); }
3440 | declaration_list_error statement_list_error { $$ = MkCompoundStmt($1, $2); }
3444 '{' { $<context>$ = PushContext(); }
3448 compound_statement_error '}' { $$ = $1; $$.loc = @$; }
3451 compound_statement_error:
3452 compound_start compound_inside_error
3453 { $$ = $2; $$.compound.context = $<context>1; PopContext($<context>1); $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++; }
3455 { $$ = MkCompoundStmt(null, null); $$.compound.context = $<context>1; PopContext($<context>1); $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++; }
3457 | compound_start compound_inside
3458 { $$ = $2; $$.compound.context = $<context>1; PopContext($<context>1); $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++; }
3462 expression_statement:
3463 ';' { $$ = MkExpressionStmt(null); $$.loc = @$; }
3464 | expression ';' { $$ = MkExpressionStmt($1); $$.loc = @$; }
3465 | expression_error ';' { $$ = MkExpressionStmt($1); $$.loc = @$; }
3468 selection_statement:
3469 IF '(' expression ')' statement %prec IFX { $$ = MkIfStmt($3, $5, null); $$.loc = @$; }
3470 | IF '(' expression_error ')' statement %prec IFX { $$ = MkIfStmt($3, $5, null); $$.loc = @$; }
3471 | IF '(' expression ')' statement ELSE statement { $$ = MkIfStmt($3, $5, $7); $$.loc = @$; }
3472 | IF '(' expression_error ')' statement ELSE statement { $$ = MkIfStmt($3, $5, $7); $$.loc = @$; }
3473 | SWITCH '(' expression ')' statement { $$ = MkSwitchStmt($3, $5); $$.loc = @$; }
3474 | SWITCH '(' expression_error ')' statement { $$ = MkSwitchStmt($3, $5); $$.loc = @$; }
3477 selection_statement_error:
3478 IF '(' expression_error { $$ = MkIfStmt($3, null, null); $$.loc = @$; }
3479 | selection_statement error
3482 iteration_statement:
3483 WHILE '(' expression ')' statement { $$ = MkWhileStmt($3, $5); $$.loc = @$; }
3484 | WHILE '(' expression_error statement { $$ = MkWhileStmt($3, $4); $$.loc = @$; }
3485 | WHILE '(' ')' statement { $$ = MkWhileStmt(null, $4); $$.loc = @$; }
3487 | DO statement WHILE '(' expression ')' ';' { $$ = MkDoWhileStmt($2, $5); $$.loc = @$; }
3488 | DO statement WHILE '(' expression_error ';' { $$ = MkDoWhileStmt($2, $5); $$.loc = @$; }
3490 | FOR '(' expression_statement expression_statement ')' statement { $$ = MkForStmt($3, $4, null, $6); $$.loc = @$; }
3491 | FOR '(' expression_statement ')' statement { $$ = MkForStmt($3, null, null, $5); $$.loc = @$; }
3492 | FOR '(' expression_statement expression_statement expression ')' statement { $$ = MkForStmt($3, $4, $5, $7); $$.loc = @$; }
3493 | FOR '(' expression_statement expression_statement expression_error statement { $$ = MkForStmt($3, $4, $5, $6 ); $$.loc = @$; }
3494 | FOR '(' ')' statement { $$ = MkForStmt(null, null, null, $4); $$.loc = @$; }
3496 | FOR '(' identifier ':' expression ')' statement { $$ = MkForEachStmt($3, $5, null, $7); $$.loc = @$; }
3497 | FOR '(' identifier ':' expression ';' expression ')' statement { $$ = MkForEachStmt($3, $5, $7, $9); $$.loc = @$; }
3500 iteration_statement_error:
3501 FOR '(' error { $$ = MkForStmt(null, null, null, null); $$.loc = @$; } |
3502 FOR '(' expression_error error { $$ = MkForStmt(MkExpressionStmt($3), null, null, null); $$.forStmt.init.loc = @3; $$.loc = @$; } |
3503 FOR '(' expression_statement error { $$ = MkForStmt($3, null, null, null); $$.loc = @$; } |
3504 FOR '(' expression_statement expression_error error { $$ = MkForStmt($3, MkExpressionStmt($4), null, null); $$.loc = @$; $$.forStmt.check.loc = @4; } |
3505 /* Useless rules due to conflicts
3506 FOR '(' expression_statement expression_statement error { $$ = MkForStmt($3, $4, null, null); $$.loc = @$; } |
3508 FOR '(' expression_statement expression_statement expression_error { $$ = MkForStmt($3, $4, $5, null); $$.loc = @$; } |
3509 FOR '(' expression_statement expression_statement ')' statement_error { $$ = MkForStmt($3, $4, null, $6); $$.loc = @$; } |
3510 FOR '(' expression_statement expression_statement expression ')' statement_error { $$ = MkForStmt($3, $4, $5, $7); $$.loc = @$; } |
3511 FOR '(' expression_statement expression_statement expression_error statement_error { $$ = MkForStmt($3, $4, $5, $6 ); $$.loc = @$; } |
3513 DO statement WHILE '(' expression ')' { $$ = MkDoWhileStmt($2, $5); $$.loc = @$; } |
3514 DO statement WHILE '(' expression { $$ = MkDoWhileStmt($2, $5); $$.loc = @$; } |
3515 DO statement WHILE '(' expression_error { $$ = MkDoWhileStmt($2, $5); $$.loc = @$; } |
3516 DO statement WHILE '(' { $$ = MkDoWhileStmt($2, null); $$.loc = @$; } |
3517 DO statement WHILE { $$ = MkDoWhileStmt($2, null); $$.loc = @$; } |
3518 DO statement { $$ = MkDoWhileStmt($2, null); $$.loc = @$; } |
3519 DO { $$ = MkDoWhileStmt(null, null); $$.loc = @$; } |
3522 WHILE error { $$ = MkWhileStmt(null, null); $$.loc = @$; } |
3523 /* Useless rules due to conflicts
3524 WHILE '(' error { $$ = MkWhileStmt(null, null); $$.loc = @$; } |
3526 WHILE '(' ')' error { $$ = MkWhileStmt(null, null); $$.loc = @$; } |
3527 WHILE '(' expression_error { $$ = MkWhileStmt($3, null); $$.loc = @$; } |
3528 /* Useless rules due to conflicts
3529 WHILE '(' expression_error error { $$ = MkWhileStmt($3, null); $$.loc = @$; } |
3531 WHILE '(' expression ')' statement_error { $$ = MkWhileStmt($3, $5); $$.loc = @$; } |
3532 WHILE '(' expression_error statement_error { $$ = MkWhileStmt($3, $4 ); $$.loc = @$; }
3536 GOTO identifier ';' { $$ = MkGotoStmt($2); $$.loc = @$; }
3537 | CONTINUE ';' { $$ = MkContinueStmt(); $$.loc = @$; }
3538 | BREAK ';' { $$ = MkBreakStmt(); $$.loc = @$; }
3539 | RETURN ';' { Expression exp = MkExpDummy(); $$ = MkReturnStmt(MkListOne(exp)); $$.loc = @$; exp.loc = @2; }
3540 | RETURN expression ';' { $$ = MkReturnStmt($2); $$.loc = @$; }
3541 | RETURN expression_error ';' { $$ = MkReturnStmt($2); $$.loc = @$; }
3542 | RETURN anon_instantiation_expression ';' { $$ = MkReturnStmt(MkListOne($2)); $$.loc = @$; }
3543 | RETURN anon_instantiation_expression_error ';' { $$ = MkReturnStmt(MkListOne($2)); $$.loc = @$; }
3546 jump_statement_error:
3547 RETURN expression_error { $$ = MkReturnStmt($2); $$.loc = @$; } |
3548 RETURN anon_instantiation_expression_error { $$ = MkReturnStmt(MkListOne($2)); $$.loc = @$; } |
3549 RETURN { Expression exp = MkExpDummy(); $$ = MkReturnStmt(MkListOne(exp)); $$.loc = @$; exp.loc.start = exp.loc.end = @1.end; } |
3550 GOTO { $$ = MkGotoStmt(null); $$.loc = @$; }
3553 /*************************************************************************************/
3555 function_definition:
3556 external_guess_declaration_specifiers declarator_function declaration_list compound_statement { $$ = MkFunction($1, $2, $3); ProcessFunctionBody($$, $4); $$.loc = @$; }
3557 | external_guess_declaration_specifiers declarator_function compound_statement
3558 { $$ = MkFunction($1, $2, null); ProcessFunctionBody($$, $3); $$.loc = @$; }
3559 | external_guess_declaration_specifiers declarator_function_type_ok declaration_list compound_statement { $$ = MkFunction($1, $2, $3); ProcessFunctionBody($$, $4); $$.loc = @$; }
3560 | external_guess_declaration_specifiers declarator_function_type_ok compound_statement
3561 { $$ = MkFunction($1, $2, null); ProcessFunctionBody($$, $3); $$.loc = @$; }
3563 | declarator_function declaration_list compound_statement { $$ = MkFunction(null, $1, $2); ProcessFunctionBody($$, $3); $$.loc = @$; }
3564 | declarator_function compound_statement { $$ = MkFunction(null, $1, null); ProcessFunctionBody($$, $2); $$.loc = @$;}
3566 function_definition_error:
3567 external_guess_declaration_specifiers declarator_function declaration_list compound_statement_error { $$ = MkFunction($1, $2, $3); ProcessFunctionBody($$, $4); $$.loc = @$; $$.loc.end = $4.loc.end; }
3568 | external_guess_declaration_specifiers declarator_function compound_statement_error { $$ = MkFunction($1, $2, null); ProcessFunctionBody($$, $3); $$.loc = @$; $$.loc.end = $3.loc.end; }
3569 | 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; }
3570 | external_guess_declaration_specifiers declarator_function_type_ok compound_statement_error { $$ = MkFunction($1, $2, null); ProcessFunctionBody($$, $3); $$.loc = @$; $$.loc.end = $3.loc.end; }
3571 | declarator_function declaration_list compound_statement_error { $$ = MkFunction(null, $1, $2); ProcessFunctionBody($$, $3); $$.loc = @$; $$.loc.end = $3.loc.end; }
3572 | declarator_function compound_statement_error { $$ = MkFunction(null, $1, null); ProcessFunctionBody($$, $2); $$.loc = @$; $$.loc.end = $2.loc.end; }
3576 STRING_LITERAL { $$ = CopyString(yytext); }
3577 | string_literal STRING_LITERAL
3579 int len1 = strlen($1);
3580 int len2 = strlen(yytext);
3581 $$ = new byte[len1-1 + len2-1 + 1];
3582 memcpy($$, $1, len1-1);
3583 memcpy($$ + len1-1, yytext+1, len2);
3588 external_declaration:
3589 function_definition { $$ = MkExternalFunction($1); $$.loc = @$; $1.declMode = declMode; declMode = defaultDeclMode; }
3591 { $$ = MkExternalClass($1); $$.loc = @$; $1.declMode = (declMode != defaultAccess) ? declMode : privateAccess; declMode = defaultDeclMode; }
3593 | external_guess_declaration_specifiers class
3594 { $$ = MkExternalClass($2); $$.loc = @$; $2.declMode = (declMode != defaultAccess) ? declMode : privateAccess; declMode = defaultDeclMode; FreeList($1, FreeSpecifier); }
3596 | external_guess_declaration
3597 { $$ = MkExternalDeclaration($1); $$.loc = @$; $1.declMode = declMode; declMode = defaultDeclMode; }
3598 | IMPORT string_literal { $$ = MkExternalImport($2, normalImport, (declMode != defaultAccess) ? declMode : privateAccess); $$.loc = @$; }
3599 | IMPORT STATIC string_literal { $$ = MkExternalImport($3, staticImport, (declMode != defaultAccess) ? declMode : privateAccess); $$.loc = @$; }
3600 | IMPORT identifier string_literal
3602 bool isRemote = !strcmp($2.string, "remote");
3603 $$ = MkExternalImport($3, isRemote ? remoteImport : normalImport, (declMode != defaultAccess) ? declMode : privateAccess);
3610 | ';' { $$ = null; }
3612 | declaration_mode function_definition { $$ = MkExternalFunction($2); $$.loc = @$; $2.declMode = $1; declMode = defaultDeclMode; }
3613 | declaration_mode class
3614 { $$ = MkExternalClass($2); $$.loc = @$; $2.declMode = ($1 != defaultAccess) ? $1 : privateAccess; declMode = defaultDeclMode; }
3615 | declaration_mode external_guess_declaration { $$ = MkExternalDeclaration($2); $$.loc = @$; $2.declMode = $1; declMode = defaultDeclMode; }
3616 | declaration_mode IMPORT string_literal { $$ = MkExternalImport($3, normalImport, ($1 != defaultAccess) ? $1 : privateAccess); $$.loc = @$; declMode = defaultDeclMode; }
3617 | declaration_mode IMPORT STATIC string_literal { $$ = MkExternalImport($4, staticImport, ($1 != defaultAccess) ? $1 : privateAccess); $$.loc = @$; declMode = defaultDeclMode; }
3618 | declaration_mode IMPORT identifier string_literal
3620 bool isRemote = !strcmp($3.string, "remote");
3621 $$ = MkExternalImport($4, isRemote ? remoteImport : normalImport, ($1 != defaultAccess) ? $1 : privateAccess);
3624 declMode = defaultDeclMode;
3628 | declaration_mode ':' { defaultDeclMode = $1; $$ = null; }
3629 | STATIC ':' { defaultDeclMode = staticAccess; $$ = null; }
3630 | NAMESPACE identifier { $$ = MkExternalNameSpace($2); $$.loc = @$; }
3631 | NAMESPACE strict_type { $$ = MkExternalNameSpace(MkIdentifier($2.name)); FreeSpecifier($2); $$.loc = @$; }
3632 | dbtable_definition { $$ = MkExternalDBTable($1); $$.loc = @$; $1.declMode = (declMode != defaultAccess) ? declMode : privateAccess; declMode = defaultDeclMode; }
3633 | declaration_mode dbtable_definition { $$ = MkExternalDBTable($2); $$.loc = @$; $2.declMode = ($1 != defaultAccess) ? declMode : privateAccess; declMode = defaultDeclMode; }
3636 external_declaration_error:
3637 class_error { $$ = MkExternalClass($1); $$.loc = $1.loc; $1.declMode = (declMode != defaultAccess) ? declMode : privateAccess; declMode = defaultDeclMode; }
3638 | external_guess_declaration_specifiers class_error
3640 FreeList($1, FreeSpecifier);
3641 $$ = MkExternalClass($2);
3643 $2.declMode = (declMode != defaultAccess) ? declMode : privateAccess;
3644 declMode = defaultDeclMode;
3646 | function_definition_error { $$ = MkExternalFunction($1); $$.loc = $1.loc; $1.declMode = declMode; declMode = defaultDeclMode; }
3648 | declaration_mode class_error { $$ = MkExternalClass($2); $$.loc = $2.loc; $2.declMode = ($1 != defaultAccess) ? $1 : privateAccess; declMode = defaultDeclMode; }
3649 | declaration_mode function_definition_error { $$ = MkExternalFunction($2); $$.loc = $2.loc; $2.declMode = $1; declMode = defaultDeclMode; }
3651 | external_guess_declaration_error
3652 { $$ = MkExternalDeclaration($1); $$.loc = @$; $1.declMode = declMode; declMode = defaultDeclMode; }
3653 | declaration_mode external_guess_declaration_error { $$ = MkExternalDeclaration($2); $$.loc = @$; $2.declMode = $1; declMode = defaultDeclMode; }
3656 translation_unit_error:
3657 external_declaration_error { $$ = MkList(); ListAdd($$, $1); ast = $$; }
3658 | translation_unit external_declaration_error { $$ = $1; ListAdd($1, $2); }
3659 | translation_unit_error external_declaration_error { $$ = $1; ListAdd($1, $2); }
3660 | translation_unit error
3661 | translation_unit_error error
3665 external_declaration { $$ = MkList(); ListAdd($$, $1); ast = $$; }
3666 | translation_unit external_declaration { $$ = $1; ListAdd($1, $2); }
3667 | translation_unit_error class
3668 { External _class = MkExternalClass($2); $$ = $1; ListAdd($1, _class); _class.loc = @2; $2.declMode = (declMode != defaultAccess) ? declMode : privateAccess; declMode = defaultDeclMode; }
3669 | translation_unit_error declaration_mode class
3670 { External _class = MkExternalClass($3); $$ = $1; ListAdd($1, _class); _class.loc = @3; $3.declMode = ($2 != defaultAccess) ? $2 : privateAccess; declMode = defaultDeclMode; }
3675 | translation_unit_error
3676 | { ast = MkList(); }
3680 DBTABLE string_literal identifier '{' dbfield_definition_list '}' { Symbol symbol = DeclClassAddNameSpace(globalContext.nextID++, $3.string); FreeIdentifier($3); $$ = MkDBTableDef($2, symbol, $5); }
3681 | DBTABLE string_literal strict_type '{' dbfield_definition_list '}' { Symbol symbol = DeclClass(globalContext.nextID++, $3.name); FreeSpecifier($3); $$ = MkDBTableDef($2, symbol, $5); }
3682 | DBTABLE string_literal '{' dbfield_definition_list '}' { $$ = MkDBTableDef($2, null, $4); }
3686 guess_declaration_specifiers identifier string_literal ';' { $$ = MkDBFieldEntry(MkTypeName($1, null), $2, $3); }
3690 identifier { $$ = MkDBIndexItem($1, ascending); }
3691 | '>' identifier { $$ = MkDBIndexItem($2, descending); }
3692 | '<' identifier { $$ = MkDBIndexItem($2, ascending); }
3696 dbindex_item { $$ = MkList(); ListAdd($$, $1); }
3697 | dbindex_item_list ',' dbindex_item { ListAdd($1, $3); }
3701 DBINDEX dbindex_item_list ';' { $$ = MkDBIndexEntry($2, null); }
3702 | DBINDEX dbindex_item_list identifier ';' { $$ = MkDBIndexEntry($2, $3); }
3705 dbfield_definition_list:
3706 dbfield_entry { $$ = MkList(); ListAdd($$, $1); }
3707 | dbindex_entry { $$ = MkList(); ListAdd($$, $1); }
3708 | dbfield_definition_list dbfield_entry { ListAdd($1, $2); }
3709 | dbfield_definition_list dbindex_entry { ListAdd($1, $2); }
3713 DATABASE_OPEN '(' assignment_expression ',' assignment_expression ')' { $$ = MkExpDBOpen($3, $5); }
3717 DBFIELD '(' string_literal ',' identifier ')' { $$ = MkExpDBField($3, $5); }
3721 DBINDEX '(' string_literal ',' identifier ')' { $$ = MkExpDBIndex($3, $5); }
3725 DBTABLE '(' string_literal ')' { $$ = MkExpDBTable($3); }