# HG changeset patch # User John W. Eaton # Date 1363026716 14400 # Node ID 3b0381ea8737e24b56fd21d53bdbd1261b9b30df # Parent dbbef00202ff3ecf74cc2640bb20e73c2138b7b5# Parent 488b0fef52c55e827c20cc11801d06c719417b9a maint: periodic merge of default to classdef diff -r dbbef00202ff -r 3b0381ea8737 libinterp/parse-tree/lex.ll --- a/libinterp/parse-tree/lex.ll Mon Mar 11 14:31:19 2013 -0400 +++ b/libinterp/parse-tree/lex.ll Mon Mar 11 14:31:56 2013 -0400 @@ -1505,22 +1505,6 @@ return false; } -// Given information about the spacing surrounding an operator, -// return 1 if it looks like it should be treated as a binary -// operator. For example, -// -// [ 1 + 2 ] or [ 1+ 2] or [ 1+2 ] ==> binary -// -// [ 1 +2 ] ==> unary - -static bool -looks_like_bin_op (bool spc_prev, int next_char) -{ - bool spc_next = (next_char == ' ' || next_char == '\t'); - - return ((spc_prev && spc_next) || ! spc_prev); -} - bool is_keyword (const std::string& s) { @@ -2684,19 +2668,6 @@ return (isalnum (c) || match_any (c, "!\"'(-[_{~")); } -static bool -can_be_command (const std::string& tok) -{ - // Don't allow these names to be treated as commands to avoid - // surprises when parsing things like "NaN ^2". - - return ! (tok == "e" - || tok == "I" || tok == "i" - || tok == "J" || tok == "j" - || tok == "Inf" || tok == "inf" - || tok == "NaN" || tok == "nan"); -} - bool octave_lexer::looks_like_command_arg (void) { @@ -3123,7 +3094,12 @@ token *tok_val = new token (NAME, &(symbol_table::insert (tok)), input_line_number, current_input_column); - if (at_beginning_of_statement) + if (at_beginning_of_statement + && (! (tok == "e" + || tok == "I" || tok == "i" + || tok == "J" || tok == "j" + || tok == "Inf" || tok == "inf" + || tok == "NaN" || tok == "nan"))) tok_val->mark_may_be_command (); push_token (tok_val);