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 constant
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
195 %token BOOL _BOOL _COMPLEX _IMAGINARY RESTRICT THREAD
197 %destructor { FreeIdentifier($$); } identifier
198 %destructor { FreePointer($$); } pointer
199 %destructor { FreeExpression($$); } primary_expression primary_expression_error postfix_expression unary_expression cast_expression
200 multiplicative_expression additive_expression shift_expression
201 relational_expression equality_expression and_expression
202 exclusive_or_expression inclusive_or_expression logical_and_expression
203 logical_or_expression conditional_expression assignment_expression
204 constant_expression constant_expression_error
205 postfix_expression_error unary_expression_error cast_expression_error
206 multiplicative_expression_error additive_expression_error shift_expression_error
207 relational_expression_error equality_expression_error and_expression_error
208 exclusive_or_expression_error inclusive_or_expression_error logical_and_expression_error
209 logical_or_expression_error conditional_expression_error assignment_expression_error i18n_string
210 %destructor { FreeSpecifier($$); } storage_class_specifier enum_specifier_compound enum_specifier_nocompound type_qualifier type_specifier class_specifier class_specifier_error
211 struct_or_union_specifier_compound struct_or_union_specifier_nocompound ext_storage type strict_type guess_type enum_class strict_type_specifier struct_class
212 struct_or_union_specifier_compound_error struct_class_error struct_decl
213 enum_specifier_compound_error enum_class_error external_storage_class_specifier
214 base_strict_type struct_head struct_entry
215 %destructor { FreeEnumerator($$); } enumerator
216 %destructor { FreeDeclarator($$); } declarator direct_declarator direct_abstract_declarator abstract_declarator
217 direct_abstract_declarator_noarray abstract_declarator_noarray
218 struct_declarator direct_declarator_function direct_declarator_function_start declarator_function_error direct_declarator_function_error declarator_function direct_declarator_nofunction
219 direct_declarator_function_type_ok declarator_nofunction_type_ok direct_declarator_nofunction_type_ok declarator_function_type_ok direct_declarator_function_error_type_ok
220 direct_declarator_function_start_type_ok direct_declarator_type_ok declarator_type_ok declarator_function_error_type_ok
222 %destructor { FreeInitializer($$); } initializer initializer_error initializer_condition initializer_condition_error
223 %destructor { FreeInitDeclarator($$); } init_declarator init_declarator_error
224 %destructor { FreeTypeName($$); } type_name guess_type_name parameter_declaration parameter_declaration_error
225 %destructor { FreeStatement($$); } statement labeled_statement labeled_statement_error compound_statement compound_statement_error expression_statement
226 selection_statement selection_statement_error iteration_statement jump_statement jump_statement_error compound_inside compound_inside_error
227 iteration_statement_error statement_error
229 %destructor { FreeDeclaration($$); } declaration
230 %destructor { FreeFunction($$); } function_definition function_definition_error
231 %destructor { FreeExternal($$); } external_declaration external_declaration_error
233 %destructor { FreeInstance($$); } instantiation_named instantiation_named_error instantiation_unnamed instantiation_unnamed_error
235 %destructor { FreeMemberInit($$); } data_member_initialization data_member_initialization_error default_property default_property_error
237 %destructor { FreeClassFunction($$); } class_function_definition class_function_definition_error class_function_definition_start
238 class_function_definition_start_error virtual_class_function_definition_start virtual_class_function_definition_start_error
239 constructor_function_definition_start destructor_function_definition_start
240 instance_class_function_definition instance_class_function_definition_error instance_class_function_definition_start instance_class_function_definition_start_error
241 %destructor { Context ctx = curContext; PopContext(ctx); FreeContext(ctx); delete ctx; } class_entry
242 %destructor { Context ctx = curContext; PopContext(ctx); FreeContext(ctx); delete ctx; } class_decl
243 %destructor { FreeClass($$); } class class_error class_head
244 %destructor { FreeClassDef($$); } struct_declaration struct_declaration_error
245 %destructor { delete $$; } string_literal attribute_word base_strict_type_name
246 %destructor { FreeProperty($$); } property
248 %destructor { FreeList($$, FreeExpression); } argument_expression_list expression expression_error argument_expression_list_error
249 %destructor { FreeList($$, FreeEnumerator); } enumerator_list
250 %destructor { FreeList($$, FreeSpecifier); } type_qualifier_list specifier_qualifier_list declaration_specifiers inheritance_specifiers _inheritance_specifiers external_guess_declaration_specifiers external_guess_declaration_specifiers_error
251 guess_declaration_specifiers guess_specifier_qualifier_list
252 %destructor { FreeList($$, FreeDeclarator); } struct_declarator_list
253 %destructor { FreeList($$, FreeDeclaration); } declaration_list declaration_list_error
254 %destructor { FreeList($$, FreeInitializer); } initializer_list
255 %destructor { FreeList($$, FreeInitDeclarator); } init_declarator_list init_declarator_list_error
256 %destructor { FreeList($$, FreeTypeName); } parameter_list parameter_list_error parameter_type_list parameter_type_list_error identifier_list identifier_list_error
257 %destructor { FreeList($$, FreeStatement); } statement_list statement_list_error
258 %destructor { if($$ != ast) FreeList($$, FreeExternal); } translation_unit translation_unit_error
259 %destructor { FreeList($$, FreeClassDef); } struct_declaration_list struct_declaration_list_error
260 %destructor { FreeList($$, FreeMemberInit); } default_property_list default_property_list_error data_member_initialization_list data_member_initialization_list_coloned data_member_initialization_list_error
261 %destructor { FreeList($$, FreeMembersInit); } members_initialization_list members_initialization_list_coloned members_initialization_list_error
262 %destructor { PopContext($$); FreeContext($$); delete $$; } compound_start
263 %destructor { FreeTemplateParameter($$); } template_parameter template_type_parameter template_identifier_parameter template_expression_parameter
264 %destructor { FreeTemplateArgument($$); } template_argument template_type_argument template_identifier_argument template_expression_argument
265 %destructor { FreeTemplateDataType($$); } template_datatype
266 %destructor { FreeList($$, FreeTemplateParameter); } template_parameters_list
267 %destructor { FreeList($$, FreeTemplateArgument); } template_arguments_list
268 %destructor { } declaration_mode
269 %destructor { FreeAttrib($$); } attrib
270 %destructor { FreeExtDecl($$); } ext_decl
271 %destructor { FreeAttribute($$); } attribute
272 %destructor { FreeList($$, FreeAttribute); } attribs_list
282 // if($1._class && !$1._class.name)
286 strcpy(name, $1._class.name ? $1._class.name : "");
288 strcat(name, $1.string);
292 _DeclClass(0, $1.string);
296 fileInput.Seek(@1.start.pos, start);
297 resetScannerPos(&@1.start);
302 YY_STACK_PRINT (yyss, yyssp);
305 YY_STACK_PRINT (yyss, yyssp);
312 // if($1._class && !$1._class.name)
316 strcpy(name, $1._class.name ? $1._class.name : "");
318 strcat(name, $1.string);
322 _DeclClass(0, $1.string);
326 fileInput.Seek(@1.start.pos, start);
327 resetScannerPos(&@1.start);
332 YY_STACK_PRINT (yyss, yyssp);
335 YY_STACK_PRINT (yyss, yyssp);
339 /* | identifier '*' '<' template_arguments_list '>'
341 //if($1._class && !$1._class.name)
345 strcpy(name, $1._class.name ? $1._class.name : "");
347 strcat(name, $1.string);
351 _DeclClass(0, $1.string);
352 fileInput.Seek(@1.start.pos, start);
353 resetScannerPos(&@1.start);
358 YY_STACK_PRINT (yyss, yyssp);
361 YY_STACK_PRINT (yyss, yyssp);
367 strict_type { $$ = $1; }
368 | identifier identifier
373 $$ = MkSpecifierName($1.string);
379 // if($1._class && !$1._class.name)
383 strcpy(name, $1._class.name ? $1._class.name : "");
385 strcat(name, $1.string);
389 _DeclClass(0, $1.string);
394 fileInput.Seek(@1.start.pos, start);
395 resetScannerPos(&@1.start);
400 YY_STACK_PRINT (yyss, yyssp);
403 YY_STACK_PRINT (yyss, yyssp);
406 Location tmpLoc = yylloc; $$ = $2; yylloc = @1;
407 Compiler_Error($"Not a type: %s\n", $1.string);
408 yylloc = tmpLoc; $2.badID = $1;
415 //if($1._class && !$1._class.name)
419 strcpy(name, $1._class.name ? $1._class.name : "");
421 strcat(name, $1.string);
425 _DeclClass(0, $1.string);
426 fileInput.Seek(@1.start.pos, start);
427 resetScannerPos(&@1.start);
432 YY_STACK_PRINT (yyss, yyssp);
435 YY_STACK_PRINT (yyss, yyssp);
439 /* | strict_type '<' template_arguments_list '>' { $$ = $1; }
440 | identifier identifier '<' template_arguments_list '>'
443 // if($1._class && !$1._class.name)
447 strcpy(name, $1._class.name ? $1._class.name : "");
449 strcat(name, $1.string);
453 _DeclClass(0, $1.string);
457 fileInput.Seek(@1.start.pos, start);
458 resetScannerPos(&@1.start);
463 YY_STACK_PRINT (yyss, yyssp);
466 YY_STACK_PRINT (yyss, yyssp);
469 Location tmpLoc = yylloc; $$ = $2; yylloc = @1;
470 Compiler_Error($"Not a type: %s\n", $1.string);
471 yylloc = tmpLoc; $2.badID = $1;
477 TYPE_NAME { $$ = MkSpecifierName(yytext); }
480 base_strict_type_name:
481 TYPE_NAME { $$ = CopyString(yytext); }
485 | base_strict_type '<' template_arguments_list '>' { $$ = $1; SetClassTemplateArgs($$, $3); $$.loc = @$; }
486 | base_strict_type '<' template_arguments_list RIGHT_OP
489 SetClassTemplateArgs($$, $3);
493 fileInput.Seek(@4.end.pos, start);
494 resetScannerPos(&@4.end);
498 /* | identifier '<' template_arguments_list '>' */
499 /*| identifier '<' error
501 // if($1._class && !$1._class.name)
505 strcpy(name, $1._class.name ? $1._class.name : "");
507 strcat(name, $1.string);
511 _DeclClass(0, $1.string);
515 fileInput.Seek(@1.start.pos, start);
516 resetScannerPos(&@1.start);
521 YY_STACK_PRINT (yyss, yyssp);
524 YY_STACK_PRINT (yyss, yyssp);
527 YY_STACK_PRINT (yyss, yyssp);
530 /* $$ = MkSpecifierNameArgs($1.string, $3); $$.loc = @$; FreeIdentifier($1); */
534 class_function_definition_start:
535 guess_declaration_specifiers declarator_function_type_ok
536 { $$ = MkClassFunction($1, null, $2, null); $$.loc = @$; $$.id = ++globalContext.nextID; }
537 | declarator_function
538 { $$ = MkClassFunction(null, null, $1, null); $$.loc = @$; $$.id = ++globalContext.nextID; }
541 constructor_function_definition_start:
542 guess_declaration_specifiers '(' ')'
543 { $$ = MkClassFunction(null, null, null, null); $$.isConstructor = true; $$.loc = @$; $$.id = ++globalContext.nextID; FreeList($1, FreeSpecifier); }
546 destructor_function_definition_start:
547 '~' guess_declaration_specifiers '(' ')'
548 { $$ = MkClassFunction(null, null, null, null); $$.isDestructor = true; $$.loc = @$; $$.id = ++globalContext.nextID; FreeList($2, FreeSpecifier) }
551 virtual_class_function_definition_start:
552 VIRTUAL guess_declaration_specifiers declarator_function_type_ok
553 { $$ = MkClassFunction($2, null, $3, null); $$.isVirtual = true; $$.loc = @$; $$.id = ++globalContext.nextID; }
554 | VIRTUAL declarator_function
555 { $$ = MkClassFunction(null, null, $2, null); $$.isVirtual = true; $$.loc = @$; $$.id = ++globalContext.nextID; }
558 class_function_definition_start_error:
559 guess_declaration_specifiers declarator_function_error_type_ok
560 { $$ = MkClassFunction($1, null, $2, null); $$.loc = @$; $$.id = ++globalContext.nextID; }
561 | declarator_function_error
562 { $$ = MkClassFunction(null, null, $1, null); $$.loc = @$; $$.id = ++globalContext.nextID; }
565 virtual_class_function_definition_start_error:
566 VIRTUAL guess_declaration_specifiers declarator_function_error_type_ok
567 { $$ = MkClassFunction($2, null, $3, null); $$.isVirtual = true; $$.loc = @$; $$.id = ++globalContext.nextID; }
568 | VIRTUAL declarator_function_error
569 { $$ = MkClassFunction(null, null, $2, null); $$.isVirtual = true; $$.loc = @$; $$.id = ++globalContext.nextID; }
572 class_function_definition:
573 class_function_definition_start compound_statement
574 { ProcessClassFunctionBody($1, $2); $$.loc = @$; }
575 | virtual_class_function_definition_start compound_statement
576 { ProcessClassFunctionBody($1, $2); $$.loc = @$; }
577 | virtual_class_function_definition_start ';'
578 { ProcessClassFunctionBody($1, null); $$.loc = @$; }
579 | constructor_function_definition_start compound_statement
580 { ProcessClassFunctionBody($1, $2); $$.loc = @$; }
581 | destructor_function_definition_start compound_statement
582 { ProcessClassFunctionBody($1, $2); $$.loc = @$; }
585 | class_function_definition_start ';'
586 { ProcessClassFunctionBody($1, null); $$.loc = @$; }
588 // Added this to fix attrib not working after function pointer declarations
589 | class_function_definition_start attrib ';'
593 $1.declarator = MkStructDeclarator($1.declarator, null);
594 $1.declarator.structDecl.attrib = $2;
596 ProcessClassFunctionBody($1, null);
601 class_function_definition_error:
602 class_function_definition_start compound_statement_error
603 { ProcessClassFunctionBody($1, $2); $$.loc = @$; $$.loc.end = $2.loc.end; }
604 | class_function_definition_start_error
605 { ProcessClassFunctionBody($1, null); $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++;}
606 | virtual_class_function_definition_start compound_statement_error
607 { ProcessClassFunctionBody($1, $2); $$.loc = @$; $$.loc.end = $2.loc.end; }
608 | virtual_class_function_definition_start_error
609 { ProcessClassFunctionBody($1, null); $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++;}
610 | virtual_class_function_definition_start_error ';'
611 { ProcessClassFunctionBody($1, null); $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++;}
614 // In Instances, return type is required to distinguish from calling the function
615 instance_class_function_definition_start:
616 declaration_specifiers declarator_function_type_ok
617 { $$ = MkClassFunction($1, null, $2, null); $$.loc = @$; $$.id = ++globalContext.nextID; }
618 | declaration_specifiers declarator_nofunction_type_ok
619 { $$ = MkClassFunction($1, null, MkDeclaratorFunction($2, null), null); $$.loc = @$; $$.id = ++globalContext.nextID; }
622 instance_class_function_definition_start_error:
623 declaration_specifiers declarator_function_error_type_ok
624 { $$ = MkClassFunction($1, null, $2, null); $$.loc = @$; $$.id = ++globalContext.nextID; }
627 instance_class_function_definition:
628 instance_class_function_definition_start compound_statement
629 { ProcessClassFunctionBody($1, $2); $$.loc = @$; }
632 instance_class_function_definition_error:
633 instance_class_function_definition_start compound_statement_error
634 { ProcessClassFunctionBody($1, $2); $$.loc = @$; $$.loc.end = $2.loc.end; $$.loc.end.charPos++; $$.loc.end.pos++;}
635 | instance_class_function_definition_start_error
636 { ProcessClassFunctionBody($1, null); $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++;}
637 | instance_class_function_definition_start
638 { ProcessClassFunctionBody($1, null); $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++;}
641 data_member_initialization:
642 postfix_expression '=' initializer_condition { $$ = MkMemberInitExp($1, $3); $$.loc = @$; $$.realLoc = @$; $$.initializer.loc.start = @2.end;}
643 | initializer_condition { $$ = MkMemberInit(null, $1); $$.loc = @$; $$.realLoc = @$;}
646 data_member_initialization_error:
647 postfix_expression '=' initializer_condition_error { $$ = MkMemberInitExp($1, $3); $$.loc = @$; $$.realLoc = @$; $$.initializer.loc.start = @2.end;}
648 | postfix_expression '=' error
650 $$ = MkMemberInitExp($1, MkInitializerAssignment(MkExpDummy()));
651 $$.loc = @$; $$.realLoc = @$; $$.initializer.loc.start = $$.initializer.loc.end = @2.end;
653 fileInput.Seek(@2.end.pos, start);
655 resetScannerPos(&@2.end);
659 | initializer_condition_error { $$ = MkMemberInit(null, $1); $$.loc = @$; $$.realLoc = @$;}
662 data_member_initialization_list:
663 data_member_initialization { $$ = MkList(); ListAdd($$, $1); }
664 | data_member_initialization_list ',' data_member_initialization
665 { ((MemberInit)$1->last).loc.end = @3.start; ListAdd($1, $3); $$ = $1; }
666 | data_member_initialization_list_error ',' data_member_initialization
667 { ((MemberInit)$1->last).loc.end = @3.start; ListAdd($1, $3); $$ = $1; }
670 data_member_initialization_list_error:
671 data_member_initialization_error { $$ = MkList(); ListAdd($$, $1); }
672 | data_member_initialization_list ',' data_member_initialization_error
673 { ((MemberInit)$1->last).loc.end = @3.start; ListAdd($1, $3); $$ = $1; }
674 | data_member_initialization_list_error ',' data_member_initialization_error
675 { ((MemberInit)$1->last).loc.end = @3.start; ListAdd($1, $3); $$ = $1; }
677 | data_member_initialization_list ',' error
678 { ((MemberInit)$1->last).loc.end = @2.end;
680 Initializer dummy = MkInitializerAssignment(MkExpDummy());
681 MemberInit memberInit = MkMemberInit(null, dummy);
682 memberInit.realLoc.start = memberInit.loc.start = dummy.loc.start = @2.end;
683 memberInit.realLoc.end = memberInit.loc.end = dummy.loc.end = @2.end;
684 ListAdd($1, memberInit);
689 data_member_initialization_list_error ',' error
690 { ((MemberInit)$1->last).loc.end = @2.end;
692 Initializer dummy = MkInitializerAssignment(MkExpDummy());
693 MemberInit memberInit = MkMemberInit(null, dummy);
694 memberInit.realLoc.start = memberInit.loc.start = dummy.loc.start = @2.end;
695 memberInit.realLoc.end = memberInit.loc.end = dummy.loc.end = @2.end;
696 ListAdd($1, memberInit);
702 Initializer dummy = MkInitializerAssignment(MkExpDummy());
703 MemberInit memberInit = MkMemberInit(null, dummy);
704 memberInit.realLoc.start = memberInit.loc.start = dummy.loc.start = @1.start;
705 memberInit.realLoc.end = memberInit.loc.end = dummy.loc.end = @1.start;
708 ListAdd($$, memberInit);
710 dummy = MkInitializerAssignment(MkExpDummy());
711 memberInit = MkMemberInit(null, dummy);
712 memberInit.realLoc.start = memberInit.loc.start = dummy.loc.start = @1.end;
713 memberInit.realLoc.end = memberInit.loc.end = dummy.loc.end = @1.end;
714 ListAdd($$, memberInit);
718 data_member_initialization_list_coloned:
719 data_member_initialization_list ';'
720 { if($1->last) ((MemberInit)$1->last).loc.end = @2.end; $$ = $1; }
721 | data_member_initialization_list_error ';'
722 { if($1->last) ((MemberInit)$1->last).loc.end = @2.end; $$ = $1; }
725 members_initialization_list_coloned:
726 data_member_initialization_list_coloned { MembersInit members = MkMembersInitList($1); $$ = MkList(); ListAdd($$, members); members.loc = @1; }
727 | instance_class_function_definition { $$ = MkList(); ListAdd($$, MkMembersInitMethod($1)); ((MembersInit)$$->last).loc = @1; }
728 | members_initialization_list_error data_member_initialization_list_coloned { MembersInit members = MkMembersInitList($2); ListAdd($$, members); members.loc = @2; $$ = $1; }
729 | members_initialization_list_error instance_class_function_definition { ListAdd($$, MkMembersInitMethod($2)); ((MembersInit)$$->last).loc = @2; $$ = $1; }
730 | members_initialization_list_coloned data_member_initialization_list_coloned { MembersInit members = MkMembersInitList($2); ListAdd($$, members); members.loc = @2; $$ = $1; }
731 | members_initialization_list_coloned instance_class_function_definition { ListAdd($$, MkMembersInitMethod($2)); ((MembersInit)$$->last).loc = @2; $$ = $1; }
732 | members_initialization_list_error ';'
733 | members_initialization_list_coloned ';'
735 MembersInit members = (MembersInit)$$->last;
736 if(members.type == dataMembersInit)
737 members.loc.end = @$.end;
740 MembersInit members = MkMembersInitList(MkList());
741 ListAdd($$, members);
746 | ';' { MembersInit members = MkMembersInitList(MkList()); $$ = MkList(); ListAdd($$, members); members.loc = @1; }
749 members_initialization_list:
750 members_initialization_list_coloned
751 | data_member_initialization_list { $$ = MkList(); ListAdd($$, MkMembersInitList($1)); ((MembersInit)$$->last).loc = @1; }
752 | members_initialization_list_coloned data_member_initialization_list { ListAdd($1, MkMembersInitList($2)); ((MembersInit)$$->last).loc = @2; }
753 | members_initialization_list_error data_member_initialization_list { ListAdd($1, MkMembersInitList($2)); ((MembersInit)$$->last).loc = @2; }
756 members_initialization_list_error:
757 instance_class_function_definition_error { $$ = MkList(); ListAdd($$, MkMembersInitMethod($1)); ((MembersInit)$$->last).loc = @1; }
758 | members_initialization_list instance_class_function_definition_error { ListAdd($$, MkMembersInitMethod($2)); ((MembersInit)$$->last).loc = @2; $$ = $1; }
759 | members_initialization_list_error instance_class_function_definition_error { ListAdd($$, MkMembersInitMethod($2)); ((MembersInit)$$->last).loc = @2; $$ = $1; }
760 | members_initialization_list_coloned instance_class_function_definition_error { ListAdd($$, MkMembersInitMethod($2)); ((MembersInit)$$->last).loc = @2; $$ = $1; }
761 | members_initialization_list_coloned data_member_initialization_list_error { ListAdd($$, MkMembersInitList($2)); ((MembersInit)$$->last).loc = @2; $$ = $1; }
762 | data_member_initialization_list_error { $$ = MkList(); ListAdd($$, MkMembersInitList($1)); ((MembersInit)$$->last).loc = @1; }
763 | data_member_initialization_list error { $$ = MkList(); ListAdd($$, MkMembersInitList($1)); ((MembersInit)$$->last).loc = @2; }
767 instantiation_named_error '}'
768 { $$.loc = @$; $$.insideLoc.end = @2.start; $$ = $1; }
769 | instantiation_named_error error '}'
770 { $$.loc = @$; $$.insideLoc.end = @2.start; $$ = $1; }
773 instantiation_named_error:
774 declaration_specifiers identifier '{' members_initialization_list_error
775 { $$ = 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++; }
776 | declaration_specifiers identifier '{' members_initialization_list error
777 { $$ = 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++; }
778 | declaration_specifiers identifier '{' members_initialization_list
779 { $$ = 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++; }
780 | declaration_specifiers identifier '{'
781 { $$ = 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++; }
782 | declaration_specifiers identifier '{' error
783 { $$ = 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++; }
788 declaration_specifiers identifier '{' members_initialization_list '}'
789 { $$ = MkInstantiationNamed($1, MkExpIdentifier($2), $4); $$.exp.loc = @2; $$.loc = @$; $$.nameLoc = @2; $$.insideLoc.start = @3.end; $$.insideLoc.end = @5.start;}
790 | declaration_specifiers identifier '{' members_initialization_list_error '}'
791 { $$ = MkInstantiationNamed($1, MkExpIdentifier($2), $4); $$.exp.loc = @2; $$.loc = @$; $$.nameLoc = @2; $$.insideLoc.start = @3.end; $$.insideLoc.end = @5.start;}
792 | declaration_specifiers identifier '{' '}'
793 { $$ = MkInstantiationNamed($1, MkExpIdentifier($2), MkList()); $$.exp.loc = @2; $$.loc = @$; $$.nameLoc = @2; $$.insideLoc.start = @3.end; $$.insideLoc.end = @4.start;}
796 instantiation_named_error:
797 declaration_specifiers identifier '{' members_initialization_list_error
798 { $$ = MkInstantiationNamed($1, MkExpIdentifier($2), $4); $$.exp.loc = @2; $$.loc = @$; $$.nameLoc = @2; $$.insideLoc.start = @3.end; $$.insideLoc.end = @4.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
799 | declaration_specifiers identifier '{' members_initialization_list error
800 { $$ = 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++; }
801 | declaration_specifiers identifier '{' members_initialization_list
802 { $$ = 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++; }
803 | declaration_specifiers identifier '{'
804 { $$ = 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++; }
805 | declaration_specifiers identifier '{' error
806 { $$ = 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++; }
811 guess_instantiation_named:
812 guess_instantiation_named_error '}'
813 { $$.loc = @$; $$.insideLoc.end = @2.start; }
814 | guess_instantiation_named_error error '}'
815 { $$.loc = @$; $$.insideLoc.end = @2.start; }
818 guess_instantiation_named_error:
819 guess_declaration_specifiers identifier '{' members_initialization_list_error
820 { $$ = 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++; }
821 | guess_declaration_specifiers identifier '{' members_initialization_list error
822 { $$ = 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++; }
823 | guess_declaration_specifiers identifier '{' members_initialization_list
824 { $$ = 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++; }
825 | guess_declaration_specifiers identifier '{'
826 { $$ = 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++; }
827 | guess_declaration_specifiers identifier '{' error
828 { $$ = 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++; }
832 guess_instantiation_named:
833 guess_declaration_specifiers identifier '{' members_initialization_list '}'
834 { $$ = MkInstantiationNamed($1, MkExpIdentifier($2), $4);$$.exp.loc = @2; $$.loc = @$; $$.nameLoc = @2; $$.insideLoc.start = @3.end; $$.insideLoc.end = @5.start;}
835 | guess_declaration_specifiers identifier '{' members_initialization_list_error '}'
836 { $$ = MkInstantiationNamed($1, MkExpIdentifier($2), $4); $$.exp.loc = @2; $$.loc = @$; $$.nameLoc = @2; $$.insideLoc.start = @3.end; $$.insideLoc.end = @5.start;}
837 | guess_declaration_specifiers identifier '{' '}'
838 { $$ = MkInstantiationNamed($1, MkExpIdentifier($2), MkList()); $$.exp.loc = @2; $$.loc = @$; $$.nameLoc = @2; $$.insideLoc.start = @3.end; $$.insideLoc.end = @4.start;}
841 guess_instantiation_named_error:
842 guess_declaration_specifiers identifier '{' members_initialization_list_error
843 { $$ = 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++; }
844 | guess_declaration_specifiers identifier '{' members_initialization_list error
845 { $$ = 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++; }
846 | guess_declaration_specifiers identifier '{' members_initialization_list
847 { $$ = 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++; }
848 | guess_declaration_specifiers identifier '{'
849 { $$ = 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++; }
850 | guess_declaration_specifiers identifier '{' error
851 { $$ = 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++; }
855 external_guess_instantiation_named:
856 external_guess_declaration_specifiers identifier '{' members_initialization_list '}'
857 { $$ = MkInstantiationNamed($1, MkExpIdentifier($2), $4); $$.exp.loc = @2; $$.loc = @$; $$.nameLoc = @2; $$.insideLoc.start = @3.end; $$.insideLoc.end = @5.start;}
858 | external_guess_declaration_specifiers identifier '{' members_initialization_list_error '}'
859 { $$ = MkInstantiationNamed($1, MkExpIdentifier($2), $4); $$.exp.loc = @2; $$.loc = @$; $$.nameLoc = @2; $$.insideLoc.start = @3.end; $$.insideLoc.end = @5.start;}
860 | external_guess_declaration_specifiers identifier '{' '}'
861 { $$ = MkInstantiationNamed($1, MkExpIdentifier($2), MkList()); $$.exp.loc = @2; $$.loc = @$; $$.nameLoc = @2; $$.insideLoc.start = @3.end; $$.insideLoc.end = @4.start;}
864 instantiation_unnamed:
865 instantiation_unnamed_error '}'
866 { $$.loc = @$; $$.insideLoc.end = @2.start; $$ = $1; }
867 | instantiation_unnamed_error error '}'
868 { $$.loc = @$; $$.insideLoc.end = @2.start; $$ = $1; }
871 instantiation_unnamed_error:
872 strict_type '{' members_initialization_list
873 { $$ = MkInstantiation($1, null, $3); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @3.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
874 | identifier '{' members_initialization_list
875 { Location tmpLoc = yylloc; yylloc = @1;
876 yylloc = tmpLoc; $$ = MkInstantiation(MkSpecifierName($1.string), null, $3); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @3.end; FreeIdentifier($1); }
878 | strict_type '{' members_initialization_list_error
879 { $$ = MkInstantiation($1, null, $3); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @3.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
881 { $$ = MkInstantiation($1, null, null); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @2.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
882 | strict_type '{' members_initialization_list error
883 { $$ = MkInstantiation($1, null, $3); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @3.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
884 | strict_type '{' error
885 { $$ = MkInstantiation($1, null, null); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @2.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
889 | identifier '{' members_initialization_list_error
890 { Location tmpLoc = yylloc; yylloc = @1;
891 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); }
893 { Location tmpLoc = yylloc; yylloc = @1;
894 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); }
895 | identifier '{' members_initialization_list error
896 { Location tmpLoc = yylloc; yylloc = @1;
897 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); }
898 | identifier '{' error
899 { Location tmpLoc = yylloc; yylloc = @1;
900 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); }
904 instantiation_unnamed:
905 strict_type '{' members_initialization_list '}'
906 { $$ = MkInstantiation($1, null, $3); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @4.start; }
907 | strict_type '{' members_initialization_list error '}'
908 { $$ = MkInstantiation($1, null, $3); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @5.start; }
909 | strict_type '{' members_initialization_list_error '}'
910 { $$ = MkInstantiation($1, null, $3); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @4.start; }
911 | strict_type '{' '}'
912 { $$ = MkInstantiation($1, null, MkList()); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @3.start;}
913 | strict_type '{' error '}'
914 { $$ = MkInstantiation($1, null, MkList()); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @4.start;}
917 | identifier '{' members_initialization_list '}'
918 { Location tmpLoc = yylloc; yylloc = @1;
919 yylloc = tmpLoc; $$ = MkInstantiation(MkSpecifierName($1.string), null, $3); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @4.start; FreeIdentifier($1); }
920 | identifier '{' members_initialization_list_error '}'
921 { Location tmpLoc = yylloc; yylloc = @1;
922 yylloc = tmpLoc; $$ = MkInstantiation(MkSpecifierName($1.string), null, $3); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @4.start; FreeIdentifier($1); }
923 | identifier '{' members_initialization_list error '}'
925 $$ = MkInstantiation(MkSpecifierName($1.string), null, $3); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @5.start; FreeIdentifier($1); }
927 { Location tmpLoc = yylloc; yylloc = @1;
928 yylloc = tmpLoc; $$ = MkInstantiation(MkSpecifierName($1.string), null, MkList()); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @3.start; FreeIdentifier($1);}
929 | identifier '{' error '}'
930 { Location tmpLoc = yylloc; yylloc = @1;
931 yylloc = tmpLoc; $$ = MkInstantiation(MkSpecifierName($1.string), null, MkList()); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @4.start; FreeIdentifier($1); }
935 instantiation_unnamed_error:
936 strict_type '{' members_initialization_list_error
937 { $$ = MkInstantiation($1, null, $3); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @3.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
939 { $$ = MkInstantiation($1, null, null); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @2.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
940 | strict_type '{' members_initialization_list error
941 { $$ = MkInstantiation($1, null, $3); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @3.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
942 | strict_type '{' error
943 { $$ = MkInstantiation($1, null, null); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @2.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
947 | identifier '{' members_initialization_list_error
948 { Location tmpLoc = yylloc; yylloc = @1;
949 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); }
951 { Location tmpLoc = yylloc; yylloc = @1;
952 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); }
953 | identifier '{' members_initialization_list error
954 { Location tmpLoc = yylloc; yylloc = @1;
955 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); }
956 | identifier '{' error
957 { Location tmpLoc = yylloc; yylloc = @1;
958 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); }
963 instantiation_anon_error '}'
964 { $$.loc = @$; $$.insideLoc.end = @2.start; }
965 | instantiation_anon_error error '}'
966 { $$.loc = @$; $$.insideLoc.end = @2.start; }
969 instantiation_anon_error:
970 '{' members_initialization_list_error
971 { $$ = MkInstantiation(null, null, $2); $$.loc = @$; $$.insideLoc.start = @1.end; $$.insideLoc.end = @2.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
972 | '{' members_initialization_list error
973 { $$ = MkInstantiation(null, null, $2); $$.loc = @$; $$.insideLoc.start = @1.end; $$.insideLoc.end = @2.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
975 { $$ = MkInstantiation(null, null, null); $$.loc = @$; $$.insideLoc.start = @1.end; $$.insideLoc.end = @1.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
977 { $$ = MkInstantiation(null, null, null); $$.loc = @$; $$.insideLoc.start = @1.end; $$.insideLoc.end = @1.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
978 | '{' members_initialization_list
979 { $$ = MkInstantiation(null, null, $2); $$.loc = @$; $$.insideLoc.start = @1.end; $$.insideLoc.end = @2.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
984 '{' members_initialization_list '}'
985 { $$ = MkInstantiation(null, null, $2); $$.loc = @$; $$.insideLoc.start = @1.end; $$.insideLoc.end = @3.start; }
986 | '{' members_initialization_list error '}'
987 { $$ = MkInstantiation(null, null, $2); $$.loc = @$; $$.insideLoc.start = @1.end; $$.insideLoc.end = @4.start; }
988 | '{' members_initialization_list_error '}'
989 { $$ = MkInstantiation(null, null, $2); $$.loc = @$; $$.insideLoc.start = @1.end; $$.insideLoc.end = @3.start; }
991 { $$ = MkInstantiation(null, null, MkList()); $$.loc = @$; $$.insideLoc.start = @1.end; $$.insideLoc.end = @2.start;}
993 { $$ = MkInstantiation(null, null, MkList()); $$.loc = @$; $$.insideLoc.start = @1.end; $$.insideLoc.end = @3.start;}
996 instantiation_anon_error:
997 '{' members_initialization_list_error
998 { $$ = MkInstantiation(null, null, $2); $$.loc = @$; $$.insideLoc.start = @1.end; $$.insideLoc.end = @2.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
1000 { $$ = MkInstantiation(null, null, null); $$.loc = @$; $$.insideLoc.start = @1.end; $$.insideLoc.end = @1.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
1001 | '{' members_initialization_list error
1002 { $$ = MkInstantiation(null, null, $2); $$.loc = @$; $$.insideLoc.start = @1.end; $$.insideLoc.end = @2.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
1004 { $$ = MkInstantiation(null, null, null); $$.loc = @$; $$.insideLoc.start = @1.end; $$.insideLoc.end = @1.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
1009 postfix_expression '=' initializer_condition { $$ = MkMemberInitExp($1, $3); $$.loc = @$; $$.realLoc = @$; }
1012 default_property_error:
1013 postfix_expression '=' initializer_condition_error { $$ = MkMemberInitExp($1, $3); $$.loc = @$; $$.realLoc = @$; $$.initializer.loc.start = @2.end; }
1014 | postfix_expression '=' error { $$ = MkMemberInitExp($1, MkInitializerAssignment(MkExpDummy())); $$.loc = @$; $$.realLoc = @$; $$.initializer.loc.start = @2.end; $$.initializer.loc.end = @2.end; }
1015 | postfix_expression error { $$ = MkMemberInitExp($1, null); $$.loc = @$; $$.realLoc = @$; }
1018 default_property_list:
1019 default_property { $$ = MkList(); ListAdd($$, $1); ((MemberInit)$$->last).loc = @$; }
1020 | default_property_list ',' default_property { ((MemberInit)$1->last).loc.end = @3.start; ListAdd($1, $3); $$ = $1; }
1021 | default_property_list_error ',' default_property { ((MemberInit)$1->last).loc.end = @3.start; ListAdd($1, $3); $$ = $1; }
1024 default_property_list_error:
1025 default_property_error { $$ = MkList(); ListAdd($$, $1); ((MemberInit)$$->last).loc = @$; }
1026 | default_property_list ',' default_property_error { ((MemberInit)$1->last).loc.end = @3.start; ListAdd($1, $3); $$ = $1; }
1027 | default_property_list_error ',' default_property_error { ((MemberInit)$1->last).loc.end = @3.start; ListAdd($1, $3); $$ = $1; }
1028 | default_property_list error
1032 PROPERTY property_specifiers identifier '{'
1033 { $$ = MkProperty($2, null, $3, null, null); $$.loc = @$; }
1035 | PROPERTY property_specifiers abstract_declarator identifier '{'
1036 { $$ = MkProperty($2, $3, $4, null, null); $$.loc = @$; }
1038 | PROPERTY property_specifiers '{'
1039 { $$ = MkProperty($2, null, null, null, null); $$.loc = @$; }
1041 | PROPERTY property_specifiers abstract_declarator '{'
1042 { $$ = MkProperty($2, $3, null, null, null); $$.loc = @$; }
1044 | PROPERTY error '{'
1045 { $$ = MkProperty(null, null, null, null, null); $$.loc = @$; }
1050 | property_body SETPROP compound_statement
1051 { $1.setStmt = $3; }
1052 | property_body GETPROP compound_statement
1053 { $1.getStmt = $3; }
1054 | property_body ISPROPSET compound_statement
1055 { $1.issetStmt = $3; }
1056 | property_body WATCHABLE
1057 { $1.isWatchable = true; }
1058 | property_body PROPERTY_CATEGORY i18n_string
1059 { $1.category = $3; }
1063 property_body '}' { $1.loc.end = @2.end; $$ = $1; }
1066 class_property_start:
1067 CLASS_PROPERTY property_specifiers identifier '{'
1068 { $$ = MkProperty($2, null, $3, null, null); $$.loc = @$; }
1070 | CLASS_PROPERTY property_specifiers abstract_declarator identifier '{'
1071 { $$ = MkProperty($2, $3, $4, null, null); $$.loc = @$; }
1073 | CLASS_PROPERTY property_specifiers '{'
1074 { $$ = MkProperty($2, null, null, null, null); $$.loc = @$; }
1076 | CLASS_PROPERTY property_specifiers abstract_declarator '{'
1077 { $$ = MkProperty($2, $3, null, null, null); $$.loc = @$; }
1079 | CLASS_PROPERTY error '{'
1080 { $$ = MkProperty(null, null, null, null, null); $$.loc = @$; }
1083 class_property_body:
1084 class_property_start
1085 | class_property_body SETPROP compound_statement
1086 { $1.setStmt = $3; }
1087 | class_property_body GETPROP compound_statement
1088 { $1.getStmt = $3; }
1092 class_property_body '}' { $1.loc.end = @2.end; }
1095 watch_property_list:
1097 { $$ = MkListOne($1); }
1098 | watch_property_list identifier
1099 { ListAdd($1, $2); }
1103 watch_property_list compound_statement
1104 { $$ = MkPropertyWatch($1, $2); }
1105 | DELETE compound_statement
1106 { $$ = MkDeleteWatch($2); }
1109 property_watch_list:
1111 { $$ = MkListOne($1); }
1112 | property_watch_list property_watch
1113 { ListAdd($1, $2); }
1116 self_watch_definition:
1117 WATCH '(' watch_property_list ')' compound_statement
1118 { $$ = MkPropertyWatch($3, $5); }
1122 WATCH '(' assignment_expression ')' '{' property_watch_list '}'
1123 { $$ = MkWatchStmt(null, $3, $6); }
1124 | assignment_expression '.' WATCH '(' assignment_expression ')' '{' property_watch_list '}'
1125 { $$ = MkWatchStmt($1, $5, $8); }
1129 STOPWATCHING '(' assignment_expression ',' watch_property_list ')'
1130 { $$ = MkStopWatchingStmt(null, $3, $5); }
1131 | assignment_expression '.' STOPWATCHING '(' assignment_expression ',' watch_property_list ')'
1132 { $$ = MkStopWatchingStmt($1, $5, $7); }
1133 | STOPWATCHING '(' assignment_expression ')'
1134 { $$ = MkStopWatchingStmt(null, $3, null); }
1135 | assignment_expression '.' STOPWATCHING '(' assignment_expression ')'
1136 { $$ = MkStopWatchingStmt($1, $5, null); }
1141 { $$ = MkFireWatchersStmt(null, null); }
1142 | FIREWATCHERS watch_property_list
1143 { $$ = MkFireWatchersStmt(null, $2); }
1144 | postfix_expression '.' FIREWATCHERS
1145 { $$ = MkFireWatchersStmt($1, null); }
1146 | assignment_expression '.' FIREWATCHERS watch_property_list
1147 { $$ = MkFireWatchersStmt($1, $4); }
1151 struct_declaration_error ';' { $$ = $1; $$.loc.end = @2.end; }
1152 | default_property_list ';' { $$ = MkClassDefDefaultProperty($1); if($1->last) ((MemberInit)$1->last).loc.end = @2.start; $$.loc = @$; }
1153 | class_function_definition { $$ = MkClassDefFunction($1); $$.loc = @$; $$.memberAccess = memberAccessStack[defaultMemberAccess]; }
1154 | property { $$ = MkClassDefProperty($1); $$.loc = @$; globalContext.nextID++; $$.memberAccess = memberAccessStack[defaultMemberAccess]; }
1155 | member_access class_function_definition { $$ = MkClassDefFunction($2); $$.loc = @$; $$.memberAccess = $1; }
1156 | member_access property { $$ = MkClassDefProperty($2); $$.loc = @$; globalContext.nextID++; $$.memberAccess = $1; }
1157 | class_property { $$ = MkClassDefClassProperty($1); $$.loc = @$; globalContext.nextID++; }
1158 | WATCHABLE { $$ = null; deleteWatchable = true; }
1159 | CLASS_NO_EXPANSION { $$ = MkClassDefNoExpansion(); }
1160 | CLASS_FIXED { $$ = MkClassDefFixed(); }
1161 | CLASS_PROPERTY '(' identifier ')' '=' initializer_condition ';' { $$ = MkClassDefClassPropertyValue($3, $6); $$.loc = @$; }
1163 | ';' { $$ = null; }
1164 | member_access ':' { memberAccessStack[defaultMemberAccess] = $1; if(defaultMemberAccess == 0) { $$ = MkClassDefMemberAccess(); $$.memberAccess = $1; $$.loc = @$; } else $$ = null; }
1166 | member_access '(' identifier ')' { $$ = MkClassDefAccessOverride($1, $3); $$.loc = @$; }
1169 struct_declaration_error:
1170 class_function_definition_error { $$ = MkClassDefFunction($1); $$.loc = $1.loc; $$.loc.end.charPos++; $$.loc.end.pos++; $$.memberAccess = memberAccessStack[defaultMemberAccess]; }
1172 // Moved all these in here without the ';'
1173 | guess_declaration_specifiers { $$ = MkClassDefDeclaration(MkStructDeclaration($1, null, null)); $$.decl.loc = @$; $$.loc = @$; $$.memberAccess = memberAccessStack[defaultMemberAccess]; }
1174 | guess_declaration_specifiers struct_declarator_list { $$ = MkClassDefDeclaration(MkStructDeclaration($1, $2, null)); $$.decl.loc = @$; $$.loc = @$; $$.memberAccess = memberAccessStack[defaultMemberAccess]; }
1175 | member_access guess_declaration_specifiers struct_declarator_list { $$ = MkClassDefDeclaration(MkStructDeclaration($2, $3, null)); $$.decl.loc = @$; $$.loc = @$; $$.memberAccess = $1; }
1176 | member_access guess_declaration_specifiers { $$ = MkClassDefDeclaration(MkStructDeclaration($2, null, null)); $$.decl.loc = @$; $$.loc = @$; $$.memberAccess = $1; }
1177 | member_access instantiation_unnamed { $$ = MkClassDefDeclaration(MkDeclarationClassInst($2)); $$.loc = @$; $$.decl.loc = @$; $$.memberAccess = $1; }
1178 | member_access guess_instantiation_named { $$ = MkClassDefDeclaration(MkDeclarationClassInst($2)); $$.loc = @$; $$.decl.loc = @$; $$.memberAccess = $1; }
1179 | CLASS_DATA guess_declaration_specifiers struct_declarator_list { $$ = MkClassDefClassData(MkStructDeclaration($2, $3, null)); $$.decl.loc = @$; $$.loc = @$; }
1180 | self_watch_definition { $$ = MkClassDefPropertyWatch($1); $$.loc = @$; globalContext.nextID++; }
1181 | CLASS_DESIGNER identifier { $$ = MkClassDefDesigner($2.string); FreeIdentifier($2); }
1182 | CLASS_DESIGNER strict_type { $$ = MkClassDefDesigner($2.name); FreeSpecifier($2); }
1183 | CLASS_DEFAULT_PROPERTY identifier { $$ = MkClassDefDesignerDefaultProperty($2); }
1184 | instantiation_unnamed { $$ = MkClassDefDeclaration(MkDeclarationClassInst($1)); $$.loc = @$; $$.decl.loc = @$; $$.memberAccess = memberAccessStack[defaultMemberAccess]; }
1185 | guess_instantiation_named { $$ = MkClassDefDeclaration(MkDeclarationClassInst($1)); $$.loc = @$; $$.decl.loc = @$; $$.memberAccess = memberAccessStack[defaultMemberAccess]; }
1186 | default_property_list { $$ = MkClassDefDefaultProperty($1); if($1->last) ((MemberInit)$1->last).loc.end = @1.end; $$.loc = @$; }
1188 | guess_instantiation_named_error error { $$ = MkClassDefDeclaration(MkDeclarationClassInst($1)); $$.loc = $1.loc; $$.decl.loc = $$.loc; $$.memberAccess = memberAccessStack[defaultMemberAccess]; }
1189 | instantiation_unnamed_error error { $$ = MkClassDefDeclaration(MkDeclarationClassInst($1)); $$.loc = $1.loc; $$.decl.loc = $$.loc; $$.memberAccess = memberAccessStack[defaultMemberAccess]; }
1190 // | guess_instantiation_named { $$ = MkClassDefDeclaration(MkDeclarationClassInst($1)); $$.loc = $1.loc; $$.decl.loc = $$.loc; $$.memberAccess = memberAccessStack[defaultMemberAccess]; }
1191 // | instantiation_unnamed { $$ = MkClassDefDeclaration(MkDeclarationClassInst($1)); $$.loc = $1.loc; $$.decl.loc = $$.loc; $$.memberAccess = memberAccessStack[defaultMemberAccess]; }
1193 | member_access class_function_definition_error { $$ = MkClassDefFunction($2); $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++; $$.memberAccess = $1; }
1194 | member_access guess_instantiation_named_error error { $$ = MkClassDefDeclaration(MkDeclarationClassInst($2)); $$.loc = @$; $$.decl.loc = $$.loc; $$.memberAccess = $1; }
1195 | member_access instantiation_unnamed_error error { $$ = MkClassDefDeclaration(MkDeclarationClassInst($2)); $$.loc = @$; $$.decl.loc = $$.loc; $$.memberAccess = $1; }
1196 // | member_access guess_instantiation_named { $$ = MkClassDefDeclaration(MkDeclarationClassInst($2)); $$.loc = @$; $$.decl.loc = $$.loc; $$.memberAccess = $1; }
1197 // | member_access instantiation_unnamed { $$ = MkClassDefDeclaration(MkDeclarationClassInst($2)); $$.loc = @$; $$.decl.loc = $$.loc; $$.memberAccess = $1; }
1199 | default_property_list_error { $$ = MkClassDefDefaultProperty($1); $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++; }
1202 struct_declaration_list:
1203 struct_declaration { $$ = MkList(); ListAdd($$, $1); }
1204 | struct_declaration_list struct_declaration { $$ = $1; ListAdd($1, $2); }
1205 | struct_declaration_list_error struct_declaration { $$ = $1; ListAdd($1, $2); }
1208 struct_declaration_list_error:
1209 struct_declaration_error { yyerror(); $$ = MkList(); ListAdd($$, $1); }
1210 | struct_declaration_list error
1211 | struct_declaration_list_error error
1212 | struct_declaration_list struct_declaration_error { yyerror(); $$ = $1; ListAdd($$, $2); }
1213 | struct_declaration_list_error struct_declaration_error { $$ = $1; ListAdd($$, $2); }
1217 guess_declaration_specifiers { $$ = MkTemplateDatatype($1, null); }
1218 | guess_declaration_specifiers abstract_declarator { $$ = MkTemplateDatatype($1, $2); }
1219 // | identifier { $$ = MkTemplateDatatype(MkListOne(MkSpecifierName($1.string)), null); FreeIdentifier($1); }
1222 template_type_argument:
1223 // template_datatype { $$ = MkTemplateTypeArgument($1); }
1225 // Explicitly copied the rules here to handle:
1226 // ast.ec: Map<List<Location>> intlStrings { };
1228 // LinkList.ec: class LinkList<bool circ = false>
1230 guess_declaration_specifiers { $$ = MkTemplateTypeArgument(MkTemplateDatatype($1, null)); }
1231 | guess_declaration_specifiers abstract_declarator { $$ = MkTemplateTypeArgument(MkTemplateDatatype($1, $2)); }
1234 template_type_parameter:
1235 CLASS identifier { $$ = MkTypeTemplateParameter($2, null, null); }
1236 | CLASS identifier '=' template_type_argument { $$ = MkTypeTemplateParameter($2, null, $4); }
1237 | CLASS identifier ':' template_datatype { $$ = MkTypeTemplateParameter($2, $4, null); }
1238 | CLASS identifier ':' template_datatype '=' template_type_argument { $$ = MkTypeTemplateParameter($2, $4, $6); }
1239 | CLASS base_strict_type_name { $$ = MkTypeTemplateParameter(MkIdentifier($2), null, null); delete $2; }
1240 | CLASS base_strict_type_name '=' template_type_argument { $$ = MkTypeTemplateParameter(MkIdentifier($2), null, $4); }
1241 | CLASS base_strict_type_name ':' template_datatype { $$ = MkTypeTemplateParameter(MkIdentifier($2), $4, null); }
1242 | CLASS base_strict_type_name ':' template_datatype '=' template_type_argument { $$ = MkTypeTemplateParameter(MkIdentifier($2), $4, $6); }
1245 template_identifier_argument:
1246 identifier { $$ = MkTemplateIdentifierArgument($1); }
1249 template_identifier_parameter:
1250 identifier { $$ = MkIdentifierTemplateParameter($1, dataMember, null); }
1251 | identifier '=' template_identifier_argument { $$ = MkIdentifierTemplateParameter($1, dataMember, $3); }
1254 template_expression_argument:
1255 shift_expression /*constant_expression*/ { $$ = MkTemplateExpressionArgument($1); }
1258 template_expression_parameter:
1260 template_datatype identifier { $$ = MkExpressionTemplateParameter($2, $1, null); }
1261 | template_datatype identifier '=' template_expression_argument { $$ = MkExpressionTemplateParameter($2, $1, $4); }
1263 guess_declaration_specifiers identifier '=' template_expression_argument { $$ = MkExpressionTemplateParameter($2, MkTemplateDatatype($1, null), $4); }
1264 | guess_declaration_specifiers abstract_declarator identifier '=' template_expression_argument { $$ = MkExpressionTemplateParameter($3, MkTemplateDatatype($1, $2), $5); }
1268 template_type_parameter
1269 | template_identifier_parameter
1270 | template_expression_parameter
1273 template_parameters_list:
1274 template_parameter { $$ = MkList(); ListAdd($$, $1); }
1275 | template_parameters_list ',' template_parameter { $$ = $1; ListAdd($1, $3); }
1279 template_expression_argument
1280 | template_identifier_argument
1281 | template_type_argument
1282 | identifier '=' template_expression_argument { $$ = $3; $$.name = $1; $$.loc = @$; }
1283 | identifier '=' template_identifier_argument { $$ = $3; $$.name = $1; $$.loc = @$; }
1284 | identifier '=' template_type_argument { $$ = $3; $$.name = $1; $$.loc = @$; }
1285 /*| template_datatype '=' template_expression_argument
1288 if($1.specifiers && $1.specifiers->first)
1290 Specifier spec = $1.specifiers->first;
1291 if(spec.type == nameSpecifier)
1292 $$.name = MkIdentifier(spec.name);
1294 FreeTemplateDataType($1);
1297 | template_datatype '=' template_identifier_argument
1300 if($1.specifiers && $1.specifiers->first)
1302 Specifier spec = $1.specifiers->first;
1303 if(spec.type == nameSpecifier)
1304 $$.name = MkIdentifier(spec.name);
1306 FreeTemplateDataType($1);
1309 | template_datatype '=' template_type_argument
1312 if($1.specifiers && $1.specifiers->first)
1314 Specifier spec = $1.specifiers->first;
1315 if(spec.type == nameSpecifier)
1316 $$.name = MkIdentifier(spec.name);
1318 FreeTemplateDataType($1);
1323 template_arguments_list:
1324 template_argument { $$ = MkList(); ListAdd($$, $1); }
1325 | template_arguments_list ',' template_argument { $$ = $1; ListAdd($1, $3); }
1331 if(curContext != globalContext)
1332 PopContext(curContext);
1337 class_entry identifier { $1; $$ = DeclClassAddNameSpace(globalContext.nextID++, $2.string); FreeIdentifier($2); $$.nameLoc = @2; memberAccessStack[++defaultMemberAccess] = privateAccess; }
1338 | class_entry base_strict_type
1340 $1; $$ = DeclClass(globalContext.nextID++, $2.name);
1343 ++defaultMemberAccess;
1344 memberAccessStack[defaultMemberAccess] = privateAccess;
1346 | identifier class_entry identifier { $2; $$ = DeclClassAddNameSpace(globalContext.nextID++, $3.string); FreeIdentifier($1); FreeIdentifier($3); $$.nameLoc = @3; $$.isRemote = true; memberAccessStack[++defaultMemberAccess] = privateAccess; }
1347 | identifier class_entry base_strict_type { $2; $$ = DeclClass(globalContext.nextID++, $3.name); FreeIdentifier($1); $$.nameLoc = @3; $$.isRemote = true; FreeSpecifier($3); memberAccessStack[++defaultMemberAccess] = privateAccess; }
1349 | class_entry identifier '<' template_parameters_list '>' { $1; $$ = DeclClassAddNameSpace(globalContext.nextID++, $2.string); $$.templateParams = $4; FreeIdentifier($2); $$.nameLoc = @2; memberAccessStack[++defaultMemberAccess] = privateAccess; }
1350 | class_entry base_strict_type '<' template_parameters_list '>'
1352 $1; $$ = DeclClass(globalContext.nextID++, $2.name);
1353 $$.templateParams = $4;
1356 ++defaultMemberAccess;
1357 memberAccessStack[defaultMemberAccess] = privateAccess;
1359 | 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; }
1360 | 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; }
1370 // Added this for unit classes...
1373 $$ = $1; $$.definitions = MkList(); $$.blockStart = @2; $$.loc = @$; $$.endid = globalContext.nextID++;
1375 PopContext(curContext);
1378 | class_decl '{' '}'
1380 $$ = MkClass($1, null, MkList()); $$.blockStart = @2; $$.loc = @$; $$.endid = globalContext.nextID++;
1382 PopContext(curContext);
1384 | class_head '{' '}'
1386 $$ = $1; $$.definitions = MkList(); $$.blockStart = @2; $$.loc = @$; $$.endid = globalContext.nextID++;
1388 PopContext(curContext);
1391 | class_entry identifier ';'
1393 $1; $$ = MkClass(DeclClassAddNameSpace(0, $2.string), null, null); FreeIdentifier($2);
1395 PopContext(curContext);
1397 | class_entry type ';'
1399 $1; $$ = MkClass(DeclClass(0, $2.name), null, null); FreeSpecifier($2);
1401 PopContext(curContext);
1406 class_decl ':' inheritance_specifiers
1408 $$ = MkClass($1, $3, null);
1413 class_decl '{' struct_declaration_list_error
1415 $$ = MkClass($1, null, $3); $$.deleteWatchable = deleteWatchable; deleteWatchable = false; $$.blockStart = @2; $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++; $$.endid = globalContext.nextID++;
1417 PopContext(curContext);
1419 | class_head '{' struct_declaration_list_error
1421 $$ = $1; $$.definitions = $3; $$.deleteWatchable = deleteWatchable; deleteWatchable = false; $$.blockStart = @2; $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++; $$.endid = globalContext.nextID++;
1423 PopContext(curContext);
1425 | class_decl '{' struct_declaration_list
1427 $$ = MkClass($1, null, $3); $$.deleteWatchable = deleteWatchable; deleteWatchable = false; $$.blockStart = @2; $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++; $$.endid = globalContext.nextID++;
1429 PopContext(curContext);
1431 | class_head '{' struct_declaration_list
1433 $$ = $1; $$.definitions = $3; $$.deleteWatchable = deleteWatchable; deleteWatchable = false; $$.blockStart = @2; $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++; $$.endid = globalContext.nextID++;
1435 PopContext(curContext);
1437 | class_decl '{' error
1439 $$ = MkClass($1, null, MkList()); $$.deleteWatchable = deleteWatchable; deleteWatchable = false; $$.blockStart = @2; $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++; $$.endid = globalContext.nextID++;
1441 PopContext(curContext);
1443 | class_head '{' error
1445 $$ = $1; $$.definitions = MkList(); $$.deleteWatchable = deleteWatchable; deleteWatchable = false; $$.blockStart = @2; $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++; $$.endid = globalContext.nextID++;
1447 PopContext(curContext);
1451 /**** EXPRESSIONS ********************************************************************/
1455 { $$ = MkIdentifier(yytext); $$.loc = @1; }
1459 simple_primary_expression
1460 | '(' expression ')'
1461 { $$ = MkExpBrackets($2); $$.loc = @$; }
1465 string_literal { $$ = MkExpString($1); delete $1; $$.loc = @$; }
1466 | '$' string_literal { $$ = MkExpIntlString($2, null); delete $2; $$.loc = @$; }
1467 | '$' string_literal '.' string_literal { $$ = MkExpIntlString($4, $2); delete $2; delete $4; $$.loc = @$; }
1471 CONSTANT { $$ = MkExpConstant(yytext); $$.loc = @$; }
1474 simple_primary_expression:
1475 identifier { $$ = MkExpIdentifier($1); $$.loc = @$; }
1476 | instantiation_unnamed { $$ = MkExpInstance($1); $$.loc = @$; }
1477 | EXTENSION '(' compound_statement ')' { $$ = MkExpExtensionCompound($3); $$.loc = @$; }
1478 | EXTENSION '(' expression ')' { $$ = MkExpExtensionExpression($3); $$.loc = @$; }
1479 | EXTENSION '(' type_name ')' initializer { $$ = MkExpExtensionInitializer($3, $5); $$.loc = @$; }
1480 | EXTENSION '(' type_name ')' '(' type_name ')' initializer { $$ = MkExpExtensionInitializer($3, MkInitializerAssignment(MkExpExtensionInitializer($6, $8))); $$.loc = @$; }
1481 | constant identifier
1483 char * constant = $1.constant;
1484 int len = strlen(constant);
1485 if(constant[len-1] == '.')
1487 constant[len-1] = 0;
1488 $$ = MkExpMember($1, $2);
1494 | constant { $$ = $1; }
1496 | '(' ')' { Expression exp = MkExpDummy(); exp.loc.start = @1.end; exp.loc.end = @2.start; $$ = MkExpBrackets(MkListOne(exp)); $$.loc = @$; yyerror(); }
1497 | NEWOP new_specifiers abstract_declarator_noarray '[' constant_expression ']' { $$ = MkExpNew(MkTypeName($2,$3), $5); $$.loc = @$; }
1498 | NEWOP new_specifiers abstract_declarator_noarray '[' constant_expression_error ']' { $$ = MkExpNew(MkTypeName($2,$3), $5); $$.loc = @$; }
1499 | NEWOP new_specifiers '[' constant_expression ']' { $$ = MkExpNew(MkTypeName($2,null), $4); $$.loc = @$; }
1500 | NEWOP new_specifiers '[' constant_expression_error ']' { $$ = MkExpNew(MkTypeName($2,null), $4); $$.loc = @$; }
1501 | NEW0OP new_specifiers abstract_declarator_noarray '[' constant_expression ']' { $$ = MkExpNew0(MkTypeName($2,$3), $5); $$.loc = @$; }
1502 | NEW0OP new_specifiers abstract_declarator_noarray '[' constant_expression_error ']' { $$ = MkExpNew0(MkTypeName($2,$3), $5); $$.loc = @$; }
1503 | NEW0OP new_specifiers '[' constant_expression ']' { $$ = MkExpNew0(MkTypeName($2,null), $4); $$.loc = @$; }
1504 | NEW0OP new_specifiers '[' constant_expression_error ']' { $$ = MkExpNew0(MkTypeName($2,null), $4); $$.loc = @$; }
1505 | RENEW constant_expression renew_specifiers abstract_declarator_noarray '[' constant_expression ']' { $$ = MkExpRenew($2, MkTypeName($3,$4), $6); $$.loc = @$; }
1506 | RENEW constant_expression renew_specifiers abstract_declarator_noarray '[' constant_expression_error ']' { $$ = MkExpRenew($2, MkTypeName($3,$4), $6); $$.loc = @$; }
1507 | RENEW constant_expression renew_specifiers '[' constant_expression ']' { $$ = MkExpRenew($2, MkTypeName($3,null), $5); $$.loc = @$; }
1508 | RENEW constant_expression renew_specifiers '[' constant_expression_error ']' { $$ = MkExpRenew($2, MkTypeName($3,null), $5); $$.loc = @$; }
1509 | RENEW0 constant_expression renew_specifiers abstract_declarator_noarray '[' constant_expression ']' { $$ = MkExpRenew0($2, MkTypeName($3,$4), $6); $$.loc = @$; }
1510 | RENEW0 constant_expression renew_specifiers abstract_declarator_noarray '[' constant_expression_error ']' { $$ = MkExpRenew0($2, MkTypeName($3,$4), $6); $$.loc = @$; }
1511 | RENEW0 constant_expression renew_specifiers '[' constant_expression ']' { $$ = MkExpRenew0($2, MkTypeName($3,null), $5); $$.loc = @$; }
1512 | RENEW0 constant_expression renew_specifiers '[' constant_expression_error ']' { $$ = MkExpRenew0($2, MkTypeName($3,null), $5); $$.loc = @$; }
1513 | CLASS '(' declaration_specifiers ')' { $$ = MkExpClass($3, null); $$.loc = @$; }
1514 | CLASS '(' declaration_specifiers abstract_declarator ')' { $$ = MkExpClass($3, $4); $$.loc = @$; }
1515 | CLASS '(' identifier ')' { $$ = MkExpClass(MkListOne(MkSpecifierName($3.string)), null); FreeIdentifier($3); $$.loc = @$; }
1516 | VAARG '(' assignment_expression ',' type_name ')' { $$ = MkExpVaArg($3, $5); $$.loc = @$; }
1518 | CLASS_DATA '(' identifier ')' { $$ = MkExpClassData($3); $$.loc = @$; }
1524 | '[' argument_expression_list /*expression*/ ']' { $$ = MkExpArray($2); $$.loc = @$; }
1525 | '[' ']' { $$ = MkExpArray(null); $$.loc = @$; }
1528 anon_instantiation_expression:
1529 instantiation_anon { $$ = MkExpInstance($1); $$.loc = @$; }
1532 anon_instantiation_expression_error:
1533 instantiation_anon_error error { $$ = MkExpInstance($1); $$.loc = @$; }
1536 primary_expression_error:
1537 '(' expression { yyerror(); $$ = MkExpBrackets($2); $$.loc = @$; }
1538 | '(' expression_error { $$ = MkExpBrackets($2); $$.loc = @$; }
1544 | postfix_expression '[' expression ']' { $$ = MkExpIndex($1, $3); $$.loc = @$; }
1545 | postfix_expression '[' expression_error ']' { $$ = MkExpIndex($1, $3); $$.loc = @$; }
1546 | postfix_expression '(' ')' { $$ = MkExpCall($1, MkList()); $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @3.end; $$.loc = @$; }
1547 | postfix_expression '(' argument_expression_list ')' { $$ = MkExpCall($1, $3); $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @4.end; $$.loc = @$; }
1548 | 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; }
1549 | postfix_expression '.' identifier { $$ = MkExpMember($1, $3); $$.loc = @$; }
1550 | postfix_expression PTR_OP identifier { $$ = MkExpPointer($1, $3); $$.loc = @$; }
1551 | postfix_expression INC_OP { $$ = MkExpOp($1, INC_OP, null); $$.loc = @$; }
1552 | postfix_expression DEC_OP { $$ = MkExpOp($1, DEC_OP, null); $$.loc = @$; }
1554 | postfix_expression_error '[' expression ']' { $$ = MkExpIndex($1, $3); $$.loc = @$; }
1555 | postfix_expression_error '[' expression_error ']' { $$ = MkExpIndex($1, $3); $$.loc = @$; }
1556 | postfix_expression_error '(' ')' { $$ = MkExpCall($1, MkList()); $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @3.end; $$.loc = @$; }
1557 | postfix_expression_error '(' argument_expression_list ')' { $$ = MkExpCall($1, $3); $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @4.end;$$.loc = @$; }
1558 | postfix_expression_error '.' identifier { $$ = MkExpMember($1, $3); $$.loc = @$; }
1559 | postfix_expression_error PTR_OP identifier { $$ = MkExpPointer($1, $3); $$.loc = @$; }
1560 | postfix_expression_error INC_OP { $$ = MkExpOp($1, INC_OP, null); $$.loc = @$; }
1561 | postfix_expression_error DEC_OP { $$ = MkExpOp($1, DEC_OP, null); $$.loc = @$; }
1564 simple_postfix_expression:
1565 simple_primary_expression
1567 | simple_postfix_expression '[' expression ']' { $$ = MkExpIndex($1, $3); $$.loc = @$; }
1568 | simple_postfix_expression '[' expression_error ']' { $$ = MkExpIndex($1, $3); $$.loc = @$; }
1569 | simple_postfix_expression '(' ')' { $$ = MkExpCall($1, MkList()); $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @3.end; $$.loc = @$; }
1570 | simple_postfix_expression '(' argument_expression_list ')' { $$ = MkExpCall($1, $3); $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @4.end; $$.loc = @$; }
1571 | 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; }
1572 | simple_postfix_expression '.' identifier { $$ = MkExpMember($1, $3); $$.loc = @$; }
1573 | simple_postfix_expression PTR_OP identifier { $$ = MkExpPointer($1, $3); $$.loc = @$; }
1574 | simple_postfix_expression INC_OP { $$ = MkExpOp($1, INC_OP, null); $$.loc = @$; }
1575 | simple_postfix_expression DEC_OP { $$ = MkExpOp($1, DEC_OP, null); $$.loc = @$; }
1577 | simple_postfix_expression_error '[' expression ']' { $$ = MkExpIndex($1, $3); $$.loc = @$; }
1578 | simple_postfix_expression_error '[' expression_error ']' { $$ = MkExpIndex($1, $3); $$.loc = @$; }
1579 | simple_postfix_expression_error '(' ')' { $$ = MkExpCall($1, MkList()); $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @3.end; $$.loc = @$; }
1580 | simple_postfix_expression_error '(' argument_expression_list ')' { $$ = MkExpCall($1, $3); $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @4.end;$$.loc = @$; }
1581 | simple_postfix_expression_error '.' identifier { $$ = MkExpMember($1, $3); $$.loc = @$; }
1582 | simple_postfix_expression_error PTR_OP identifier { $$ = MkExpPointer($1, $3); $$.loc = @$; }
1583 | simple_postfix_expression_error INC_OP { $$ = MkExpOp($1, INC_OP, null); $$.loc = @$; }
1584 | simple_postfix_expression_error DEC_OP { $$ = MkExpOp($1, DEC_OP, null); $$.loc = @$; }
1587 argument_expression_list:
1588 assignment_expression { $$ = MkList(); ListAdd($$, $1); }
1589 | anon_instantiation_expression { $$ = MkList(); ListAdd($$, $1); }
1590 | argument_expression_list ',' assignment_expression { $$ = $1; ListAdd($1, $3); }
1591 | argument_expression_list ',' anon_instantiation_expression { $$ = $1; ListAdd($1, $3); }
1594 argument_expression_list_error:
1595 assignment_expression_error { $$ = MkList(); ListAdd($$, $1); }
1596 | anon_instantiation_expression_error { $$ = MkList(); ListAdd($$, $1); }
1597 | argument_expression_list ',' assignment_expression_error { $$ = $1; ListAdd($1, $3); }
1598 | argument_expression_list ',' anon_instantiation_expression_error { $$ = $1; ListAdd($1, $3); }
1599 | argument_expression_list ',' { Expression exp = MkExpDummy(); yyerror(); exp.loc.start = @2.end; exp.loc.end = @2.end; $$ = $1; ListAdd($1, exp); }
1602 common_unary_expression:
1603 INC_OP unary_expression { $$ = MkExpOp(null, INC_OP, $2); $$.loc = @$; }
1604 | DEC_OP unary_expression { $$ = MkExpOp(null, DEC_OP, $2); $$.loc = @$; }
1605 | unary_operator cast_expression { $$ = MkExpOp(null, $1, $2); $$.loc = @$; }
1606 | unary_operator anon_instantiation_expression { $$ = MkExpOp(null, $1, $2); $$.loc = @$; }
1607 | SIZEOF '(' unary_expression ')' { $$ = MkExpOp(null, SIZEOF, $3); $$.loc = @$; }
1608 | SIZEOF simple_unary_expression { $$ = MkExpOp(null, SIZEOF, $2); $$.loc = @$; }
1609 | SIZEOF '(' guess_type_name ')' { $$ = MkExpTypeSize($3); $$.loc = @$; }
1610 | SIZEOF '(' CLASS type ')' { $$ = MkExpClassSize($4); $$.loc = @$; }
1611 | SIZEOF '(' CLASS guess_type ')' { $$ = MkExpClassSize($4); $$.loc = @$; }
1613 | ALIGNOF '(' unary_expression ')' { $$ = MkExpOp(null, ALIGNOF, $3); $$.loc = @$; }
1614 | ALIGNOF simple_unary_expression { $$ = MkExpOp(null, ALIGNOF, $2); $$.loc = @$; }
1615 | ALIGNOF '(' guess_type_name ')' { $$ = MkExpTypeAlign($3); $$.loc = @$; }
1619 common_unary_expression
1620 | postfix_expression
1623 simple_unary_expression:
1624 common_unary_expression
1625 | simple_postfix_expression
1635 | DELETE { $$ = DELETE; }
1636 | _INCREF { $$ = _INCREF; }
1641 | '(' type_name ')' cast_expression { $$ = MkExpCast($2, $4); $$.loc = @$; }
1644 multiplicative_expression:
1646 | multiplicative_expression '*' cast_expression { $$ = MkExpOp($1, '*', $3); $$.loc = @$; }
1647 | multiplicative_expression '/' cast_expression { $$ = MkExpOp($1, '/', $3); $$.loc = @$; }
1648 | multiplicative_expression '%' cast_expression { $$ = MkExpOp($1, '%', $3); $$.loc = @$; }
1649 | multiplicative_expression_error '*' cast_expression { $$ = MkExpOp($1, '*', $3); $$.loc = @$; }
1650 | multiplicative_expression_error '/' cast_expression { $$ = MkExpOp($1, '/', $3); $$.loc = @$; }
1651 | multiplicative_expression_error '%' cast_expression { $$ = MkExpOp($1, '%', $3); $$.loc = @$; }
1654 additive_expression:
1655 multiplicative_expression
1656 | additive_expression '+' multiplicative_expression { $$ = MkExpOp($1, '+', $3); $$.loc = @$; }
1657 | additive_expression '-' multiplicative_expression { $$ = MkExpOp($1, '-', $3); $$.loc = @$; }
1658 | additive_expression_error '+' multiplicative_expression { $$ = MkExpOp($1, '+', $3); $$.loc = @$; }
1659 | additive_expression_error '-' multiplicative_expression { $$ = MkExpOp($1, '-', $3); $$.loc = @$; }
1664 | shift_expression LEFT_OP additive_expression { $$ = MkExpOp($1, LEFT_OP, $3); $$.loc = @$; }
1665 | shift_expression RIGHT_OP additive_expression { $$ = MkExpOp($1, RIGHT_OP, $3); $$.loc = @$; }
1666 | shift_expression_error LEFT_OP additive_expression { $$ = MkExpOp($1, LEFT_OP, $3); $$.loc = @$; }
1667 | shift_expression_error RIGHT_OP additive_expression { $$ = MkExpOp($1, RIGHT_OP, $3); $$.loc = @$; }
1670 relational_expression_smaller_than:
1671 relational_expression '<'
1678 relational_expression:
1680 | relational_expression_smaller_than /*relational_expression '<' */ shift_expression { skipErrors = false; $$ = MkExpOp($1, '<', $2/*$3*/); $$.loc = @$; }
1681 | relational_expression '>' shift_expression { $$ = MkExpOp($1, '>', $3); $$.loc = @$; }
1682 | relational_expression LE_OP shift_expression { $$ = MkExpOp($1, LE_OP, $3); $$.loc = @$; }
1683 | relational_expression GE_OP shift_expression { $$ = MkExpOp($1, GE_OP, $3); $$.loc = @$; }
1684 | relational_expression_error '<' shift_expression { $$ = MkExpOp($1, '<', $3); $$.loc = @$; }
1685 | relational_expression_error '>' shift_expression { $$ = MkExpOp($1, '>', $3); $$.loc = @$; }
1686 | relational_expression_error LE_OP shift_expression { $$ = MkExpOp($1, LE_OP, $3); $$.loc = @$; }
1687 | relational_expression_error GE_OP shift_expression { $$ = MkExpOp($1, GE_OP, $3); $$.loc = @$; }
1691 : relational_expression
1692 | equality_expression EQ_OP relational_expression { $$ = MkExpOp($1, EQ_OP, $3); $$.loc = @$; }
1693 | equality_expression NE_OP relational_expression { $$ = MkExpOp($1, NE_OP, $3); $$.loc = @$; }
1694 | equality_expression_error EQ_OP relational_expression { $$ = MkExpOp($1, EQ_OP, $3); $$.loc = @$; }
1695 | equality_expression_error NE_OP relational_expression { $$ = MkExpOp($1, NE_OP, $3); $$.loc = @$; }
1697 | equality_expression EQ_OP anon_instantiation_expression { $$ = MkExpOp($1, EQ_OP, $3); $$.loc = @$; }
1698 | equality_expression NE_OP anon_instantiation_expression { $$ = MkExpOp($1, NE_OP, $3); $$.loc = @$; }
1699 | equality_expression_error EQ_OP anon_instantiation_expression { $$ = MkExpOp($1, EQ_OP, $3); $$.loc = @$; }
1700 | equality_expression_error NE_OP anon_instantiation_expression { $$ = MkExpOp($1, NE_OP, $3); $$.loc = @$; }
1704 : equality_expression
1705 | and_expression '&' equality_expression { $$ = MkExpOp($1, '&', $3); $$.loc = @$; }
1706 | and_expression_error '&' equality_expression { $$ = MkExpOp($1, '&', $3); $$.loc = @$; }
1708 | and_expression '&' anon_instantiation_expression { $$ = MkExpOp($1, '&', $3); $$.loc = @$; }
1709 | and_expression_error '&' anon_instantiation_expression { $$ = MkExpOp($1, '&', $3); $$.loc = @$; }
1712 exclusive_or_expression
1714 | exclusive_or_expression '^' and_expression { $$ = MkExpOp($1, '^', $3); $$.loc = @$; }
1715 | exclusive_or_expression_error '^' and_expression { $$ = MkExpOp($1, '^', $3); $$.loc = @$; }
1717 | exclusive_or_expression '^' anon_instantiation_expression { $$ = MkExpOp($1, '^', $3); $$.loc = @$; }
1718 | exclusive_or_expression_error '^' anon_instantiation_expression { $$ = MkExpOp($1, '^', $3); $$.loc = @$; }
1721 inclusive_or_expression
1722 : exclusive_or_expression
1723 | inclusive_or_expression '|' exclusive_or_expression { $$ = MkExpOp($1, '|', $3); $$.loc = @$; }
1724 | inclusive_or_expression_error '|' exclusive_or_expression { $$ = MkExpOp($1, '|', $3); $$.loc = @$; }
1726 | inclusive_or_expression '|' anon_instantiation_expression { $$ = MkExpOp($1, '|', $3); $$.loc = @$; }
1727 | inclusive_or_expression_error '|' anon_instantiation_expression { $$ = MkExpOp($1, '|', $3); $$.loc = @$; }
1730 logical_and_expression
1731 : inclusive_or_expression
1732 | logical_and_expression AND_OP inclusive_or_expression { $$ = MkExpOp($1, AND_OP, $3); $$.loc = @$; }
1733 | logical_and_expression_error AND_OP inclusive_or_expression { $$ = MkExpOp($1, AND_OP, $3); $$.loc = @$; }
1736 logical_or_expression
1737 : logical_and_expression
1738 | logical_or_expression OR_OP logical_and_expression { $$ = MkExpOp($1, OR_OP, $3); $$.loc = @$; }
1739 | logical_or_expression_error OR_OP logical_and_expression { $$ = MkExpOp($1, OR_OP, $3); $$.loc = @$; }
1742 conditional_expression
1743 : logical_or_expression
1744 | logical_or_expression '?' expression ':' conditional_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1745 | logical_or_expression '?' expression_error ':' conditional_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1746 | logical_or_expression_error '?' expression ':' conditional_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1747 | logical_or_expression_error '?' expression_error ':' conditional_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1749 | logical_or_expression '?' expression_anon_inst ':' conditional_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1750 | logical_or_expression '?' expression_anon_inst_error ':' conditional_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1751 | logical_or_expression_error '?' expression_anon_inst ':' conditional_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1752 | logical_or_expression_error '?' expression_anon_inst_error ':' conditional_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1754 | logical_or_expression '?' expression ':' anon_instantiation_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1755 | logical_or_expression '?' expression_error ':' anon_instantiation_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1756 | logical_or_expression_error '?' expression ':' anon_instantiation_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1757 | logical_or_expression_error '?' expression_error ':' anon_instantiation_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1759 | logical_or_expression '?' expression_anon_inst ':' anon_instantiation_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1760 | logical_or_expression '?' expression_anon_inst_error ':' anon_instantiation_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1761 | logical_or_expression_error '?' expression_anon_inst ':' anon_instantiation_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1762 | logical_or_expression_error '?' expression_anon_inst_error ':' anon_instantiation_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1765 assignment_expression:
1766 conditional_expression
1767 | unary_expression assignment_operator assignment_expression { $$ = MkExpOp($1, $2, $3); $$.loc = @$; }
1768 | unary_expression_error assignment_operator assignment_expression { $$ = MkExpOp($1, $2, $3); $$.loc = @$; }
1769 | conditional_expression assignment_operator assignment_expression { Compiler_Error($"l-value expected\n"); $$ = MkExpOp($1, $2, $3); $$.loc = @$; }
1770 | conditional_expression_error assignment_operator assignment_expression { Compiler_Error($"l-value expected\n"); $$ = MkExpOp($1, $2, $3); $$.loc = @$; }
1772 | unary_expression assignment_operator anon_instantiation_expression { $$ = MkExpOp($1, $2, $3); $$.loc = @$; }
1773 | unary_expression_error assignment_operator anon_instantiation_expression { $$ = MkExpOp($1, $2, $3); $$.loc = @$; }
1774 | conditional_expression assignment_operator anon_instantiation_expression { $$ = MkExpOp($1, $2, $3); $$.loc = @$; }
1775 | conditional_expression_error assignment_operator anon_instantiation_expression { $$ = MkExpOp($1, $2, $3); $$.loc = @$; }
1778 assignment_operator:
1780 | MUL_ASSIGN { $$ = MUL_ASSIGN; }
1781 | DIV_ASSIGN { $$ = DIV_ASSIGN; }
1782 | MOD_ASSIGN { $$ = MOD_ASSIGN; }
1783 | ADD_ASSIGN { $$ = ADD_ASSIGN; }
1784 | SUB_ASSIGN { $$ = SUB_ASSIGN; }
1785 | LEFT_ASSIGN { $$ = LEFT_ASSIGN; }
1786 | RIGHT_ASSIGN { $$ = RIGHT_ASSIGN; }
1787 | AND_ASSIGN { $$ = AND_ASSIGN; }
1788 | XOR_ASSIGN { $$ = XOR_ASSIGN; }
1789 | OR_ASSIGN { $$ = OR_ASSIGN; }
1793 assignment_expression { $$ = MkList(); ListAdd($$, $1); }
1794 | expression ',' assignment_expression { $$ = $1; ListAdd($1, $3); }
1795 | expression_error ',' assignment_expression { $$ = $1; ListAdd($1, $3); }
1796 | expression_error ')'
1799 expression_anon_inst:
1800 anon_instantiation_expression { $$ = MkList(); ListAdd($$, $1); }
1801 | expression ',' anon_instantiation_expression { $$ = $1; ListAdd($1, $3); }
1802 | expression_error ',' anon_instantiation_expression { $$ = $1; ListAdd($1, $3); }
1805 postfix_expression_error:
1806 primary_expression_error
1807 | error { $$ = MkExpDummy(); $$.loc = @$; /*printf("Sorry, didn't mean that syntax error\n");*/ }
1808 | postfix_expression error
1809 | instantiation_unnamed_error error { $$ = MkExpInstance($1); $$.loc = @$; }
1811 | postfix_expression PTR_OP error { $$ = MkExpPointer($1, null); $$.loc = @$; }
1812 | postfix_expression_error PTR_OP error { $$ = MkExpPointer($1, null); $$.loc = @$; }
1814 | postfix_expression '(' argument_expression_list { yyerror(); $$ = MkExpCall($1, $3); $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @3.end; $$.loc = @$; $$.call.argLoc.end.charPos++;}
1815 | postfix_expression '(' argument_expression_list_error { $$ = MkExpCall($1, $3); $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @3.end; $$.loc = @$; $$.call.argLoc.end.charPos++;}
1816 /* Useless rules due to conflicts
1817 | postfix_expression '(' argument_expression_list ',' error { $$ = MkExpCall($1, $3); $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @4.end;$$.loc = @$; $$.call.argLoc.end.charPos++;}
1818 | postfix_expression '(' error { $$ = MkExpCall($1, MkList() ); @$.end = yylloc.start; $$.loc = @$; $$.call.argLoc.start = @2.start; $$.call.argLoc.end = yylloc.start; }
1820 | postfix_expression '.' error { $$ = MkExpMember($1, null); $$.loc = @$; }
1822 | 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++;}
1823 /* Useless rules due to conflicts
1824 | 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++;}
1825 | postfix_expression_error '(' error { $$ = MkExpCall($1, MkList() ); $$.loc = @$; $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @2.end; $$.call.argLoc.end.charPos++;}
1827 | postfix_expression_error '.' error { $$ = MkExpMember($1, null); $$.loc = @$; }
1830 simple_postfix_expression_error:
1831 error { $$ = MkExpDummy(); $$.loc = @$; }
1832 | simple_postfix_expression error
1833 | instantiation_unnamed_error error { $$ = MkExpInstance($1); $$.loc = @$; }
1835 | simple_postfix_expression PTR_OP error { $$ = MkExpPointer($1, null); $$.loc = @$; }
1836 | simple_postfix_expression_error PTR_OP error { $$ = MkExpPointer($1, null); $$.loc = @$; }
1838 | simple_postfix_expression '(' argument_expression_list { yyerror(); $$ = MkExpCall($1, $3); $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @3.end; $$.loc = @$; $$.call.argLoc.end.charPos++;}
1839 | 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++;}
1840 /* Useless rules due to conflicts
1841 | 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++;}
1842 | simple_postfix_expression '(' error { $$ = MkExpCall($1, MkList() ); @$.end = yylloc.start; $$.loc = @$; $$.call.argLoc.start = @2.start; $$.call.argLoc.end = yylloc.start; }
1844 | simple_postfix_expression '.' error { $$ = MkExpMember($1, null); $$.loc = @$; }
1846 | 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++;}
1847 /* Useless rules due to conflicts
1848 | 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++;}
1849 | simple_postfix_expression_error '(' error { $$ = MkExpCall($1, MkList() ); $$.loc = @$; $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @2.end; $$.call.argLoc.end.charPos++;}
1851 | simple_postfix_expression_error '.' error { $$ = MkExpMember($1, null); $$.loc = @$; }
1854 common_unary_expression_error:
1855 INC_OP unary_expression_error { $$ = MkExpOp(null, INC_OP, $2); $$.loc = @$; }
1856 | DEC_OP unary_expression_error { $$ = MkExpOp(null, DEC_OP, $2); $$.loc = @$; }
1857 | unary_operator cast_expression_error { $$ = MkExpOp(null, $1, $2); $$.loc = @$; }
1858 | unary_operator anon_instantiation_expression_error { $$ = MkExpOp(null, $1, $2); $$.loc = @$; }
1859 | SIZEOF '(' unary_expression_error { $$ = MkExpOp(null, SIZEOF, $3); $$.loc = @$; }
1860 | SIZEOF simple_unary_expression_error { $$ = MkExpOp(null, SIZEOF, $2); $$.loc = @$; }
1861 | SIZEOF '(' guess_type_name ')' error { $$ = MkExpTypeSize($3); $$.loc = @$; }
1862 | SIZEOF '(' CLASS type ')' error { $$ = MkExpClassSize($4); $$.loc = @$; }
1863 | SIZEOF '(' CLASS guess_type ')' error { $$ = MkExpClassSize($4); $$.loc = @$; }
1864 | ALIGNOF '(' unary_expression_error { $$ = MkExpOp(null, ALIGNOF, $3); $$.loc = @$; }
1865 | ALIGNOF simple_unary_expression_error { $$ = MkExpOp(null, ALIGNOF, $2); $$.loc = @$; }
1866 | ALIGNOF '(' guess_type_name ')' error { $$ = MkExpTypeAlign($3); $$.loc = @$; }
1869 unary_expression_error:
1870 common_unary_expression_error
1871 | postfix_expression_error
1874 simple_unary_expression_error:
1875 common_unary_expression_error
1876 | simple_postfix_expression_error
1880 cast_expression_error:
1881 unary_expression_error
1882 | '(' type_name ')' cast_expression_error { $$ = MkExpCast($2, $4); $$.loc = @$; }
1885 multiplicative_expression_error:
1886 cast_expression_error
1887 | multiplicative_expression '*' cast_expression_error { $$ = MkExpOp($1, '*', $3); $$.loc = @$; }
1888 | multiplicative_expression '/' cast_expression_error { $$ = MkExpOp($1, '/', $3); $$.loc = @$; }
1889 | multiplicative_expression '%' cast_expression_error { $$ = MkExpOp($1, '%', $3); $$.loc = @$; }
1890 | multiplicative_expression_error '*' cast_expression_error { $$ = MkExpOp($1, '*', $3); $$.loc = @$; }
1891 | multiplicative_expression_error '/' cast_expression_error { $$ = MkExpOp($1, '/', $3); $$.loc = @$; }
1892 | multiplicative_expression_error '%' cast_expression_error { $$ = MkExpOp($1, '%', $3); $$.loc = @$; }
1895 additive_expression_error:
1896 multiplicative_expression_error
1897 | additive_expression '+' multiplicative_expression_error { $$ = MkExpOp($1, '+', $3); $$.loc = @$; }
1898 /* Useless rules due to conflicts
1899 | additive_expression '+' error { $$ = MkExpOp($1, '+', null); $$.loc = @$; }
1901 | additive_expression '-' multiplicative_expression_error { $$ = MkExpOp($1, '-', $3); $$.loc = @$; }
1902 /* Useless rules due to conflicts
1903 | additive_expression '-' error { $$ = MkExpOp($1, '-', null); $$.loc = @$; }
1905 | additive_expression_error '+' multiplicative_expression_error { $$ = MkExpOp($1, '+', $3); $$.loc = @$; }
1906 /* Useless rules due to conflicts
1907 | additive_expression_error '+' error { $$ = MkExpOp($1, '+', null); $$.loc = @$; }
1909 | additive_expression_error '-' multiplicative_expression_error { $$ = MkExpOp($1, '-', $3); $$.loc = @$; }
1910 /* Useless rules due to conflicts
1911 | additive_expression_error '-' error { $$ = MkExpOp($1, '-', null); $$.loc = @$; }
1915 shift_expression_error:
1916 additive_expression_error
1917 | shift_expression LEFT_OP additive_expression_error { $$ = MkExpOp($1, LEFT_OP, $3); $$.loc = @$; }
1918 | shift_expression RIGHT_OP additive_expression_error { $$ = MkExpOp($1, RIGHT_OP, $3); $$.loc = @$; }
1919 | shift_expression_error LEFT_OP additive_expression_error { $$ = MkExpOp($1, LEFT_OP, $3); $$.loc = @$; }
1920 | shift_expression_error RIGHT_OP additive_expression_error { $$ = MkExpOp($1, RIGHT_OP, $3); $$.loc = @$; }
1923 relational_expression_error:
1924 shift_expression_error
1925 | relational_expression_smaller_than /*relational_expression '<' */ shift_expression_error
1927 if($1.type == identifierExp)
1929 if($1.identifier._class && !$1.identifier._class.name)
1933 strcat(name, $1.identifier.string);
1934 _DeclClass(0, name);
1937 _DeclClass(0, $1.identifier.string);
1939 // printf("Declaring Class %s\n", $1.identifier.string);
1945 fileInput.Seek(@1.start.pos, start);
1946 resetScannerPos(&@1.start);
1951 YY_STACK_PRINT (yyss, yyssp);
1955 YY_STACK_PRINT (yyss, yyssp);
1959 YY_STACK_PRINT (yyss, yyssp);
1963 YY_STACK_PRINT (yyss, yyssp);
1971 $$ = MkExpOp($1, '<', $2);
1976 | relational_expression '>' shift_expression_error { $$ = MkExpOp($1, '>', $3); $$.loc = @$; }
1977 | relational_expression LE_OP shift_expression_error { $$ = MkExpOp($1, LE_OP, $3); $$.loc = @$; }
1978 | relational_expression GE_OP shift_expression_error { $$ = MkExpOp($1, GE_OP, $3); $$.loc = @$; }
1979 | relational_expression_error '<' shift_expression_error { $$ = MkExpOp($1, '<', $3); $$.loc = @$; }
1980 | relational_expression_error '>' shift_expression_error { $$ = MkExpOp($1, '>', $3); $$.loc = @$; }
1981 | relational_expression_error LE_OP shift_expression_error { $$ = MkExpOp($1, LE_OP, $3); $$.loc = @$; }
1982 | relational_expression_error GE_OP shift_expression_error { $$ = MkExpOp($1, GE_OP, $3); $$.loc = @$; }
1985 equality_expression_error:
1986 relational_expression_error
1987 | equality_expression EQ_OP relational_expression_error { $$ = MkExpOp($1, EQ_OP, $3); $$.loc = @$; }
1988 | equality_expression NE_OP relational_expression_error { $$ = MkExpOp($1, NE_OP, $3); $$.loc = @$; }
1989 | equality_expression_error EQ_OP relational_expression_error { $$ = MkExpOp($1, EQ_OP, $3); $$.loc = @$; }
1990 | equality_expression_error NE_OP relational_expression_error { $$ = MkExpOp($1, NE_OP, $3); $$.loc = @$; }
1991 /* Useless rules due to conflicts
1992 | equality_expression EQ_OP error { $$ = MkExpOp($1, EQ_OP, MkExpDummy()); $$.loc = @$; }
1993 | equality_expression NE_OP error { $$ = MkExpOp($1, NE_OP, MkExpDummy()); $$.loc = @$; }
1994 | equality_expression_error EQ_OP error { $$ = MkExpOp($1, EQ_OP, MkExpDummy()); $$.loc = @$; }
1995 | equality_expression_error NE_OP error { $$ = MkExpOp($1, NE_OP, MkExpDummy()); $$.loc = @$; }
1997 | equality_expression EQ_OP anon_instantiation_expression_error { $$ = MkExpOp($1, EQ_OP, $3); $$.loc = @$; }
1998 | equality_expression NE_OP anon_instantiation_expression_error { $$ = MkExpOp($1, NE_OP, $3); $$.loc = @$; }
1999 | equality_expression_error EQ_OP anon_instantiation_expression_error { $$ = MkExpOp($1, EQ_OP, $3); $$.loc = @$; }
2000 | equality_expression_error NE_OP anon_instantiation_expression_error { $$ = MkExpOp($1, NE_OP, $3); $$.loc = @$; }
2003 and_expression_error:
2004 equality_expression_error
2005 | and_expression '&' equality_expression_error { $$ = MkExpOp($1, '&', $3); $$.loc = @$; }
2006 | and_expression_error '&' equality_expression_error { $$ = MkExpOp($1, '&', $3); $$.loc = @$; }
2008 | and_expression '&' anon_instantiation_expression_error { $$ = MkExpOp($1, '&', $3); $$.loc = @$; }
2009 | and_expression_error '&' anon_instantiation_expression_error { $$ = MkExpOp($1, '&', $3); $$.loc = @$; }
2012 exclusive_or_expression_error:
2013 and_expression_error
2014 | exclusive_or_expression '^' and_expression_error { $$ = MkExpOp($1, '^', $3); $$.loc = @$; }
2015 | exclusive_or_expression_error '^' and_expression_error { $$ = MkExpOp($1, '^', $3); $$.loc = @$; }
2017 | exclusive_or_expression '^' anon_instantiation_expression_error { $$ = MkExpOp($1, '^', $3); $$.loc = @$; }
2018 | exclusive_or_expression_error '^' anon_instantiation_expression_error { $$ = MkExpOp($1, '^', $3); $$.loc = @$; }
2021 inclusive_or_expression_error:
2022 exclusive_or_expression_error
2023 | inclusive_or_expression '|' exclusive_or_expression_error { $$ = MkExpOp($1, '|', $3); $$.loc = @$; }
2024 | inclusive_or_expression_error '|' exclusive_or_expression_error { $$ = MkExpOp($1, '|', $3); $$.loc = @$; }
2026 | inclusive_or_expression '|' anon_instantiation_expression_error { $$ = MkExpOp($1, '|', $3); $$.loc = @$; }
2027 | inclusive_or_expression_error '|' anon_instantiation_expression_error { $$ = MkExpOp($1, '|', $3); $$.loc = @$; }
2030 logical_and_expression_error:
2031 inclusive_or_expression_error
2032 | logical_and_expression AND_OP inclusive_or_expression_error { $$ = MkExpOp($1, AND_OP, $3); $$.loc = @$; }
2033 | logical_and_expression_error AND_OP inclusive_or_expression_error { $$ = MkExpOp($1, AND_OP, $3); $$.loc = @$; }
2036 logical_or_expression_error:
2037 logical_and_expression_error
2038 | logical_or_expression OR_OP logical_and_expression_error { $$ = MkExpOp($1, OR_OP, $3); $$.loc = @$; }
2039 | logical_or_expression_error OR_OP logical_and_expression_error { $$ = MkExpOp($1, OR_OP, $3); $$.loc = @$; }
2042 conditional_expression_error:
2043 logical_or_expression_error
2044 | logical_or_expression '?' expression ':' logical_or_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
2045 | logical_or_expression '?' expression_error ':' logical_or_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
2046 | logical_or_expression_error '?' expression ':' logical_or_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
2047 | logical_or_expression_error '?' expression_error ':' logical_or_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
2048 | logical_or_expression '?' expression ':' { $$ = MkExpCondition($1, $3, MkExpDummy()); $$.loc = @$; $$.cond.elseExp.loc = @3; }
2049 | logical_or_expression '?' expression_error ':' { $$ = MkExpCondition($1, $3, MkExpDummy()); $$.loc = @$; $$.cond.elseExp.loc = @3; }
2050 | logical_or_expression_error '?' expression ':' { $$ = MkExpCondition($1, $3, MkExpDummy()); $$.loc = @$; $$.cond.elseExp.loc = @3; }
2051 | logical_or_expression_error '?' expression_error ':' { $$ = MkExpCondition($1, $3, MkExpDummy()); $$.loc = @$; $$.cond.elseExp.loc = @3; }
2053 | logical_or_expression '?' expression_anon_inst ':' logical_or_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
2054 | logical_or_expression '?' expression_anon_inst_error ':' logical_or_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
2055 | logical_or_expression_error '?' expression_anon_inst ':' logical_or_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
2056 | logical_or_expression_error '?' expression_anon_inst_error ':' logical_or_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
2057 | logical_or_expression '?' expression_anon_inst ':' { $$ = MkExpCondition($1, $3, MkExpDummy()); $$.loc = @$; $$.cond.elseExp.loc = @3; }
2058 | logical_or_expression '?' expression_anon_inst_error ':' { $$ = MkExpCondition($1, $3, MkExpDummy()); $$.loc = @$; $$.cond.elseExp.loc = @3; }
2059 | logical_or_expression_error '?' expression_anon_inst ':' { $$ = MkExpCondition($1, $3, MkExpDummy()); $$.loc = @$; $$.cond.elseExp.loc = @3; }
2060 | logical_or_expression_error '?' expression_anon_inst_error ':' { $$ = MkExpCondition($1, $3, MkExpDummy()); $$.loc = @$; $$.cond.elseExp.loc = @3; }
2062 | logical_or_expression '?' expression ':' anon_instantiation_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
2063 | logical_or_expression '?' expression_error ':' anon_instantiation_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
2064 | logical_or_expression_error '?' expression ':' anon_instantiation_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
2065 | logical_or_expression_error '?' expression_error ':' anon_instantiation_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
2067 | logical_or_expression '?' expression_anon_inst ':' anon_instantiation_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
2068 | logical_or_expression '?' expression_anon_inst_error ':' anon_instantiation_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
2069 | logical_or_expression_error '?' expression_anon_inst ':' anon_instantiation_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
2070 | logical_or_expression_error '?' expression_anon_inst_error ':' anon_instantiation_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
2072 | logical_or_expression '?' ':'
2075 $$ = MkExpCondition($1, MkListOne(MkExpDummy()), MkExpDummy());
2077 ((Expression)$$.cond.exp->last).loc = @2;
2078 $$.cond.elseExp.loc = @3;
2080 | logical_or_expression_error '?' ':'
2082 $$ = MkExpCondition($1, MkListOne(MkExpDummy()), MkExpDummy()); $$.loc = @$; ((Expression)$$.cond.exp->last).loc = @2; $$.cond.elseExp.loc = @3;
2084 | logical_or_expression '?'
2087 $$ = MkExpCondition($1, MkListOne(MkExpDummy()), MkExpDummy()); $$.loc = @$; ((Expression)$$.cond.exp->last).loc = @2; $$.cond.elseExp.loc = @2;
2089 | logical_or_expression_error '?'
2091 $$ = MkExpCondition($1, MkListOne(MkExpDummy()), MkExpDummy()); $$.loc = @$; ((Expression)$$.cond.exp->last).loc = @2; $$.cond.elseExp.loc = @2;
2095 assignment_expression_error:
2096 conditional_expression_error
2097 | unary_expression assignment_operator assignment_expression_error { $$ = MkExpOp($1, $2, $3); $$.loc = @$; }
2098 /* Useless rules due to conflicts
2099 | unary_expression assignment_operator error { $$ = MkExpOp($1, $2, MkExpDummy()); $$.loc = @$; $$.op.exp2.loc = @2; }
2101 | unary_expression_error assignment_operator assignment_expression_error { $$ = MkExpOp($1, $2, $3); $$.loc = @$; }
2102 /* Useless rules due to conflicts
2103 | unary_expression_error assignment_operator error { $$ = MkExpOp($1, $2, MkExpDummy()); $$.loc = @$; $$.op.exp2.loc = @2; }
2106 | unary_expression assignment_operator anon_instantiation_expression_error { $$ = MkExpOp($1, $2, $3); $$.loc = @$; }
2107 | unary_expression_error assignment_operator anon_instantiation_expression_error { $$ = MkExpOp($1, $2, $3); $$.loc = @$; }
2111 assignment_expression_error { $$ = MkList(); ListAdd($$, $1); }
2112 | assignment_expression error { $$ = MkList(); ListAdd($$, $1); }
2113 | expression ',' assignment_expression_error { $$ = $1; ListAdd($1, $3); }
2114 | expression_error ',' assignment_expression_error { $$ = $1; ListAdd($1, $3); }
2115 /* Useless rules due to conflicts
2116 | expression ',' error
2117 | expression_error ',' error
2120 | expression expression { yyerror(); $$ = $1; FreeList($2, FreeExpression); }
2121 | expression_error expression { $$ = $1; FreeList($2, FreeExpression); }
2122 | expression expression_error { $$ = $1; FreeList($2, FreeExpression); }
2125 expression_anon_inst_error:
2126 anon_instantiation_expression_error { $$ = MkList(); ListAdd($$, $1); }
2127 | anon_instantiation_expression error { $$ = MkList(); ListAdd($$, $1); }
2128 | expression ',' anon_instantiation_expression_error { $$ = $1; ListAdd($1, $3); }
2129 | expression_error ',' anon_instantiation_expression_error { $$ = $1; ListAdd($1, $3); }
2133 constant_expression: conditional_expression;
2135 constant_expression_error: conditional_expression_error;
2137 /**** TYPES **************************************************************************/
2138 storage_class_specifier:
2139 TYPEDEF { $$ = MkSpecifier(TYPEDEF); }
2140 | EXTERN { $$ = MkSpecifier(EXTERN); }
2141 | STATIC { $$ = MkSpecifier(STATIC); }
2142 | THREAD { $$ = MkSpecifier(THREAD); }
2143 | AUTO { $$ = MkSpecifier(AUTO); }
2144 | REGISTER { $$ = MkSpecifier(REGISTER); }
2145 | RESTRICT { $$ = MkSpecifier(RESTRICT); }
2148 external_storage_class_specifier:
2149 TYPEDEF { $$ = MkSpecifier(TYPEDEF); structDeclMode = declMode = defaultAccess; }
2150 | EXTERN { $$ = MkSpecifier(EXTERN); }
2151 | STATIC { $$ = MkSpecifier(STATIC); structDeclMode = declMode = staticAccess; }
2152 | THREAD { $$ = MkSpecifier(THREAD); }
2153 | AUTO { $$ = MkSpecifier(AUTO); }
2154 | REGISTER { $$ = MkSpecifier(REGISTER); }
2155 | RESTRICT { $$ = MkSpecifier(RESTRICT); }
2159 identifier { $$ = MkEnumerator($1, null); }
2160 | identifier '=' constant_expression { $$ = MkEnumerator($1, $3); }
2161 | identifier '=' constant_expression_error { $$ = MkEnumerator($1, $3); }
2165 enumerator { $$ = MkList(); ListAdd($$, $1); }
2166 | enumerator_list ',' enumerator { $$ = $1; ListAdd($1, $3); }
2167 | enumerator_list ','
2171 ENUM { memberAccessStack[++defaultMemberAccess] = publicAccess; }
2174 enum_specifier_nocompound:
2175 enum_specifier identifier { $$ = MkEnum($2, null); POP_DEFAULT_ACCESS }
2176 | enum_specifier strict_type { $$ = MkEnum(MkIdentifier($2.name), null); POP_DEFAULT_ACCESS }
2179 enum_specifier_compound:
2180 enum_specifier_compound_error '}' { $$.loc = @$; POP_DEFAULT_ACCESS $$ = $1; }
2181 | enum_specifier identifier '{' '}' { $$ = MkEnum($2, null); $$.loc = @$; POP_DEFAULT_ACCESS }
2182 | enum_specifier strict_type '{' '}' { $$ = MkEnum(MkIdentifier($2.name), null); FreeSpecifier($2); $$.loc = @$; POP_DEFAULT_ACCESS }
2185 enum_specifier_compound_error:
2186 enum_specifier '{' enumerator_list { $$ = MkEnum(null, $3); $$.loc = @$; POP_DEFAULT_ACCESS }
2187 | enum_specifier '{' error { $$ = MkEnum(null, null); $$.loc = @$; POP_DEFAULT_ACCESS }
2189 | enum_specifier identifier '{' enumerator_list { $$ = MkEnum($2, $4); $$.loc = @$; POP_DEFAULT_ACCESS }
2190 | enum_specifier identifier '{' enumerator_list error { $$ = MkEnum($2, $4); $$.loc = @$; POP_DEFAULT_ACCESS }
2191 | enum_specifier identifier '{' error { $$ = MkEnum($2, null); $$.loc = @$; POP_DEFAULT_ACCESS }
2192 | enum_specifier identifier '{' enumerator_list ';' struct_declaration_list { $$ = MkEnum($2, $4); $$.loc = @$; $$.definitions = $6; POP_DEFAULT_ACCESS }
2193 | enum_specifier identifier '{' enumerator_list ';' struct_declaration_list_error { $$ = MkEnum($2, $4); $$.loc = @$; $$.definitions = $6; POP_DEFAULT_ACCESS }
2195 | enum_specifier strict_type '{' enumerator_list { $$ = MkEnum(MkIdentifier($2.name), $4); $$.loc = @$; FreeSpecifier($2); POP_DEFAULT_ACCESS }
2196 | enum_specifier strict_type '{' enumerator_list error { $$ = MkEnum(MkIdentifier($2.name), $4); $$.loc = @$; FreeSpecifier($2); POP_DEFAULT_ACCESS }
2197 | enum_specifier strict_type '{' error { $$ = MkEnum(MkIdentifier($2.name), null); $$.loc = @$; FreeSpecifier($2); POP_DEFAULT_ACCESS }
2198 | enum_specifier strict_type '{' enumerator_list ';' struct_declaration_list { $$ = MkEnum(MkIdentifier($2.name), $4); $$.loc = @$; $$.definitions = $6; FreeSpecifier($2); POP_DEFAULT_ACCESS }
2199 | enum_specifier strict_type '{' enumerator_list ';' struct_declaration_list_error { $$ = MkEnum(MkIdentifier($2.name), $4); $$.loc = @$; $$.definitions = $6; FreeSpecifier($2); POP_DEFAULT_ACCESS }
2203 enum_specifier identifier { $$ = $2; if(declMode) DeclClassAddNameSpace(globalContext.nextID++, $2.string); }
2204 | enum_specifier strict_type { $$ = MkIdentifier($2.name); if(declMode) DeclClass(globalContext.nextID++, $2.name); FreeSpecifier($2); }
2208 enum_class_error '}' { $$ = $1; $$.loc = @$; }
2209 | enum_decl ':' inheritance_specifiers '{' '}' { $$ = MkEnum($1, null); $$.baseSpecs = $3; $$.loc = @$; POP_DEFAULT_ACCESS }
2210 | enum_decl '{' '}' { $$ = MkEnum($1, null); POP_DEFAULT_ACCESS }
2214 enum_decl ':' inheritance_specifiers '{' enumerator_list { $$ = MkEnum($1, $5); $$.baseSpecs = $3; $$.loc = @$; POP_DEFAULT_ACCESS }
2215 | enum_decl ':' inheritance_specifiers '{' enumerator_list error { $$ = MkEnum($1, $5); $$.baseSpecs = $3; $$.loc = @$; POP_DEFAULT_ACCESS }
2216 | enum_decl ':' inheritance_specifiers '{' error { $$ = MkEnum($1, null); $$.baseSpecs = $3; $$.loc = @$; POP_DEFAULT_ACCESS }
2217 | enum_decl ':' inheritance_specifiers '{' enumerator_list ';' struct_declaration_list { $$ = MkEnum($1, $5); $$.baseSpecs = $3; $$.definitions = $7; $$.loc = @$; POP_DEFAULT_ACCESS }
2218 | enum_decl ':' inheritance_specifiers '{' enumerator_list ';' struct_declaration_list_error { $$ = MkEnum($1, $5); $$.baseSpecs = $3; $$.definitions = $7; $$.loc = @$; POP_DEFAULT_ACCESS }
2219 | enum_decl ':' inheritance_specifiers '{' enumerator_list error ';' struct_declaration_list { $$ = MkEnum($1, $5); $$.baseSpecs = $3; $$.definitions = $8; $$.loc = @$; POP_DEFAULT_ACCESS }
2220 | enum_decl ':' inheritance_specifiers '{' enumerator_list error ';' struct_declaration_list_error { $$ = MkEnum($1, $5); $$.baseSpecs = $3; $$.definitions = $8; $$.loc = @$; POP_DEFAULT_ACCESS }
2221 | enum_decl ':' inheritance_specifiers '{' error ';' struct_declaration_list { $$ = MkEnum($1, null); $$.baseSpecs = $3; $$.definitions = $7; $$.loc = @$; POP_DEFAULT_ACCESS }
2222 | enum_decl ':' inheritance_specifiers '{' error ';' struct_declaration_list_error { $$ = MkEnum($1, null); $$.baseSpecs = $3; $$.definitions = $7; $$.loc = @$; POP_DEFAULT_ACCESS }
2224 | enum_specifier '{' enumerator_list { $$ = MkEnum(null, $3); $$.loc = @$; POP_DEFAULT_ACCESS }
2225 | enum_specifier '{' error { $$ = MkEnum(null, null); $$.loc = @$; POP_DEFAULT_ACCESS }
2227 | enum_decl '{' enumerator_list { $$ = MkEnum($1, $3); $$.loc = @$; POP_DEFAULT_ACCESS }
2228 | enum_decl '{' enumerator_list error { $$ = MkEnum($1, $3); $$.loc = @$; POP_DEFAULT_ACCESS }
2229 | enum_decl '{' error { $$ = MkEnum($1, null); $$.loc = @$; POP_DEFAULT_ACCESS }
2230 | enum_decl '{' enumerator_list ';' struct_declaration_list { $$ = MkEnum($1, $3); $$.definitions = $5; $$.loc = @$; POP_DEFAULT_ACCESS }
2231 | enum_decl '{' enumerator_list ';' struct_declaration_list_error { $$ = MkEnum($1, $3); $$.definitions = $5; $$.loc = @$; POP_DEFAULT_ACCESS }
2239 class_specifier_error:
2241 | struct_class_error
2245 ext_decl { $$ = MkSpecifierExtended($1); }
2249 CONST { $$ = MkSpecifier(CONST); }
2250 | VOLATILE { $$ = MkSpecifier(VOLATILE); }
2251 | ext_storage { $$ = $1; }
2255 type_qualifier_list:
2256 type_qualifier { $$ = MkList(); ListAdd($$, $1); }
2257 | type_qualifier_list type_qualifier { $$ = $1; ListAdd($1, $2); }
2261 VOID { $$ = MkSpecifier(VOID); }
2262 | CHAR { $$ = MkSpecifier(CHAR); }
2263 | SHORT { $$ = MkSpecifier(SHORT); }
2264 | INT { $$ = MkSpecifier(INT); }
2265 | UINT { $$ = MkSpecifier(UINT); }
2266 | INT64 { $$ = MkSpecifier(INT64); }
2267 | VALIST { $$ = MkSpecifier(VALIST); }
2268 | LONG { $$ = MkSpecifier(LONG); }
2269 | FLOAT { $$ = MkSpecifier(FLOAT); }
2270 | DOUBLE { $$ = MkSpecifier(DOUBLE); }
2271 | SIGNED { $$ = MkSpecifier(SIGNED); }
2272 | UNSIGNED { $$ = MkSpecifier(UNSIGNED); }
2273 | EXTENSION { $$ = MkSpecifier(EXTENSION); }
2274 | struct_or_union_specifier_nocompound
2275 | enum_specifier_nocompound
2277 | TYPEOF '(' assignment_expression ')' { $$ = MkSpecifierTypeOf($3); }
2278 | SUBCLASS '(' type ')' { $$ = MkSpecifierSubClass($3); }
2279 | SUBCLASS '(' identifier ')' { _DeclClass(0, $3.string); $$ = MkSpecifierSubClass(MkSpecifierName($3.string)); FreeIdentifier($3); }
2280 | THISCLASS { $$ = MkSpecifier(THISCLASS); }
2281 | TYPED_OBJECT { $$ = MkSpecifier(TYPED_OBJECT); }
2282 | ANY_OBJECT { $$ = MkSpecifier(ANY_OBJECT); }
2283 | _BOOL { $$ = MkSpecifier(_BOOL); }
2284 | BOOL { $$ = MkSpecifier(BOOL); }
2285 | _COMPLEX { $$ = MkSpecifier(_COMPLEX); }
2286 | _IMAGINARY { $$ = MkSpecifier(_IMAGINARY); }
2289 strict_type_specifier:
2290 VOID { $$ = MkSpecifier(VOID); }
2291 | CHAR { $$ = MkSpecifier(CHAR); }
2292 | SHORT { $$ = MkSpecifier(SHORT); }
2293 | INT { $$ = MkSpecifier(INT); }
2294 | UINT { $$ = MkSpecifier(UINT); }
2295 | INT64 { $$ = MkSpecifier(INT64); }
2296 | VALIST { $$ = MkSpecifier(VALIST); }
2297 | LONG { $$ = MkSpecifier(LONG); }
2298 | FLOAT { $$ = MkSpecifier(FLOAT); }
2299 | DOUBLE { $$ = MkSpecifier(DOUBLE); }
2300 | SIGNED { $$ = MkSpecifier(SIGNED); }
2301 | UNSIGNED { $$ = MkSpecifier(UNSIGNED); }
2302 | EXTENSION { $$ = MkSpecifier(EXTENSION); }
2303 | struct_or_union_specifier_nocompound
2304 | enum_specifier_nocompound
2306 | _BOOL { $$ = MkSpecifier(_BOOL); }
2307 | BOOL { $$ = MkSpecifier(BOOL); }
2308 | _COMPLEX { $$ = MkSpecifier(_COMPLEX); }
2309 | _IMAGINARY { $$ = MkSpecifier(_IMAGINARY); }
2310 | TYPEOF '(' assignment_expression ')' { $$ = MkSpecifierTypeOf($3); }
2311 | SUBCLASS '(' type ')' { $$ = MkSpecifierSubClass($3); }
2312 | SUBCLASS '(' identifier ')' { _DeclClass(0, $3.string); $$ = MkSpecifierSubClass(MkSpecifierName($3.string)); FreeIdentifier($3); }
2313 | THISCLASS { $$ = MkSpecifier(THISCLASS); }
2316 // TESTING declarator_nofunction here... For function declarations
2319 declarator_nofunction_type_ok
2320 { $$ = MkStructDeclarator($1, null); $$.loc = @$; }
2321 | declarator_nofunction_type_ok attrib
2322 { $$ = MkStructDeclarator($1, null); $$.structDecl.attrib = $2; $$.loc = @$; }
2323 | ':' constant_expression
2324 { $$ = MkStructDeclarator(null, $2); $$.loc = @$; }
2325 | declarator_nofunction_type_ok ':' constant_expression
2326 { $$ = MkStructDeclarator($1, $3); $$.loc = @$; }
2327 | declarator_nofunction_type_ok ':' constant_expression ':' constant_expression
2328 { $$ = MkStructDeclarator($1, $3); $$.structDecl.posExp = $5; $$.loc = @$; }
2329 | ':' constant_expression_error
2330 { $$ = MkStructDeclarator(null, $2); $$.loc = @$; }
2331 | declarator_nofunction_type_ok ':' constant_expression_error
2332 { $$ = MkStructDeclarator($1, $3); $$.loc = @$; }
2333 | declarator_nofunction_type_ok ':' constant_expression ':' constant_expression_error
2334 { $$ = MkStructDeclarator($1, $3); $$.structDecl.posExp = $5; $$.loc = @$; }
2335 | declarator_nofunction_type_ok ':' constant_expression_error ':' constant_expression_error
2336 { $$ = MkStructDeclarator($1, $3); $$.structDecl.posExp = $5; $$.loc = @$; }
2337 | declarator_nofunction_type_ok ':' constant_expression_error ':' constant_expression
2338 { $$ = MkStructDeclarator($1, $3); $$.structDecl.posExp = $5; $$.loc = @$; }
2341 struct_declarator_list:
2342 struct_declarator { $$ = MkList(); ListAdd($$, $1); }
2343 | struct_declarator_list ',' struct_declarator { $$ = $1; ListAdd($1, $3); }
2347 struct_or_union identifier
2349 $$ = MkStructOrUnion($1, $2, null);
2350 $$.addNameSpace = true;
2351 $$.ctx = PushContext();
2353 | struct_or_union base_strict_type
2355 $$ = MkStructOrUnion($1, MkIdentifier($2.name), null);
2356 $$.ctx = PushContext();
2359 | struct_or_union ext_decl identifier
2361 $$ = MkStructOrUnion($1, $3, null);
2362 $$.extDeclStruct = $2;
2363 $$.addNameSpace = true;
2364 $$.ctx = PushContext();
2366 | struct_or_union ext_decl base_strict_type
2368 $$ = MkStructOrUnion($1, MkIdentifier($3.name), null);
2369 $$.extDeclStruct = $2;
2370 $$.ctx = PushContext();
2375 struct_or_union_specifier_compound:
2376 struct_or_union_specifier_compound_error '}' { $$ = $1; $$.loc = @$; }
2377 | struct_entry '{' '}' { $$ = $1; $$.loc = @$; POP_DEFAULT_ACCESS PopContext(curContext); }
2378 | struct_or_union '{' '}' { $$ = MkStructOrUnion($1, null, null); $$.loc = @$; POP_DEFAULT_ACCESS }
2379 | struct_or_union ext_decl '{' '}' { $$ = MkStructOrUnion($1, null, null); $$.extDeclStruct = $2; $$.loc = @$; POP_DEFAULT_ACCESS }
2382 struct_or_union_specifier_compound_error:
2383 struct_entry '{' struct_declaration_list { $$ = $1; AddStructDefinitions($1, $3); POP_DEFAULT_ACCESS PopContext(curContext); }
2384 | struct_entry '{' struct_declaration_list_error { $$ = $1; AddStructDefinitions($1, $3); POP_DEFAULT_ACCESS PopContext(curContext); }
2385 | struct_entry '{' error { $$ = $1; POP_DEFAULT_ACCESS PopContext(curContext); }
2387 | struct_or_union '{' struct_declaration_list { $$ = MkStructOrUnion($1, null, $3); POP_DEFAULT_ACCESS }
2388 | struct_or_union '{' struct_declaration_list_error { $$ = MkStructOrUnion($1, null, $3); POP_DEFAULT_ACCESS }
2389 | struct_or_union '{' error { $$ = MkStructOrUnion($1, null, null); POP_DEFAULT_ACCESS }
2391 | struct_or_union ext_decl '{' struct_declaration_list { $$ = MkStructOrUnion($1, null, $4); $$.extDeclStruct = $2; POP_DEFAULT_ACCESS }
2392 | struct_or_union ext_decl '{' struct_declaration_list_error { $$ = MkStructOrUnion($1, null, $4); $$.extDeclStruct = $2; POP_DEFAULT_ACCESS }
2393 | struct_or_union ext_decl '{' error { $$ = MkStructOrUnion($1, null, null); $$.extDeclStruct = $2; POP_DEFAULT_ACCESS }
2396 struct_or_union_specifier_nocompound:
2397 struct_entry { $$ = $1; POP_DEFAULT_ACCESS PopContext(curContext); }
2406 ($1.addNameSpace ? DeclClassAddNameSpace : DeclClass)(globalContext.nextID++, $1.id.string);
2409 | struct_entry '<' template_parameters_list '>'
2411 Symbol symbol = ($1.addNameSpace ? DeclClassAddNameSpace : DeclClass)(globalContext.nextID++, $1.id.string);
2413 symbol.templateParams = $3;
2418 struct_decl ':' inheritance_specifiers
2422 SetupBaseSpecs(null, $3);
2427 struct_class_error '}' { $$ = $1; $$.loc = @$; }
2428 | struct_head '{' '}'
2429 { $$ = $1; POP_DEFAULT_ACCESS PopContext(curContext); }
2430 | struct_decl '{' '}' { $$ = $1; POP_DEFAULT_ACCESS PopContext(curContext); }
2431 | struct_or_union '{' '}' { $$ = MkStructOrUnion($1, null, null); POP_DEFAULT_ACCESS }
2435 struct_head '{' struct_declaration_list
2438 $$.definitions = $3;
2440 PopContext(curContext);
2442 | struct_head '{' struct_declaration_list_error
2445 $$.definitions = $3;
2447 PopContext(curContext);
2449 | struct_head '{' error
2450 { $$ = $1; POP_DEFAULT_ACCESS PopContext(curContext);}
2452 | struct_decl '{' struct_declaration_list
2454 PopContext(curContext);
2457 $$ = MkStructOrUnion($1.type, $1.id, $3);
2462 $$.definitions = $3;
2465 | struct_decl '{' struct_declaration_list_error
2467 PopContext(curContext);
2471 $$ = MkStructOrUnion($1.type, $1.id, $3);
2476 $$.definitions = $3;
2479 | struct_decl '{' error
2480 { $$ = $1; POP_DEFAULT_ACCESS PopContext(curContext); }
2482 | struct_or_union '{' struct_declaration_list
2483 { $$ = MkStructOrUnion($1, null, $3); POP_DEFAULT_ACCESS }
2484 | struct_or_union '{' struct_declaration_list_error
2485 { $$ = MkStructOrUnion($1, null, $3); POP_DEFAULT_ACCESS }
2486 | struct_or_union '{' error
2487 { $$ = MkStructOrUnion($1, null, null); POP_DEFAULT_ACCESS }
2491 STRUCT { $$ = structSpecifier; memberAccessStack[++defaultMemberAccess] = publicAccess; }
2492 | UNION { $$ = unionSpecifier; memberAccessStack[++defaultMemberAccess] = publicAccess; }
2495 specifier_qualifier_list:
2496 type_qualifier { $$ = MkList(); ListAdd($$, $1); }
2497 | specifier_qualifier_list type_qualifier { $$ = $1; ListAdd($1, $2); }
2498 | type_specifier { $$ = MkList(); ListAdd($$, $1); }
2499 | specifier_qualifier_list type_specifier { $$ = $1; ListAdd($1, $2); }
2500 | enum_specifier_compound { $$ = MkList(); ListAdd($$, $1); }
2501 | specifier_qualifier_list enum_specifier_compound { $$ = $1; ListAdd($1, $2); }
2502 | struct_or_union_specifier_compound { $$ = MkList(); ListAdd($$, $1); }
2503 | specifier_qualifier_list struct_or_union_specifier_compound { $$ = $1; ListAdd($1, $2); }
2506 guess_specifier_qualifier_list:
2507 type_qualifier { $$ = MkList(); ListAdd($$, $1); }
2508 | guess_specifier_qualifier_list type_qualifier { $$ = $1; ListAdd($1, $2); }
2509 | type_specifier { $$ = MkList(); ListAdd($$, $1); }
2510 | guess_specifier_qualifier_list type_specifier { $$ = $1; ListAdd($1, $2); }
2511 | guess_type { $$ = MkList(); ListAdd($$, $1); }
2512 | guess_specifier_qualifier_list guess_type { $$ = $1; ListAdd($1, $2); }
2513 | enum_specifier_compound { $$ = MkList(); ListAdd($$, $1); }
2514 | guess_specifier_qualifier_list enum_specifier_compound { $$ = $1; ListAdd($1, $2); }
2515 | struct_or_union_specifier_compound { $$ = MkList(); ListAdd($$, $1); }
2516 | guess_specifier_qualifier_list struct_or_union_specifier_compound { $$ = $1; ListAdd($1, $2); }
2519 declaration_specifiers:
2520 storage_class_specifier { $$ = MkList(); ListAdd($$, $1); }
2521 | declaration_specifiers storage_class_specifier { $$ = $1; ListAdd($1, $2); }
2522 | type_qualifier { $$ = MkList(); ListAdd($$, $1); }
2523 | declaration_specifiers type_qualifier { $$ = $1; ListAdd($1, $2); }
2524 | strict_type_specifier { $$ = MkList(); ListAdd($$, $1); }
2525 | declaration_specifiers strict_type_specifier { $$ = $1; ListAdd($1, $2); }
2526 | enum_specifier_compound { $$ = MkList(); ListAdd($$, $1); }
2527 | declaration_specifiers enum_specifier_compound { $$ = $1; ListAdd($1, $2); }
2528 | struct_or_union_specifier_compound { $$ = MkList(); ListAdd($$, $1); }
2529 | declaration_specifiers struct_or_union_specifier_compound { $$ = $1; ListAdd($1, $2); }
2532 guess_declaration_specifiers:
2533 storage_class_specifier { $$ = MkList(); ListAdd($$, $1); }
2534 | guess_declaration_specifiers storage_class_specifier { $$ = $1; ListAdd($1, $2); }
2535 | type_qualifier { $$ = MkList(); ListAdd($$, $1); }
2536 | guess_declaration_specifiers type_qualifier { $$ = $1; ListAdd($1, $2); }
2537 | type_specifier { $$ = MkList(); ListAdd($$, $1); }
2538 | guess_declaration_specifiers type_specifier { $$ = $1; ListAdd($1, $2); }
2539 | guess_type { $$ = MkList(); ListAdd($$, $1); }
2540 | guess_declaration_specifiers guess_type { $$ = $1; ListAdd($1, $2); }
2541 | struct_or_union_specifier_compound { $$ = MkList(); ListAdd($$, $1); }
2542 | guess_declaration_specifiers struct_or_union_specifier_compound { $$ = $1; ListAdd($1, $2); }
2543 | enum_specifier_compound { $$ = MkList(); ListAdd($$, $1); }
2544 | guess_declaration_specifiers enum_specifier_compound { $$ = $1; ListAdd($1, $2); }
2547 external_guess_declaration_specifiers:
2548 external_storage_class_specifier { $$ = MkList(); ListAdd($$, $1); }
2549 | external_guess_declaration_specifiers external_storage_class_specifier { $$ = $1; ListAdd($1, $2); }
2550 | type_qualifier { $$ = MkList(); ListAdd($$, $1); }
2551 | external_guess_declaration_specifiers type_qualifier { $$ = $1; ListAdd($1, $2); }
2552 | type_specifier { $$ = MkList(); ListAdd($$, $1); }
2553 | external_guess_declaration_specifiers type_specifier { $$ = $1; ListAdd($1, $2); }
2554 | guess_type { $$ = MkList(); ListAdd($$, $1); }
2555 | external_guess_declaration_specifiers guess_type { $$ = $1; ListAdd($1, $2); }
2556 | class_specifier { $$ = MkList(); ListAdd($$, $1); }
2557 | external_guess_declaration_specifiers class_specifier { $$ = $1; ListAdd($1, $2); }
2560 external_guess_declaration_specifiers_error:
2561 class_specifier_error { $$ = MkList(); ListAdd($$, $1); }
2562 | external_guess_declaration_specifiers class_specifier_error { $$ = $1; ListAdd($1, $2); }
2565 _inheritance_specifiers:
2566 PRIVATE { $$ = MkList(); ListAdd($$, MkSpecifier(PRIVATE)); }
2567 | PUBLIC { $$ = MkList(); ListAdd($$, MkSpecifier(PUBLIC)); }
2568 | storage_class_specifier { $$ = MkList(); ListAdd($$, $1); }
2569 | _inheritance_specifiers storage_class_specifier { $$ = $1; ListAdd($1, $2); }
2570 | type_qualifier { $$ = MkList(); ListAdd($$, $1); }
2571 | _inheritance_specifiers type_qualifier { $$ = $1; ListAdd($1, $2); }
2572 | strict_type_specifier { $$ = MkList(); ListAdd($$, $1); }
2573 | _inheritance_specifiers strict_type_specifier { $$ = $1; ListAdd($1, $2); }
2575 { _DeclClass(0, $1.string); $$ = MkListOne(MkSpecifierName($1.string)); FreeIdentifier($1); }
2576 | _inheritance_specifiers identifier { $$ = $1; _DeclClass(0, $2.string); ListAdd($1, MkSpecifierName($2.string)); FreeIdentifier($2); }
2578 | identifier '<' template_arguments_list '>'
2580 // if($1._class && !$1._class.name)
2584 strcpy(name, $1._class.name ? $1._class.name : "");
2586 strcat(name, $1.string);
2587 _DeclClass(0, name);
2590 _DeclClass(0, $1.string);
2593 ListAdd($$, MkSpecifierNameArgs($1.string, $3));
2596 | _inheritance_specifiers identifier '<' template_arguments_list '>'
2599 if($2._class && !$2._class.name)
2603 strcat(name, $2.string);
2604 _DeclClass(0, name);
2607 _DeclClass(0, $2.string);
2608 ListAdd($1, MkSpecifierNameArgs($2.string, $4));
2613 inheritance_specifiers:
2614 _inheritance_specifiers
2615 | struct_or_union { $$ = MkListOne(MkStructOrUnion($1, null, null)); POP_DEFAULT_ACCESS }
2618 property_specifiers:
2619 storage_class_specifier { $$ = MkList(); ListAdd($$, $1); }
2620 | property_specifiers storage_class_specifier { $$ = $1; ListAdd($1, $2); }
2621 | type_qualifier { $$ = MkList(); ListAdd($$, $1); }
2622 | property_specifiers type_qualifier { $$ = $1; ListAdd($1, $2); }
2623 | strict_type_specifier { $$ = MkList(); ListAdd($$, $1); }
2624 | property_specifiers strict_type_specifier { $$ = $1; ListAdd($1, $2); }
2625 | identifier { $$ = MkList(); ListAdd($$, MkSpecifierName($1.string)); FreeIdentifier($1)}
2626 | property_specifiers identifier { $$ = $1; ListAdd($1, MkSpecifierName($2.string)); FreeIdentifier($2)}
2627 | identifier '<' template_arguments_list '>'
2629 // if($1._class && !$1._class.name)
2633 strcpy(name, $1._class.name ? $1._class.name : "");
2635 strcat(name, $1.string);
2636 _DeclClass(0, name);
2639 _DeclClass(0, $1.string);
2642 ListAdd($$, MkSpecifierNameArgs($1.string, $3));
2645 | property_specifiers identifier '<' template_arguments_list '>'
2647 if($2._class && !$2._class.name)
2651 strcat(name, $2.string);
2652 _DeclClass(0, name);
2655 _DeclClass(0, $2.string);
2656 ListAdd($1, MkSpecifierNameArgs($2.string, $4));
2662 storage_class_specifier { $$ = MkList(); ListAdd($$, $1); }
2663 | renew_specifiers storage_class_specifier { $$ = $1; ListAdd($1, $2); }
2664 | type_qualifier { $$ = MkList(); ListAdd($$, $1); }
2665 | renew_specifiers type_qualifier { $$ = $1; ListAdd($1, $2); }
2666 | strict_type_specifier { $$ = MkList(); ListAdd($$, $1); }
2667 | renew_specifiers strict_type_specifier { $$ = $1; ListAdd($1, $2); }
2668 | struct_or_union_specifier_compound { $$ = MkList(); ListAdd($$, $1); }
2669 | renew_specifiers struct_or_union_specifier_compound { $$ = $1; ListAdd($1, $2); }
2670 | enum_specifier_compound { $$ = MkList(); ListAdd($$, $1); }
2671 | renew_specifiers enum_specifier_compound { $$ = $1; ListAdd($1, $2); }
2672 | identifier { $$ = MkList(); ListAdd($$, MkSpecifierName($1.string)); FreeIdentifier($1)}
2673 | renew_specifiers identifier { $$ = $1; ListAdd($1, MkSpecifierName($2.string)); FreeIdentifier($2)}
2674 | identifier '<' template_arguments_list '>'
2676 // if($1._class && !$1._class.name)
2680 strcpy(name, $1._class.name ? $1._class.name : "");
2682 strcat(name, $1.string);
2683 _DeclClass(0, name);
2686 _DeclClass(0, $1.string);
2689 ListAdd($$, MkSpecifierNameArgs($1.string, $3));
2692 | renew_specifiers identifier '<' template_arguments_list '>'
2694 if($2._class && !$2._class.name)
2698 strcat(name, $2.string);
2699 _DeclClass(0, name);
2702 _DeclClass(0, $2.string);
2703 ListAdd($1, MkSpecifierNameArgs($2.string, $4));
2709 storage_class_specifier { $$ = MkList(); ListAdd($$, $1); }
2710 | new_specifiers storage_class_specifier { $$ = $1; ListAdd($1, $2); }
2711 | type_qualifier { $$ = MkList(); ListAdd($$, $1); }
2712 | new_specifiers type_qualifier { $$ = $1; ListAdd($1, $2); }
2713 | strict_type_specifier { $$ = MkList(); ListAdd($$, $1); }
2714 | new_specifiers strict_type_specifier { $$ = $1; ListAdd($1, $2); }
2715 | struct_or_union_specifier_compound { $$ = MkList(); ListAdd($$, $1); }
2716 | new_specifiers struct_or_union_specifier_compound { $$ = $1; ListAdd($1, $2); }
2717 | enum_specifier_compound { $$ = MkList(); ListAdd($$, $1); }
2718 | new_specifiers enum_specifier_compound { $$ = $1; ListAdd($1, $2); }
2719 | identifier { $$ = MkList(); ListAdd($$, MkSpecifierName($1.string)); FreeIdentifier($1)}
2720 | new_specifiers identifier { $$ = $1; ListAdd($1, MkSpecifierName($2.string)); FreeIdentifier($2)}
2721 | identifier '<' template_arguments_list '>'
2723 // if($1._class && !$1._class.name)
2727 strcpy(name, $1._class.name ? $1._class.name : "");
2729 strcat(name, $1.string);
2730 _DeclClass(0, name);
2733 _DeclClass(0, $1.string);
2736 ListAdd($$, MkSpecifierNameArgs($1.string, $3));
2739 | new_specifiers identifier '<' template_arguments_list '>'
2741 if($2._class && !$2._class.name)
2745 strcat(name, $2.string);
2746 _DeclClass(0, name);
2749 _DeclClass(0, $2.string);
2750 ListAdd($1, MkSpecifierNameArgs($2.string, $4));
2755 identifier_list_error:
2756 identifier_list ',' error { $$ = $1; ListAdd($1, null); }
2757 | identifier_list_error ',' error { $$ = $1; ListAdd($1, null); }
2761 identifier { $$ = MkList(); ListAdd($$, MkTypeName(null, MkDeclaratorIdentifier($1))); }
2762 | identifier_list ',' identifier { $$ = $1; ListAdd($1, MkTypeName(null, MkDeclaratorIdentifier($3))); }
2763 | identifier_list_error ',' identifier { $$ = $1; ListAdd($1, MkTypeName(null, MkDeclaratorIdentifier($3))); }
2764 | parameter_list ',' identifier { $$ = $1; ListAdd($1, MkTypeName(null, MkDeclaratorIdentifier($3))); }
2765 | parameter_list_error ',' identifier { $$ = $1; ListAdd($1, MkTypeName(null, MkDeclaratorIdentifier($3))); }
2768 direct_declarator_nofunction_type_ok:
2769 direct_declarator_nofunction
2772 char * colon = RSearchString($1.name, "::", strlen($1.name), true, false);
2773 String s = colon ? colon + 2 : $1.name;
2774 $$ = MkDeclaratorIdentifier(MkIdentifier(s));
2777 | UINT { $$ = MkDeclaratorIdentifier(MkIdentifier("uint")); }
2778 // These rules need to be reviewed in lights of prototypes with types only...
2779 | base_strict_type '[' constant_expression ']'
2782 char * colon = RSearchString($1.name, "::", strlen($1.name), true, false);
2783 String s = colon ? colon + 2 : $1.name;
2784 decl = MkDeclaratorIdentifier(MkIdentifier(s));
2786 $$ = MkDeclaratorArray(decl, $3);
2788 | base_strict_type '[' constant_expression_error ']'
2791 char * colon = RSearchString($1.name, "::", strlen($1.name), true, false);
2792 String s = colon ? colon + 2 : $1.name;
2793 decl = MkDeclaratorIdentifier(MkIdentifier(s));
2795 $$ = MkDeclaratorArray(decl, $3);
2797 | base_strict_type '[' type ']'
2800 char * colon = RSearchString($1.name, "::", strlen($1.name), true, false);
2801 String s = colon ? colon + 2 : $1.name;
2802 decl = MkDeclaratorIdentifier(MkIdentifier(s));
2804 $$ = MkDeclaratorEnumArray(decl, $3);
2806 | base_strict_type '[' ']'
2809 char * colon = RSearchString($1.name, "::", strlen($1.name), true, false);
2810 String s = colon ? colon + 2 : $1.name;
2811 decl = MkDeclaratorIdentifier(MkIdentifier(s));
2813 $$ = MkDeclaratorEnumArray(decl, null);
2815 | direct_declarator_nofunction_type_ok '[' constant_expression ']' { $$ = MkDeclaratorArray($1, $3); }
2816 | direct_declarator_nofunction_type_ok '[' constant_expression_error ']' { $$ = MkDeclaratorArray($1, $3); }
2817 | direct_declarator_nofunction_type_ok '[' type ']' { $$ = MkDeclaratorEnumArray($1, $3); }
2818 | direct_declarator_nofunction_type_ok '[' ']' { $$ = MkDeclaratorArray($1, null); }
2821 direct_declarator_nofunction:
2822 identifier { $$ = MkDeclaratorIdentifier($1); }
2823 | '(' declarator ')' { $$ = MkDeclaratorBrackets($2); }
2824 | '(' ext_decl declarator ')' { $$ = MkDeclaratorBrackets(MkDeclaratorExtended($2, $3)); }
2825 | '(' declarator_type_ok ')' { $$ = MkDeclaratorBrackets($2); }
2826 | '(' ext_decl declarator_type_ok ')' { $$ = MkDeclaratorBrackets(MkDeclaratorExtended($2, $3)); }
2827 | direct_declarator_nofunction '[' constant_expression ']' { $$ = MkDeclaratorArray($1, $3); }
2828 | direct_declarator_nofunction '[' constant_expression_error ']' { $$ = MkDeclaratorArray($1, $3); }
2829 | direct_declarator_nofunction '[' type ']' { $$ = MkDeclaratorEnumArray($1, $3); }
2830 | direct_declarator_nofunction '[' ']' { $$ = MkDeclaratorArray($1, null); }
2833 direct_declarator_function_start:
2834 direct_declarator_nofunction '('
2837 direct_declarator_function:
2838 direct_declarator_function_start parameter_type_list ')' { $$ = MkDeclaratorFunction($1, $2); }
2839 | direct_declarator_function_start parameter_type_list_error ')' { $$ = MkDeclaratorFunction($1, $2); }
2840 | direct_declarator_function_start identifier_list ')' { $$ = MkDeclaratorFunction($1, $2); }
2841 | direct_declarator_function_start identifier_list_error ')' { $$ = MkDeclaratorFunction($1, $2); }
2842 | direct_declarator_function_start ')' { $$ = MkDeclaratorFunction($1, null); }
2845 // Tricky stuff here for overriding...
2846 direct_declarator_function_error:
2847 direct_declarator_function_start identifier_list_error
2849 $$ = MkDeclaratorFunction($1, $2);
2850 fileInput.Seek(@1.end.pos, start);
2852 resetScannerPos(&@1.end);
2853 @$.start = @1.start;
2856 | direct_declarator_function_start error
2858 $$ = MkDeclaratorFunction($1, null);
2859 fileInput.Seek(@1.end.pos, start);
2861 resetScannerPos(&@1.end);
2862 @$.start = @1.start;
2865 | direct_declarator_function_start parameter_list '('
2867 $$ = MkDeclaratorFunction($1, $2);
2868 fileInput.Seek(@1.end.pos, start);
2870 resetScannerPos(&@1.end);
2871 @$.start = @1.start;
2874 | direct_declarator_function_start guess_declaration_specifiers identifier '('
2876 $$ = MkDeclaratorFunction($1, null);
2877 fileInput.Seek(@1.end.pos, start);
2879 resetScannerPos(&@1.end);
2880 @$.start = @1.start;
2882 FreeList($2, FreeSpecifier);
2888 direct_declarator_function
2889 | direct_declarator_nofunction
2893 direct_declarator_function_start_type_ok:
2894 direct_declarator_nofunction_type_ok '('
2897 direct_declarator_function_type_ok:
2898 direct_declarator_function_start_type_ok parameter_type_list ')' { $$ = MkDeclaratorFunction($1, $2); }
2899 | direct_declarator_function_start_type_ok parameter_type_list_error ')' { $$ = MkDeclaratorFunction($1, $2); }
2900 | direct_declarator_function_start_type_ok identifier_list ')' { $$ = MkDeclaratorFunction($1, $2); }
2901 | direct_declarator_function_start_type_ok identifier_list_error ')' { $$ = MkDeclaratorFunction($1, $2); }
2902 | direct_declarator_function_start_type_ok ')' { $$ = MkDeclaratorFunction($1, null); }
2905 // Tricky stuff here for overriding...
2906 direct_declarator_function_error_type_ok:
2907 direct_declarator_function_start_type_ok identifier_list_error
2909 $$ = MkDeclaratorFunction($1, $2);
2910 fileInput.Seek(@1.end.pos, start);
2912 resetScannerPos(&@1.end);
2913 @$.start = @1.start;
2916 | direct_declarator_function_start_type_ok error
2918 $$ = MkDeclaratorFunction($1, null);
2919 fileInput.Seek(@1.end.pos, start);
2921 resetScannerPos(&@1.end);
2922 @$.start = @1.start;
2925 | direct_declarator_function_start_type_ok parameter_list '('
2927 $$ = MkDeclaratorFunction($1, $2);
2928 fileInput.Seek(@1.end.pos, start);
2930 resetScannerPos(&@1.end);
2931 @$.start = @1.start;
2934 | direct_declarator_function_start_type_ok guess_declaration_specifiers identifier '('
2936 $$ = MkDeclaratorFunction($1, null);
2937 fileInput.Seek(@1.end.pos, start);
2939 resetScannerPos(&@1.end);
2940 @$.start = @1.start;
2942 FreeList($2, FreeSpecifier);
2947 direct_declarator_type_ok:
2948 direct_declarator_function_type_ok
2949 | direct_declarator_nofunction_type_ok
2951 | ext_decl direct_declarator_function_type_ok
2952 { $$ = MkDeclaratorExtended($1, $2); }
2953 | ext_decl direct_declarator_nofunction_type_ok
2954 { $$ = MkDeclaratorExtended($1, $2); }
2959 ASM '(' STRING_LITERAL { $<string>$ = CopyString(yytext); } STRING_LITERAL { $<string>$ = CopyString(yytext); }
2962 strcpy(temp, "__asm__(");
2963 strcat(temp, $<string>4);
2965 strcat(temp, $<string>6);
2968 $<string>$ = CopyString(temp);
2973 EXT_DECL { $$ = MkExtDeclString(CopyString(yytext)); }
2974 | attrib { $$ = MkExtDeclAttrib($1);
2978 strcpy(temp, $<string>1);
2981 $$ = MkExtDeclString(CopyString(temp));
2983 | asm_start STRING_LITERAL { $$ = CopyString(yytext); } ')'
2986 strcpy(temp, $<string>1);
2988 strcat(temp, $<string>3);
2992 $$ = MkExtDeclString(CopyString(temp));
2998 EXT_DECL { $$ = MkExtDeclString(CopyString(yytext)); }
2999 | EXT_STORAGE { $$ = MkExtDeclString(CopyString(yytext)); }
3000 | attrib { $$ = MkExtDeclAttrib($1); }
3001 | ASM '(' string_literal ')'
3004 strcpy(temp, "__asm__(");
3007 $$ = MkExtDeclString(CopyString(temp));
3013 ATTRIB { $<i>$ = ATTRIB; }
3014 | ATTRIB_DEP { $<i>$ = ATTRIB_DEP; }
3015 | __ATTRIB { $<i>$ = __ATTRIB; }
3020 IDENTIFIER { $$ = CopyString(yytext); }
3021 | TYPE_NAME { $$ = CopyString(yytext); }
3022 | EXT_STORAGE { $$ = CopyString(yytext); }
3023 | EXT_DECL { $$ = CopyString(yytext); }
3024 | CONST { $$ = CopyString(yytext); }
3028 attribute_word { $$ = MkAttribute($1, null); $$.loc = @$; }
3029 | attribute_word '(' expression ')' { $$ = MkAttribute($1, MkExpBrackets($3)); $$.loc = @$; }
3033 attribute { $$ = MkListOne($1); }
3034 | attribs_list attribute { ListAdd($1, $2); $$ = $1; }
3035 | attribs_list ',' attribute { ListAdd($1, $3); $$ = $1; }
3039 _attrib '(' '(' attribs_list ')' ')' { $$ = MkAttrib($<i>1, $4); $$.loc = @$; }
3040 | _attrib '(' '(' ')' ')' { $$ = MkAttrib($<i>1, null); $$.loc = @$; }
3043 direct_abstract_declarator:
3044 '(' abstract_declarator ')' { $$ = MkDeclaratorBrackets($2); }
3045 | '(' ext_decl abstract_declarator ')' { $$ = MkDeclaratorBrackets(MkDeclaratorExtended($2, $3)); }
3046 | '[' ']' { $$ = MkDeclaratorArray(null, null); }
3047 | '[' constant_expression ']' { $$ = MkDeclaratorArray(null, $2); }
3048 | '[' constant_expression_error ']' { $$ = MkDeclaratorArray(null, $2); }
3049 | '[' type ']' { $$ = MkDeclaratorEnumArray(null, $2); }
3050 | direct_abstract_declarator '[' ']' { $$ = MkDeclaratorArray($1, null); }
3051 | direct_abstract_declarator '[' constant_expression ']' { $$ = MkDeclaratorArray($1, $3); }
3052 | direct_abstract_declarator '[' type']' { $$ = MkDeclaratorEnumArray($1, $3); }
3053 | direct_abstract_declarator '[' constant_expression_error ']' { $$ = MkDeclaratorArray($1, $3); }
3054 | '(' ')' { $$ = MkDeclaratorFunction(null, null); }
3055 | '(' parameter_type_list ')' { $$ = MkDeclaratorFunction(null, $2); }
3056 | '(' parameter_type_list_error ')' { $$ = MkDeclaratorFunction(null, $2); }
3057 | direct_abstract_declarator '(' ')' { $$ = MkDeclaratorFunction($1, null); }
3058 | direct_abstract_declarator '(' parameter_type_list ')' { $$ = MkDeclaratorFunction($1, $3); }
3059 | direct_abstract_declarator '(' parameter_type_list_error ')' { $$ = MkDeclaratorFunction($1, $3); }
3062 direct_abstract_declarator_noarray:
3063 '(' abstract_declarator_noarray ')' { $$ = MkDeclaratorBrackets($2); }
3064 | '(' ext_decl abstract_declarator_noarray ')' { $$ = MkDeclaratorBrackets(MkDeclaratorExtended($2, $3)); }
3065 | '(' ')' { $$ = MkDeclaratorFunction(null, null); }
3066 | '(' parameter_type_list ')' { $$ = MkDeclaratorFunction(null, $2); }
3067 | '(' parameter_type_list_error ')' { $$ = MkDeclaratorFunction(null, $2); }
3068 | direct_abstract_declarator_noarray '(' ')' { $$ = MkDeclaratorFunction($1, null); }
3069 | direct_abstract_declarator_noarray '(' parameter_type_list ')' { $$ = MkDeclaratorFunction($1, $3); }
3070 | direct_abstract_declarator_noarray '(' parameter_type_list_error ')' { $$ = MkDeclaratorFunction($1, $3); }
3074 '*' { $$ = MkPointer(null, null); }
3075 | '*' type_qualifier_list { $$ = MkPointer($2, null); }
3076 | '*' pointer { $$ = MkPointer(null, $2); }
3077 | '*' type_qualifier_list pointer { $$ = MkPointer($2, $3); }
3080 abstract_declarator:
3081 pointer { $$ = MkDeclaratorPointer($1, null); }
3082 | direct_abstract_declarator
3083 | pointer direct_abstract_declarator { $$ = MkDeclaratorPointer($1, $2); }
3084 | ext_decl pointer { $$ = MkDeclaratorExtended($1, MkDeclaratorPointer($2, null)); }
3085 | ext_decl pointer direct_abstract_declarator { $$ = MkDeclaratorExtended($1, MkDeclaratorPointer($2, $3)); }
3088 abstract_declarator_noarray:
3089 pointer { $$ = MkDeclaratorPointer($1, null); }
3090 | direct_abstract_declarator_noarray
3091 | pointer direct_abstract_declarator_noarray { $$ = MkDeclaratorPointer($1, $2); }
3092 | ext_decl pointer { $$ = MkDeclaratorExtended($1, MkDeclaratorPointer($2, null)); }
3093 | ext_decl pointer direct_abstract_declarator_noarray { $$ = MkDeclaratorExtended($1, MkDeclaratorPointer($2, $3)); }
3098 | pointer direct_declarator
3099 { $$ = MkDeclaratorPointer($1, $2); }
3100 | ext_decl pointer direct_declarator
3101 { $$ = MkDeclaratorExtended($1, MkDeclaratorPointer($2, $3)); }
3102 | declarator ext_decl
3103 { $$ = MkDeclaratorExtendedEnd($2, $1); }
3104 | declarator_nofunction_type_ok ext_decl
3105 { $$ = MkDeclaratorExtendedEnd($2, $1); }
3109 direct_declarator_type_ok
3110 | pointer direct_declarator_type_ok
3111 { $$ = MkDeclaratorPointer($1, $2); }
3112 | ext_decl pointer direct_declarator_type_ok
3113 { $$ = MkDeclaratorExtended($1, MkDeclaratorPointer($2, $3)); }
3114 | declarator_type_ok ext_decl
3115 { $$ = MkDeclaratorExtendedEnd($2, $1); }
3118 declarator_function:
3119 direct_declarator_function
3120 | pointer direct_declarator_function { $$ = MkDeclaratorPointer($1, $2); }
3121 | ext_decl pointer direct_declarator_function { $$ = MkDeclaratorExtended($1, MkDeclaratorPointer($2, $3)); }
3122 | pointer ext_decl direct_declarator_function { $$ = MkDeclaratorPointer($1, MkDeclaratorExtended($2, $3)); }
3125 declarator_function_error:
3126 direct_declarator_function_error
3127 | pointer direct_declarator_function_error { $$ = MkDeclaratorPointer($1, $2); }
3128 | ext_decl pointer direct_declarator_function_error { $$ = MkDeclaratorExtended($1, MkDeclaratorPointer($2, $3)); }
3129 | pointer ext_decl direct_declarator_function_error { $$ = MkDeclaratorPointer($1, MkDeclaratorExtended($2, $3)); }
3132 declarator_function_type_ok:
3133 direct_declarator_function_type_ok
3134 | pointer direct_declarator_function_type_ok { $$ = MkDeclaratorPointer($1, $2); }
3135 | ext_decl pointer direct_declarator_function_type_ok { $$ = MkDeclaratorExtended($1, MkDeclaratorPointer($2, $3)); }
3136 | pointer ext_decl direct_declarator_function_type_ok { $$ = MkDeclaratorPointer($1, MkDeclaratorExtended($2, $3)); }
3139 declarator_function_error_type_ok:
3140 direct_declarator_function_error_type_ok
3141 | pointer direct_declarator_function_error_type_ok { $$ = MkDeclaratorPointer($1, $2); }
3142 | ext_decl pointer direct_declarator_function_error_type_ok { $$ = MkDeclaratorExtended($1, MkDeclaratorPointer($2, $3)); }
3143 | pointer ext_decl direct_declarator_function_error_type_ok { $$ = MkDeclaratorPointer($1, MkDeclaratorExtended($2, $3)); }
3146 declarator_nofunction_type_ok:
3147 direct_declarator_nofunction_type_ok
3148 | pointer direct_declarator_nofunction_type_ok { $$ = MkDeclaratorPointer($1, $2); }
3149 | ext_decl pointer direct_declarator_nofunction_type_ok { $$ = MkDeclaratorExtended($1, MkDeclaratorPointer($2, $3)); }
3150 | pointer ext_decl direct_declarator_nofunction_type_ok { $$ = MkDeclaratorPointer($1, MkDeclaratorExtended($2, $3)); }
3154 assignment_expression { $$ = MkInitializerAssignment($1); $$.loc = @$; }
3155 | '{' initializer_list '}' { $$ = MkInitializerList($2); $$.loc = @$; }
3156 | '{' initializer_list ',' '}'
3158 Compiler_Warning($"Extra comma\n");
3159 $$ = MkInitializerList($2);
3163 Expression exp = MkExpDummy();
3164 Initializer init = MkInitializerAssignment(exp);
3173 assignment_expression_error { $$ = MkInitializerAssignment($1); $$.loc = @$; }
3174 | '{' initializer_list '}' error { $$ = MkInitializerList($2); $$.loc = @$; }
3175 | '{' initializer_list { yyerror(); $$ = MkInitializerList($2); $$.loc = @$; }
3176 | '{' initializer_list ',' '}' error
3178 $$ = MkInitializerList($2);
3182 Expression exp = MkExpDummy();
3183 Initializer init = MkInitializerAssignment(exp);
3189 | '{' initializer_list ','
3192 $$ = MkInitializerList($2);
3196 Expression exp = MkExpDummy();
3197 Initializer init = MkInitializerAssignment(exp);
3205 initializer_condition:
3206 conditional_expression { $$ = MkInitializerAssignment($1); $$.loc = @$; }
3207 | anon_instantiation_expression
3208 { $$ = MkInitializerAssignment($1); $$.loc = @$; }
3211 initializer_condition_error:
3212 conditional_expression_error { $$ = MkInitializerAssignment($1); $$.loc = @$; }
3213 | anon_instantiation_expression_error { $$ = MkInitializerAssignment($1); $$.loc = @$; }
3217 initializer { $$ = MkList(); ListAdd($$, $1); }
3218 | initializer_error { $$ = MkList(); ListAdd($$, $1); }
3219 | initializer_list ',' initializer { $$ = $1; ListAdd($1, $3); }
3220 | initializer_list ',' initializer_error { $$ = $1; ListAdd($1, $3); }
3223 | initializer_list initializer { yyerror(); $$ = $1; ListAdd($1, $2); }
3224 | initializer_list initializer_error { $$ = $1; ListAdd($1, $2); }
3228 declarator { $$ = MkInitDeclarator($1, null); $$.loc = @$; }
3229 | declarator_type_ok { $$ = MkInitDeclarator($1, null); $$.loc = @$; }
3230 | declarator '=' initializer { $$ = MkInitDeclarator($1, $3); $$.loc = @$; $$.initializer.loc.start = @2.end; }
3233 init_declarator_error:
3234 declarator error { $$ = MkInitDeclarator($1, null); $$.loc = @$; }
3235 /* Useless rules due to conflicts
3236 | declarator '=' error { $$ = MkInitDeclarator($1, MkInitializerAssignment(MkExpDummy())); $$.loc = @$; $$.initializer.loc = @2; $$.initializer.exp.loc = @2; }
3238 | declarator '=' initializer_error { $$ = MkInitDeclarator($1, $3); $$.loc = @$; $$.initializer.loc.start = @2.end; }
3241 init_declarator_list:
3242 init_declarator { $$ = MkList(); ListAdd($$, $1); }
3243 | init_declarator_list ',' init_declarator { $$ = $1; ListAdd($1, $3); }
3244 | UINT ',' init_declarator { $$ = MkList(); ListAdd($$, MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier("uint")), null)); ListAdd($$, $3); }
3245 | INT64 ',' init_declarator { $$ = MkList(); ListAdd($$, MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier("int64")), null)); ListAdd($$, $3); }
3246 | base_strict_type ',' init_declarator
3248 char * colon = RSearchString($1.name, "::", strlen($1.name), true, false);
3249 String s = colon ? colon + 2 : $1.name;
3251 ListAdd($$, MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier(s)), null));
3255 | init_declarator_list_error ',' init_declarator { $$ = $1; ListAdd($1, $3); }
3256 /*| base_strict_type ',' init_declarator
3263 init_declarator_list_error:
3264 init_declarator_error { $$ = MkList(); ListAdd($$, $1); }
3265 | init_declarator error { $$ = MkList(); ListAdd($$, $1); }
3266 | init_declarator_list ',' init_declarator_error { $$ = $1; ListAdd($1, $3); }
3267 | init_declarator_list_error ',' init_declarator_error { $$ = $1; ListAdd($1, $3); }
3271 specifier_qualifier_list { $$ = MkTypeName($1, null); }
3272 | specifier_qualifier_list abstract_declarator { $$ = MkTypeName($1, $2); }
3276 guess_specifier_qualifier_list { $$ = MkTypeName($1, null); }
3277 | guess_specifier_qualifier_list abstract_declarator { $$ = MkTypeName($1, $2); }
3280 /*** PARAMETERS **********************************************************************/
3281 parameter_declaration:
3282 guess_declaration_specifiers declarator_type_ok { $$ = MkTypeName($1, $2); }
3283 | guess_declaration_specifiers abstract_declarator { $$ = MkTypeName($1, $2); }
3284 | guess_declaration_specifiers '&' { $$ = MkTypeName($1, MkDeclaratorPointer(MkPointer(null,null), null)); }
3285 | guess_declaration_specifiers '&' declarator_type_ok { $$ = MkTypeName($1, MkDeclaratorPointer(MkPointer(null,null), $3)); }
3286 | guess_declaration_specifiers { $$ = MkTypeNameGuessDecl($1, null); }
3288 { $$ = MkTypeName(MkListOne(MkSpecifier(CLASS)), null); }
3291 { $$ = MkTypeName(MkListOne(MkSpecifier(TYPED_OBJECT)), null); }
3293 { $$ = MkTypeName(MkListOne(MkSpecifier(TYPED_OBJECT)), MkDeclaratorPointer(MkPointer(null,null), null)); }
3294 | TYPED_OBJECT declarator
3295 { $$ = MkTypeName(MkListOne(MkSpecifier(TYPED_OBJECT)), $2); }
3296 | TYPED_OBJECT '&' declarator
3297 { $$ = MkTypeName(MkListOne(MkSpecifier(TYPED_OBJECT)), MkDeclaratorPointer(MkPointer(null,null), $3)); }
3299 { $$ = MkTypeName(MkListOne(MkSpecifier(ANY_OBJECT)), null); }
3300 | ANY_OBJECT declarator
3301 { $$ = MkTypeName(MkListOne(MkSpecifier(ANY_OBJECT)), $2); }
3305 parameter_declaration_error:
3306 guess_declaration_specifiers declarator_type_ok error { $$ = MkTypeName($1, $2); }
3307 | guess_declaration_specifiers abstract_declarator error { $$ = MkTypeName($1, $2); }
3311 parameter_declaration { $$ = MkList(); ListAdd($$, $1); }
3312 | parameter_list ',' parameter_declaration { $$ = $1; ListAdd($1, $3); }
3313 | parameter_list error ',' parameter_declaration { $$ = $1; ListAdd($1, $4); }
3314 | parameter_list_error ',' parameter_declaration { $$ = $1; ListAdd($1, $3); }
3315 | parameter_list_error error ',' parameter_declaration { $$ = $1; ListAdd($1, $4); }
3316 | error ',' parameter_declaration { $$ = MkList(); ListAdd($$, MkTypeName(MkList(), null)); ListAdd($$, $3); }
3318 | identifier_list ',' parameter_declaration { $$ = $1; ListAdd($1, $3); }
3319 | identifier_list error ',' parameter_declaration { $$ = $1; ListAdd($1, $4); }
3320 | identifier_list_error ',' parameter_declaration { $$ = $1; ListAdd($1, $3); }
3321 | identifier_list_error error ',' parameter_declaration { $$ = $1; ListAdd($1, $4); }
3324 parameter_list_error:
3325 parameter_declaration_error { $$ = MkList(); ListAdd($$, $1); }
3326 | parameter_list ',' parameter_declaration_error { $$ = $1; ListAdd($1, $3); }
3327 | parameter_list_error ',' parameter_declaration_error { $$ = $1; ListAdd($1, $3); }
3328 | parameter_list_error error ',' parameter_declaration_error { $$ = $1; ListAdd($1, $4); }
3329 | error ',' parameter_declaration_error { $$ = MkList(); ListAdd($$, MkTypeName(MkList(), null)); ListAdd($$, $3); }
3331 | identifier_list ',' parameter_declaration_error { $$ = $1; ListAdd($1, $3); }
3332 | identifier_list_error ',' parameter_declaration_error { $$ = $1; ListAdd($1, $3); }
3333 | identifier_list_error error ',' parameter_declaration_error { $$ = $1; ListAdd($1, $4); }
3336 parameter_type_list:
3338 | parameter_list ',' ELLIPSIS { $$ = $1; ListAdd($1, MkTypeName(null, null)); }
3339 | parameter_list_error ',' ELLIPSIS { $$ = $1; ListAdd($1, MkTypeName(null, null)); }
3340 | identifier_list ',' ELLIPSIS { $$ = $1; ListAdd($1, MkTypeName(null, null)); }
3341 | identifier_list_error ',' ELLIPSIS { $$ = $1; ListAdd($1, MkTypeName(null, null)); }
3342 | error ',' ELLIPSIS { $$ = MkList(); ListAdd($$, MkTypeName(null, null)); }
3345 parameter_type_list_error:
3346 parameter_list_error
3347 | parameter_list ',' error { $$ = $1; ListAdd($1, null); }
3348 | parameter_list_error error
3351 /****** STATEMENTS *******************************************************************/
3354 | attrib { $$ = MkExpressionStmt(null); FreeAttrib($1); } // Ignoring this for now... ( For __attribute__ ((__unused__)) )
3355 | compound_statement
3356 | ';' { $$ = MkExpressionStmt(null); }
3357 | ':' { $$ = MkExpressionStmt(null); }
3358 | expression ';' { $$ = MkExpressionStmt($1); $$.loc = @$; }
3359 | selection_statement
3360 | iteration_statement
3365 | watch_definition ';'
3369 labeled_statement_error { $$ = $1; Compiler_Error($"syntax error\n"); }
3370 | iteration_statement_error { $$ = $1; Compiler_Error($"syntax error\n"); }
3371 | compound_statement_error { $$ = $1; Compiler_Error($"syntax error\n"); }
3372 | selection_statement_error { $$ = $1; Compiler_Error($"syntax error\n"); }
3373 | jump_statement_error { $$ = $1; Compiler_Error($"syntax error\n"); }
3374 | jump_statement error { $$ = $1; Compiler_Error($"syntax error\n"); }
3375 | expression_error { $$ = MkExpressionStmt($1); Compiler_Error($"syntax error\n"); $$.loc = @1; }
3379 string_literal { $$ = MkAsmField($1, null, null); $$.loc = @1; }
3380 | string_literal '(' assignment_expression ')' { $$ = MkAsmField($1, $3, null); $$.loc = @$; }
3381 | '[' identifier ']' string_literal '(' assignment_expression ')' { $$ = MkAsmField($4, $6, $2); $$.loc = @$; }
3385 asm_field { $$ = MkListOne($1); }
3386 | asm_field_list ',' asm_field { ListAdd($$, $3); }
3391 ASM type_qualifier '(' string_literal ')' ';' { $$ = MkAsmStmt($2, $4, null, null, null); $$.loc = @$; }
3392 | ASM type_qualifier '(' string_literal ':' asm_field_list ')' ';' { $$ = MkAsmStmt($2, $4, $6, null, null); $$.loc = @$; }
3393 | ASM type_qualifier '(' string_literal ':' asm_field_list ':' asm_field_list ')' ';' { $$ = MkAsmStmt($2, $4, $6, $8, null); $$.loc = @$; }
3394 | ASM type_qualifier '(' string_literal ':' asm_field_list ':' asm_field_list ':' asm_field_list ')' ';' { $$ = MkAsmStmt($2, $4, $6, $8, $10); $$.loc = @$; }
3396 | ASM type_qualifier '(' string_literal IDENTIFIER asm_field_list ')' ';' { $$ = MkAsmStmt($2, $4, null, $6, null); $$.loc = @$; }
3397 | ASM type_qualifier '(' string_literal IDENTIFIER asm_field_list ':' asm_field_list ')' ';' { $$ = MkAsmStmt($2, $4, null, $6, $8); $$.loc = @$; }
3398 | ASM type_qualifier '(' string_literal ':' asm_field_list IDENTIFIER asm_field_list ')' ';' { $$ = MkAsmStmt($2, $4, $6, null, $8); $$.loc = @$; }
3400 | ASM '(' string_literal ')' ';' { $$ = MkAsmStmt(null, $3, null, null, null); $$.loc = @$; }
3401 | ASM '(' string_literal ':' asm_field_list ')' ';' { $$ = MkAsmStmt(null, $3, $5, null, null); $$.loc = @$; }
3402 | ASM '(' string_literal ':' asm_field_list ':' asm_field_list ')' ';' { $$ = MkAsmStmt(null, $3, $5, $7, null); $$.loc = @$; }
3403 | ASM '(' string_literal ':' asm_field_list ':' asm_field_list ':' asm_field_list ')' ';' { $$ = MkAsmStmt(null, $3, $5, $7, $9); $$.loc = @$; }
3405 | ASM '(' string_literal IDENTIFIER asm_field_list ')' ';' { $$ = MkAsmStmt(null, $3, null, $5, null); $$.loc = @$; }
3406 | ASM '(' string_literal IDENTIFIER asm_field_list ':' asm_field_list ')' ';' { $$ = MkAsmStmt(null, $3, null, $5, $7); $$.loc = @$; }
3407 | ASM '(' string_literal ':' asm_field_list IDENTIFIER asm_field_list ')' ';' { $$ = MkAsmStmt(null, $3, $5, null, $7); $$.loc = @$; }
3411 identifier ':' statement { $$ = MkLabeledStmt($1, $3); $$.loc = @$; }
3412 | CASE constant_expression ':' statement { $$ = MkCaseStmt($2, $4); $$.loc = @$; $2.loc.start = @1.end; }
3413 | CASE constant_expression_error ':' statement { $$ = MkCaseStmt($2, $4); $$.loc = @$; $2.loc.start = @1.end; }
3414 | CASE ':' statement { $$ = MkCaseStmt(MkExpDummy(), $3); $$.caseStmt.exp.loc = @2; $$.loc = @$; $$.caseStmt.exp.loc.start = @1.end; }
3415 | DEFAULT ':' statement { $$ = MkCaseStmt(null, $3); $$.loc = @$; }
3417 | identifier ':' declaration { Statement stmt = MkBadDeclStmt($3); stmt.loc = @3; Compiler_Warning(C89_DECL_WARNING); $$ = MkLabeledStmt($1, stmt); $$.loc = @$; }
3418 | CASE constant_expression ':' declaration { Statement stmt = MkBadDeclStmt($4); stmt.loc = @4; Compiler_Warning(C89_DECL_WARNING); $$ = MkCaseStmt($2, stmt); $$.loc = @$; $2.loc.start = @1.end; }
3419 | CASE constant_expression_error ':' declaration { Statement stmt = MkBadDeclStmt($4); stmt.loc = @4; Compiler_Warning(C89_DECL_WARNING); $$ = MkCaseStmt($2, stmt); $$.loc = @$; $2.loc.start = @1.end; }
3420 | CASE ':' declaration { Statement stmt = MkBadDeclStmt($3); stmt.loc = @3; Compiler_Warning(C89_DECL_WARNING); $$ = MkCaseStmt(MkExpDummy(), stmt); $$.caseStmt.exp.loc = @2; $$.loc = @$; $$.caseStmt.exp.loc.start = @1.end; }
3421 | DEFAULT ':' declaration { Statement stmt = MkBadDeclStmt($3); stmt.loc = @3; Compiler_Warning(C89_DECL_WARNING); $$ = MkCaseStmt(null, stmt); $$.loc = @$; }
3424 labeled_statement_error:
3425 identifier ':' statement_error { $$ = MkLabeledStmt($1, $3); $$.loc = @$; }
3426 | CASE constant_expression ':' statement_error { $$ = MkCaseStmt($2, $4); $$.loc = @$; $2.loc.start = @1.end; }
3427 | CASE constant_expression_error ':' statement_error { $$ = MkCaseStmt($2, $4); $$.loc = @$; $2.loc.start = @1.end; }
3428 | CASE ':' statement_error { $$ = MkCaseStmt(MkExpDummy(), $3); $$.caseStmt.exp.loc = @2; $$.loc = @$; $$.caseStmt.exp.loc.start = @1.end; }
3429 | CASE ':' { $$ = MkCaseStmt(MkExpDummy(), null); $$.caseStmt.exp.loc = @2; $$.loc = @$; $$.caseStmt.exp.loc.start = @1.end; }
3430 | DEFAULT ':' statement_error { $$ = MkCaseStmt(null, $3); $$.loc = @$; }
3431 | DEFAULT ':' { $$ = MkCaseStmt(null, null); $$.loc = @$; }
3433 | identifier ':' declaration_error { Statement stmt = MkBadDeclStmt($3); stmt.loc = @3; Compiler_Warning(C89_DECL_WARNING); $$ = MkLabeledStmt($1, stmt); $$.loc = @$; }
3434 | CASE constant_expression ':' declaration_error { Statement stmt = MkBadDeclStmt($4); stmt.loc = @4; Compiler_Warning(C89_DECL_WARNING); $$ = MkCaseStmt($2, stmt); $$.loc = @$; $2.loc.start = @1.end; }
3435 | CASE constant_expression_error ':' declaration_error { Statement stmt = MkBadDeclStmt($4); stmt.loc = @4; Compiler_Warning(C89_DECL_WARNING); $$ = MkCaseStmt($2, stmt); $$.loc = @$; $2.loc.start = @1.end; }
3436 | CASE ':' declaration_error { Statement stmt = MkBadDeclStmt($3); stmt.loc = @3; Compiler_Warning(C89_DECL_WARNING); $$ = MkCaseStmt(MkExpDummy(), stmt); $$.caseStmt.exp.loc = @2; $$.loc = @$; $$.caseStmt.exp.loc.start = @1.end; }
3437 | DEFAULT ':' declaration_error { Statement stmt = MkBadDeclStmt($3); stmt.loc = @3; Compiler_Warning(C89_DECL_WARNING); $$ = MkCaseStmt(null, stmt); $$.loc = @$; }
3441 PUBLIC { $$ = structDeclMode = declMode = publicAccess; }
3442 | PRIVATE { $$ = structDeclMode = declMode = privateAccess; }
3443 | DEFAULT { $$ = structDeclMode = declMode = defaultAccess; }
3447 PUBLIC { $$ = publicAccess; }
3448 | PRIVATE { $$ = privateAccess; }
3452 declaration_specifiers ';' { $$ = MkDeclaration($1, null); $$.loc = @$; structDeclMode = defaultDeclMode; }
3453 | declaration_specifiers init_declarator_list ';' { $$ = MkDeclaration($1, $2); $$.loc = @$; structDeclMode = defaultDeclMode; }
3454 | instantiation_named ';' { $$ = MkDeclarationInst($1); $$.loc = @$; structDeclMode = defaultDeclMode; }
3455 | declaration_error ';' { $$ = $1; structDeclMode = defaultDeclMode; }
3458 external_guess_declaration:
3459 external_guess_declaration_specifiers ';' { $$ = MkDeclaration($1, null); $$.loc = @$; }
3460 | external_guess_declaration_specifiers init_declarator_list ';' { $$ = MkDeclaration($1, $2); $$.loc = @$; }
3461 | external_guess_declaration_specifiers_error init_declarator_list ';' { $$ = MkDeclaration($1, $2); $$.loc = @$; }
3463 | external_guess_instantiation_named ';' { $$ = MkDeclarationInst($1); $$.loc = @$; }
3464 | DEFINE identifier '=' conditional_expression ';' { $$ = MkDeclarationDefine($2, $4); $$.loc = @$; }
3465 | STATIC DEFINE identifier '=' conditional_expression ';' { structDeclMode = declMode = staticAccess; $$ = MkDeclarationDefine($3, $5); $$.loc = @$; }
3468 external_guess_declaration_error:
3469 external_guess_declaration_specifiers error { $$ = MkDeclaration($1, null); $$.loc = @$; yyerrok; }
3473 declaration_specifiers error { $$ = MkDeclaration($1, null); $$.loc = @$; structDeclMode = defaultDeclMode; }
3474 | declaration_error error { structDeclMode = defaultDeclMode; }
3476 | instantiation_named_error error { $$ = MkDeclarationInst($1); $$.loc = @$; structDeclMode = defaultDeclMode; }
3477 | instantiation_named error { $$ = MkDeclarationInst($1); $$.loc = @$; structDeclMode = defaultDeclMode; }
3478 | declaration_specifiers init_declarator_list_error { $$ = MkDeclaration($1, $2); $$.loc = @$; structDeclMode = defaultDeclMode; }
3482 declaration { $$ = MkList(); ListAdd($$, $1); /*declMode = defaultDeclMode;*/ }
3483 | declaration_list declaration { $$ = $1; ListAdd($1, $2); /*declMode = defaultDeclMode; */}
3484 | declaration_list_error declaration { $$ = $1; ListAdd($1, $2); /*declMode = defaultDeclMode; */}
3485 | declaration_list error ';' { $$ = $1; }
3488 declaration_list_error:
3489 declaration_error { $$ = MkList(); ListAdd($$, $1); }
3490 | declaration_list declaration_error { $$ = $1; ListAdd($1, $2); }
3494 statement { $$ = MkList(); ListAdd($$, $1); }
3495 | statement_list statement { $$ = $1; ListAdd($1, $2); }
3496 | statement_list_error statement { $$ = $1; ListAdd($1, $2); }
3499 statement_list_error:
3500 statement_error { $$ = MkList(); ListAdd($$, $1); }
3501 | statement_list statement_error { $$ = $1; ListAdd($1, $2); }
3502 | statement_list_error statement_error { $$ = $1; ListAdd($1, $2); }
3503 | statement_list declaration { Statement stmt = MkBadDeclStmt($2); stmt.loc = @2; Compiler_Warning(C89_DECL_WARNING); $$ = $1; ListAdd($1, stmt); /*declMode = defaultDeclMode;*/ }
3504 | statement_list_error declaration { Statement stmt = MkBadDeclStmt($2); stmt.loc = @2; Compiler_Warning(C89_DECL_WARNING); $$ = $1; ListAdd($1, stmt); /*declMode = defaultDeclMode;*/ }
3505 | statement_list declaration_error { Statement stmt = MkBadDeclStmt($2); stmt.loc = @2; Compiler_Warning(C89_DECL_WARNING); $$ = $1; ListAdd($1, stmt); /*declMode = defaultDeclMode;*/ }
3506 | statement_list_error declaration_error { Statement stmt = MkBadDeclStmt($2); stmt.loc = @2; Compiler_Warning(C89_DECL_WARNING); $$ = $1; ListAdd($1, stmt); /*declMode = defaultDeclMode;*/ }
3510 statement_list { $$ = MkCompoundStmt(null, $1); }
3511 | declaration_list { $$ = MkCompoundStmt($1, null); }
3512 | declaration_list statement_list { $$ = MkCompoundStmt($1, $2); }
3513 | declaration_list_error statement_list { $$ = MkCompoundStmt($1, $2); }
3516 compound_inside_error:
3517 statement_list_error { $$ = MkCompoundStmt(null, $1); }
3518 | declaration_list_error { $$ = MkCompoundStmt($1, null); }
3519 | declaration_list statement_list_error { $$ = MkCompoundStmt($1, $2); }
3520 | declaration_list_error statement_list_error { $$ = MkCompoundStmt($1, $2); }
3524 '{' { $<context>$ = PushContext(); }
3528 compound_statement_error '}' { $$ = $1; $$.loc = @$; }
3531 compound_statement_error:
3532 compound_start compound_inside_error
3533 { $$ = $2; $$.compound.context = $<context>1; PopContext($<context>1); $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++; }
3535 { $$ = MkCompoundStmt(null, null); $$.compound.context = $<context>1; PopContext($<context>1); $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++; }
3537 | compound_start compound_inside
3538 { $$ = $2; $$.compound.context = $<context>1; PopContext($<context>1); $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++; }
3542 expression_statement:
3543 ';' { $$ = MkExpressionStmt(null); $$.loc = @$; }
3544 | expression ';' { $$ = MkExpressionStmt($1); $$.loc = @$; }
3545 | expression_error ';' { $$ = MkExpressionStmt($1); $$.loc = @$; }
3548 selection_statement:
3549 IF '(' expression ')' statement %prec IFX { $$ = MkIfStmt($3, $5, null); $$.loc = @$; }
3550 | IF '(' expression_error ')' statement %prec IFX { $$ = MkIfStmt($3, $5, null); $$.loc = @$; }
3551 | IF '(' expression ')' statement ELSE statement { $$ = MkIfStmt($3, $5, $7); $$.loc = @$; }
3552 | IF '(' expression_error ')' statement ELSE statement { $$ = MkIfStmt($3, $5, $7); $$.loc = @$; }
3553 | SWITCH '(' expression ')' statement { $$ = MkSwitchStmt($3, $5); $$.loc = @$; }
3554 | SWITCH '(' expression_error ')' statement { $$ = MkSwitchStmt($3, $5); $$.loc = @$; }
3557 selection_statement_error:
3558 IF '(' expression_error { $$ = MkIfStmt($3, null, null); $$.loc = @$; }
3559 | selection_statement error
3562 iteration_statement:
3563 WHILE '(' expression ')' statement { $$ = MkWhileStmt($3, $5); $$.loc = @$; }
3564 | WHILE '(' expression_error statement { $$ = MkWhileStmt($3, $4); $$.loc = @$; }
3565 | WHILE '(' ')' statement { yyerror(); $$ = MkWhileStmt(null, $4); $$.loc = @$; }
3567 | DO statement WHILE '(' expression ')' ';' { $$ = MkDoWhileStmt($2, $5); $$.loc = @$; }
3568 | DO statement WHILE '(' expression_error ';' { $$ = MkDoWhileStmt($2, $5); $$.loc = @$; }
3570 | FOR '(' expression_statement expression_statement ')' statement { $$ = MkForStmt($3, $4, null, $6); $$.loc = @$; }
3571 | FOR '(' expression_statement ')' statement { yyerror(); $$ = MkForStmt($3, null, null, $5); $$.loc = @$; }
3572 | FOR '(' expression_statement expression_statement expression ')' statement { $$ = MkForStmt($3, $4, $5, $7); $$.loc = @$; }
3573 | FOR '(' expression_statement expression_statement expression_error statement { $$ = MkForStmt($3, $4, $5, $6 ); $$.loc = @$; }
3574 | FOR '(' ')' statement { yyerror(); $$ = MkForStmt(null, null, null, $4); $$.loc = @$; }
3576 | FOR '(' identifier ':' expression ')' statement { $$ = MkForEachStmt($3, $5, null, $7); $$.loc = @$; }
3577 | FOR '(' identifier ':' expression ';' expression ')' statement { $$ = MkForEachStmt($3, $5, $7, $9); $$.loc = @$; }
3580 iteration_statement_error:
3581 FOR '(' error { $$ = MkForStmt(null, null, null, null); $$.loc = @$; } |
3582 FOR '(' expression_error error { $$ = MkForStmt(MkExpressionStmt($3), null, null, null); $$.forStmt.init.loc = @3; $$.loc = @$; } |
3583 FOR '(' expression_statement error { $$ = MkForStmt($3, null, null, null); $$.loc = @$; } |
3584 FOR '(' expression_statement expression_error error { $$ = MkForStmt($3, MkExpressionStmt($4), null, null); $$.loc = @$; $$.forStmt.check.loc = @4; } |
3585 /* Useless rules due to conflicts
3586 FOR '(' expression_statement expression_statement error { $$ = MkForStmt($3, $4, null, null); $$.loc = @$; } |
3588 FOR '(' expression_statement expression_statement expression_error { $$ = MkForStmt($3, $4, $5, null); $$.loc = @$; } |
3589 FOR '(' expression_statement expression_statement ')' statement_error { $$ = MkForStmt($3, $4, null, $6); $$.loc = @$; } |
3590 FOR '(' expression_statement expression_statement expression ')' statement_error { $$ = MkForStmt($3, $4, $5, $7); $$.loc = @$; } |
3591 FOR '(' expression_statement expression_statement expression_error statement_error { $$ = MkForStmt($3, $4, $5, $6 ); $$.loc = @$; } |
3593 DO statement WHILE '(' expression ')' { yyerror(); $$ = MkDoWhileStmt($2, $5); $$.loc = @$; } |
3594 DO statement WHILE '(' expression { yyerror(); $$ = MkDoWhileStmt($2, $5); $$.loc = @$; } |
3595 DO statement WHILE '(' expression_error { $$ = MkDoWhileStmt($2, $5); $$.loc = @$; } |
3596 DO statement WHILE '(' { $$ = MkDoWhileStmt($2, null); $$.loc = @$; } |
3597 DO statement WHILE { yyerror(); $$ = MkDoWhileStmt($2, null); $$.loc = @$; } |
3598 DO statement { yyerror(); $$ = MkDoWhileStmt($2, null); $$.loc = @$; } |
3599 DO { yyerror(); $$ = MkDoWhileStmt(null, null); $$.loc = @$; } |
3602 WHILE error { $$ = MkWhileStmt(null, null); $$.loc = @$; } |
3603 /* Useless rules due to conflicts
3604 WHILE '(' error { $$ = MkWhileStmt(null, null); $$.loc = @$; } |
3606 WHILE '(' ')' error { $$ = MkWhileStmt(null, null); $$.loc = @$; } |
3607 WHILE '(' expression_error { $$ = MkWhileStmt($3, null); $$.loc = @$; } |
3608 /* Useless rules due to conflicts
3609 WHILE '(' expression_error error { $$ = MkWhileStmt($3, null); $$.loc = @$; } |
3611 WHILE '(' expression ')' statement_error { $$ = MkWhileStmt($3, $5); $$.loc = @$; } |
3612 WHILE '(' expression_error statement_error { $$ = MkWhileStmt($3, $4 ); $$.loc = @$; }
3616 GOTO identifier ';' { $$ = MkGotoStmt($2); $$.loc = @$; }
3617 | CONTINUE ';' { $$ = MkContinueStmt(); $$.loc = @$; }
3618 | BREAK ';' { $$ = MkBreakStmt(); $$.loc = @$; }
3619 | RETURN ';' { Expression exp = MkExpDummy(); $$ = MkReturnStmt(MkListOne(exp)); $$.loc = @$; exp.loc = @2; }
3620 | RETURN expression ';' { $$ = MkReturnStmt($2); $$.loc = @$; }
3621 | RETURN expression_error ';' { $$ = MkReturnStmt($2); $$.loc = @$; }
3622 | RETURN anon_instantiation_expression ';' { $$ = MkReturnStmt(MkListOne($2)); $$.loc = @$; }
3623 | RETURN anon_instantiation_expression_error ';' { $$ = MkReturnStmt(MkListOne($2)); $$.loc = @$; }
3626 jump_statement_error:
3627 RETURN expression_error { $$ = MkReturnStmt($2); $$.loc = @$; } |
3628 RETURN anon_instantiation_expression_error { $$ = MkReturnStmt(MkListOne($2)); $$.loc = @$; } |
3629 RETURN { Expression exp = MkExpDummy(); $$ = MkReturnStmt(MkListOne(exp)); $$.loc = @$; exp.loc.start = exp.loc.end = @1.end; } |
3630 GOTO { $$ = MkGotoStmt(null); $$.loc = @$; }
3633 /*************************************************************************************/
3635 function_definition:
3636 external_guess_declaration_specifiers declarator_function declaration_list compound_statement { $$ = MkFunction($1, $2, $3); ProcessFunctionBody($$, $4); $$.loc = @$; }
3637 | external_guess_declaration_specifiers declarator_function compound_statement
3638 { $$ = MkFunction($1, $2, null); ProcessFunctionBody($$, $3); $$.loc = @$; }
3639 | external_guess_declaration_specifiers declarator_function_type_ok declaration_list compound_statement { $$ = MkFunction($1, $2, $3); ProcessFunctionBody($$, $4); $$.loc = @$; }
3640 | external_guess_declaration_specifiers declarator_function_type_ok compound_statement
3641 { $$ = MkFunction($1, $2, null); ProcessFunctionBody($$, $3); $$.loc = @$; }
3643 | declarator_function declaration_list compound_statement { $$ = MkFunction(null, $1, $2); ProcessFunctionBody($$, $3); $$.loc = @$; }
3644 | declarator_function compound_statement { $$ = MkFunction(null, $1, null); ProcessFunctionBody($$, $2); $$.loc = @$;}
3646 function_definition_error:
3647 external_guess_declaration_specifiers declarator_function declaration_list compound_statement_error { $$ = MkFunction($1, $2, $3); ProcessFunctionBody($$, $4); $$.loc = @$; $$.loc.end = $4.loc.end; }
3648 | external_guess_declaration_specifiers declarator_function compound_statement_error { $$ = MkFunction($1, $2, null); ProcessFunctionBody($$, $3); $$.loc = @$; $$.loc.end = $3.loc.end; }
3649 | 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; }
3650 | external_guess_declaration_specifiers declarator_function_type_ok compound_statement_error { $$ = MkFunction($1, $2, null); ProcessFunctionBody($$, $3); $$.loc = @$; $$.loc.end = $3.loc.end; }
3651 | declarator_function declaration_list compound_statement_error { $$ = MkFunction(null, $1, $2); ProcessFunctionBody($$, $3); $$.loc = @$; $$.loc.end = $3.loc.end; }
3652 | declarator_function compound_statement_error { $$ = MkFunction(null, $1, null); ProcessFunctionBody($$, $2); $$.loc = @$; $$.loc.end = $2.loc.end; }
3656 STRING_LITERAL { $$ = CopyString(yytext); }
3657 | string_literal STRING_LITERAL
3659 int len1 = strlen($1);
3660 int len2 = strlen(yytext);
3661 $$ = new byte[len1-1 + len2-1 + 1];
3662 memcpy($$, $1, len1-1);
3663 memcpy($$ + len1-1, yytext+1, len2);
3668 external_declaration:
3669 function_definition { $$ = MkExternalFunction($1); $$.loc = @$; $1.declMode = declMode; structDeclMode = declMode = defaultDeclMode; }
3671 { $$ = MkExternalClass($1); $$.loc = @$; $1.declMode = (declMode != defaultAccess) ? declMode : privateAccess; structDeclMode = declMode = defaultDeclMode; }
3673 | external_guess_declaration_specifiers class
3674 { $$ = MkExternalClass($2); $$.loc = @$; $2.declMode = (declMode != defaultAccess) ? declMode : privateAccess; structDeclMode = declMode = defaultDeclMode; FreeList($1, FreeSpecifier); }
3676 | external_guess_declaration
3677 { $$ = MkExternalDeclaration($1); $$.loc = @$; $1.declMode = declMode; structDeclMode = declMode = defaultDeclMode; }
3678 | IMPORT string_literal { $$ = MkExternalImport($2, normalImport, (declMode != defaultAccess) ? declMode : privateAccess); $$.loc = @$; }
3679 | IMPORT STATIC string_literal { $$ = MkExternalImport($3, staticImport, (declMode != defaultAccess) ? declMode : privateAccess); $$.loc = @$; }
3680 | IMPORT identifier string_literal
3682 bool isRemote = !strcmp($2.string, "remote");
3683 $$ = MkExternalImport($3, isRemote ? remoteImport : normalImport, (declMode != defaultAccess) ? declMode : privateAccess);
3690 | ';' { $$ = null; }
3692 | declaration_mode function_definition { $$ = MkExternalFunction($2); $$.loc = @$; $2.declMode = $1; structDeclMode = declMode = defaultDeclMode; }
3693 | declaration_mode class
3694 { $$ = MkExternalClass($2); $$.loc = @$; $2.declMode = ($1 != defaultAccess) ? $1 : privateAccess; structDeclMode = declMode = defaultDeclMode; }
3695 | declaration_mode external_guess_declaration { $$ = MkExternalDeclaration($2); $$.loc = @$; $2.declMode = $1; structDeclMode = declMode = defaultDeclMode; }
3696 | declaration_mode IMPORT string_literal { $$ = MkExternalImport($3, normalImport, ($1 != defaultAccess) ? $1 : privateAccess); $$.loc = @$; structDeclMode = declMode = defaultDeclMode; }
3697 | declaration_mode IMPORT STATIC string_literal { $$ = MkExternalImport($4, staticImport, ($1 != defaultAccess) ? $1 : privateAccess); $$.loc = @$; structDeclMode = declMode = defaultDeclMode; }
3698 | declaration_mode IMPORT identifier string_literal
3700 bool isRemote = !strcmp($3.string, "remote");
3701 $$ = MkExternalImport($4, isRemote ? remoteImport : normalImport, ($1 != defaultAccess) ? $1 : privateAccess);
3704 structDeclMode = declMode = defaultDeclMode;
3708 | declaration_mode ':' { defaultDeclMode = $1; $$ = null; }
3709 | STATIC ':' { defaultDeclMode = staticAccess; $$ = null; }
3710 | NAMESPACE identifier { $$ = MkExternalNameSpace($2); $$.loc = @$; }
3711 | NAMESPACE strict_type { $$ = MkExternalNameSpace(MkIdentifier($2.name)); FreeSpecifier($2); $$.loc = @$; }
3712 | dbtable_definition { $$ = MkExternalDBTable($1); $$.loc = @$; $1.declMode = (declMode != defaultAccess) ? declMode : privateAccess; structDeclMode = declMode = defaultDeclMode; }
3713 | declaration_mode dbtable_definition { $$ = MkExternalDBTable($2); $$.loc = @$; $2.declMode = ($1 != defaultAccess) ? declMode : privateAccess; structDeclMode = declMode = defaultDeclMode; }
3716 external_declaration_error:
3717 class_error { yyerror(); $$ = MkExternalClass($1); $$.loc = $1.loc; $1.declMode = (declMode != defaultAccess) ? declMode : privateAccess; structDeclMode = declMode = defaultDeclMode; }
3718 | external_guess_declaration_specifiers class_error
3721 FreeList($1, FreeSpecifier);
3722 $$ = MkExternalClass($2);
3724 $2.declMode = (declMode != defaultAccess) ? declMode : privateAccess;
3725 structDeclMode = declMode = defaultDeclMode;
3727 | function_definition_error { yyerror(); $$ = MkExternalFunction($1); $$.loc = $1.loc; $1.declMode = declMode; structDeclMode = declMode = defaultDeclMode; }
3729 | declaration_mode class_error { yyerror(); $$ = MkExternalClass($2); $$.loc = $2.loc; $2.declMode = ($1 != defaultAccess) ? $1 : privateAccess; structDeclMode = declMode = defaultDeclMode; }
3730 | declaration_mode function_definition_error { yyerror(); $$ = MkExternalFunction($2); $$.loc = $2.loc; $2.declMode = $1; structDeclMode = declMode = defaultDeclMode; }
3732 | external_guess_declaration_error
3733 { yyerror(); $$ = MkExternalDeclaration($1); $$.loc = @$; $1.declMode = declMode; structDeclMode = declMode = defaultDeclMode; }
3734 | declaration_mode external_guess_declaration_error { yyerror(); $$ = MkExternalDeclaration($2); $$.loc = @$; $2.declMode = $1; structDeclMode = declMode = defaultDeclMode; }
3737 translation_unit_error:
3738 external_declaration_error { $$ = MkList(); ListAdd($$, $1); ast = $$; }
3739 | translation_unit external_declaration_error { $$ = $1; ListAdd($1, $2); }
3740 | translation_unit_error external_declaration_error { $$ = $1; ListAdd($1, $2); }
3741 | translation_unit error
3742 | translation_unit_error error
3746 external_declaration { $$ = MkList(); ListAdd($$, $1); ast = $$; }
3747 | translation_unit external_declaration { $$ = $1; ListAdd($1, $2); }
3748 | translation_unit_error class
3749 { External _class = MkExternalClass($2); $$ = $1; ListAdd($1, _class); _class.loc = @2; $2.declMode = (declMode != defaultAccess) ? declMode : privateAccess; structDeclMode = declMode = defaultDeclMode; }
3750 | translation_unit_error declaration_mode class
3751 { External _class = MkExternalClass($3); $$ = $1; ListAdd($1, _class); _class.loc = @3; $3.declMode = ($2 != defaultAccess) ? $2 : privateAccess; structDeclMode = declMode = defaultDeclMode; }
3756 | translation_unit_error
3757 | { ast = MkList(); }
3761 DBTABLE string_literal identifier '{' dbfield_definition_list '}' { Symbol symbol = DeclClassAddNameSpace(globalContext.nextID++, $3.string); FreeIdentifier($3); $$ = MkDBTableDef($2, symbol, $5); }
3762 | DBTABLE string_literal strict_type '{' dbfield_definition_list '}' { Symbol symbol = DeclClass(globalContext.nextID++, $3.name); FreeSpecifier($3); $$ = MkDBTableDef($2, symbol, $5); }
3763 | DBTABLE string_literal '{' dbfield_definition_list '}' { $$ = MkDBTableDef($2, null, $4); }
3767 guess_declaration_specifiers identifier string_literal ';' { $$ = MkDBFieldEntry(MkTypeName($1, null), $2, $3); }
3771 identifier { $$ = MkDBIndexItem($1, ascending); }
3772 | '>' identifier { $$ = MkDBIndexItem($2, descending); }
3773 | '<' identifier { $$ = MkDBIndexItem($2, ascending); }
3777 dbindex_item { $$ = MkList(); ListAdd($$, $1); }
3778 | dbindex_item_list ',' dbindex_item { ListAdd($1, $3); }
3782 DBINDEX dbindex_item_list ';' { $$ = MkDBIndexEntry($2, null); }
3783 | DBINDEX dbindex_item_list identifier ';' { $$ = MkDBIndexEntry($2, $3); }
3786 dbfield_definition_list:
3787 dbfield_entry { $$ = MkList(); ListAdd($$, $1); }
3788 | dbindex_entry { $$ = MkList(); ListAdd($$, $1); }
3789 | dbfield_definition_list dbfield_entry { ListAdd($1, $2); }
3790 | dbfield_definition_list dbindex_entry { ListAdd($1, $2); }
3794 DATABASE_OPEN '(' assignment_expression ',' assignment_expression ')' { $$ = MkExpDBOpen($3, $5); }
3798 DBFIELD '(' string_literal ',' identifier ')' { $$ = MkExpDBField($3, $5); }
3802 DBINDEX '(' string_literal ',' identifier ')' { $$ = MkExpDBIndex($3, $5); }
3806 DBTABLE '(' string_literal ')' { $$ = MkExpDBTable($3); }