comparison libinterp/parse-tree/lex.ll @ 17355:f0edd6c752e9

don't convert "end" token to "__end__" for indexing * lex.ll (octave_base_lexer::handle_identifier): Don't translate "end" to "__end__". * pt-arg-list.cc (Fend): Rename from F__end__. * pt-id.h (tree_identifier::has_magic_end): Recognize "end" instead of "__end__". * pt-idx.cc: Refer to "end" in comment instead of "__end__". * variables.cc (symbol_exist): Return early if keyword is found. * resource-manager.cc (resource_manager::octave_keywords): Delete __end__ from the list.
author John W. Eaton <jwe@octave.org>
date Wed, 28 Aug 2013 23:00:42 -0400
parents 6470a113eae2
children c702371ff6df efbe746f8fa8
comparison
equal deleted inserted replaced
17354:040752d07240 17355:f0edd6c752e9
2721 // The call to is_keyword_token set at_beginning_of_statement. 2721 // The call to is_keyword_token set at_beginning_of_statement.
2722 2722
2723 return kw_token; 2723 return kw_token;
2724 } 2724 }
2725 2725
2726 // Find the token in the symbol table. Beware the magic 2726 // Find the token in the symbol table.
2727 // transformation of the end keyword...
2728
2729 if (tok == "end")
2730 tok = "__end__";
2731 2727
2732 symbol_table::scope_id sid = symtab_context.curr_scope (); 2728 symbol_table::scope_id sid = symtab_context.curr_scope ();
2733 2729
2734 token *tok_val = new token (NAME, &(symbol_table::insert (tok, sid)), 2730 token *tok_val = new token (NAME, &(symbol_table::insert (tok, sid)),
2735 input_line_number, current_input_column); 2731 input_line_number, current_input_column);
2752 2748
2753 push_token (tok_val); 2749 push_token (tok_val);
2754 2750
2755 current_input_column += flex_yyleng (); 2751 current_input_column += flex_yyleng ();
2756 2752
2757 if (tok != "__end__") 2753 // The magic end index can't be indexed.
2754
2755 if (tok != "end")
2758 looking_for_object_index = true; 2756 looking_for_object_index = true;
2759 2757
2760 at_beginning_of_statement = false; 2758 at_beginning_of_statement = false;
2761 2759
2762 return NAME; 2760 return NAME;