Mercurial > octave-libgccjit
comparison libinterp/parse-tree/oct-parse.in.yy @ 16277:8cb65fd72164
eliminate obsolete concepts of "pending local" and "forced" variables
* symtab.h, lexh, lex.ll, oct-parse.in.yy, toplev.cc, input.cc:
Delete unused functions and data for handling pending local and forced
variables in the parser and lexer.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Mon, 11 Mar 2013 15:01:32 -0400 |
parents | c5e5f6ccac5d |
children | ea78011f66bf 8c17cd370477 |
comparison
equal
deleted
inserted
replaced
16275:dd7de0345124 | 16277:8cb65fd72164 |
---|---|
425 | string | 425 | string |
426 { $$ = $1; } | 426 { $$ = $1; } |
427 ; | 427 ; |
428 | 428 |
429 matrix : '[' ']' | 429 matrix : '[' ']' |
430 { | 430 { $$ = new tree_constant (octave_null_matrix::instance); } |
431 $$ = new tree_constant (octave_null_matrix::instance); | |
432 curr_lexer->pending_local_variables.clear (); | |
433 } | |
434 | '[' ';' ']' | 431 | '[' ';' ']' |
435 { | 432 { $$ = new tree_constant (octave_null_matrix::instance); } |
436 $$ = new tree_constant (octave_null_matrix::instance); | |
437 curr_lexer->pending_local_variables.clear (); | |
438 } | |
439 | '[' ',' ']' | 433 | '[' ',' ']' |
440 { | 434 { $$ = new tree_constant (octave_null_matrix::instance); } |
441 $$ = new tree_constant (octave_null_matrix::instance); | |
442 curr_lexer->pending_local_variables.clear (); | |
443 } | |
444 | '[' matrix_rows ']' | 435 | '[' matrix_rows ']' |
445 { | 436 { $$ = curr_parser.finish_matrix ($2); } |
446 $$ = curr_parser.finish_matrix ($2); | |
447 curr_lexer->pending_local_variables.clear (); | |
448 } | |
449 ; | 437 ; |
450 | 438 |
451 matrix_rows : matrix_rows1 | 439 matrix_rows : matrix_rows1 |
452 { $$ = $1; } | 440 { $$ = $1; } |
453 | matrix_rows1 ';' // Ignore trailing semicolon. | 441 | matrix_rows1 ';' // Ignore trailing semicolon. |
670 assign_lhs : simple_expr | 658 assign_lhs : simple_expr |
671 { | 659 { |
672 $$ = curr_parser.validate_matrix_for_assignment ($1); | 660 $$ = curr_parser.validate_matrix_for_assignment ($1); |
673 | 661 |
674 if ($$) | 662 if ($$) |
675 { | 663 { curr_lexer->looking_at_matrix_or_assign_lhs = false; } |
676 curr_lexer->looking_at_matrix_or_assign_lhs = false; | |
677 curr_lexer->pending_local_variables.clear (); | |
678 } | |
679 else | 664 else |
680 { | 665 { |
681 // validate_matrix_for_assignment deleted $1 | 666 // validate_matrix_for_assignment deleted $1. |
682 // for us. | |
683 ABORT_PARSE; | 667 ABORT_PARSE; |
684 } | 668 } |
685 } | 669 } |
686 ; | 670 ; |
687 | 671 |
2579 octave_time now; | 2563 octave_time now; |
2580 | 2564 |
2581 script->stash_fcn_file_time (now); | 2565 script->stash_fcn_file_time (now); |
2582 | 2566 |
2583 primary_fcn_ptr = script; | 2567 primary_fcn_ptr = script; |
2584 | |
2585 // Unmark any symbols that may have been tagged as local variables | |
2586 // while parsing (for example, by force_local_variable in lex.l). | |
2587 | |
2588 symbol_table::unmark_forced_variables (); | |
2589 } | 2568 } |
2590 | 2569 |
2591 // Begin defining a function. | 2570 // Begin defining a function. |
2592 | 2571 |
2593 octave_user_function * | 2572 octave_user_function * |
2784 // parse_fcn_file, and | 2763 // parse_fcn_file, and |
2785 // symbol_table::fcn_info::fcn_info_rep::find_user_function). | 2764 // symbol_table::fcn_info::fcn_info_rep::find_user_function). |
2786 | 2765 |
2787 retval = new tree_function_def (fcn); | 2766 retval = new tree_function_def (fcn); |
2788 } | 2767 } |
2789 | |
2790 // Unmark any symbols that may have been tagged as local | |
2791 // variables while parsing (for example, by force_local_variable | |
2792 // in lex.l). | |
2793 | |
2794 symbol_table::unmark_forced_variables (fcn->scope ()); | |
2795 } | 2768 } |
2796 | 2769 |
2797 return retval; | 2770 return retval; |
2798 } | 2771 } |
2799 | 2772 |
3234 octave_parser curr_parser (ffile); | 3207 octave_parser curr_parser (ffile); |
3235 | 3208 |
3236 curr_parser.curr_class_name = dispatch_type; | 3209 curr_parser.curr_class_name = dispatch_type; |
3237 curr_parser.autoloading = autoload; | 3210 curr_parser.autoloading = autoload; |
3238 curr_parser.fcn_file_from_relative_lookup = relative_lookup; | 3211 curr_parser.fcn_file_from_relative_lookup = relative_lookup; |
3239 | |
3240 // Do this with an unwind-protect cleanup function so that | |
3241 // the forced variables will be unmarked in the event of an | |
3242 // interrupt. | |
3243 symbol_table::scope_id scope = symbol_table::top_scope (); | |
3244 frame.add_fcn (symbol_table::unmark_forced_variables, scope); | |
3245 | 3212 |
3246 curr_parser.curr_lexer->force_script = force_script; | 3213 curr_parser.curr_lexer->force_script = force_script; |
3247 curr_parser.curr_lexer->prep_for_file (); | 3214 curr_parser.curr_lexer->prep_for_file (); |
3248 curr_parser.curr_lexer->parsing_class_method = ! dispatch_type.empty (); | 3215 curr_parser.curr_lexer->parsing_class_method = ! dispatch_type.empty (); |
3249 | 3216 |
3937 | 3904 |
3938 do | 3905 do |
3939 { | 3906 { |
3940 curr_parser.reset (); | 3907 curr_parser.reset (); |
3941 | 3908 |
3942 // Do this with an unwind-protect cleanup function so that the | |
3943 // forced variables will be unmarked in the event of an | |
3944 // interrupt. | |
3945 symbol_table::scope_id scope = symbol_table::top_scope (); | |
3946 frame.add_fcn (symbol_table::unmark_forced_variables, scope); | |
3947 | |
3948 parse_status = curr_parser.run (); | 3909 parse_status = curr_parser.run (); |
3949 | 3910 |
3950 // Unmark forced variables. | 3911 // Unmark forced variables. |
3951 frame.run (1); | 3912 frame.run (1); |
3952 | 3913 |