Mercurial > hg > octave-nkf
diff src/lex.l @ 3400:18366d37e7dd
[project @ 1999-12-22 23:36:09 by jwe]
author | jwe |
---|---|
date | Wed, 22 Dec 1999 23:36:14 +0000 |
parents | 42cb61dd0248 |
children | e098ebb77023 |
line wrap: on
line diff
--- a/src/lex.l +++ b/src/lex.l @@ -165,6 +165,8 @@ static bool Vwarn_separator_insert = false; +static bool Vwarn_single_quote_string = false; + // Forward declarations for functions defined at the bottom of this // file. @@ -189,6 +191,7 @@ static yum_yum eat_whitespace (void); static yum_yum eat_continuation (void); static void maybe_warn_separator_insert (char sep); +static void gripe_single_quote_string (void); %} @@ -1755,6 +1758,10 @@ yylval.tok_val = new token (s); token_stack.push (yylval.tok_val); + + if (delim == '\'') + gripe_single_quote_string (); + return TEXT; } } @@ -2217,6 +2224,22 @@ } } +static void +gripe_single_quote_string (void) +{ + string nm = curr_fcn_file_full_name; + + if (Vwarn_single_quote_string) + { + if (nm.empty ()) + warning ("single quote delimited string near line %d", + input_line_number); + else + warning ("single quote delimited string near line %d of file %s", + input_line_number, nm.c_str ()); + } +} + static int warn_separator_insert (void) { @@ -2226,6 +2249,14 @@ } static int +warn_single_quote_string (void) +{ + Vwarn_single_quote_string = check_preference ("warn_single_quote_string"); + + return 0; +} + +static int whitespace_in_literal_matrix (void) { int pref = 0; @@ -2252,6 +2283,10 @@ "print warning if commas or semicolons that might be inserted\n\ automatically in literal matrices"); + DEFVAR (warn_single_quote_string, 0.0, warn_single_quote_string, + "print warning if a signle quote character is used to introduce a\n\ + string constant"); + DEFVAR (whitespace_in_literal_matrix, "", whitespace_in_literal_matrix, "control auto-insertion of commas and semicolons in literal matrices"); }