1994
|
1 /* |
1
|
2 |
2847
|
3 Copyright (C) 1996, 1997 John W. Eaton |
1
|
4 |
|
5 This file is part of Octave. |
|
6 |
|
7 Octave is free software; you can redistribute it and/or modify it |
|
8 under the terms of the GNU General Public License as published by the |
|
9 Free Software Foundation; either version 2, or (at your option) any |
|
10 later version. |
|
11 |
|
12 Octave is distributed in the hope that it will be useful, but WITHOUT |
|
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
15 for more details. |
|
16 |
|
17 You should have received a copy of the GNU General Public License |
|
18 along with GNU CC; see the file COPYING. If not, write to the Free |
1315
|
19 Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
1
|
20 |
|
21 */ |
|
22 |
|
23 %s TEXT_FCN |
|
24 %s MATRIX |
|
25 |
|
26 %{ |
240
|
27 #ifdef HAVE_CONFIG_H |
1220
|
28 #include <config.h> |
240
|
29 #endif |
|
30 |
1341
|
31 #include <cctype> |
|
32 #include <cstring> |
|
33 |
1823
|
34 #include <string> |
|
35 |
973
|
36 #include <strstream.h> |
522
|
37 |
1
|
38 #include "SLStack.h" |
|
39 |
2926
|
40 #include "cmd-edit.h" |
|
41 |
1497
|
42 // These would be alphabetical, but y.tab.h must be included before |
|
43 // oct-gperf.h and y.tab.h must be included after token.h and the tree |
|
44 // class declarations. We can't include y.tab.h in oct-gperf.h |
|
45 // because it may not be protected to allow it to be included multiple |
|
46 // times. |
|
47 |
2181
|
48 #include "defun.h" |
1355
|
49 #include "error.h" |
1351
|
50 #include "input.h" |
1355
|
51 #include "lex.h" |
2891
|
52 #include "ov.h" |
1355
|
53 #include "parse.h" |
2987
|
54 #include "pt-all.h" |
2891
|
55 #include "symtab.h" |
|
56 #include "token.h" |
|
57 #include "toplev.h" |
1355
|
58 #include "utils.h" |
|
59 #include "variables.h" |
2492
|
60 #include <y.tab.h> |
|
61 #include <oct-gperf.h> |
1
|
62 |
2716
|
63 #if ! (defined (FLEX_SCANNER) \ |
|
64 && defined (YY_FLEX_MAJOR_VERSION) && YY_FLEX_MAJOR_VERSION >= 2 \ |
|
65 && defined (YY_FLEX_MINOR_VERSION) && YY_FLEX_MINOR_VERSION >= 5) |
|
66 #error lex.l requires flex version 2.5.4 or later |
|
67 #endif |
|
68 |
1826
|
69 // Flags that need to be shared between the lexer and parser. |
|
70 lexical_feedback lexer_flags; |
|
71 |
1351
|
72 // Stack to hold tokens so that we can delete them when the parser is |
|
73 // reset and avoid growing forever just because we are stashing some |
|
74 // information. This has to appear before lex.h is included, because |
|
75 // one of the macros defined there uses token_stack. |
2614
|
76 // |
|
77 // XXX FIXME XXX -- this should really be static, but that causes |
|
78 // problems on some systems. |
|
79 SLStack <token*> token_stack; |
1351
|
80 |
1826
|
81 // Did eat_whitespace() eat a space or tab, or a newline, or both? |
1
|
82 |
1826
|
83 typedef int yum_yum; |
1
|
84 |
1826
|
85 const yum_yum ATE_NOTHING = 0; |
|
86 const yum_yum ATE_SPACE_OR_TAB = 1; |
|
87 const yum_yum ATE_NEWLINE = 2; |
1088
|
88 |
1
|
89 // Is the closest nesting level a square brace or a paren? |
1826
|
90 |
|
91 class brace_paren_nesting_level : public SLStack <int> |
|
92 { |
|
93 public: |
|
94 |
|
95 brace_paren_nesting_level (void) : SLStack<int> () { } |
|
96 |
|
97 ~brace_paren_nesting_level (void) { } |
|
98 |
|
99 void brace (void) { push (BRACE); } |
|
100 bool is_brace (void) { return ! empty () && top () == BRACE; } |
|
101 |
|
102 void paren (void) { push (PAREN); } |
|
103 bool is_paren (void) { return ! empty () && top () == PAREN; } |
985
|
104 |
1826
|
105 bool none (void) { return empty (); } |
|
106 |
|
107 void remove (void) { if (! empty ()) SLStack<int>::pop (); } |
|
108 |
|
109 private: |
|
110 |
|
111 enum { BRACE = 1, PAREN = 2 }; |
|
112 |
|
113 brace_paren_nesting_level (const brace_paren_nesting_level&); |
|
114 |
|
115 brace_paren_nesting_level& operator = (const brace_paren_nesting_level&); |
|
116 }; |
|
117 |
|
118 static brace_paren_nesting_level nesting_level; |
1
|
119 |
2167
|
120 // Should whitespace in a literal matrix list be automatically |
|
121 // converted to commas and semicolons? |
|
122 // |
|
123 // user specifies value of var |
|
124 // -------------- ------------ |
|
125 // "ignore" 2 |
|
126 // "traditional" 1 |
|
127 // anything else 0 |
|
128 // |
|
129 // Octave will never insert a comma in a literal matrix list if the |
|
130 // user specifies "ignore". For example, the statement [1 2] will |
|
131 // result in an error instead of being treated the same as [1, 2], and |
|
132 // the statement |
|
133 // |
|
134 // [ 1, 2, |
|
135 // 3, 4 ] |
|
136 // |
|
137 // will result in the vector [1 2 3 4] instead of a matrix. |
|
138 // |
|
139 // Traditional behavior makes Octave convert spaces to a comma between |
|
140 // identifiers and `('. For example, the statement |
|
141 // |
|
142 // [eye (2)] |
|
143 // |
|
144 // will be parsed as |
|
145 // |
|
146 // [eye, (2)] |
|
147 // |
|
148 // and will result in an error since the `eye' function will be |
|
149 // called with no arguments. To get around this, you would have to |
|
150 // omit the space between `eye' and the `('. |
|
151 // |
|
152 // The default value is 0, which results in behavior that is the same |
|
153 // as traditional, except that Octave does not convert spaces to a |
|
154 // comma between identifiers and `('. For example, the statement |
|
155 // |
|
156 // [eye (2)] |
|
157 // |
|
158 // will result in a call to `eye' with the argument `2'. |
|
159 |
|
160 static int Vwhitespace_in_literal_matrix; |
|
161 |
3096
|
162 // Should Octave treat backslashes in strings as escapes that |
|
163 // introduce special characters like newline (\n), tab (\t), etc.? |
|
164 static bool Vbackslash_escapes; |
2167
|
165 |
146
|
166 // Forward declarations for functions defined at the bottom of this |
|
167 // file. |
|
168 |
1
|
169 static void fixup_column_count (char *s); |
146
|
170 static void do_comma_insert_check (void); |
1823
|
171 static int is_plot_keyword (const string& s); |
|
172 static int is_keyword (const string& s); |
|
173 static string plot_style_token (const string& s); |
|
174 static symbol_record *lookup_identifier (const string& s); |
1
|
175 static void grab_help_text (void); |
2857
|
176 static bool match_any (char c, const char *s); |
|
177 static bool next_token_is_bin_op (int spc_prev, char *yytext); |
|
178 static bool next_token_is_postfix_unary_op (int spc_prev, char *yytext); |
1823
|
179 static string strip_trailing_whitespace (char *s); |
972
|
180 static void handle_number (char *yytext); |
975
|
181 static int handle_string (char delim, int text_style = 0); |
1001
|
182 static int handle_close_brace (int spc_gobbled); |
1823
|
183 static int handle_identifier (const string& tok, int spc_gobbled); |
3096
|
184 static bool have_continuation (bool trailing_comments_ok = true); |
|
185 static bool have_ellipsis_continuation (bool trailing_comments_ok = true); |
1826
|
186 static yum_yum eat_whitespace (void); |
|
187 static yum_yum eat_continuation (void); |
1
|
188 |
|
189 %} |
|
190 |
|
191 D [0-9] |
|
192 S [ \t] |
2042
|
193 NL ((\n)|(\r\n)) |
|
194 SNL ({S}|{NL}) |
1
|
195 EL (\.\.\.) |
967
|
196 BS (\\) |
|
197 CONT ({EL}|{BS}) |
1
|
198 Im [iIjJ] |
967
|
199 CCHAR [#%] |
|
200 COMMENT ({CCHAR}.*{NL}) |
|
201 SNLCMT ({SNL}|{COMMENT}) |
|
202 NOTEQ ((~=)|(!=)|(<>)) |
|
203 POW ((\*\*)|(\^)) |
|
204 EPOW (\.{POW}) |
|
205 NOT ((\~)|(\!)) |
1
|
206 IDENT ([_a-zA-Z][_a-zA-Z0-9]*) |
|
207 EXPON ([DdEe][+-]?{D}+) |
968
|
208 NUMBER (({D}+\.?{D}*{EXPON}?)|(\.{D}+{EXPON}?)) |
1
|
209 %% |
|
210 |
968
|
211 %{ |
|
212 // Help and other text-style functions are a pain in the ass. This |
|
213 // stuff needs to be simplified. May require some changes in the |
|
214 // parser too. |
|
215 %} |
|
216 |
967
|
217 <TEXT_FCN>{NL} { |
|
218 BEGIN 0; |
|
219 current_input_column = 1; |
2857
|
220 lexer_flags.quote_is_transpose = false; |
|
221 lexer_flags.cant_be_identifier = false; |
|
222 lexer_flags.convert_spaces_to_comma = true; |
967
|
223 return '\n'; |
|
224 } |
1
|
225 |
967
|
226 <TEXT_FCN>[\;\,] { |
1826
|
227 if (lexer_flags.doing_set && strcmp (yytext, ",") == 0) |
967
|
228 { |
1060
|
229 TOK_PUSH_AND_RETURN (yytext, TEXT); |
967
|
230 } |
|
231 else |
|
232 { |
|
233 BEGIN 0; |
|
234 if (strcmp (yytext, ",") == 0) |
|
235 TOK_RETURN (','); |
|
236 else |
|
237 TOK_RETURN (';'); |
|
238 } |
|
239 } |
1
|
240 |
975
|
241 <TEXT_FCN>[\"\'] { |
|
242 current_input_column++; |
|
243 return handle_string (yytext[0], 1); |
|
244 } |
|
245 |
3079
|
246 <TEXT_FCN>[^ \t\n\;\,\"\'][^ \t\n\;\,]*{S}* { |
1823
|
247 string tok = strip_trailing_whitespace (yytext); |
1060
|
248 TOK_PUSH_AND_RETURN (tok, TEXT); |
967
|
249 } |
1
|
250 |
968
|
251 %{ |
1
|
252 // For this and the next two rules, we're looking at ']', and we |
971
|
253 // need to know if the next token is `=' or `=='. |
1
|
254 // |
|
255 // It would have been so much easier if the delimiters were simply |
|
256 // different for the expression on the left hand side of the equals |
|
257 // operator. |
971
|
258 // |
|
259 // It's also a pain in the ass to decide whether to insert a comma |
|
260 // after seeing a ']' character... |
968
|
261 %} |
|
262 |
2119
|
263 <MATRIX>{SNLCMT}*\]{S}* { |
1001
|
264 fixup_column_count (yytext); |
|
265 int c = yytext[yyleng-1]; |
|
266 int cont_is_spc = eat_continuation (); |
|
267 int spc_gobbled = (cont_is_spc || c == ' ' || c == '\t'); |
|
268 return handle_close_brace (spc_gobbled); |
967
|
269 } |
1
|
270 |
968
|
271 %{ |
1088
|
272 // Commas are element separators in matrix constants. If we don't |
|
273 // check for continuations here we can end up inserting too many |
|
274 // commas. |
968
|
275 %} |
|
276 |
967
|
277 <MATRIX>{S}*\,{S}* { |
1088
|
278 current_input_column += yyleng; |
|
279 int tmp = eat_continuation (); |
2857
|
280 lexer_flags.quote_is_transpose = false; |
|
281 lexer_flags.cant_be_identifier = false; |
|
282 lexer_flags.convert_spaces_to_comma = true; |
2167
|
283 if (Vwhitespace_in_literal_matrix != 2 |
1088
|
284 && (tmp & ATE_NEWLINE) == ATE_NEWLINE) |
|
285 unput (';'); |
|
286 return (','); |
967
|
287 } |
1
|
288 |
968
|
289 %{ |
|
290 // In some cases, spaces in matrix constants can turn into commas. |
|
291 // If commas are required, spaces are not important in matrix |
1088
|
292 // constants so we just eat them. If we don't check for continuations |
|
293 // here we can end up inserting too many commas. |
968
|
294 %} |
430
|
295 |
968
|
296 <MATRIX>{S}+ { |
1088
|
297 current_input_column += yyleng; |
2167
|
298 if (Vwhitespace_in_literal_matrix != 2) |
967
|
299 { |
1088
|
300 int tmp = eat_continuation (); |
967
|
301 int bin_op = next_token_is_bin_op (1, yytext); |
|
302 int postfix_un_op = next_token_is_postfix_unary_op (1, yytext); |
|
303 |
1826
|
304 if (! (postfix_un_op || bin_op) |
|
305 && nesting_level.is_brace () |
|
306 && lexer_flags.convert_spaces_to_comma) |
1088
|
307 { |
2857
|
308 lexer_flags.quote_is_transpose = false; |
|
309 lexer_flags.cant_be_identifier = false; |
|
310 lexer_flags.convert_spaces_to_comma = true; |
1088
|
311 if ((tmp & ATE_NEWLINE) == ATE_NEWLINE) |
|
312 unput (';'); |
|
313 return (','); |
|
314 } |
967
|
315 } |
|
316 } |
430
|
317 |
968
|
318 %{ |
1088
|
319 // Semicolons are handled as row seprators in matrix constants. If we |
|
320 // don't eat whitespace here we can end up inserting too many |
|
321 // semicolons. |
968
|
322 %} |
|
323 |
985
|
324 <MATRIX>{SNLCMT}*;{SNLCMT}* { |
967
|
325 fixup_column_count (yytext); |
1001
|
326 eat_whitespace (); |
2857
|
327 lexer_flags.quote_is_transpose = false; |
|
328 lexer_flags.cant_be_identifier = false; |
|
329 lexer_flags.convert_spaces_to_comma = true; |
967
|
330 return ';'; |
|
331 } |
|
332 |
968
|
333 %{ |
1088
|
334 // In some cases, new lines can also become row separators. If we |
|
335 // don't eat whitespace here we can end up inserting too many |
|
336 // semicolons. |
985
|
337 %} |
|
338 |
|
339 <MATRIX>{SNLCMT}*\n{SNLCMT}* { |
1082
|
340 fixup_column_count (yytext); |
1088
|
341 eat_whitespace (); |
2167
|
342 if (Vwhitespace_in_literal_matrix != 2) |
985
|
343 { |
2857
|
344 lexer_flags.quote_is_transpose = false; |
|
345 lexer_flags.cant_be_identifier = false; |
|
346 lexer_flags.convert_spaces_to_comma = true; |
985
|
347 |
1826
|
348 if (nesting_level.none ()) |
985
|
349 return LEXICAL_ERROR; |
|
350 |
1826
|
351 if (nesting_level.is_brace ()) |
985
|
352 return ';'; |
|
353 } |
|
354 } |
|
355 |
|
356 %{ |
968
|
357 // Open and close brace are handled differently if we are in the range |
|
358 // part of a plot command. |
975
|
359 // |
968
|
360 %} |
1
|
361 |
967
|
362 \[{S}* { |
1826
|
363 nesting_level.brace (); |
975
|
364 |
1082
|
365 current_input_column += yyleng; |
2857
|
366 lexer_flags.quote_is_transpose = false; |
|
367 lexer_flags.cant_be_identifier = false; |
|
368 lexer_flags.convert_spaces_to_comma = true; |
975
|
369 |
|
370 promptflag--; |
|
371 eat_whitespace (); |
|
372 |
1826
|
373 if (lexer_flags.plotting && ! lexer_flags.past_plot_range) |
967
|
374 { |
2857
|
375 lexer_flags.in_plot_range = true; |
1082
|
376 return OPEN_BRACE; |
967
|
377 } |
|
378 else |
|
379 { |
1826
|
380 lexer_flags.braceflag++; |
975
|
381 BEGIN MATRIX; |
1082
|
382 return '['; |
967
|
383 } |
|
384 } |
1
|
385 |
968
|
386 \] { |
1826
|
387 nesting_level.remove (); |
968
|
388 |
1826
|
389 if (lexer_flags.plotting && ! lexer_flags.past_plot_range) |
968
|
390 { |
2857
|
391 lexer_flags.in_plot_range = false; |
968
|
392 TOK_RETURN (CLOSE_BRACE); |
|
393 } |
|
394 else |
|
395 TOK_RETURN (']'); |
|
396 } |
|
397 |
|
398 %{ |
|
399 // Imaginary numbers. |
|
400 %} |
|
401 |
|
402 {NUMBER}{Im} { |
972
|
403 handle_number (yytext); |
968
|
404 return IMAG_NUM; |
|
405 } |
|
406 |
|
407 %{ |
|
408 // Real numbers. Don't grab the `.' part of a dot operator as part of |
|
409 // the constant. |
|
410 %} |
|
411 |
|
412 {D}+/\.[\*/\\^'] | |
|
413 {NUMBER} { |
972
|
414 handle_number (yytext); |
968
|
415 return NUM; |
|
416 } |
|
417 |
|
418 %{ |
|
419 // Eat whitespace. Whitespace inside matrix constants is handled by |
|
420 // the <MATRIX> start state code above. |
|
421 %} |
|
422 |
967
|
423 {S}* { |
|
424 current_input_column += yyleng; |
|
425 } |
|
426 |
968
|
427 %{ |
|
428 // Continuation lines. Allow comments after continuations. |
|
429 %} |
|
430 |
967
|
431 {CONT}{S}*{NL} | |
|
432 {CONT}{S}*{COMMENT} { |
|
433 promptflag--; |
|
434 current_input_column = 1; |
|
435 } |
1
|
436 |
968
|
437 %{ |
|
438 // An ellipsis not at the end of a line is not a continuation, but |
|
439 // does have another meaning. |
|
440 %} |
|
441 |
967
|
442 {EL} { |
|
443 return ELLIPSIS; |
|
444 } |
1
|
445 |
968
|
446 %{ |
|
447 // End of file. |
|
448 %} |
|
449 |
967
|
450 <<EOF>> { |
|
451 TOK_RETURN (END_OF_INPUT); |
|
452 } |
1
|
453 |
968
|
454 %{ |
970
|
455 // Identifiers. Truncate the token at the first space or tab but |
|
456 // don't write directly on yytext. |
968
|
457 %} |
|
458 |
967
|
459 {IDENT}{S}* { |
1823
|
460 string tok = strip_trailing_whitespace (yytext); |
1001
|
461 int c = yytext[yyleng-1]; |
|
462 int cont_is_spc = eat_continuation (); |
|
463 int spc_gobbled = (cont_is_spc || c == ' ' || c == '\t'); |
|
464 return handle_identifier (tok, spc_gobbled); |
967
|
465 } |
1
|
466 |
968
|
467 %{ |
|
468 // A new line character. New line characters inside matrix constants |
985
|
469 // are handled by the <MATRIX> start state code above. If closest |
|
470 // nesting is inside parentheses, don't return a row separator. |
968
|
471 %} |
|
472 |
967
|
473 {NL} { |
|
474 current_input_column = 1; |
2857
|
475 lexer_flags.quote_is_transpose = false; |
|
476 lexer_flags.cant_be_identifier = false; |
|
477 lexer_flags.convert_spaces_to_comma = true; |
985
|
478 |
1826
|
479 if (nesting_level.none ()) |
985
|
480 return '\n'; |
|
481 |
1826
|
482 if (nesting_level.is_brace ()) |
985
|
483 return LEXICAL_ERROR; |
967
|
484 } |
1
|
485 |
968
|
486 %{ |
|
487 // Single quote can either be the beginning of a string or a transpose |
|
488 // operator. |
|
489 %} |
|
490 |
967
|
491 "'" { |
|
492 current_input_column++; |
2857
|
493 lexer_flags.convert_spaces_to_comma = true; |
1
|
494 |
1826
|
495 if (lexer_flags.quote_is_transpose) |
967
|
496 { |
|
497 do_comma_insert_check (); |
|
498 return QUOTE; |
|
499 } |
|
500 else |
973
|
501 return handle_string ('\''); |
967
|
502 } |
1
|
503 |
968
|
504 %{ |
971
|
505 // Double quotes always begin strings. |
|
506 %} |
|
507 |
973
|
508 \" { |
|
509 current_input_column++; |
|
510 return handle_string ('"'); |
|
511 } |
971
|
512 |
|
513 %{ |
|
514 // The colon operator is handled differently if we are in the range |
|
515 // part of a plot command. |
968
|
516 %} |
|
517 |
967
|
518 ":" { |
1826
|
519 if (lexer_flags.plotting |
|
520 && (lexer_flags.in_plot_range || lexer_flags.in_plot_using)) |
2857
|
521 BIN_OP_RETURN (COLON, true); |
967
|
522 else |
2857
|
523 BIN_OP_RETURN (':', false); |
967
|
524 } |
1
|
525 |
968
|
526 %{ |
985
|
527 // Gobble comments. If closest nesting is inside parentheses, don't |
|
528 // return a new line. |
|
529 %} |
968
|
530 |
967
|
531 {CCHAR} { |
1826
|
532 if (help_buf.empty () |
|
533 && lexer_flags.beginning_of_function |
|
534 && nesting_level.none ()) |
967
|
535 { |
|
536 grab_help_text (); |
2857
|
537 lexer_flags.beginning_of_function = false; |
967
|
538 } |
|
539 else |
|
540 { |
|
541 int c; |
|
542 while ((c = yyinput ()) != EOF && c != '\n') |
|
543 ; // Eat comment. |
|
544 } |
440
|
545 |
967
|
546 current_input_column = 1; |
2857
|
547 lexer_flags.quote_is_transpose = false; |
|
548 lexer_flags.cant_be_identifier = false; |
|
549 lexer_flags.convert_spaces_to_comma = true; |
985
|
550 |
1826
|
551 if (nesting_level.none ()) |
985
|
552 return '\n'; |
1826
|
553 else if (nesting_level.is_brace ()) |
1566
|
554 return ';'; |
967
|
555 } |
440
|
556 |
968
|
557 %{ |
|
558 // Other operators. |
|
559 %} |
|
560 |
2857
|
561 ".+" { BIN_OP_RETURN (EPLUS, false); } |
|
562 ".-" { BIN_OP_RETURN (EMINUS, false); } |
|
563 ".*" { BIN_OP_RETURN (EMUL, false); } |
|
564 "./" { BIN_OP_RETURN (EDIV, false); } |
|
565 ".\\" { BIN_OP_RETURN (ELEFTDIV, false); } |
|
566 {EPOW} { BIN_OP_RETURN (EPOW, false); } |
|
567 ".'" { do_comma_insert_check (); BIN_OP_RETURN (TRANSPOSE, true); } |
|
568 "++" { do_comma_insert_check (); BIN_OP_RETURN (PLUS_PLUS, true); } |
|
569 "--" { do_comma_insert_check (); BIN_OP_RETURN (MINUS_MINUS, true); } |
|
570 "<=" { BIN_OP_RETURN (EXPR_LE, false); } |
|
571 "==" { BIN_OP_RETURN (EXPR_EQ, false); } |
|
572 {NOTEQ} { BIN_OP_RETURN (EXPR_NE, false); } |
|
573 ">=" { BIN_OP_RETURN (EXPR_GE, false); } |
2877
|
574 "&" { BIN_OP_RETURN (EXPR_AND, false); } |
2857
|
575 "|" { BIN_OP_RETURN (EXPR_OR, false); } |
|
576 "<" { BIN_OP_RETURN (EXPR_LT, false); } |
|
577 ">" { BIN_OP_RETURN (EXPR_GT, false); } |
|
578 "*" { BIN_OP_RETURN ('*', false); } |
|
579 "/" { BIN_OP_RETURN ('/', false); } |
|
580 "\\" { BIN_OP_RETURN (LEFTDIV, false); } |
|
581 ";" { BIN_OP_RETURN (';', true); } |
|
582 "," { BIN_OP_RETURN (',', true); } |
|
583 {POW} { BIN_OP_RETURN (POW, false); } |
|
584 "=" { BIN_OP_RETURN ('=', true); } |
2877
|
585 "&&" { BIN_OP_RETURN (EXPR_AND_AND, false); } |
2857
|
586 "||" { BIN_OP_RETURN (EXPR_OR_OR, false); } |
2900
|
587 "<<" { BIN_OP_RETURN (LSHIFT, false); } |
|
588 ">>" { BIN_OP_RETURN (RSHIFT, false); } |
967
|
589 |
|
590 {NOT} { |
1826
|
591 if (lexer_flags.plotting && ! lexer_flags.in_plot_range) |
2857
|
592 lexer_flags.past_plot_range = true; |
|
593 BIN_OP_RETURN (EXPR_NOT, false); |
967
|
594 } |
1
|
595 |
1276
|
596 "+" { |
1826
|
597 if (lexer_flags.plotting && ! lexer_flags.in_plot_range) |
2857
|
598 lexer_flags.past_plot_range = true; |
|
599 BIN_OP_RETURN ('+', false); |
967
|
600 } |
|
601 |
1276
|
602 "-" { |
1826
|
603 if (lexer_flags.plotting && ! lexer_flags.in_plot_range) |
2857
|
604 lexer_flags.past_plot_range = true; |
|
605 BIN_OP_RETURN ('-', false); |
967
|
606 } |
|
607 |
|
608 "(" { |
1826
|
609 if (lexer_flags.plotting && ! lexer_flags.in_plot_range) |
2857
|
610 lexer_flags.past_plot_range = true; |
1826
|
611 nesting_level.paren (); |
985
|
612 promptflag--; |
967
|
613 TOK_RETURN ('('); |
|
614 } |
|
615 |
|
616 ")" { |
1826
|
617 nesting_level.remove (); |
1001
|
618 |
967
|
619 current_input_column++; |
2857
|
620 lexer_flags.cant_be_identifier = true; |
|
621 lexer_flags.quote_is_transpose = true; |
1826
|
622 lexer_flags.convert_spaces_to_comma = nesting_level.is_brace (); |
1001
|
623 do_comma_insert_check (); |
967
|
624 return ')'; |
|
625 } |
|
626 |
2066
|
627 "." { |
|
628 TOK_RETURN ('.'); |
|
629 } |
|
630 |
2877
|
631 "+=" { BIN_OP_RETURN (ADD_EQ, false); } |
|
632 "-=" { BIN_OP_RETURN (SUB_EQ, false); } |
|
633 "*=" { BIN_OP_RETURN (MUL_EQ, false); } |
|
634 "/=" { BIN_OP_RETURN (DIV_EQ, false); } |
|
635 ".+=" { BIN_OP_RETURN (ADD_EQ, false); } |
|
636 ".-=" { BIN_OP_RETURN (SUB_EQ, false); } |
|
637 ".*=" { BIN_OP_RETURN (EMUL_EQ, false); } |
|
638 "./=" { BIN_OP_RETURN (EDIV_EQ, false); } |
|
639 "&=" { BIN_OP_RETURN (AND_EQ, false); } |
|
640 "|=" { BIN_OP_RETURN (OR_EQ, false); } |
2900
|
641 "<<=" { BIN_OP_RETURN (LSHIFT_EQ, false); } |
|
642 ">>=" { BIN_OP_RETURN (RSHIFT_EQ, false); } |
2877
|
643 |
968
|
644 %{ |
2066
|
645 // Unrecognized input is a lexical error. |
968
|
646 %} |
1
|
647 |
2042
|
648 . { |
2066
|
649 current_input_column++; |
|
650 |
|
651 error ("invalid character `%s' near line %d, column %d", |
|
652 undo_string_escape (yytext[0]), input_line_number, |
|
653 current_input_column); |
|
654 |
|
655 return LEXICAL_ERROR; |
|
656 } |
1
|
657 |
|
658 %% |
|
659 |
767
|
660 // GAG. |
|
661 // |
|
662 // If we're reading a matrix and the next character is '[', make sure |
|
663 // that we insert a comma ahead of it. |
|
664 |
146
|
665 void |
1
|
666 do_comma_insert_check (void) |
|
667 { |
1001
|
668 int spc_gobbled = eat_continuation (); |
2970
|
669 |
1
|
670 int c = yyinput (); |
2970
|
671 |
146
|
672 yyunput (c, yytext); |
2970
|
673 |
1001
|
674 if (spc_gobbled) |
|
675 yyunput (' ', yytext); |
2970
|
676 |
1826
|
677 lexer_flags.do_comma_insert = (lexer_flags.braceflag && c == '['); |
1
|
678 } |
|
679 |
767
|
680 // Fix things up for errors or interrupts. The parser is never called |
|
681 // recursively, so it is always safe to reinitialize its state before |
|
682 // doing any parsing. |
|
683 |
1
|
684 void |
|
685 reset_parser (void) |
|
686 { |
1826
|
687 // Start off on the right foot. |
1
|
688 BEGIN 0; |
166
|
689 error_state = 0; |
287
|
690 |
1826
|
691 // We do want a prompt by default. |
1
|
692 promptflag = 1; |
287
|
693 |
1826
|
694 // Error may have occurred inside some parentheses or braces. |
985
|
695 nesting_level.clear (); |
287
|
696 |
1826
|
697 // Clear out the stack of token info used to track line and column |
|
698 // numbers. |
143
|
699 while (! token_stack.empty ()) |
|
700 delete token_stack.pop (); |
287
|
701 |
1826
|
702 // Can be reset by defining a function. |
985
|
703 if (! (reading_script_file || reading_fcn_file)) |
|
704 { |
|
705 current_input_column = 1; |
2926
|
706 input_line_number = command_editor::current_command_number () - 1; |
985
|
707 } |
287
|
708 |
1826
|
709 // Only ask for input from stdin if we are expecting interactive |
|
710 // input. |
338
|
711 if (interactive && ! (reading_fcn_file || get_input_from_eval_string)) |
287
|
712 yyrestart (stdin); |
991
|
713 |
1826
|
714 // Clear the buffer for help text. |
|
715 help_buf.resize (0); |
1755
|
716 |
1826
|
717 // Reset other flags. |
|
718 lexer_flags.init (); |
1
|
719 } |
|
720 |
767
|
721 // If we read some newlines, we need figure out what column we're |
|
722 // really looking at. |
|
723 |
1
|
724 static void |
|
725 fixup_column_count (char *s) |
|
726 { |
|
727 char c; |
|
728 while ((c = *s++) != '\0') |
|
729 { |
|
730 if (c == '\n') |
143
|
731 current_input_column = 1; |
1
|
732 else |
|
733 current_input_column++; |
|
734 } |
|
735 } |
|
736 |
767
|
737 // Include these so that we don't have to link to libfl.a. |
246
|
738 |
1
|
739 #ifdef yywrap |
|
740 #undef yywrap |
|
741 #endif |
246
|
742 static int |
1
|
743 yywrap (void) |
|
744 { |
287
|
745 return 1; |
1
|
746 } |
|
747 |
767
|
748 // Tell us all what the current buffer is. |
|
749 |
1
|
750 YY_BUFFER_STATE |
|
751 current_buffer (void) |
|
752 { |
|
753 return YY_CURRENT_BUFFER; |
|
754 } |
|
755 |
767
|
756 // Create a new buffer. |
|
757 |
1
|
758 YY_BUFFER_STATE |
|
759 create_buffer (FILE *f) |
|
760 { |
|
761 return yy_create_buffer (f, YY_BUF_SIZE); |
|
762 } |
|
763 |
767
|
764 // Start reading a new buffer. |
|
765 |
1
|
766 void |
|
767 switch_to_buffer (YY_BUFFER_STATE buf) |
|
768 { |
|
769 yy_switch_to_buffer (buf); |
|
770 } |
|
771 |
767
|
772 // Delete a buffer. |
|
773 |
1
|
774 void |
|
775 delete_buffer (YY_BUFFER_STATE buf) |
|
776 { |
|
777 yy_delete_buffer (buf); |
|
778 } |
|
779 |
767
|
780 // Restore a buffer (for unwind-prot). |
|
781 |
1
|
782 void |
|
783 restore_input_buffer (void *buf) |
|
784 { |
2861
|
785 switch_to_buffer (static_cast<YY_BUFFER_STATE> (buf)); |
1
|
786 } |
|
787 |
767
|
788 // Delete a buffer (for unwind-prot). |
|
789 |
1
|
790 void |
|
791 delete_input_buffer (void *buf) |
|
792 { |
2861
|
793 delete_buffer (static_cast<YY_BUFFER_STATE> (buf)); |
1
|
794 } |
|
795 |
767
|
796 // Check to see if a character string matches any of the possible line |
|
797 // styles for plots. |
|
798 |
1823
|
799 static string |
|
800 plot_style_token (const string& s) |
1
|
801 { |
1823
|
802 string retval; |
|
803 |
2804
|
804 static const char *plot_styles[] = |
146
|
805 { |
925
|
806 "boxes", |
924
|
807 "boxerrorbars", |
2542
|
808 "boxxyerrorbars", |
|
809 "candlesticks", |
146
|
810 "dots", |
|
811 "errorbars", |
2542
|
812 "financebars", |
|
813 "fsteps", |
|
814 "histeps", |
146
|
815 "impulses", |
|
816 "lines", |
|
817 "linespoints", |
|
818 "points", |
926
|
819 "steps", |
2542
|
820 "vector", |
|
821 "xerrorbars", |
|
822 "xyerrorbars", |
|
823 "yerrorbars", |
522
|
824 0, |
146
|
825 }; |
|
826 |
2804
|
827 const char * const *tmp = plot_styles; |
522
|
828 while (*tmp) |
1
|
829 { |
1823
|
830 if (almost_match (*tmp, s.c_str ())) |
|
831 { |
|
832 retval = *tmp; |
|
833 break; |
|
834 } |
1
|
835 |
|
836 tmp++; |
|
837 } |
|
838 |
1823
|
839 return retval; |
1
|
840 } |
|
841 |
767
|
842 // Check to see if a character string matches any one of the plot |
941
|
843 // option keywords. Don't match abbreviations for clear, since that's |
|
844 // not a gnuplot keyword (users will probably only expect to be able |
|
845 // to abbreviate actual gnuplot keywords). |
767
|
846 |
1
|
847 static int |
1823
|
848 is_plot_keyword (const string& s) |
1
|
849 { |
1823
|
850 const char *t = s.c_str (); |
|
851 if (almost_match ("title", t)) |
146
|
852 { |
|
853 return TITLE; |
|
854 } |
1823
|
855 else if (almost_match ("using", t)) |
146
|
856 { |
2857
|
857 lexer_flags.in_plot_using = true; |
146
|
858 return USING; |
|
859 } |
1823
|
860 else if (almost_match ("with", t)) |
146
|
861 { |
2857
|
862 lexer_flags.in_plot_style = true; |
146
|
863 return WITH; |
|
864 } |
1823
|
865 else if (strcmp ("clear", t) == 0) |
883
|
866 { |
|
867 return CLEAR; |
|
868 } |
1
|
869 else |
146
|
870 { |
|
871 return 0; |
|
872 } |
1
|
873 } |
|
874 |
2877
|
875 // Handle keywords. |
767
|
876 |
1
|
877 static int |
1823
|
878 is_keyword (const string& s) |
1
|
879 { |
1826
|
880 if (lexer_flags.plotting && lexer_flags.in_plot_style) |
1
|
881 { |
1823
|
882 string sty = plot_style_token (s); |
|
883 |
|
884 if (! sty.empty ()) |
1
|
885 { |
2857
|
886 lexer_flags.in_plot_style = false; |
143
|
887 yylval.tok_val = new token (sty); |
|
888 token_stack.push (yylval.tok_val); |
1
|
889 return STYLE; |
|
890 } |
|
891 } |
|
892 |
143
|
893 int l = input_line_number; |
|
894 int c = current_input_column; |
|
895 |
1823
|
896 int len = s.length (); |
922
|
897 |
1823
|
898 const octave_kw *kw = octave_kw_lookup (s.c_str (), len); |
191
|
899 |
1497
|
900 if (kw) |
143
|
901 { |
1497
|
902 yylval.tok_val = 0; |
|
903 |
|
904 switch (kw->kw_id) |
|
905 { |
|
906 case all_va_args_kw: |
|
907 case break_kw: |
2764
|
908 case case_kw: |
1497
|
909 case catch_kw: |
|
910 case continue_kw: |
|
911 case else_kw: |
|
912 case elseif_kw: |
|
913 case global_kw: |
2764
|
914 case otherwise_kw: |
1497
|
915 case return_kw: |
2846
|
916 case static_kw: |
1497
|
917 case unwind_protect_cleanup_kw: |
|
918 break; |
|
919 |
|
920 case end_kw: |
|
921 yylval.tok_val = new token (token::simple_end, l, c); |
|
922 break; |
|
923 |
|
924 case end_try_catch_kw: |
|
925 yylval.tok_val = new token (token::try_catch_end, l, c); |
|
926 break; |
|
927 |
|
928 case end_unwind_protect_kw: |
|
929 yylval.tok_val = new token (token::unwind_protect_end, l, c); |
|
930 break; |
|
931 |
|
932 case endfor_kw: |
|
933 yylval.tok_val = new token (token::for_end, l, c); |
|
934 break; |
|
935 |
|
936 case endfunction_kw: |
|
937 yylval.tok_val = new token (token::function_end, l, c); |
|
938 break; |
|
939 |
|
940 case endif_kw: |
|
941 yylval.tok_val = new token (token::if_end, l, c); |
|
942 break; |
|
943 |
2764
|
944 case endswitch_kw: |
|
945 yylval.tok_val = new token (token::switch_end, l, c); |
|
946 break; |
|
947 |
1497
|
948 case endwhile_kw: |
|
949 yylval.tok_val = new token (token::while_end, l, c); |
|
950 break; |
|
951 |
|
952 case for_kw: |
|
953 case while_kw: |
|
954 promptflag--; |
1826
|
955 lexer_flags.looping++; |
1497
|
956 break; |
|
957 |
|
958 case if_kw: |
|
959 case try_kw: |
2764
|
960 case switch_kw: |
1497
|
961 case unwind_protect_kw: |
|
962 promptflag--; |
|
963 break; |
|
964 |
|
965 case gplot_kw: |
2857
|
966 lexer_flags.plotting = true; |
1497
|
967 yylval.tok_val = new token (token::two_dee, l, c); |
|
968 break; |
|
969 |
|
970 case gsplot_kw: |
2857
|
971 lexer_flags.plotting = true; |
1497
|
972 yylval.tok_val = new token (token::three_dee, l, c); |
|
973 break; |
|
974 |
|
975 case replot_kw: |
2857
|
976 lexer_flags.plotting = true; |
1497
|
977 yylval.tok_val = new token (token::replot, l, c); |
|
978 break; |
|
979 |
|
980 case function_kw: |
1826
|
981 if (lexer_flags.defining_func) |
1497
|
982 { |
|
983 error ("function keyword invalid within a function body"); |
|
984 |
|
985 if ((reading_fcn_file || reading_script_file) |
1755
|
986 && ! curr_fcn_file_name.empty ()) |
1497
|
987 error ("defining new function near line %d of file `%s.m'", |
1755
|
988 input_line_number, curr_fcn_file_name.c_str ()); |
1497
|
989 else |
1755
|
990 error ("defining new function near line %d", |
|
991 input_line_number); |
1497
|
992 |
|
993 return LEXICAL_ERROR; |
|
994 } |
|
995 else |
|
996 { |
2877
|
997 // Prepare for local symbols. |
|
998 |
1497
|
999 tmp_local_sym_tab = new symbol_table (); |
2877
|
1000 |
|
1001 promptflag--; |
|
1002 |
2857
|
1003 lexer_flags.defining_func = true; |
2877
|
1004 lexer_flags.parsed_function_name = false; |
2857
|
1005 lexer_flags.beginning_of_function = true; |
2877
|
1006 |
1497
|
1007 if (! (reading_fcn_file || reading_script_file)) |
|
1008 input_line_number = 1; |
|
1009 } |
|
1010 break; |
|
1011 |
|
1012 default: |
|
1013 panic_impossible (); |
|
1014 } |
|
1015 |
|
1016 if (! yylval.tok_val) |
|
1017 yylval.tok_val = new token (l, c); |
|
1018 |
476
|
1019 token_stack.push (yylval.tok_val); |
1497
|
1020 |
|
1021 return kw->tok; |
143
|
1022 } |
1
|
1023 |
|
1024 return 0; |
|
1025 } |
|
1026 |
767
|
1027 // Try to find an identifier. All binding to global or builtin |
|
1028 // variables occurs when expressions are evaluated. |
|
1029 |
1
|
1030 static symbol_record * |
1823
|
1031 lookup_identifier (const string& name) |
1
|
1032 { |
2856
|
1033 return curr_sym_tab->lookup (name, true); |
1
|
1034 } |
|
1035 |
2702
|
1036 static bool |
|
1037 is_variable (const string& name) |
|
1038 { |
2856
|
1039 symbol_record *sr = curr_sym_tab->lookup (name); |
2702
|
1040 |
|
1041 return sr && sr->is_variable (); |
|
1042 } |
|
1043 |
|
1044 static void |
|
1045 force_local_variable (const string& name) |
|
1046 { |
2856
|
1047 symbol_record *sr = curr_sym_tab->lookup (name, true); |
2702
|
1048 |
|
1049 if (sr) |
|
1050 sr->define (octave_value ()); |
|
1051 } |
|
1052 |
1019
|
1053 // Grab the help text from an function file. Always overwrites the |
|
1054 // current contents of help_buf. |
767
|
1055 |
2300
|
1056 // XXX FIXME XXX -- gobble_leading_white_space() in variables.cc |
|
1057 // duplicates some of this code! |
|
1058 |
1
|
1059 static void |
|
1060 grab_help_text (void) |
|
1061 { |
1755
|
1062 help_buf.resize (0); |
1019
|
1063 |
2300
|
1064 bool begin_comment = true; |
|
1065 bool in_comment = true; |
1019
|
1066 int c = 0; |
1
|
1067 |
1019
|
1068 while ((c = yyinput ()) != EOF) |
|
1069 { |
2300
|
1070 if (begin_comment) |
|
1071 { |
|
1072 if (c == '%' || c == '#') |
|
1073 continue; |
|
1074 else |
|
1075 begin_comment = false; |
|
1076 } |
|
1077 |
1019
|
1078 if (in_comment) |
1
|
1079 { |
1755
|
1080 help_buf += (char) c; |
|
1081 |
1019
|
1082 if (c == '\n') |
2300
|
1083 in_comment = false; |
1019
|
1084 } |
|
1085 else |
|
1086 { |
|
1087 switch (c) |
991
|
1088 { |
1019
|
1089 case '%': |
|
1090 case '#': |
2300
|
1091 in_comment = true; |
|
1092 begin_comment = true; |
1019
|
1093 break; |
777
|
1094 |
1019
|
1095 case ' ': |
|
1096 case '\t': |
|
1097 break; |
777
|
1098 |
1019
|
1099 default: |
|
1100 goto done; |
1
|
1101 } |
|
1102 } |
1019
|
1103 } |
991
|
1104 |
1019
|
1105 done: |
991
|
1106 |
1019
|
1107 if (c) |
|
1108 yyunput (c, yytext); |
1
|
1109 } |
|
1110 |
767
|
1111 // Return 1 if the given character matches any character in the given |
|
1112 // string. |
|
1113 |
2857
|
1114 static bool |
2804
|
1115 match_any (char c, const char *s) |
1
|
1116 { |
|
1117 char tmp; |
|
1118 while ((tmp = *s++) != '\0') |
|
1119 { |
|
1120 if (c == tmp) |
2857
|
1121 return true; |
1
|
1122 } |
2857
|
1123 return false; |
1
|
1124 } |
|
1125 |
767
|
1126 // Given information about the spacing surrounding an operator, |
|
1127 // return 1 if it looks like it should be treated as a binary |
|
1128 // operator. For example, |
|
1129 // |
|
1130 // [ 1 + 2 ] or [ 1+ 2] or [ 1+2 ] ==> binary |
|
1131 |
2857
|
1132 static bool |
1
|
1133 looks_like_bin_op (int spc_prev, int spc_next) |
|
1134 { |
608
|
1135 return ((spc_prev && spc_next) || ! spc_prev); |
1
|
1136 } |
|
1137 |
767
|
1138 // Try to determine if the next token should be treated as a postfix |
|
1139 // unary operator. This is ugly, but it seems to do the right thing. |
|
1140 |
2857
|
1141 static bool |
1
|
1142 next_token_is_postfix_unary_op (int spc_prev, char *yytext) |
|
1143 { |
2857
|
1144 bool un_op = false; |
1
|
1145 |
|
1146 int c0 = yyinput (); |
|
1147 int c1 = yyinput (); |
|
1148 |
|
1149 yyunput (c1, yytext); |
|
1150 yyunput (c0, yytext); |
|
1151 |
|
1152 int transpose = (c0 == '.' && c1 == '\''); |
|
1153 int hermitian = (c0 == '\''); |
|
1154 |
|
1155 un_op = (transpose || (hermitian && ! spc_prev)); |
|
1156 |
|
1157 return un_op; |
|
1158 } |
|
1159 |
767
|
1160 // Try to determine if the next token should be treated as a binary |
|
1161 // operator. This is even uglier, but it also seems to do the right |
1276
|
1162 // thing. Note that it is only necessary to check the spacing for `+' |
|
1163 // and `-', since those are the only tokens that can appear as unary |
|
1164 // ops too. |
1521
|
1165 // |
|
1166 // Note that this never returns true for `.', even though it can be a |
|
1167 // binary operator (the structure reference thing). The only time |
|
1168 // this appears to matter is for things like |
|
1169 // |
|
1170 // [ a . b ] |
|
1171 // |
|
1172 // which probably doesn't occur that often, can be worked around by |
|
1173 // eliminating the whitespace, putting the expression in parentheses, |
|
1174 // or using `whitespace_in_literal_matrix = "ignored"', so I think it |
|
1175 // is an acceptable change. It would be quite a bit harder to `fix' |
|
1176 // this. (Well, maybe not. the best fix would be to do away with the |
|
1177 // specialness of whitespace inside of `[ ... ]'). |
1554
|
1178 // |
|
1179 // However, we still do check for `.+', `.*', etc. |
767
|
1180 |
2857
|
1181 static bool |
1
|
1182 next_token_is_bin_op (int spc_prev, char *yytext) |
|
1183 { |
2857
|
1184 bool bin_op = false; |
1
|
1185 |
|
1186 int c0 = yyinput (); |
|
1187 |
|
1188 switch (c0) |
|
1189 { |
777
|
1190 case '+': |
|
1191 case '-': |
1276
|
1192 { |
|
1193 int c1 = yyinput (); |
|
1194 yyunput (c1, yytext); |
|
1195 int spc_next = (c1 == ' ' || c1 == '\t'); |
|
1196 bin_op = looks_like_bin_op (spc_prev, spc_next); |
|
1197 } |
|
1198 break; |
|
1199 |
1554
|
1200 case '.': |
|
1201 { |
|
1202 int c1 = yyinput (); |
|
1203 yyunput (c1, yytext); |
|
1204 bin_op = match_any (c1, "+-*/\\^"); |
|
1205 } |
|
1206 break; |
|
1207 |
777
|
1208 case '/': |
|
1209 case ':': |
|
1210 case '\\': |
|
1211 case '^': |
1
|
1212 case '&': |
|
1213 case '*': |
|
1214 case '|': |
|
1215 case '<': |
|
1216 case '>': |
777
|
1217 case '~': |
|
1218 case '!': |
|
1219 case '=': |
2857
|
1220 bin_op = true; |
1
|
1221 break; |
|
1222 |
|
1223 default: |
1276
|
1224 break; |
1
|
1225 } |
|
1226 |
|
1227 yyunput (c0, yytext); |
|
1228 |
|
1229 return bin_op; |
|
1230 } |
|
1231 |
767
|
1232 // Used to delete trailing white space from tokens. |
|
1233 |
1823
|
1234 static string |
1
|
1235 strip_trailing_whitespace (char *s) |
|
1236 { |
1823
|
1237 string retval = s; |
1
|
1238 |
1823
|
1239 size_t pos = retval.find_first_of (" \t"); |
1
|
1240 |
1823
|
1241 if (pos != NPOS) |
|
1242 retval.resize (pos); |
1
|
1243 |
|
1244 return retval; |
|
1245 } |
|
1246 |
1001
|
1247 // Discard whitespace, including comments and continuations. |
1088
|
1248 // |
|
1249 // Return value is logical OR of the following values: |
|
1250 // |
1826
|
1251 // ATE_NOTHING : no spaces to eat |
1088
|
1252 // ATE_SPACE_OR_TAB : space or tab in input |
|
1253 // ATE_NEWLINE : bare new line in input |
1001
|
1254 |
1826
|
1255 static yum_yum |
975
|
1256 eat_whitespace (void) |
|
1257 { |
1826
|
1258 yum_yum retval = ATE_NOTHING; |
2857
|
1259 bool in_comment = false; |
975
|
1260 int c; |
|
1261 while ((c = yyinput ()) != EOF) |
|
1262 { |
|
1263 current_input_column++; |
|
1264 |
|
1265 switch (c) |
|
1266 { |
|
1267 case ' ': |
|
1268 case '\t': |
1088
|
1269 retval |= ATE_SPACE_OR_TAB; |
975
|
1270 break; |
|
1271 |
|
1272 case '\n': |
1088
|
1273 retval |= ATE_NEWLINE; |
2857
|
1274 in_comment = false; |
975
|
1275 current_input_column = 0; |
|
1276 break; |
|
1277 |
|
1278 case '#': |
|
1279 case '%': |
2857
|
1280 in_comment = true; |
975
|
1281 break; |
|
1282 |
1001
|
1283 case '.': |
|
1284 if (in_comment) |
|
1285 break; |
|
1286 else |
|
1287 { |
|
1288 if (have_ellipsis_continuation ()) |
|
1289 break; |
|
1290 else |
|
1291 goto done; |
|
1292 } |
|
1293 |
|
1294 case '\\': |
|
1295 if (in_comment) |
|
1296 break; |
|
1297 else |
|
1298 { |
3096
|
1299 if (Vbackslash_escapes && have_continuation ()) |
1001
|
1300 break; |
|
1301 else |
|
1302 goto done; |
|
1303 } |
|
1304 |
975
|
1305 default: |
|
1306 if (in_comment) |
|
1307 break; |
|
1308 else |
|
1309 goto done; |
|
1310 } |
|
1311 } |
|
1312 |
|
1313 done: |
|
1314 yyunput (c, yytext); |
1082
|
1315 current_input_column--; |
1001
|
1316 return retval; |
975
|
1317 } |
|
1318 |
|
1319 static void |
972
|
1320 handle_number (char *yytext) |
|
1321 { |
2621
|
1322 char *tmp = strsave (yytext); |
|
1323 |
|
1324 char *idx = strpbrk (tmp, "Dd"); |
|
1325 |
|
1326 if (idx) |
|
1327 *idx = 'e'; |
|
1328 |
972
|
1329 double value; |
2621
|
1330 int nread = sscanf (tmp, "%lf", &value); |
|
1331 |
|
1332 delete [] tmp; |
972
|
1333 |
1826
|
1334 // If yytext doesn't contain a valid number, we are in deep doo doo. |
985
|
1335 |
972
|
1336 assert (nread == 1); |
|
1337 |
1826
|
1338 lexer_flags.quote_is_transpose = 1; |
|
1339 lexer_flags.cant_be_identifier = 1; |
|
1340 lexer_flags.convert_spaces_to_comma = 1; |
972
|
1341 |
1826
|
1342 if (lexer_flags.plotting && ! lexer_flags.in_plot_range) |
|
1343 lexer_flags.past_plot_range = 1; |
972
|
1344 |
|
1345 yylval.tok_val = new token (value, yytext, input_line_number, |
|
1346 current_input_column); |
|
1347 |
|
1348 token_stack.push (yylval.tok_val); |
|
1349 |
|
1350 current_input_column += yyleng; |
|
1351 |
|
1352 do_comma_insert_check (); |
|
1353 } |
|
1354 |
1001
|
1355 // We have seen a backslash and need to find out if it should be |
|
1356 // treated as a continuation character. If so, this eats it, up to |
|
1357 // and including the new line character. |
|
1358 // |
973
|
1359 // Match whitespace only, followed by a comment character or newline. |
|
1360 // Once a comment character is found, discard all input until newline. |
|
1361 // If non-whitespace characters are found before comment |
|
1362 // characters, return 0. Otherwise, return 1. |
|
1363 |
2857
|
1364 static bool |
3096
|
1365 have_continuation (bool trailing_comments_ok) |
973
|
1366 { |
|
1367 ostrstream buf; |
|
1368 |
2857
|
1369 bool in_comment = false; |
973
|
1370 char c; |
|
1371 while ((c = yyinput ()) != EOF) |
|
1372 { |
|
1373 buf << (char) c; |
|
1374 |
|
1375 switch (c) |
|
1376 { |
|
1377 case ' ': |
|
1378 case '\t': |
|
1379 break; |
|
1380 |
|
1381 case '%': |
|
1382 case '#': |
1091
|
1383 if (trailing_comments_ok) |
2857
|
1384 in_comment = true; |
1091
|
1385 else |
|
1386 goto cleanup; |
973
|
1387 break; |
|
1388 |
|
1389 case '\n': |
975
|
1390 current_input_column = 0; |
1001
|
1391 promptflag--; |
2857
|
1392 return true; |
973
|
1393 |
|
1394 default: |
1091
|
1395 if (! in_comment) |
|
1396 goto cleanup; |
|
1397 break; |
973
|
1398 } |
|
1399 } |
|
1400 |
|
1401 yyunput (c, yytext); |
2857
|
1402 return false; |
973
|
1403 |
3096
|
1404 cleanup: |
1091
|
1405 buf << ends; |
|
1406 char *s = buf.str (); |
|
1407 if (s) |
|
1408 { |
|
1409 int len = strlen (s); |
|
1410 while (len--) |
|
1411 yyunput (s[len], yytext); |
|
1412 } |
|
1413 delete [] s; |
3096
|
1414 |
2857
|
1415 return false; |
973
|
1416 } |
|
1417 |
1001
|
1418 // We have seen a `.' and need to see if it is the start of a |
|
1419 // continuation. If so, this eats it, up to and including the new |
|
1420 // line character. |
|
1421 |
2857
|
1422 static bool |
3096
|
1423 have_ellipsis_continuation (bool trailing_comments_ok) |
973
|
1424 { |
|
1425 char c1 = yyinput (); |
|
1426 if (c1 == '.') |
|
1427 { |
|
1428 char c2 = yyinput (); |
1091
|
1429 if (c2 == '.' && have_continuation (trailing_comments_ok)) |
2857
|
1430 return true; |
973
|
1431 else |
|
1432 { |
|
1433 yyunput (c2, yytext); |
|
1434 yyunput (c1, yytext); |
|
1435 } |
|
1436 } |
|
1437 else |
|
1438 yyunput (c1, yytext); |
|
1439 |
2857
|
1440 return false; |
973
|
1441 } |
|
1442 |
1001
|
1443 // See if we have a continuation line. If so, eat it and the leading |
|
1444 // whitespace on the next line. |
1088
|
1445 // |
|
1446 // Return value is the same as described for eat_whitespace(). |
1001
|
1447 |
1826
|
1448 static yum_yum |
1001
|
1449 eat_continuation (void) |
|
1450 { |
1826
|
1451 int retval = ATE_NOTHING; |
1001
|
1452 int c = yyinput (); |
|
1453 if ((c == '.' && have_ellipsis_continuation ()) |
3096
|
1454 || (c == '\\' && Vbackslash_escapes && have_continuation ())) |
1001
|
1455 retval = eat_whitespace (); |
|
1456 else |
|
1457 yyunput (c, yytext); |
|
1458 |
|
1459 return retval; |
|
1460 } |
|
1461 |
973
|
1462 static int |
975
|
1463 handle_string (char delim, int text_style) |
973
|
1464 { |
|
1465 ostrstream buf; |
|
1466 |
|
1467 int c; |
1031
|
1468 int escape_pending = 0; |
973
|
1469 |
|
1470 while ((c = yyinput ()) != EOF) |
|
1471 { |
|
1472 current_input_column++; |
|
1473 |
3096
|
1474 if (c == '\\' && Vbackslash_escapes) |
973
|
1475 { |
1053
|
1476 if (escape_pending) |
|
1477 { |
|
1478 buf << (char) c; |
|
1479 escape_pending = 0; |
|
1480 } |
|
1481 else |
|
1482 { |
3096
|
1483 if (have_continuation (false)) |
1053
|
1484 escape_pending = 0; |
|
1485 else |
|
1486 { |
|
1487 buf << (char) c; |
|
1488 escape_pending = 1; |
|
1489 } |
|
1490 } |
1031
|
1491 continue; |
973
|
1492 } |
|
1493 else if (c == '.') |
|
1494 { |
3096
|
1495 if (! have_ellipsis_continuation (false)) |
973
|
1496 buf << (char) c; |
|
1497 } |
|
1498 else if (c == '\n') |
|
1499 { |
1053
|
1500 error ("unterminated string constant"); |
973
|
1501 break; |
|
1502 } |
|
1503 else if (c == delim) |
|
1504 { |
1031
|
1505 if (escape_pending) |
973
|
1506 buf << (char) c; |
|
1507 else |
|
1508 { |
|
1509 c = yyinput (); |
|
1510 if (c == delim) |
|
1511 buf << (char) c; |
|
1512 else |
|
1513 { |
|
1514 yyunput (c, yytext); |
|
1515 buf << ends; |
3103
|
1516 char *tmp = buf.str (); |
|
1517 string tok = Vbackslash_escapes |
|
1518 ? do_string_escapes (tmp) : string (tmp); |
|
1519 delete [] tmp; |
975
|
1520 |
1826
|
1521 if (text_style && lexer_flags.doing_set) |
975
|
1522 { |
3103
|
1523 if (! tok.empty ()) |
|
1524 tok = string (delim, 1) + tok + string (delim, 1); |
975
|
1525 } |
|
1526 else |
|
1527 { |
2857
|
1528 lexer_flags.quote_is_transpose = true; |
|
1529 lexer_flags.cant_be_identifier = true; |
|
1530 lexer_flags.convert_spaces_to_comma = true; |
975
|
1531 } |
|
1532 |
973
|
1533 yylval.tok_val = new token (tok); |
|
1534 token_stack.push (yylval.tok_val); |
|
1535 return TEXT; |
|
1536 } |
|
1537 } |
|
1538 } |
|
1539 else |
|
1540 { |
|
1541 buf << (char) c; |
|
1542 } |
|
1543 |
1031
|
1544 escape_pending = 0; |
973
|
1545 } |
|
1546 |
|
1547 return LEXICAL_ERROR; |
|
1548 } |
|
1549 |
971
|
1550 static int |
1001
|
1551 handle_close_brace (int spc_gobbled) |
971
|
1552 { |
1826
|
1553 if (! nesting_level.none ()) |
971
|
1554 { |
1826
|
1555 nesting_level.remove (); |
|
1556 lexer_flags.braceflag--; |
971
|
1557 } |
|
1558 |
1826
|
1559 if (lexer_flags.braceflag == 0) |
1001
|
1560 BEGIN 0; |
|
1561 |
2970
|
1562 // XXX FIXME XXX -- this needs to handle +=, -=, etc. |
|
1563 |
971
|
1564 int c1 = yyinput (); |
|
1565 if (c1 == '=') |
|
1566 { |
2857
|
1567 lexer_flags.quote_is_transpose = false; |
|
1568 lexer_flags.cant_be_identifier = false; |
|
1569 lexer_flags.convert_spaces_to_comma = true; |
971
|
1570 |
|
1571 int c2 = yyinput (); |
|
1572 unput (c2); |
|
1573 unput (c1); |
|
1574 |
2970
|
1575 if (c2 == '=' || lexer_flags.looking_at_return_list) |
|
1576 return ']'; |
971
|
1577 else |
2970
|
1578 return CLOSE_BRACE; |
971
|
1579 } |
|
1580 else |
|
1581 { |
|
1582 unput (c1); |
|
1583 |
2167
|
1584 if (lexer_flags.braceflag && Vwhitespace_in_literal_matrix != 2) |
971
|
1585 { |
1001
|
1586 int bin_op = next_token_is_bin_op (spc_gobbled, yytext); |
971
|
1587 int postfix_un_op = next_token_is_postfix_unary_op |
1001
|
1588 (spc_gobbled, yytext); |
971
|
1589 |
|
1590 int other_op = match_any (c1, ",;\n]"); |
|
1591 |
1826
|
1592 if (! (postfix_un_op || bin_op || other_op) |
|
1593 && nesting_level.is_brace () |
|
1594 && lexer_flags.convert_spaces_to_comma) |
971
|
1595 { |
|
1596 unput (','); |
|
1597 return ']'; |
|
1598 } |
|
1599 } |
|
1600 } |
|
1601 |
2857
|
1602 lexer_flags.quote_is_transpose = true; |
|
1603 lexer_flags.cant_be_identifier = false; |
|
1604 lexer_flags.convert_spaces_to_comma = true; |
971
|
1605 return ']'; |
|
1606 } |
|
1607 |
1072
|
1608 static void |
|
1609 maybe_unput_comma (int spc_gobbled) |
|
1610 { |
2970
|
1611 if (Vwhitespace_in_literal_matrix != 2 && nesting_level.is_brace ()) |
1072
|
1612 { |
|
1613 int bin_op = next_token_is_bin_op (spc_gobbled, yytext); |
|
1614 |
2970
|
1615 int postfix_un_op |
|
1616 = next_token_is_postfix_unary_op (spc_gobbled, yytext); |
1072
|
1617 |
|
1618 int c1 = yyinput (); |
|
1619 int c2 = yyinput (); |
2970
|
1620 |
1072
|
1621 unput (c2); |
|
1622 unput (c1); |
2970
|
1623 |
1072
|
1624 int sep_op = match_any (c1, ",;\n]"); |
2970
|
1625 |
1072
|
1626 int dot_op = (c1 == '.' |
|
1627 && (isalpha (c2) || isspace (c2) || c2 == '_')); |
2970
|
1628 |
1072
|
1629 int index_op = (c1 == '(' |
2167
|
1630 && (Vwhitespace_in_literal_matrix == 0 |
1072
|
1631 || ! spc_gobbled)); |
|
1632 |
|
1633 if (! (postfix_un_op || bin_op || sep_op || dot_op || index_op)) |
|
1634 unput (','); |
|
1635 } |
|
1636 } |
|
1637 |
767
|
1638 // Figure out exactly what kind of token to return when we have seen |
|
1639 // an identifier. Handles keywords. |
|
1640 |
146
|
1641 static int |
1823
|
1642 handle_identifier (const string& tok, int spc_gobbled) |
146
|
1643 { |
1826
|
1644 // It is almost always an error for an identifier to be followed |
|
1645 // directly by another identifier. Special cases are handled |
|
1646 // below. |
883
|
1647 |
2857
|
1648 lexer_flags.cant_be_identifier = true; |
883
|
1649 |
2970
|
1650 // If we are expecting a structure element, avoid recognizing |
|
1651 // keywords and other special names and return STRUCT_ELT, which is |
|
1652 // a string that is also a valid identifier. But first, we have to |
|
1653 // decide whether to insert a comma. |
747
|
1654 |
1826
|
1655 if (lexer_flags.looking_at_indirect_ref) |
1072
|
1656 { |
2970
|
1657 do_comma_insert_check (); |
|
1658 |
1072
|
1659 maybe_unput_comma (spc_gobbled); |
2819
|
1660 |
|
1661 yylval.tok_val = new token (tok, input_line_number, |
|
1662 current_input_column); |
|
1663 |
|
1664 token_stack.push (yylval.tok_val); |
|
1665 |
2857
|
1666 lexer_flags.cant_be_identifier = false; |
|
1667 lexer_flags.quote_is_transpose = true; |
|
1668 lexer_flags.convert_spaces_to_comma = true; |
2819
|
1669 |
|
1670 current_input_column += yyleng; |
|
1671 |
2970
|
1672 return STRUCT_ELT; |
1072
|
1673 } |
747
|
1674 |
1826
|
1675 // If we have a regular keyword, or a plot STYLE, return it. |
|
1676 // Keywords can be followed by identifiers (TOK_RETURN handles |
|
1677 // that). |
146
|
1678 |
|
1679 int kw_token = is_keyword (tok); |
2970
|
1680 |
146
|
1681 if (kw_token) |
|
1682 { |
|
1683 if (kw_token == STYLE) |
|
1684 { |
1060
|
1685 current_input_column += yyleng; |
2857
|
1686 lexer_flags.quote_is_transpose = false; |
|
1687 lexer_flags.convert_spaces_to_comma = true; |
146
|
1688 return kw_token; |
|
1689 } |
|
1690 else |
|
1691 TOK_RETURN (kw_token); |
|
1692 } |
|
1693 |
1826
|
1694 // See if we have a plot keyword (title, using, with, or clear). |
146
|
1695 |
1826
|
1696 if (lexer_flags.plotting) |
941
|
1697 { |
1826
|
1698 // Yes, we really do need both of these plot_range variables. |
|
1699 // One is used to mark when we are past all possiblity of a plot |
|
1700 // range, the other is used to mark when we are actually between |
|
1701 // the square brackets that surround the range. |
146
|
1702 |
1826
|
1703 if (! lexer_flags.in_plot_range) |
2857
|
1704 lexer_flags.past_plot_range = true; |
941
|
1705 |
1273
|
1706 // Option keywords can't appear in parentheses or braces. |
|
1707 |
|
1708 int plot_option_kw = 0; |
2970
|
1709 |
1826
|
1710 if (nesting_level.none ()) |
1273
|
1711 plot_option_kw = is_plot_keyword (tok); |
941
|
1712 |
1826
|
1713 if (lexer_flags.cant_be_identifier && plot_option_kw) |
941
|
1714 TOK_RETURN (plot_option_kw); |
|
1715 } |
146
|
1716 |
1001
|
1717 int c = yyinput (); |
|
1718 yyunput (c, yytext); |
2702
|
1719 bool next_tok_is_eq = (c == '='); |
|
1720 bool next_tok_is_paren = (c == '('); |
1001
|
1721 |
1826
|
1722 // Make sure we put the return values of a function in the symbol |
|
1723 // table that is local to the function. |
146
|
1724 |
2877
|
1725 // If we are defining a function and we have not seen the function |
|
1726 // name yet and the next token is `=', then this identifier must be |
|
1727 // the only return value for the function and it belongs in the |
|
1728 // local symbol table. |
|
1729 |
1826
|
1730 if (next_tok_is_eq |
2877
|
1731 && lexer_flags.defining_func |
|
1732 && ! lexer_flags.parsed_function_name) |
146
|
1733 curr_sym_tab = tmp_local_sym_tab; |
|
1734 |
2702
|
1735 // Kluge alert. |
|
1736 // |
|
1737 // If we are looking at a text style function, set up to gobble its |
2745
|
1738 // arguments. |
|
1739 // |
|
1740 // If the following token is `=', or if we are parsing a function |
|
1741 // return list or function parameter list, force the symbol to be |
2702
|
1742 // inserted as a variable in the current symbol table. |
|
1743 |
|
1744 if (is_text_function_name (tok) && ! is_variable (tok)) |
|
1745 { |
2745
|
1746 if (next_tok_is_eq |
|
1747 || lexer_flags.looking_at_return_list |
|
1748 || lexer_flags.looking_at_parameter_list) |
|
1749 { |
|
1750 force_local_variable (tok); |
|
1751 } |
2702
|
1752 else if (! next_tok_is_paren) |
|
1753 { |
|
1754 if (tok == "gset") |
2857
|
1755 lexer_flags.doing_set = true; |
2702
|
1756 |
|
1757 BEGIN TEXT_FCN; |
|
1758 } |
|
1759 } |
|
1760 |
1826
|
1761 // Find the token in the symbol table. |
146
|
1762 |
|
1763 yylval.tok_val = new token (lookup_identifier (tok), |
|
1764 input_line_number, |
|
1765 current_input_column); |
|
1766 |
|
1767 token_stack.push (yylval.tok_val); |
|
1768 |
1826
|
1769 // After seeing an identifer, it is ok to convert spaces to a comma |
|
1770 // (if needed). |
146
|
1771 |
2857
|
1772 lexer_flags.convert_spaces_to_comma = true; |
146
|
1773 |
2877
|
1774 if (! next_tok_is_eq) |
|
1775 { |
|
1776 lexer_flags.quote_is_transpose = true; |
146
|
1777 |
2877
|
1778 do_comma_insert_check (); |
|
1779 |
|
1780 maybe_unput_comma (spc_gobbled); |
146
|
1781 } |
|
1782 |
2877
|
1783 current_input_column += yyleng; |
146
|
1784 |
|
1785 return NAME; |
|
1786 } |
|
1787 |
767
|
1788 // Print a warning if a function file that defines a function has |
|
1789 // anything other than comments and whitespace following the END token |
|
1790 // that matches the FUNCTION statement. |
|
1791 |
1
|
1792 void |
|
1793 check_for_garbage_after_fcn_def (void) |
|
1794 { |
1826
|
1795 // By making a newline be the next character to be read, we will |
|
1796 // force the parser to return after reading the function. Calling |
|
1797 // yyunput with EOF seems not to work... |
1
|
1798 |
2857
|
1799 bool in_comment = false; |
1
|
1800 int lineno = input_line_number; |
|
1801 int c; |
|
1802 while ((c = yyinput ()) != EOF) |
|
1803 { |
|
1804 switch (c) |
|
1805 { |
|
1806 case ' ': |
|
1807 case '\t': |
|
1808 case ';': |
|
1809 case ',': |
|
1810 break; |
777
|
1811 |
1
|
1812 case '\n': |
|
1813 if (in_comment) |
2857
|
1814 in_comment = false; |
1
|
1815 break; |
777
|
1816 |
1
|
1817 case '%': |
|
1818 case '#': |
2857
|
1819 in_comment = true; |
1
|
1820 break; |
777
|
1821 |
1
|
1822 default: |
|
1823 if (in_comment) |
|
1824 break; |
|
1825 else |
|
1826 { |
|
1827 warning ("ignoring trailing garbage after end of function\n\ |
1755
|
1828 near line %d of file `%s.m'", lineno, curr_fcn_file_name.c_str ()); |
1
|
1829 |
|
1830 yyunput ('\n', yytext); |
|
1831 return; |
|
1832 } |
|
1833 } |
|
1834 } |
|
1835 yyunput ('\n', yytext); |
|
1836 } |
|
1837 |
1826
|
1838 void |
|
1839 lexical_feedback::init (void) |
|
1840 { |
|
1841 // Not initially defining a matrix list. |
|
1842 braceflag = 0; |
|
1843 |
|
1844 // Not initially inside a loop or if statement. |
|
1845 looping = 0; |
|
1846 |
2857
|
1847 // Not initially defining a function. |
|
1848 beginning_of_function = false; |
|
1849 defining_func = false; |
2877
|
1850 parsed_function_name = false; |
2857
|
1851 |
|
1852 // Not parsing a function return or parameter list. |
|
1853 looking_at_return_list = false; |
|
1854 looking_at_parameter_list = false; |
|
1855 |
|
1856 // Next token can be identifier. |
|
1857 cant_be_identifier = false; |
|
1858 |
|
1859 // No need to do comma insert or convert spaces to comma at |
|
1860 // beginning of input. |
|
1861 convert_spaces_to_comma = true; |
|
1862 do_comma_insert = false; |
|
1863 |
|
1864 // Not initially doing any plotting or setting of plot attributes. |
|
1865 doing_set = false; |
|
1866 in_plot_range = false; |
|
1867 in_plot_style = false; |
|
1868 in_plot_using = false; |
|
1869 past_plot_range = false; |
|
1870 plotting = false; |
|
1871 |
1826
|
1872 // Not initially looking at indirect references. |
2857
|
1873 looking_at_indirect_ref = false; |
1826
|
1874 |
|
1875 // Quote marks strings intially. |
2857
|
1876 quote_is_transpose = false; |
1826
|
1877 } |
|
1878 |
2167
|
1879 int |
3096
|
1880 backslash_escapes (void) |
|
1881 { |
|
1882 Vbackslash_escapes = check_preference ("backslash_escapes"); |
|
1883 |
|
1884 return 0; |
|
1885 } |
|
1886 |
|
1887 int |
2167
|
1888 whitespace_in_literal_matrix (void) |
|
1889 { |
|
1890 int pref = 0; |
3009
|
1891 |
2167
|
1892 string val = builtin_string_variable ("whitespace_in_literal_matrix"); |
3009
|
1893 |
2167
|
1894 if (! val.empty ()) |
|
1895 { |
|
1896 if (val.compare ("ignore", 0, 6) == 0) |
|
1897 pref = 2; |
|
1898 else if (val.compare ("traditional", 0, 11) == 0) |
|
1899 pref = 1; |
|
1900 } |
3009
|
1901 |
2167
|
1902 Vwhitespace_in_literal_matrix = pref; |
3009
|
1903 |
2167
|
1904 return 0; |
|
1905 } |
|
1906 |
|
1907 void |
|
1908 symbols_of_lex (void) |
|
1909 { |
3096
|
1910 DEFVAR (backslash_escapes, 1.0, 0, backslash_escapes, |
|
1911 "if nonzero, Octave recognizes backslashes in strings as escapes that\n\ |
|
1912 introduce special characters like newline (\\n), tab (\\t), etc."); |
|
1913 |
2167
|
1914 DEFVAR (whitespace_in_literal_matrix, "", 0, whitespace_in_literal_matrix, |
|
1915 "control auto-insertion of commas and semicolons in literal matrices"); |
|
1916 } |
|
1917 |
1994
|
1918 /* |
|
1919 ;;; Local Variables: *** |
|
1920 ;;; mode: C++ *** |
|
1921 ;;; End: *** |
|
1922 */ |