Mercurial > hg > octave-lyh
changeset 3903:1dbe160ea0d1
[project @ 2002-04-23 03:40:25 by jwe]
author | jwe |
---|---|
date | Tue, 23 Apr 2002 03:40:25 +0000 |
parents | 3aa0e187901c |
children | 6b00ac653c0f |
files | src/ChangeLog src/parse.y |
diffstat | 2 files changed, 27 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,11 @@ +2002-04-22 John W. Eaton <jwe@bevo.che.wisc.edu> + + * parse.y (save_symtab): New non-terminal. Save current symbol + table context here. + (function_beg): Use it. + (symtab_context): New file-scope variable. + (recover_from_parsing_function): Restore symbol table context here. + 2002-04-17 John W. Eaton <jwe@bevo.che.wisc.edu> * load-save.cc (get_lines_and_columns): Handle CRLF as line
--- a/src/parse.y +++ b/src/parse.y @@ -127,6 +127,9 @@ // an eval() statement. bool evaluating_function_body = false; +// Keep track of symbol table information when parsing functions. +static symbol_table *symtab_context = 0; + // Forward declarations for some functions defined at the bottom of // the file. @@ -1049,6 +1052,15 @@ // Some `subroutines' for function definitions // =========================================== +save_symtab : // empty + { + if (symtab_context) + panic_impossible (); + + symtab_context = curr_sym_tab; + } + ; + global_symtab : // empty { curr_sym_tab = global_sym_tab; } ; @@ -1173,8 +1185,8 @@ // Function definition // =================== -function_beg : FCN stash_comment global_symtab - { $$ = $2; } +function_beg : save_symtab FCN stash_comment global_symtab + { $$ = $3; } ; function : function_beg function2 @@ -2538,7 +2550,11 @@ static void recover_from_parsing_function (void) { - curr_sym_tab = top_level_sym_tab; + if (! symtab_context) + panic_impossible (); + + curr_sym_tab = symtab_context; + symtab_context = 0; lexer_flags.defining_func = false; lexer_flags.beginning_of_function = false;