Mercurial > octave-nkf
diff src/lex.l @ 3974:e2290bf911f0
[project @ 2002-07-04 17:38:22 by jwe]
author | jwe |
---|---|
date | Thu, 04 Jul 2002 17:38:23 +0000 |
parents | 826092b5665e |
children | fa0ae9105656 |
line wrap: on
line diff
--- a/src/lex.l Thu Jul 04 01:42:46 2002 +0000 +++ b/src/lex.l Thu Jul 04 17:38:23 2002 +0000 @@ -188,7 +188,7 @@ static void handle_number (void); static int handle_string (char delim, int text_style = 0); static int handle_close_bracket (int spc_gobbled); -static int handle_identifier (const std::string& tok, int spc_gobbled); +static int handle_identifier (void); static bool have_continuation (bool trailing_comments_ok = true); static bool have_ellipsis_continuation (bool trailing_comments_ok = true); static void scan_for_comments (const char *); @@ -481,9 +481,15 @@ {EL} { if (lexer_flags.looking_at_parameter_list) - return VARARGIN; + { + warning ("`...' is deprecated; use varargin instead"); + return VARARGIN; + } else if (lexer_flags.looking_at_return_list) - return VARARGOUT; + { + warning ("`...' is deprecated; use varargout instead"); + return VARARGOUT; + } else return LEXICAL_ERROR; } @@ -502,11 +508,7 @@ %} {IDENT}{S}* { - std::string tok = strip_trailing_whitespace (yytext); - int c = yytext[yyleng-1]; - int cont_is_spc = eat_continuation (); - int spc_gobbled = (cont_is_spc || c == ' ' || c == '\t'); - return handle_identifier (tok, spc_gobbled); + return handle_identifier (); } %{ @@ -1166,6 +1168,16 @@ yylval.tok_val = new token (static_cast<double> (l), "", l, c); break; + case varargin_kw: + if (! lexer_flags.looking_at_parameter_list) + return 0; + break; + + case varargout_kw: + if (! lexer_flags.looking_at_return_list) + return 0; + break; + default: panic_impossible (); } @@ -2175,8 +2187,16 @@ // an identifier. Handles keywords. static int -handle_identifier (const std::string& tok, int spc_gobbled) +handle_identifier (void) { + std::string tok = strip_trailing_whitespace (yytext); + + int c = yytext[yyleng-1]; + + int cont_is_spc = eat_continuation (); + + int spc_gobbled = (cont_is_spc || c == ' ' || c == '\t'); + // It is almost always an error for an identifier to be followed // directly by another identifier. Special cases are handled // below.