From 35d53d0d77fb84218c6b29e58ba00eb4a66bdc00 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Tue, 8 Feb 2011 08:20:32 +0900 Subject: [PATCH] Fix typedefs and class names once and for all. I suspect Holub did them that way as a teaching exercise :P --- tools/qfcc/source/qc-parse.y | 41 +++++++++--------------------------- 1 file changed, 10 insertions(+), 31 deletions(-) diff --git a/tools/qfcc/source/qc-parse.y b/tools/qfcc/source/qc-parse.y index abc77420f..5917a515f 100644 --- a/tools/qfcc/source/qc-parse.y +++ b/tools/qfcc/source/qc-parse.y @@ -154,7 +154,7 @@ int yylex (void); %type optional_specifiers specifiers local_specifiers %type storage_class %type type_specifier type_specifier_or_storage_class -%type type_name_or_class_name type +%type type %type function_params var_list param_declaration %type var_decl function_decl @@ -388,30 +388,13 @@ storage_class ; optional_specifiers - : storage_class type_name_or_class_name - { - $$ = make_spec ($2.type, current_storage, 0, 0); - $$ = spec_merge ($1, $$); - } - | type_name_or_class_name - | specifiers + : specifiers | /* empty */ { $$ = make_spec (0, current_storage, 0, 0); } ; -type_name_or_class_name - : TYPE_NAME - { - $$ = make_spec ($1->type, current_storage, 0, 0); - } - | CLASS_NAME - { - $$ = make_spec ($1->type, current_storage, 0, 0); - } - ; - specifiers : type_specifier_or_storage_class | specifiers type_specifier_or_storage_class @@ -437,6 +420,14 @@ type_specifier } | enum_specifier | struct_specifier + | TYPE_NAME + { + $$ = make_spec ($1->type, current_storage, 0, 0); + } + | CLASS_NAME + { + $$ = make_spec ($1->type, current_storage, 0, 0); + } // NOTE: fields don't parse the way they should | '.' type_specifier { @@ -541,7 +532,6 @@ struct_defs struct_def : type struct_decl_list - | type_name_or_class_name struct_decl_list | type ; @@ -644,11 +634,6 @@ param_declaration $2->type = find_type (append_type ($2->type, $1.type)); $$ = new_param (0, $2->type, $2->name); } - | type_name_or_class_name var_decl - { - $2->type = find_type (append_type ($2->type, $1.type)); - $$ = new_param (0, $2->type, $2->name); - } | abstract_decl { $$ = new_param (0, $1->type, 0); } | ELLIPSIS { $$ = new_param (0, 0, 0); } ; @@ -659,11 +644,6 @@ abstract_decl $$ = $2; $$->type = find_type (append_type ($$->type, $1.type)); } - | type_name_or_class_name abs_decl - { - $$ = $2; - $$->type = find_type (append_type ($$->type, $1.type)); - } ; //FIXME type construction is inside-out @@ -1415,7 +1395,6 @@ ivar_decls ivar_decl : type ivars - | type_name_or_class_name ivars {} ; ivars