Mercurial > octave-nkf
comparison 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 |
comparison
equal
deleted
inserted
replaced
3399:e665633c76af | 3400:18366d37e7dd |
---|---|
162 // will result in a call to `eye' with the argument `2'. | 162 // will result in a call to `eye' with the argument `2'. |
163 | 163 |
164 static int Vwhitespace_in_literal_matrix; | 164 static int Vwhitespace_in_literal_matrix; |
165 | 165 |
166 static bool Vwarn_separator_insert = false; | 166 static bool Vwarn_separator_insert = false; |
167 | |
168 static bool Vwarn_single_quote_string = false; | |
167 | 169 |
168 // Forward declarations for functions defined at the bottom of this | 170 // Forward declarations for functions defined at the bottom of this |
169 // file. | 171 // file. |
170 | 172 |
171 static void fixup_column_count (char *s); | 173 static void fixup_column_count (char *s); |
187 static bool have_continuation (bool trailing_comments_ok = true); | 189 static bool have_continuation (bool trailing_comments_ok = true); |
188 static bool have_ellipsis_continuation (bool trailing_comments_ok = true); | 190 static bool have_ellipsis_continuation (bool trailing_comments_ok = true); |
189 static yum_yum eat_whitespace (void); | 191 static yum_yum eat_whitespace (void); |
190 static yum_yum eat_continuation (void); | 192 static yum_yum eat_continuation (void); |
191 static void maybe_warn_separator_insert (char sep); | 193 static void maybe_warn_separator_insert (char sep); |
194 static void gripe_single_quote_string (void); | |
192 | 195 |
193 %} | 196 %} |
194 | 197 |
195 D [0-9] | 198 D [0-9] |
196 S [ \t] | 199 S [ \t] |
1753 lexer_flags.convert_spaces_to_comma = true; | 1756 lexer_flags.convert_spaces_to_comma = true; |
1754 } | 1757 } |
1755 | 1758 |
1756 yylval.tok_val = new token (s); | 1759 yylval.tok_val = new token (s); |
1757 token_stack.push (yylval.tok_val); | 1760 token_stack.push (yylval.tok_val); |
1761 | |
1762 if (delim == '\'') | |
1763 gripe_single_quote_string (); | |
1764 | |
1758 return TEXT; | 1765 return TEXT; |
1759 } | 1766 } |
1760 } | 1767 } |
1761 } | 1768 } |
1762 else | 1769 else |
2215 warning ("potential auto-insertion of `%c' near line %d of file %s", | 2222 warning ("potential auto-insertion of `%c' near line %d of file %s", |
2216 sep, input_line_number, nm.c_str ()); | 2223 sep, input_line_number, nm.c_str ()); |
2217 } | 2224 } |
2218 } | 2225 } |
2219 | 2226 |
2227 static void | |
2228 gripe_single_quote_string (void) | |
2229 { | |
2230 string nm = curr_fcn_file_full_name; | |
2231 | |
2232 if (Vwarn_single_quote_string) | |
2233 { | |
2234 if (nm.empty ()) | |
2235 warning ("single quote delimited string near line %d", | |
2236 input_line_number); | |
2237 else | |
2238 warning ("single quote delimited string near line %d of file %s", | |
2239 input_line_number, nm.c_str ()); | |
2240 } | |
2241 } | |
2242 | |
2220 static int | 2243 static int |
2221 warn_separator_insert (void) | 2244 warn_separator_insert (void) |
2222 { | 2245 { |
2223 Vwarn_separator_insert = check_preference ("warn_separator_insert"); | 2246 Vwarn_separator_insert = check_preference ("warn_separator_insert"); |
2247 | |
2248 return 0; | |
2249 } | |
2250 | |
2251 static int | |
2252 warn_single_quote_string (void) | |
2253 { | |
2254 Vwarn_single_quote_string = check_preference ("warn_single_quote_string"); | |
2224 | 2255 |
2225 return 0; | 2256 return 0; |
2226 } | 2257 } |
2227 | 2258 |
2228 static int | 2259 static int |
2249 symbols_of_lex (void) | 2280 symbols_of_lex (void) |
2250 { | 2281 { |
2251 DEFVAR (warn_separator_insert, 0.0, warn_separator_insert, | 2282 DEFVAR (warn_separator_insert, 0.0, warn_separator_insert, |
2252 "print warning if commas or semicolons that might be inserted\n\ | 2283 "print warning if commas or semicolons that might be inserted\n\ |
2253 automatically in literal matrices"); | 2284 automatically in literal matrices"); |
2285 | |
2286 DEFVAR (warn_single_quote_string, 0.0, warn_single_quote_string, | |
2287 "print warning if a signle quote character is used to introduce a\n\ | |
2288 string constant"); | |
2254 | 2289 |
2255 DEFVAR (whitespace_in_literal_matrix, "", whitespace_in_literal_matrix, | 2290 DEFVAR (whitespace_in_literal_matrix, "", whitespace_in_literal_matrix, |
2256 "control auto-insertion of commas and semicolons in literal matrices"); | 2291 "control auto-insertion of commas and semicolons in literal matrices"); |
2257 } | 2292 } |
2258 | 2293 |