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