comparison src/parse.y @ 4009:27e461aed956

[project @ 2002-07-31 09:33:03 by jwe]
author jwe
date Wed, 31 Jul 2002 09:33:09 +0000
parents 826092b5665e
children a8621d87fbf5
comparison
equal deleted inserted replaced
4008:a0e323e959cd 4009:27e461aed956
1068 1068
1069 symtab_context = curr_sym_tab; 1069 symtab_context = curr_sym_tab;
1070 } 1070 }
1071 ; 1071 ;
1072 1072
1073 global_symtab : // empty 1073 function_symtab : // empty
1074 { curr_sym_tab = global_sym_tab; } 1074 { curr_sym_tab = fbi_sym_tab; }
1075 ; 1075 ;
1076 1076
1077 local_symtab : // empty 1077 local_symtab : // empty
1078 { curr_sym_tab = tmp_local_sym_tab; } 1078 { curr_sym_tab = tmp_local_sym_tab; }
1079 ; 1079 ;
1185 $1->append ($3); 1185 $1->append ($3);
1186 $$ = $1; 1186 $$ = $1;
1187 } 1187 }
1188 ; 1188 ;
1189 1189
1190 return_list_end : global_symtab ']' 1190 return_list_end : function_symtab ']'
1191 ; 1191 ;
1192 1192
1193 // =================== 1193 // ===================
1194 // Function definition 1194 // Function definition
1195 // =================== 1195 // ===================
1196 1196
1197 function_beg : save_symtab FCN stash_comment global_symtab 1197 function_beg : save_symtab FCN stash_comment function_symtab
1198 { $$ = $3; } 1198 { $$ = $3; }
1199 ; 1199 ;
1200 1200
1201 function : function_beg function2 1201 function : function_beg function2
1202 { 1202 {
1216 recover_from_parsing_function (); 1216 recover_from_parsing_function ();
1217 $$ = 0; 1217 $$ = 0;
1218 } 1218 }
1219 ; 1219 ;
1220 1220
1221 function1 : global_symtab '=' function2 1221 function1 : function_symtab '=' function2
1222 { $$ = $3; } 1222 { $$ = $3; }
1223 ; 1223 ;
1224 1224
1225 function2 : identifier local_symtab parsed_fcn_name function3 1225 function2 : identifier local_symtab parsed_fcn_name function3
1226 { 1226 {
2476 { 2476 {
2477 if (Vwarn_function_name_clash) 2477 if (Vwarn_function_name_clash)
2478 warning ("function name `%s' does not agree with function\ 2478 warning ("function name `%s' does not agree with function\
2479 file name `%s'", id_name.c_str (), curr_fcn_file_full_name.c_str ()); 2479 file name `%s'", id_name.c_str (), curr_fcn_file_full_name.c_str ());
2480 2480
2481 global_sym_tab->rename (id_name, curr_fcn_file_name); 2481 fbi_sym_tab->rename (id_name, curr_fcn_file_name);
2482 2482
2483 if (error_state) 2483 if (error_state)
2484 return 0; 2484 return 0;
2485 2485
2486 id_name = id->name (); 2486 id_name = id->name ();
2511 id_name.c_str (), curr_fcn_file_full_name.c_str ()); 2511 id_name.c_str (), curr_fcn_file_full_name.c_str ());
2512 } 2512 }
2513 2513
2514 top_level_sym_tab->clear (id_name); 2514 top_level_sym_tab->clear (id_name);
2515 2515
2516 symbol_record *sr = global_sym_tab->lookup (id_name); 2516 symbol_record *sr = fbi_sym_tab->lookup (id_name);
2517 2517
2518 if (sr) 2518 if (sr)
2519 fcn->stash_symtab_ptr (sr); 2519 fcn->stash_symtab_ptr (sr);
2520 else 2520 else
2521 panic_impossible (); 2521 panic_impossible ();
3222 3222
3223 if (status != 0) 3223 if (status != 0)
3224 { 3224 {
3225 error ("parse error while reading function file %s", 3225 error ("parse error while reading function file %s",
3226 ff.c_str ()); 3226 ff.c_str ());
3227 global_sym_tab->clear (curr_fcn_file_name); 3227 fbi_sym_tab->clear (curr_fcn_file_name);
3228 } 3228 }
3229 } 3229 }
3230 else if (exec_script) 3230 else if (exec_script)
3231 { 3231 {
3232 // The value of `reading_fcn_file' will be restored to the 3232 // The value of `reading_fcn_file' will be restored to the