Mercurial > hg > octave-nkf
changeset 16270:3b0381ea8737 classdef
maint: periodic merge of default to classdef
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Mon, 11 Mar 2013 14:31:56 -0400 |
parents | dbbef00202ff (current diff) 488b0fef52c5 (diff) |
children | 4cf2c4ae8df5 |
files | libinterp/parse-tree/lex.ll |
diffstat | 1 files changed, 6 insertions(+), 30 deletions(-) [+] |
line wrap: on
line diff
--- a/libinterp/parse-tree/lex.ll +++ b/libinterp/parse-tree/lex.ll @@ -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);