GNU Octave  4.2.1
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
lex.cc
Go to the documentation of this file.
1 #if defined (HAVE_CONFIG_H)
2 # include "config.h"
3 #endif
4 
5 #if defined (HAVE_PRAGMA_GCC_DIAGNOSTIC)
6 // This one needs to be global.
7 #pragma GCC diagnostic ignored "-Wunused-function"
8 
9 // Disable these warnings for code that is generated by flex, including
10 // pattern rules. Push the current state so we can restore the warning
11 // state prior to functions we define at the bottom of the file.
12 #pragma GCC diagnostic push
13 #pragma GCC diagnostic ignored "-Wold-style-cast"
14 #pragma GCC diagnostic ignored "-Wsign-compare"
15 #endif
16 
17 // Define away the deprecated register storage class specifier to avoid
18 // potential warnings about it.
19 #if ! defined (register)
20 # define register
21 #endif
22 
23 #line 24 "libinterp/parse-tree/lex.cc"
24 
25 #define YY_INT_ALIGNED short int
26 
27 /* A lexical scanner generated by flex */
28 
29 #define FLEX_SCANNER
30 #define YY_FLEX_MAJOR_VERSION 2
31 #define YY_FLEX_MINOR_VERSION 6
32 #define YY_FLEX_SUBMINOR_VERSION 1
33 #if YY_FLEX_SUBMINOR_VERSION > 0
34 #define FLEX_BETA
35 #endif
36 
37 /* First, we deal with platform-specific or compiler-specific issues. */
38 
39 /* begin standard C headers. */
40 #include <stdio.h>
41 #include <string.h>
42 #include <errno.h>
43 #include <stdlib.h>
44 
45 /* end standard C headers. */
46 
47 /* flex integer type definitions */
48 
49 #ifndef FLEXINT_H
50 #define FLEXINT_H
51 
52 /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
53 
54 #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
55 
56 /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
57  * if you want the limit (max/min) macros for int types.
58  */
59 #ifndef __STDC_LIMIT_MACROS
60 #define __STDC_LIMIT_MACROS 1
61 #endif
62 
63 #include <inttypes.h>
64 typedef int8_t flex_int8_t;
65 typedef uint8_t flex_uint8_t;
66 typedef int16_t flex_int16_t;
67 typedef uint16_t flex_uint16_t;
68 typedef int32_t flex_int32_t;
69 typedef uint32_t flex_uint32_t;
70 #else
71 typedef signed char flex_int8_t;
72 typedef short int flex_int16_t;
73 typedef int flex_int32_t;
74 typedef unsigned char flex_uint8_t;
75 typedef unsigned short int flex_uint16_t;
76 typedef unsigned int flex_uint32_t;
77 
78 /* Limits of integral types. */
79 #ifndef INT8_MIN
80 #define INT8_MIN (-128)
81 #endif
82 #ifndef INT16_MIN
83 #define INT16_MIN (-32767-1)
84 #endif
85 #ifndef INT32_MIN
86 #define INT32_MIN (-2147483647-1)
87 #endif
88 #ifndef INT8_MAX
89 #define INT8_MAX (127)
90 #endif
91 #ifndef INT16_MAX
92 #define INT16_MAX (32767)
93 #endif
94 #ifndef INT32_MAX
95 #define INT32_MAX (2147483647)
96 #endif
97 #ifndef UINT8_MAX
98 #define UINT8_MAX (255U)
99 #endif
100 #ifndef UINT16_MAX
101 #define UINT16_MAX (65535U)
102 #endif
103 #ifndef UINT32_MAX
104 #define UINT32_MAX (4294967295U)
105 #endif
106 
107 #endif /* ! C99 */
108 
109 #endif /* ! FLEXINT_H */
110 
111 /* TODO: this is always defined, so inline it */
112 #define yyconst const
113 
114 #if defined(__GNUC__) && __GNUC__ >= 3
115 #define yynoreturn __attribute__((__noreturn__))
116 #else
117 #define yynoreturn
118 #endif
119 
120 /* Returned upon end-of-file. */
121 #define YY_NULL 0
122 
123 /* Promotes a possibly negative, possibly signed char to an unsigned
124  * integer for use as an array index. If the signed char is negative,
125  * we want to instead treat it as an 8-bit unsigned char, hence the
126  * double cast.
127  */
128 #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
129 
130 /* An opaque pointer. */
131 #ifndef YY_TYPEDEF_YY_SCANNER_T
132 #define YY_TYPEDEF_YY_SCANNER_T
133 typedef void* yyscan_t;
134 #endif
135 
136 /* For convenience, these vars (plus the bison vars far below)
137  are macros in the reentrant scanner. */
138 #define yyin yyg->yyin_r
139 #define yyout yyg->yyout_r
140 #define yyextra yyg->yyextra_r
141 #define yyleng yyg->yyleng_r
142 #define yytext yyg->yytext_r
143 #define yylineno (YY_CURRENT_BUFFER_LVALUE->yy_bs_lineno)
144 #define yycolumn (YY_CURRENT_BUFFER_LVALUE->yy_bs_column)
145 #define yy_flex_debug yyg->yy_flex_debug_r
146 
147 /* Enter a start condition. This macro really ought to take a parameter,
148  * but we do it the disgusting crufty way forced on us by the ()-less
149  * definition of BEGIN.
150  */
151 #define BEGIN yyg->yy_start = 1 + 2 *
152 
153 /* Translate the current start state into a value that can be later handed
154  * to BEGIN to return to the state. The YYSTATE alias is for lex
155  * compatibility.
156  */
157 #define YY_START ((yyg->yy_start - 1) / 2)
158 #define YYSTATE YY_START
159 
160 /* Action number for EOF rule of a given start state. */
161 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
162 
163 /* Special action meaning "start processing a new file". */
164 #define YY_NEW_FILE octave_restart(yyin ,yyscanner )
165 
166 #define YY_END_OF_BUFFER_CHAR 0
167 
168 /* Size of default input buffer. */
169 #ifndef YY_BUF_SIZE
170 #ifdef __ia64__
171 /* On IA-64, the buffer size is 16k, not 8k.
172  * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
173  * Ditto for the __ia64__ case accordingly.
174  */
175 #define YY_BUF_SIZE 32768
176 #else
177 #define YY_BUF_SIZE 16384
178 #endif /* __ia64__ */
179 #endif
180 
181 /* The state buf must be large enough to hold one state per character in the main buffer.
182  */
183 #define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
184 
185 #ifndef YY_TYPEDEF_YY_BUFFER_STATE
186 #define YY_TYPEDEF_YY_BUFFER_STATE
188 #endif
189 
190 #ifndef YY_TYPEDEF_YY_SIZE_T
191 #define YY_TYPEDEF_YY_SIZE_T
192 typedef size_t yy_size_t;
193 #endif
194 
195 #define EOB_ACT_CONTINUE_SCAN 0
196 #define EOB_ACT_END_OF_FILE 1
197 #define EOB_ACT_LAST_MATCH 2
198 
199  #define YY_LESS_LINENO(n)
200  #define YY_LINENO_REWIND_TO(ptr)
201 
202 /* Return all but the first "n" matched characters back to the input stream. */
203 #define yyless(n) \
204  do \
205  { \
206  /* Undo effects of setting up yytext. */ \
207  int yyless_macro_arg = (n); \
208  YY_LESS_LINENO(yyless_macro_arg);\
209  *yy_cp = yyg->yy_hold_char; \
210  YY_RESTORE_YY_MORE_OFFSET \
211  yyg->yy_c_buf_p = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
212  YY_DO_BEFORE_ACTION; /* set up yytext again */ \
213  } \
214  while ( 0 )
215 
216 #define unput(c) yyunput( c, yyg->yytext_ptr , yyscanner )
217 
218 #ifndef YY_STRUCT_YY_BUFFER_STATE
219 #define YY_STRUCT_YY_BUFFER_STATE
220 struct yy_buffer_state
221  {
222  FILE *yy_input_file;
223 
224  char *yy_ch_buf; /* input buffer */
225  char *yy_buf_pos; /* current position in input buffer */
226 
227  /* Size of input buffer in bytes, not including room for EOB
228  * characters.
229  */
230  int yy_buf_size;
231 
232  /* Number of characters read into yy_ch_buf, not including EOB
233  * characters.
234  */
235  int yy_n_chars;
236 
237  /* Whether we "own" the buffer - i.e., we know we created it,
238  * and can realloc() it to grow it, and should free() it to
239  * delete it.
240  */
241  int yy_is_our_buffer;
242 
243  /* Whether this is an "interactive" input source; if so, and
244  * if we're using stdio for input, then we want to use getc()
245  * instead of fread(), to make sure we stop fetching input after
246  * each newline.
247  */
248  int yy_is_interactive;
249 
250  /* Whether we're considered to be at the beginning of a line.
251  * If so, '^' rules will be active on the next match, otherwise
252  * not.
253  */
254  int yy_at_bol;
255 
256  int yy_bs_lineno; /**< The line count. */
257  int yy_bs_column; /**< The column count. */
258 
259  /* Whether to try to fill the input buffer when we reach the
260  * end of it.
261  */
262  int yy_fill_buffer;
263 
264  int yy_buffer_status;
265 
266 #define YY_BUFFER_NEW 0
267 #define YY_BUFFER_NORMAL 1
268  /* When an EOF's been seen but there's still some text to process
269  * then we mark the buffer as YY_EOF_PENDING, to indicate that we
270  * shouldn't try reading from the input source any more. We might
271  * still have a bunch of tokens to match, though, because of
272  * possible backing-up.
273  *
274  * When we actually see the EOF, we change the status to "new"
275  * (via octave_restart()), so that the user can continue scanning by
276  * just pointing yyin at a new input file.
277  */
278 #define YY_BUFFER_EOF_PENDING 2
279 
280  };
281 #endif /* !YY_STRUCT_YY_BUFFER_STATE */
282 
283 /* We provide macros for accessing buffer states in case in the
284  * future we want to put the buffer states in a more general
285  * "scanner state".
286  *
287  * Returns the top of the stack, or NULL.
288  */
289 #define YY_CURRENT_BUFFER ( yyg->yy_buffer_stack \
290  ? yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] \
291  : NULL)
292 
293 /* Same as previous macro, but useful when we know that the buffer stack is not
294  * NULL or when we need an lvalue. For internal use only.
295  */
296 #define YY_CURRENT_BUFFER_LVALUE yyg->yy_buffer_stack[yyg->yy_buffer_stack_top]
297 
298 void octave_restart (FILE *input_file ,yyscan_t yyscanner );
299 void octave__switch_to_buffer (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner );
300 YY_BUFFER_STATE octave__create_buffer (FILE *file,int size ,yyscan_t yyscanner );
301 void octave__delete_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner );
302 void octave__flush_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner );
303 void octave_push_buffer_state (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner );
304 void octave_pop_buffer_state (yyscan_t yyscanner );
305 
306 static void octave_ensure_buffer_stack (yyscan_t yyscanner );
307 static void octave__load_buffer_state (yyscan_t yyscanner );
308 static void octave__init_buffer (YY_BUFFER_STATE b,FILE *file ,yyscan_t yyscanner );
309 
310 #define YY_FLUSH_BUFFER octave__flush_buffer(YY_CURRENT_BUFFER ,yyscanner)
311 
312 YY_BUFFER_STATE octave__scan_buffer (char *base,yy_size_t size ,yyscan_t yyscanner );
313 YY_BUFFER_STATE octave__scan_string (yyconst char *yy_str ,yyscan_t yyscanner );
314 YY_BUFFER_STATE octave__scan_bytes (yyconst char *bytes,int len ,yyscan_t yyscanner );
315 
316 void *octave_alloc (yy_size_t ,yyscan_t yyscanner );
317 void *octave_realloc (void *,yy_size_t ,yyscan_t yyscanner );
318 void octave_free (void * ,yyscan_t yyscanner );
319 
320 #define yy_new_buffer octave__create_buffer
321 
322 #define yy_set_interactive(is_interactive) \
323  { \
324  if ( ! YY_CURRENT_BUFFER ){ \
325  octave_ensure_buffer_stack (yyscanner); \
326  YY_CURRENT_BUFFER_LVALUE = \
327  octave__create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \
328  } \
329  YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
330  }
331 
332 #define yy_set_bol(at_bol) \
333  { \
334  if ( ! YY_CURRENT_BUFFER ){\
335  octave_ensure_buffer_stack (yyscanner); \
336  YY_CURRENT_BUFFER_LVALUE = \
337  octave__create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \
338  } \
339  YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
340  }
341 
342 #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
343 
344 /* Begin user sect3 */
345 
346 #define octave_wrap(yyscanner) (/*CONSTCOND*/1)
347 #define YY_SKIP_YYWRAP
348 
349 typedef unsigned char YY_CHAR;
350 
351 typedef int yy_state_type;
352 
353 #define yytext_ptr yytext_r
354 
355 static yy_state_type yy_get_previous_state (yyscan_t yyscanner );
356 static yy_state_type yy_try_NUL_trans (yy_state_type current_state ,yyscan_t yyscanner);
357 static int yy_get_next_buffer (yyscan_t yyscanner );
358 static void yynoreturn yy_fatal_error (yyconst char* msg ,yyscan_t yyscanner );
359 
360 /* Done after the current pattern has been matched and before the
361  * corresponding action - sets up yytext.
362  */
363 #define YY_DO_BEFORE_ACTION \
364  yyg->yytext_ptr = yy_bp; \
365  yyleng = (int) (yy_cp - yy_bp); \
366  yyg->yy_hold_char = *yy_cp; \
367  *yy_cp = '\0'; \
368  yyg->yy_c_buf_p = yy_cp;
369 
370 #define YY_NUM_RULES 119
371 #define YY_END_OF_BUFFER 120
372 /* This struct is not used in this scanner,
373  but its presence is necessary. */
374 struct yy_trans_info
375  {
378  };
380  { 0,
381  0, 0, 5, 5, 10, 10, 0, 0, 0, 0,
382  0, 0, 0, 0, 0, 0, 0, 0, 120, 118,
383  51, 60, 60, 91, 62, 118, 56, 76, 61, 96,
384  97, 80, 88, 92, 89, 98, 81, 50, 50, 63,
385  87, 78, 99, 79, 118, 59, 14, 82, 15, 83,
386  56, 56, 116, 77, 117, 90, 51, 118, 9, 8,
387  3, 3, 7, 119, 5, 6, 4, 9, 10, 11,
388  11, 12, 13, 10, 1, 1, 119, 19, 19, 119,
389  119, 22, 22, 22, 22, 39, 40, 40, 24, 38,
390  119, 43, 44, 44, 42, 47, 46, 119, 45, 51,
391 
392  0, 60, 74, 0, 20, 20, 56, 0, 85, 114,
393  84, 102, 94, 100, 95, 101, 93, 66, 64, 65,
394  0, 67, 50, 68, 69, 103, 50, 50, 0, 0,
395  48, 0, 71, 72, 75, 58, 0, 53, 53, 0,
396  104, 110, 56, 56, 115, 86, 73, 51, 0, 0,
397  9, 8, 3, 0, 3, 5, 6, 0, 10, 11,
398  10, 1, 0, 19, 19, 0, 0, 0, 0, 0,
399  0, 22, 0, 21, 21, 39, 40, 23, 0, 37,
400  37, 36, 36, 25, 27, 28, 29, 30, 31, 32,
401  33, 37, 43, 44, 41, 46, 45, 0, 57, 111,
402 
403  70, 107, 105, 106, 0, 108, 50, 0, 109, 112,
404  49, 50, 50, 0, 50, 50, 58, 0, 0, 54,
405  54, 56, 0, 16, 16, 0, 0, 17, 17, 0,
406  18, 18, 0, 0, 35, 35, 25, 26, 45, 57,
407  0, 113, 0, 52, 52, 0, 50, 50, 50, 58,
408  0, 55, 0, 2, 2, 0, 34, 34, 25, 45,
409  57, 50, 58, 57, 0
410  } ;
411 
412 static yyconst YY_CHAR yy_ec[256] =
413  { 0,
414  1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
415  1, 1, 4, 1, 1, 1, 1, 1, 1, 1,
416  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
417  1, 2, 5, 6, 7, 8, 7, 9, 10, 11,
418  12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
419  21, 21, 21, 21, 21, 22, 22, 23, 24, 25,
420  26, 27, 28, 29, 30, 31, 30, 32, 32, 30,
421  8, 8, 33, 33, 8, 8, 8, 8, 8, 8,
422  8, 8, 8, 8, 8, 8, 8, 34, 8, 8,
423  35, 36, 37, 38, 39, 1, 40, 41, 30, 32,
424 
425  42, 43, 44, 8, 33, 33, 8, 8, 8, 45,
426  8, 8, 8, 46, 47, 48, 8, 49, 8, 50,
427  8, 8, 51, 52, 53, 54, 1, 1, 1, 1,
428  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
429  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
430  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
431  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
432  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
433  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
434  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
435 
436  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
437  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
438  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
439  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
440  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
441  1, 1, 1, 1, 1
442  } ;
443 
444 static yyconst YY_CHAR yy_meta[55] =
445  { 0,
446  1, 2, 3, 3, 1, 4, 2, 5, 1, 6,
447  2, 2, 1, 1, 2, 1, 7, 1, 8, 8,
448  8, 8, 1, 2, 1, 1, 1, 1, 9, 10,
449  10, 10, 11, 5, 2, 12, 2, 1, 11, 10,
450  10, 10, 10, 5, 5, 5, 5, 5, 5, 5,
451  2, 1, 2, 1
452  } ;
453 
455  { 0,
456  0, 53, 59, 111, 54, 83, 619, 618, 64, 75,
457  91, 95, 102, 127, 137, 139, 163, 212, 618, 820,
458  57, 820, 614, 590, 820, 69, 586, 66, 820, 820,
459  820, 75, 90, 820, 108, 253, 583, 275, 119, 820,
460  820, 582, 483, 482, 0, 820, 820, 152, 820, 481,
461  103, 110, 820, 77, 820, 480, 82, 170, 0, 503,
462  820, 500, 820, 77, 116, 145, 820, 485, 168, 820,
463  498, 820, 820, 170, 820, 497, 176, 820, 496, 181,
464  183, 820, 174, 495, 186, 0, 820, 494, 490, 478,
465  324, 0, 820, 491, 478, 820, 485, 820, 469, 215,
466 
467  188, 820, 820, 196, 820, 481, 453, 0, 820, 820,
468  455, 820, 820, 820, 820, 820, 820, 203, 454, 452,
469  460, 450, 279, 427, 408, 820, 365, 0, 199, 211,
470  820, 0, 820, 820, 820, 388, 274, 820, 397, 220,
471  820, 820, 199, 220, 820, 820, 820, 233, 279, 282,
472  0, 394, 820, 261, 391, 268, 276, 374, 303, 820,
473  313, 820, 319, 820, 386, 329, 337, 335, 344, 347,
474  331, 820, 347, 820, 373, 0, 820, 820, 354, 820,
475  353, 820, 363, 339, 820, 820, 820, 820, 820, 820,
476  820, 0, 0, 820, 820, 361, 325, 0, 307, 820,
477 
478  278, 820, 820, 820, 349, 820, 360, 392, 820, 820,
479  820, 396, 400, 402, 421, 269, 276, 0, 358, 820,
480  287, 366, 423, 820, 284, 406, 428, 820, 277, 442,
481  820, 247, 445, 448, 820, 245, 436, 0, 224, 222,
482  0, 820, 433, 820, 234, 442, 446, 450, 193, 184,
483  98, 820, 455, 820, 165, 471, 820, 158, 820, 141,
484  120, 471, 108, 94, 820, 510, 522, 534, 546, 558,
485  570, 582, 594, 602, 609, 620, 632, 644, 656, 668,
486  679, 691, 699, 706, 710, 716, 727, 732, 738, 745,
487  756, 761, 768, 779, 787, 794, 801, 808
488 
489  } ;
490 
492  { 0,
493  265, 1, 266, 266, 1, 1, 267, 267, 268, 268,
494  269, 269, 270, 270, 271, 271, 272, 272, 265, 265,
495  265, 265, 265, 265, 265, 273, 274, 265, 265, 265,
496  265, 265, 265, 265, 265, 265, 265, 265, 38, 265,
497  265, 265, 265, 265, 275, 265, 265, 265, 265, 265,
498  274, 274, 265, 265, 265, 265, 265, 273, 276, 265,
499  265, 265, 265, 277, 265, 265, 265, 265, 265, 265,
500  265, 265, 265, 265, 265, 265, 278, 265, 265, 278,
501  278, 265, 265, 265, 279, 280, 265, 265, 265, 265,
502  281, 282, 265, 265, 265, 265, 265, 265, 283, 265,
503 
504  273, 265, 265, 273, 265, 265, 274, 284, 265, 265,
505  265, 265, 265, 265, 265, 265, 265, 265, 265, 265,
506  265, 265, 265, 265, 265, 265, 265, 39, 265, 265,
507  265, 285, 265, 265, 265, 286, 265, 265, 265, 287,
508  265, 265, 274, 274, 265, 265, 265, 265, 273, 273,
509  276, 265, 265, 277, 265, 265, 265, 265, 265, 265,
510  265, 265, 278, 265, 265, 278, 278, 278, 278, 265,
511  279, 265, 279, 265, 265, 280, 265, 265, 265, 265,
512  265, 265, 265, 265, 265, 265, 265, 265, 265, 265,
513  265, 288, 282, 265, 265, 265, 283, 289, 290, 265,
514 
515  265, 265, 265, 265, 291, 265, 265, 265, 265, 265,
516  265, 265, 265, 265, 265, 292, 286, 293, 287, 265,
517  265, 274, 273, 265, 265, 294, 278, 265, 265, 278,
518  265, 265, 265, 265, 265, 265, 265, 288, 295, 290,
519  296, 265, 291, 265, 265, 265, 265, 265, 292, 297,
520  265, 265, 294, 265, 265, 265, 265, 265, 265, 295,
521  298, 265, 297, 298, 0, 265, 265, 265, 265, 265,
522  265, 265, 265, 265, 265, 265, 265, 265, 265, 265,
523  265, 265, 265, 265, 265, 265, 265, 265, 265, 265,
524  265, 265, 265, 265, 265, 265, 265, 265
525 
526  } ;
527 
529  { 0,
530  20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
531  30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
532  39, 39, 40, 41, 42, 43, 44, 45, 46, 27,
533  27, 27, 27, 27, 47, 48, 49, 50, 27, 27,
534  27, 27, 27, 51, 27, 27, 52, 27, 27, 27,
535  53, 54, 55, 56, 57, 69, 70, 71, 100, 58,
536  60, 61, 62, 101, 63, 64, 78, 79, 63, 65,
537  66, 105, 106, 67, 109, 68, 80, 78, 79, 153,
538  155, 81, 67, 148, 74, 70, 71, 111, 149, 58,
539  72, 110, 83, 65, 84, 66, 83, 85, 84, 251,
540 
541  112, 85, 145, 113, 87, 88, 73, 89, 252, 65,
542  241, 66, 60, 61, 62, 114, 63, 64, 90, 72,
543  63, 65, 66, 115, 218, 67, 156, 68, 146, 87,
544  88, 108, 89, 116, 67, 73, 241, 91, 108, 93,
545  94, 93, 94, 90, 143, 65, 95, 66, 95, 265,
546  156, 144, 265, 137, 138, 139, 157, 198, 140, 265,
547  257, 65, 91, 66, 97, 98, 156, 254, 265, 159,
548  99, 161, 105, 106, 101, 170, 149, 141, 164, 165,
549  171, 157, 166, 164, 165, 164, 165, 167, 174, 175,
550  105, 106, 99, 99, 99, 99, 99, 157, 105, 106,
551 
552  218, 99, 99, 99, 99, 99, 99, 99, 99, 99,
553  99, 99, 99, 97, 98, 201, 100, 213, 213, 99,
554  150, 101, 220, 221, 214, 131, 214, 108, 202, 215,
555  215, 215, 215, 168, 148, 169, 244, 213, 241, 149,
556  198, 99, 99, 99, 99, 99, 222, 235, 108, 231,
557  99, 99, 99, 99, 99, 99, 99, 99, 99, 99,
558  99, 99, 117, 153, 155, 118, 119, 222, 120, 121,
559  122, 123, 123, 123, 123, 137, 138, 139, 156, 228,
560  140, 105, 106, 223, 224, 225, 224, 157, 124, 220,
561  125, 127, 218, 128, 128, 128, 128, 207, 207, 207,
562 
563  207, 131, 156, 242, 159, 129, 130, 131, 132, 101,
564  208, 131, 157, 128, 161, 129, 130, 207, 156, 149,
565  208, 164, 165, 241, 132, 181, 182, 183, 157, 150,
566  166, 164, 165, 174, 175, 167, 227, 228, 229, 164,
567  165, 198, 184, 184, 184, 230, 231, 232, 170, 174,
568  175, 244, 245, 171, 234, 235, 236, 237, 237, 237,
569  220, 221, 196, 185, 186, 182, 187, 251, 188, 189,
570  233, 190, 191, 192, 211, 174, 252, 211, 207, 207,
571  207, 207, 211, 212, 212, 212, 212, 168, 164, 169,
572  226, 208, 131, 153, 108, 152, 130, 131, 207, 138,
573 
574  211, 208, 211, 212, 218, 246, 130, 246, 254, 255,
575  247, 247, 247, 247, 212, 212, 212, 212, 213, 213,
576  215, 215, 215, 215, 223, 224, 225, 130, 131, 227,
577  228, 229, 131, 210, 212, 244, 245, 130, 213, 248,
578  248, 248, 248, 230, 231, 232, 256, 257, 258, 234,
579  235, 236, 209, 131, 259, 259, 259, 254, 255, 248,
580  247, 247, 247, 247, 262, 262, 262, 262, 248, 248,
581  248, 248, 256, 257, 258, 206, 205, 204, 131, 203,
582  200, 108, 131, 105, 262, 198, 196, 195, 248, 262,
583  262, 262, 262, 194, 179, 178, 177, 172, 164, 162,
584 
585  160, 158, 153, 131, 152, 147, 142, 135, 134, 262,
586  59, 59, 59, 59, 59, 59, 59, 59, 59, 59,
587  59, 59, 75, 75, 75, 75, 75, 75, 75, 75,
588  75, 75, 75, 75, 77, 77, 77, 77, 77, 77,
589  77, 77, 77, 77, 77, 77, 82, 82, 82, 82,
590  82, 82, 82, 82, 82, 82, 82, 82, 86, 86,
591  86, 86, 86, 86, 86, 86, 86, 86, 86, 86,
592  92, 92, 92, 92, 92, 92, 92, 92, 92, 92,
593  92, 92, 96, 96, 96, 96, 96, 96, 96, 96,
594  96, 96, 96, 96, 104, 104, 104, 104, 104, 104,
595 
596  104, 104, 104, 104, 104, 104, 107, 133, 126, 107,
597  107, 107, 107, 136, 108, 103, 102, 265, 136, 136,
598  151, 76, 76, 265, 151, 265, 265, 151, 151, 151,
599  151, 151, 154, 154, 154, 154, 154, 154, 154, 154,
600  154, 154, 154, 154, 163, 163, 163, 163, 163, 163,
601  163, 163, 163, 163, 163, 163, 173, 173, 173, 173,
602  173, 173, 173, 173, 173, 173, 173, 173, 176, 176,
603  265, 265, 176, 176, 265, 176, 176, 176, 176, 180,
604  180, 180, 180, 180, 180, 180, 180, 180, 180, 180,
605  180, 193, 193, 265, 193, 193, 265, 193, 193, 193,
606 
607  193, 193, 193, 197, 265, 197, 197, 265, 197, 197,
608  199, 265, 265, 265, 265, 199, 199, 216, 265, 216,
609  217, 265, 217, 217, 265, 217, 217, 219, 219, 219,
610  219, 219, 219, 219, 219, 219, 219, 219, 219, 238,
611  265, 238, 239, 265, 265, 265, 265, 239, 239, 240,
612  265, 240, 240, 265, 240, 240, 243, 243, 243, 243,
613  243, 243, 243, 243, 243, 243, 243, 243, 249, 265,
614  249, 249, 250, 265, 265, 265, 265, 250, 250, 253,
615  253, 253, 253, 253, 253, 253, 253, 253, 253, 253,
616  253, 260, 265, 260, 260, 265, 260, 260, 261, 265,
617 
618  265, 265, 265, 261, 261, 263, 265, 263, 263, 265,
619  263, 263, 264, 265, 264, 264, 265, 264, 264, 19,
620  265, 265, 265, 265, 265, 265, 265, 265, 265, 265,
621  265, 265, 265, 265, 265, 265, 265, 265, 265, 265,
622  265, 265, 265, 265, 265, 265, 265, 265, 265, 265,
623  265, 265, 265, 265, 265, 265, 265, 265, 265, 265,
624  265, 265, 265, 265, 265, 265, 265, 265, 265, 265,
625  265, 265, 265, 265
626  } ;
627 
629  { 0,
630  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
631  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
632  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
633  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
634  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
635  1, 1, 1, 1, 2, 5, 5, 5, 21, 2,
636  3, 3, 3, 21, 3, 3, 9, 9, 3, 3,
637  3, 26, 26, 3, 28, 3, 10, 10, 10, 64,
638  64, 10, 3, 57, 6, 6, 6, 32, 57, 6,
639  5, 28, 11, 3, 11, 3, 12, 11, 12, 251,
640 
641  32, 12, 54, 33, 13, 13, 5, 13, 251, 3,
642  264, 3, 4, 4, 4, 33, 4, 4, 13, 6,
643  4, 4, 4, 35, 263, 4, 65, 4, 54, 14,
644  14, 51, 14, 35, 4, 6, 261, 13, 52, 15,
645  15, 16, 16, 14, 51, 4, 15, 4, 16, 39,
646  65, 52, 39, 48, 48, 48, 66, 260, 48, 39,
647  258, 4, 14, 4, 17, 17, 65, 255, 39, 69,
648  17, 74, 58, 58, 69, 83, 74, 48, 77, 77,
649  83, 66, 80, 80, 80, 81, 81, 80, 85, 85,
650  101, 101, 17, 17, 17, 17, 17, 66, 104, 104,
651 
652  250, 17, 17, 17, 17, 17, 17, 17, 17, 17,
653  17, 17, 17, 18, 18, 118, 100, 129, 129, 18,
654  58, 100, 140, 140, 130, 249, 130, 143, 118, 130,
655  130, 130, 130, 81, 148, 81, 245, 129, 240, 148,
656  239, 18, 18, 18, 18, 18, 143, 236, 144, 232,
657  18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
658  18, 18, 36, 154, 154, 36, 36, 144, 36, 36,
659  36, 36, 36, 36, 36, 137, 137, 137, 156, 229,
660  137, 149, 149, 150, 150, 150, 225, 157, 36, 221,
661  36, 38, 217, 38, 38, 38, 38, 123, 123, 123,
662 
663  123, 216, 156, 201, 159, 38, 38, 38, 38, 159,
664  123, 123, 157, 38, 161, 38, 38, 123, 156, 161,
665  123, 163, 163, 199, 38, 91, 91, 91, 157, 149,
666  166, 166, 166, 171, 171, 166, 168, 168, 168, 167,
667  167, 197, 91, 91, 91, 169, 169, 169, 170, 173,
668  173, 205, 205, 170, 181, 181, 181, 184, 184, 184,
669  219, 219, 196, 91, 91, 183, 91, 222, 91, 91,
670  179, 91, 91, 91, 127, 175, 222, 127, 207, 207,
671  207, 207, 127, 127, 127, 127, 127, 167, 165, 167,
672  158, 207, 207, 155, 222, 152, 127, 127, 207, 139,
673 
674  127, 207, 127, 127, 136, 208, 127, 208, 226, 226,
675  208, 208, 208, 208, 212, 212, 212, 212, 213, 213,
676  214, 214, 214, 214, 223, 223, 223, 212, 212, 227,
677  227, 227, 213, 125, 212, 243, 243, 212, 213, 215,
678  215, 215, 215, 230, 230, 230, 233, 233, 233, 234,
679  234, 234, 124, 215, 237, 237, 237, 253, 253, 215,
680  246, 246, 246, 246, 247, 247, 247, 247, 248, 248,
681  248, 248, 256, 256, 256, 122, 121, 120, 247, 119,
682  111, 107, 248, 106, 247, 99, 97, 95, 248, 262,
683  262, 262, 262, 94, 90, 89, 88, 84, 79, 76,
684 
685  71, 68, 62, 262, 60, 56, 50, 44, 43, 262,
686  266, 266, 266, 266, 266, 266, 266, 266, 266, 266,
687  266, 266, 267, 267, 267, 267, 267, 267, 267, 267,
688  267, 267, 267, 267, 268, 268, 268, 268, 268, 268,
689  268, 268, 268, 268, 268, 268, 269, 269, 269, 269,
690  269, 269, 269, 269, 269, 269, 269, 269, 270, 270,
691  270, 270, 270, 270, 270, 270, 270, 270, 270, 270,
692  271, 271, 271, 271, 271, 271, 271, 271, 271, 271,
693  271, 271, 272, 272, 272, 272, 272, 272, 272, 272,
694  272, 272, 272, 272, 273, 273, 273, 273, 273, 273,
695 
696  273, 273, 273, 273, 273, 273, 274, 42, 37, 274,
697  274, 274, 274, 275, 27, 24, 23, 19, 275, 275,
698  276, 8, 7, 0, 276, 0, 0, 276, 276, 276,
699  276, 276, 277, 277, 277, 277, 277, 277, 277, 277,
700  277, 277, 277, 277, 278, 278, 278, 278, 278, 278,
701  278, 278, 278, 278, 278, 278, 279, 279, 279, 279,
702  279, 279, 279, 279, 279, 279, 279, 279, 280, 280,
703  0, 0, 280, 280, 0, 280, 280, 280, 280, 281,
704  281, 281, 281, 281, 281, 281, 281, 281, 281, 281,
705  281, 282, 282, 0, 282, 282, 0, 282, 282, 282,
706 
707  282, 282, 282, 283, 0, 283, 283, 0, 283, 283,
708  284, 0, 0, 0, 0, 284, 284, 285, 0, 285,
709  286, 0, 286, 286, 0, 286, 286, 287, 287, 287,
710  287, 287, 287, 287, 287, 287, 287, 287, 287, 288,
711  0, 288, 289, 0, 0, 0, 0, 289, 289, 290,
712  0, 290, 290, 0, 290, 290, 291, 291, 291, 291,
713  291, 291, 291, 291, 291, 291, 291, 291, 292, 0,
714  292, 292, 293, 0, 0, 0, 0, 293, 293, 294,
715  294, 294, 294, 294, 294, 294, 294, 294, 294, 294,
716  294, 295, 0, 295, 295, 0, 295, 295, 296, 0,
717 
718  0, 0, 0, 296, 296, 297, 0, 297, 297, 0,
719  297, 297, 298, 0, 298, 298, 0, 298, 298, 265,
720  265, 265, 265, 265, 265, 265, 265, 265, 265, 265,
721  265, 265, 265, 265, 265, 265, 265, 265, 265, 265,
722  265, 265, 265, 265, 265, 265, 265, 265, 265, 265,
723  265, 265, 265, 265, 265, 265, 265, 265, 265, 265,
724  265, 265, 265, 265, 265, 265, 265, 265, 265, 265,
725  265, 265, 265, 265
726  } ;
727 
728 /* The intent behind this definition is that it'll catch
729  * any uses of REJECT which flex missed.
730  */
731 #define REJECT reject_used_but_not_detected
732 #define yymore() yymore_used_but_not_detected
733 #define YY_MORE_ADJ 0
734 #define YY_RESTORE_YY_MORE_OFFSET
735 #line 1 "../libinterp/parse-tree/lex.ll"
736 /*
737 
738 Copyright (C) 1993-2017 John W. Eaton
739 
740 This file is part of Octave.
741 
742 Octave is free software; you can redistribute it and/or modify it
743 under the terms of the GNU General Public License as published by the
744 Free Software Foundation; either version 3 of the License, or (at your
745 option) any later version.
746 
747 Octave is distributed in the hope that it will be useful, but WITHOUT
748 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
749 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
750 for more details.
751 
752 You should have received a copy of the GNU General Public License
753 along with Octave; see the file COPYING. If not, see
754 <http://www.gnu.org/licenses/>.
755 
756 */
757 /*
758 We are using the pure parser interface and the reentrant lexer
759 interface but the Octave parser and lexer are NOT properly
760 reentrant because both still use many global variables. It should be
761 safe to create a parser object and call it while another parser
762 object is active (to parse a callback function while the main
763 interactive parser is waiting for input, for example) if you take
764 care to properly save and restore (typically with an unwind_protect
765 object) relevant global values before and after the nested call.
766 */
767 
768 
769 
770 
771 
772 
773 
774 
775 
776 #line 82 "../libinterp/parse-tree/lex.ll"
777 
778 #include <cctype>
779 #include <cstring>
780 
781 #include <iostream>
782 #include <set>
783 #include <sstream>
784 #include <string>
785 #include <stack>
786 
787 #include "cmd-edit.h"
788 #include "lo-mappers.h"
789 #include "quit.h"
790 #include "unistd-wrappers.h"
791 
792 // These would be alphabetical, but oct-parse.h must be included before
793 // oct-gperf.h and oct-parse.h must be included after token.h and the tree
794 // class declarations. We can't include oct-parse.h in oct-gperf.h
795 // because it may not be protected to allow it to be included multiple
796 // times.
797 
798 #include "Cell.h"
799 #include "comment-list.h"
800 #include "defun.h"
801 #include "error.h"
802 #include "errwarn.h"
803 #include "input.h"
804 #include "interpreter.h"
805 #include "lex.h"
806 #include "octave.h"
807 #include "ov.h"
808 #include "parse.h"
809 #include "pt-all.h"
810 #include "symtab.h"
811 #include "token.h"
812 #include "utils.h"
813 #include "variables.h"
814 #include <oct-parse.h>
815 #include <oct-gperf.h>
816 
817 // FIXME: with bison 3.x, OCTAVE_STYPE appears in the generated
818 // oct-parse.h file, but there is no definition for YYSTYPE, which is
819 // needed by the code that is generated by flex. I can't seem to find a
820 // way to tell flex to use OCTAVE_STYPE instead of YYSTYPE in the code
821 // it generates, or to tell bison to provide the definition of YYSTYPE
822 // in the generated oct-parse.h file.
823 
824 #if defined (OCTAVE_STYPE_IS_DECLARED) && ! defined YYSTYPE
825 # define YYSTYPE OCTAVE_STYPE
826 #endif
827 
828 #define YY_NO_UNISTD_H 1
829 #define isatty octave_isatty_wrapper
830 
831 #if ! (defined (FLEX_SCANNER) \
832  && defined (YY_FLEX_MAJOR_VERSION) && YY_FLEX_MAJOR_VERSION >= 2 \
833  && defined (YY_FLEX_MINOR_VERSION) && YY_FLEX_MINOR_VERSION >= 5)
834 #error lex.l requires flex version 2.5.4 or later
835 #endif
836 
837 #define YY_EXTRA_TYPE octave::base_lexer *
838 #define curr_lexer yyextra
839 
840 // Arrange to get input via readline.
841 
842 #if defined (YY_INPUT)
843 # undef YY_INPUT
844 #endif
845 #define YY_INPUT(buf, result, max_size) \
846  result = curr_lexer->fill_flex_buffer (buf, max_size)
847 
848 // Try to avoid crashing out completely on fatal scanner errors.
849 
850 #if defined (YY_FATAL_ERROR)
851 # undef YY_FATAL_ERROR
852 #endif
853 #define YY_FATAL_ERROR(msg) \
854  (octave_get_extra (yyscanner))->fatal_error (msg)
855 
856 #define CMD_OR_OP(PATTERN, TOK, COMPAT) \
857  do \
858  { \
859  curr_lexer->lexer_debug (PATTERN); \
860  \
861  if (curr_lexer->looks_like_command_arg ()) \
862  { \
863  yyless (0); \
864  curr_lexer->push_start_state (COMMAND_START); \
865  } \
866  else \
867  { \
868  return curr_lexer->handle_op_internal (TOK, false, COMPAT); \
869  } \
870  } \
871  while (0)
872 
873 #define CMD_OR_COMPUTED_ASSIGN_OP(PATTERN, TOK) \
874  do \
875  { \
876  curr_lexer->lexer_debug (PATTERN); \
877  \
878  if (curr_lexer->previous_token_may_be_command () \
879  && curr_lexer->space_follows_previous_token ()) \
880  { \
881  yyless (0); \
882  curr_lexer->push_start_state (COMMAND_START); \
883  } \
884  else \
885  { \
886  return curr_lexer->handle_language_extension_op (PATTERN, TOK, \
887  false); \
888  } \
889  } \
890  while (0)
891 
892 #define CMD_OR_UNARY_OP(PATTERN, TOK, COMPAT) \
893  do \
894  { \
895  curr_lexer->lexer_debug (PATTERN); \
896  \
897  if (curr_lexer->previous_token_may_be_command ()) \
898  { \
899  if (curr_lexer->looks_like_command_arg ()) \
900  { \
901  yyless (0); \
902  curr_lexer->push_start_state (COMMAND_START); \
903  } \
904  else \
905  { \
906  return curr_lexer->handle_op_internal (TOK, false, COMPAT); \
907  } \
908  } \
909  else \
910  { \
911  int tok \
912  = (COMPAT \
913  ? curr_lexer->handle_unary_op (TOK) \
914  : curr_lexer->handle_language_extension_unary_op (TOK)); \
915  \
916  if (tok < 0) \
917  { \
918  yyless (0); \
919  curr_lexer->xunput (','); \
920  /* Adjust for comma that was not really in the input stream. */ \
921  curr_lexer->current_input_column--; \
922  } \
923  else \
924  { \
925  return tok; \
926  } \
927  } \
928  } \
929  while (0)
930 
931 // We can't rely on the trick used elsewhere of sticking ASCII 1 in
932 // the input buffer and recognizing it as a special case because ASCII
933 // 1 is a valid character for a character string. If we are at the
934 // end of the buffer, ask for more input. If we are at the end of the
935 // file, deal with it. Otherwise, just keep going with the text from
936 // the current buffer.
937 #define HANDLE_STRING_CONTINUATION \
938  do \
939  { \
940  curr_lexer->decrement_promptflag (); \
941  curr_lexer->input_line_number++; \
942  curr_lexer->current_input_column = 1; \
943  \
944  if (curr_lexer->is_push_lexer ()) \
945  { \
946  if (curr_lexer->at_end_of_buffer ()) \
947  return -1; \
948  \
949  if (curr_lexer->at_end_of_file ()) \
950  return curr_lexer->handle_end_of_input (); \
951  } \
952  } \
953  while (0)
954 
955 // When a command argument boundary is detected, push out the
956 // current argument being built. This one seems like a good
957 // candidate for a function call.
958 
959 #define COMMAND_ARG_FINISH \
960  do \
961  { \
962  if (curr_lexer->string_text.empty ()) \
963  break; \
964  \
965  int retval = curr_lexer->handle_token (curr_lexer->string_text, \
966  SQ_STRING); \
967  \
968  curr_lexer->string_text = ""; \
969  curr_lexer->command_arg_paren_count = 0; \
970  \
971  yyless (0); \
972  \
973  return retval; \
974  } \
975  while (0)
976 
977 #define HANDLE_IDENTIFIER(pattern, get_set) \
978  do \
979  { \
980  curr_lexer->lexer_debug (pattern); \
981  \
982  int tok = curr_lexer->previous_token_value (); \
983  \
984  if (curr_lexer->whitespace_is_significant () \
985  && curr_lexer->space_follows_previous_token () \
986  && ! (tok == '[' || tok == '{' \
987  || curr_lexer->previous_token_is_binop ())) \
988  { \
989  yyless (0); \
990  unput (','); \
991  } \
992  else \
993  { \
994  if (! curr_lexer->looking_at_decl_list \
995  && curr_lexer->previous_token_may_be_command ()) \
996  { \
997  yyless (0); \
998  curr_lexer->push_start_state (COMMAND_START); \
999  } \
1000  else \
1001  { \
1002  if (get_set) \
1003  { \
1004  yyless (3); \
1005  curr_lexer->maybe_classdef_get_set_method = false; \
1006  } \
1007  \
1008  int id_tok = curr_lexer->handle_identifier (); \
1009  \
1010  if (id_tok >= 0) \
1011  return curr_lexer->count_token_internal (id_tok); \
1012  } \
1013  } \
1014  } \
1015  while (0)
1016 
1017 static bool Vdisplay_tokens = false;
1018 
1019 static unsigned int Vtoken_count = 0;
1020 
1021 // Internal variable for lexer debugging state.
1022 static bool lexer_debug_flag = false;
1023 
1024 #line 1025 "libinterp/parse-tree/lex.cc"
1025 
1026 #define INITIAL 0
1027 #define COMMAND_START 1
1028 #define MATRIX_START 2
1029 #define INPUT_FILE_START 3
1030 #define BLOCK_COMMENT_START 4
1031 #define LINE_COMMENT_START 5
1032 #define DQ_STRING_START 6
1033 #define SQ_STRING_START 7
1034 #define FQ_IDENT_START 8
1035 
1036 #ifndef YY_NO_UNISTD_H
1037 /* Special case for "unistd.h", since it is non-ANSI. We include it way
1038  * down here because we want the user's section 1 to have been scanned first.
1039  * The user has a chance to override it with an option.
1040  */
1041 #include <unistd.h>
1042 #endif
1043 
1044 #ifndef YY_EXTRA_TYPE
1045 #define YY_EXTRA_TYPE void *
1046 #endif
1047 
1048 /* Holds the entire state of the reentrant scanner. */
1049 struct yyguts_t
1050  {
1051 
1052  /* User-defined. Not touched by flex. */
1054 
1055  /* The rest are the same as the globals declared in the non-reentrant scanner. */
1056  FILE *yyin_r, *yyout_r;
1057  size_t yy_buffer_stack_top; /**< index of top of stack. */
1058  size_t yy_buffer_stack_max; /**< capacity of stack. */
1059  YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */
1063  char *yy_c_buf_p;
1064  int yy_init;
1072 
1075 
1076  char *yytext_r;
1079 
1081 
1082  }; /* end struct yyguts_t */
1083 
1084 static int yy_init_globals (yyscan_t yyscanner );
1085 
1086  /* This must go here because YYSTYPE and YYLTYPE are included
1087  * from bison output in section 1.*/
1088  # define yylval yyg->yylval_r
1089 
1091 
1093 
1094 /* Accessor methods to globals.
1095  These are made visible to non-reentrant scanners for convenience. */
1096 
1097 int octave_lex_destroy (yyscan_t yyscanner );
1098 
1099 int octave_get_debug (yyscan_t yyscanner );
1100 
1101 void octave_set_debug (int debug_flag ,yyscan_t yyscanner );
1102 
1104 
1105 void octave_set_extra (YY_EXTRA_TYPE user_defined ,yyscan_t yyscanner );
1106 
1107 FILE *octave_get_in (yyscan_t yyscanner );
1108 
1109 void octave_set_in (FILE * _in_str ,yyscan_t yyscanner );
1110 
1111 FILE *octave_get_out (yyscan_t yyscanner );
1112 
1113 void octave_set_out (FILE * _out_str ,yyscan_t yyscanner );
1114 
1115  int octave_get_leng (yyscan_t yyscanner );
1116 
1117 char *octave_get_text (yyscan_t yyscanner );
1118 
1119 int octave_get_lineno (yyscan_t yyscanner );
1120 
1121 void octave_set_lineno (int _line_number ,yyscan_t yyscanner );
1122 
1123 int octave_get_column (yyscan_t yyscanner );
1124 
1125 void octave_set_column (int _column_no ,yyscan_t yyscanner );
1126 
1127 YYSTYPE * octave_get_lval (yyscan_t yyscanner );
1128 
1129 void octave_set_lval (YYSTYPE * yylval_param ,yyscan_t yyscanner );
1130 
1131 /* Macros after this point can all be overridden by user definitions in
1132  * section 1.
1133  */
1134 
1135 #ifndef YY_SKIP_YYWRAP
1136 #ifdef __cplusplus
1137 extern "C" int octave_wrap (yyscan_t yyscanner );
1138 #else
1139 extern int octave_wrap (yyscan_t yyscanner );
1140 #endif
1141 #endif
1142 
1143 #ifndef YY_NO_UNPUT
1144 
1145  static void yyunput (int c,char *buf_ptr ,yyscan_t yyscanner);
1146 
1147 #endif
1148 
1149 #ifndef yytext_ptr
1150 static void yy_flex_strncpy (char *,yyconst char *,int ,yyscan_t yyscanner);
1151 #endif
1152 
1153 #ifdef YY_NEED_STRLEN
1154 static int yy_flex_strlen (yyconst char * ,yyscan_t yyscanner);
1155 #endif
1156 
1157 #ifndef YY_NO_INPUT
1158 
1159 #ifdef __cplusplus
1160 static int yyinput (yyscan_t yyscanner );
1161 #else
1162 static int input (yyscan_t yyscanner );
1163 #endif
1164 
1165 #endif
1166 
1167 /* Amount of stuff to slurp up with each read. */
1168 #ifndef YY_READ_BUF_SIZE
1169 #ifdef __ia64__
1170 /* On IA-64, the buffer size is 16k, not 8k */
1171 #define YY_READ_BUF_SIZE 16384
1172 #else
1173 #define YY_READ_BUF_SIZE 8192
1174 #endif /* __ia64__ */
1175 #endif
1176 
1177 /* Copy whatever the last rule matched to the standard output. */
1178 #ifndef ECHO
1179 /* This used to be an fputs(), but since the string might contain NUL's,
1180  * we now use fwrite().
1181  */
1182 #define ECHO do { if (fwrite( yytext, (size_t) yyleng, 1, yyout )) {} } while (0)
1183 #endif
1184 
1185 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
1186  * is returned in "result".
1187  */
1188 #ifndef YY_INPUT
1189 #define YY_INPUT(buf,result,max_size) \
1190  if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
1191  { \
1192  int c = '*'; \
1193  size_t n; \
1194  for ( n = 0; n < max_size && \
1195  (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
1196  buf[n] = (char) c; \
1197  if ( c == '\n' ) \
1198  buf[n++] = (char) c; \
1199  if ( c == EOF && ferror( yyin ) ) \
1200  YY_FATAL_ERROR( "input in flex scanner failed" ); \
1201  result = n; \
1202  } \
1203  else \
1204  { \
1205  errno=0; \
1206  while ( (result = (int) fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \
1207  { \
1208  if( errno != EINTR) \
1209  { \
1210  YY_FATAL_ERROR( "input in flex scanner failed" ); \
1211  break; \
1212  } \
1213  errno=0; \
1214  clearerr(yyin); \
1215  } \
1216  }\
1217 \
1218 
1219 #endif
1220 
1221 /* No semi-colon after return; correct usage is to write "yyterminate();" -
1222  * we don't want an extra ';' after the "return" because that will cause
1223  * some compilers to complain about unreachable statements.
1224  */
1225 #ifndef yyterminate
1226 #define yyterminate() return YY_NULL
1227 #endif
1228 
1229 /* Number of entries by which start-condition stack grows. */
1230 #ifndef YY_START_STACK_INCR
1231 #define YY_START_STACK_INCR 25
1232 #endif
1233 
1234 /* Report a fatal error. */
1235 #ifndef YY_FATAL_ERROR
1236 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg , yyscanner)
1237 #endif
1238 
1239 /* end tables serialization structures and prototypes */
1240 
1241 /* Default declaration of generated scanner - a define so the user can
1242  * easily add parameters.
1243  */
1244 #ifndef YY_DECL
1245 #define YY_DECL_IS_OURS 1
1246 
1247 extern int octave_lex \
1248  (YYSTYPE * yylval_param ,yyscan_t yyscanner);
1249 
1250 #define YY_DECL int octave_lex \
1251  (YYSTYPE * yylval_param , yyscan_t yyscanner)
1252 #endif /* !YY_DECL */
1253 
1254 /* Code executed at the beginning of each rule, after yytext and yyleng
1255  * have been set up.
1256  */
1257 #ifndef YY_USER_ACTION
1258 #define YY_USER_ACTION
1259 #endif
1260 
1261 /* Code executed at the end of each rule. */
1262 #ifndef YY_BREAK
1263 #define YY_BREAK /*LINTED*/break;
1264 #endif
1265 
1266 #define YY_RULE_SETUP \
1267  if ( yyleng > 0 ) \
1268  YY_CURRENT_BUFFER_LVALUE->yy_at_bol = \
1269  (yytext[yyleng - 1] == '\n'); \
1270  YY_USER_ACTION
1271 
1272 /** The main scanner function which does all the work.
1273  */
1275 {
1276  yy_state_type yy_current_state;
1277  char *yy_cp, *yy_bp;
1278  int yy_act;
1279  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1280 
1281  yylval = yylval_param;
1282 
1283  if ( !yyg->yy_init )
1284  {
1285  yyg->yy_init = 1;
1286 
1287 #ifdef YY_USER_INIT
1288  YY_USER_INIT;
1289 #endif
1290 
1291  if ( ! yyg->yy_start )
1292  yyg->yy_start = 1; /* first start state */
1293 
1294  if ( ! yyin )
1295  yyin = stdin;
1296 
1297  if ( ! yyout )
1298  yyout = stdout;
1299 
1300  if ( ! YY_CURRENT_BUFFER ) {
1301  octave_ensure_buffer_stack (yyscanner);
1304  }
1305 
1306  octave__load_buffer_state(yyscanner );
1307  }
1308 
1309  {
1310 #line 348 "../libinterp/parse-tree/lex.ll"
1311 
1312 
1313 
1314 // Make script and function files start with an invalid token. This makes
1315 // the parser go down a special path.
1316 
1317 
1318 #line 1319 "libinterp/parse-tree/lex.cc"
1319 
1320  while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */
1321  {
1322  yy_cp = yyg->yy_c_buf_p;
1323 
1324  /* Support of yytext. */
1325  *yy_cp = yyg->yy_hold_char;
1326 
1327  /* yy_bp points to the position in yy_ch_buf of the start of
1328  * the current run.
1329  */
1330  yy_bp = yy_cp;
1331 
1332  yy_current_state = yyg->yy_start;
1333  yy_current_state += YY_AT_BOL();
1334 yy_match:
1335  do
1336  {
1337  YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ;
1338  if ( yy_accept[yy_current_state] )
1339  {
1340  yyg->yy_last_accepting_state = yy_current_state;
1341  yyg->yy_last_accepting_cpos = yy_cp;
1342  }
1343  while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1344  {
1345  yy_current_state = (int) yy_def[yy_current_state];
1346  if ( yy_current_state >= 266 )
1347  yy_c = yy_meta[(unsigned int) yy_c];
1348  }
1349  yy_current_state = yy_nxt[yy_base[yy_current_state] + (flex_int16_t) yy_c];
1350  ++yy_cp;
1351  }
1352  while ( yy_base[yy_current_state] != 820 );
1353 
1354 yy_find_action:
1355  yy_act = yy_accept[yy_current_state];
1356  if ( yy_act == 0 )
1357  { /* have to back up */
1358  yy_cp = yyg->yy_last_accepting_cpos;
1359  yy_current_state = yyg->yy_last_accepting_state;
1360  yy_act = yy_accept[yy_current_state];
1361  }
1362 
1364 
1365 do_action: /* This label is used only to access EOF actions. */
1366 
1367  switch ( yy_act )
1368  { /* beginning of action switch */
1369  case 0: /* must back up */
1370  /* undo the effects of YY_DO_BEFORE_ACTION */
1371  *yy_cp = yyg->yy_hold_char;
1372  yy_cp = yyg->yy_last_accepting_cpos;
1373  yy_current_state = yyg->yy_last_accepting_state;
1374  goto yy_find_action;
1375 
1376 case 1:
1377 /* rule 1 can match eol */
1379 #line 355 "../libinterp/parse-tree/lex.ll"
1380 {
1381  curr_lexer->lexer_debug ("<INPUT_FILE_START>{ANY_INCLUDING_NL}");
1382 
1383  curr_lexer->xunput (yytext[0]);
1384 
1385  // May be reset later if we see "function" or "classdef" appears
1386  // as the first token.
1387  curr_lexer->reading_script_file = true;
1388 
1389  curr_lexer->pop_start_state ();
1390 
1391  return curr_lexer->show_token (INPUT_FILE);
1392  }
1393  YY_BREAK
1395 #line 369 "../libinterp/parse-tree/lex.ll"
1396 {
1397  curr_lexer->lexer_debug ("<INPUT_FILE_START><<EOF>>");
1398 
1399  // May be reset later if we see "function" or "classdef" appears
1400  // as the first token.
1401  curr_lexer->reading_script_file = true;
1402 
1403  curr_lexer->pop_start_state ();
1404 
1405  return curr_lexer->show_token (INPUT_FILE);
1406  }
1407  YY_BREAK
1408 
1409 // Help and other command-style functions.
1410 
1411 
1412 // Commands can be continued on a second line using the ellipsis.
1413 // If an argument is in construction, it is completed.
1414 
1415 case 2:
1416 /* rule 2 can match eol */
1418 #line 390 "../libinterp/parse-tree/lex.ll"
1419 {
1420  curr_lexer->lexer_debug ("<COMMAND_START>(\\.\\.\\.){ANY_EXCEPT_NL}*{NL}");
1421 
1423 
1424  curr_lexer->input_line_number++;
1425  curr_lexer->current_input_column = 1;
1426 
1428  }
1429  YY_BREAK
1430 
1431 // Commands normally end at the end of a line or a semicolon.
1432 
1433 case 3:
1434 /* rule 3 can match eol */
1436 #line 405 "../libinterp/parse-tree/lex.ll"
1437 {
1438  curr_lexer->lexer_debug ("<COMMAND_START>({CCHAR}{ANY_EXCEPT_NL}*)?{NL}");
1439 
1441 
1442  curr_lexer->input_line_number++;
1443  curr_lexer->current_input_column = 1;
1444  curr_lexer->looking_for_object_index = false;
1445  curr_lexer->at_beginning_of_statement = true;
1446  curr_lexer->pop_start_state ();
1447 
1448  return curr_lexer->handle_token ('\n');
1449  }
1450  YY_BREAK
1451 case 4:
1453 #line 419 "../libinterp/parse-tree/lex.ll"
1454 {
1455  curr_lexer->lexer_debug ("<COMMAND_START>[\\,\\;]");
1456 
1457  if (yytext[0] != ',' || curr_lexer->command_arg_paren_count == 0)
1458  {
1460  curr_lexer->looking_for_object_index = false;
1461  curr_lexer->at_beginning_of_statement = true;
1462  curr_lexer->pop_start_state ();
1463  return curr_lexer->handle_token (yytext[0]);
1464  }
1465  else
1466  curr_lexer->string_text += yytext;
1467 
1468  curr_lexer->current_input_column += yyleng;
1469  }
1470  YY_BREAK
1471 
1472 // Unbalanced parentheses serve as pseudo-quotes: they are included in
1473 // the final argument string, but they cause parentheses and quotes to
1474 // be slurped into that argument as well.
1475 
1476 case 5:
1478 #line 442 "../libinterp/parse-tree/lex.ll"
1479 {
1480  curr_lexer->lexer_debug ("<COMMAND_START>[\\(\\[\\{]+");
1481 
1482  curr_lexer->command_arg_paren_count += yyleng;
1483  curr_lexer->string_text += yytext;
1484  curr_lexer->current_input_column += yyleng;
1485  }
1486  YY_BREAK
1487 case 6:
1489 #line 450 "../libinterp/parse-tree/lex.ll"
1490 {
1491  curr_lexer->lexer_debug ("<COMMAND_START>[\\)\\]\\}]+");
1492 
1493  curr_lexer->command_arg_paren_count -= yyleng;
1494  curr_lexer->string_text += yytext;
1495  curr_lexer->current_input_column += yyleng;
1496 }
1497  YY_BREAK
1498 
1499 // Handle quoted strings. Quoted strings that are not separated by
1500 // whitespace from other argument text are combined with that previous
1501 // text. For instance,
1502 //
1503 // command 'text1'"text2"
1504 //
1505 // has a single argument text1text2, not two separate arguments.
1506 // That's why we must test to see if we are in command argument mode
1507 // when processing the end of a string.
1508 
1509 case 7:
1511 #line 470 "../libinterp/parse-tree/lex.ll"
1512 {
1513  curr_lexer->lexer_debug ("<COMMAND_START>[\\\"\\']");
1514 
1515  if (curr_lexer->command_arg_paren_count == 0)
1516  curr_lexer->begin_string (yytext[0] == '"'
1518  else
1519  curr_lexer->string_text += yytext;
1520 
1521  curr_lexer->current_input_column += yyleng;
1522  }
1523  YY_BREAK
1524 
1525 // In standard command argument processing, whitespace separates
1526 // arguments. In the presence of unbalanced parentheses, it is
1527 // incorporated into the argument.
1528 
1529 case 8:
1531 #line 488 "../libinterp/parse-tree/lex.ll"
1532 {
1533  curr_lexer->lexer_debug ("<COMMAND_START>{S}*");
1534 
1535  if (curr_lexer->command_arg_paren_count == 0)
1537  else
1538  curr_lexer->string_text += yytext;
1539 
1540  curr_lexer->current_input_column += yyleng;
1541  }
1542  YY_BREAK
1543 
1544 // Everything else is slurped into the command arguments.
1545 
1546 case 9:
1548 #line 503 "../libinterp/parse-tree/lex.ll"
1549 {
1550  curr_lexer->lexer_debug ("<COMMAND_START>([\\.]|[^#% \\t\\r\\n\\.\\,\\;\\\"\\'\\(\\[\\{\\}\\]\\)]*");
1551 
1552  curr_lexer->string_text += yytext;
1553  curr_lexer->current_input_column += yyleng;
1554  }
1555  YY_BREAK
1556 case 10:
1558 #line 510 "../libinterp/parse-tree/lex.ll"
1559 {
1560  curr_lexer->lexer_debug ("<MATRIX_START>{S}*");
1561 
1562  curr_lexer->mark_previous_token_trailing_space ();
1563  }
1564  YY_BREAK
1565 case 11:
1566 /* rule 11 can match eol */
1568 #line 516 "../libinterp/parse-tree/lex.ll"
1569 {
1570  curr_lexer->lexer_debug ("<MATRIX_START>{NL}");
1571 
1572  curr_lexer->input_line_number++;
1573  curr_lexer->current_input_column = 1;
1574 
1575  if (curr_lexer->nesting_level.is_paren ())
1576  curr_lexer->warn_language_extension ("bare newline inside parentheses");
1577  else
1578  {
1579  int tok = curr_lexer->previous_token_value ();
1580 
1581  if (! (tok == ';' || tok == '[' || tok == '{'))
1582  {
1583  curr_lexer->xunput (';');
1584  // Adjust for semicolon that was not really in the input stream.
1585  curr_lexer->current_input_column--;
1586  }
1587  }
1588  }
1589  YY_BREAK
1590 
1591 // For this and the next two rules, we're looking at ']', and we
1592 // need to know if the next token is '=' or '=='.
1593 //
1594 // It would have been so much easier if the delimiters were simply
1595 // different for the expression on the left hand side of the equals
1596 // operator.
1597 //
1598 // It's also a pain in the ass to decide whether to insert a comma
1599 // after seeing a ']' character...
1600 
1601 // FIXME: we need to handle block comments here.
1602 
1603 case 12:
1605 #line 551 "../libinterp/parse-tree/lex.ll"
1606 {
1607  curr_lexer->lexer_debug ("<MATRIX_START>\\]");
1608 
1609  curr_lexer->looking_at_object_index.pop_front ();
1610 
1611  curr_lexer->looking_for_object_index = true;
1612  curr_lexer->at_beginning_of_statement = false;
1613 
1614  curr_lexer->handle_close_bracket (']');
1615 
1616  return curr_lexer->count_token (']');
1617  }
1618  YY_BREAK
1619 
1620 // FIXME: we need to handle block comments here.
1621 
1622 case 13:
1624 #line 568 "../libinterp/parse-tree/lex.ll"
1625 {
1626  curr_lexer->lexer_debug ("<MATRIX_START>\\}*");
1627 
1628  curr_lexer->looking_at_object_index.pop_front ();
1629 
1630  curr_lexer->looking_for_object_index = true;
1631  curr_lexer->at_beginning_of_statement = false;
1632 
1633  curr_lexer->handle_close_bracket ('}');
1634 
1635  return curr_lexer->count_token ('}');
1636  }
1637  YY_BREAK
1638 case 14:
1640 #line 581 "../libinterp/parse-tree/lex.ll"
1641 {
1642  curr_lexer->lexer_debug ("\\[");
1643 
1644  bool unput_comma = false;
1645 
1646  if (curr_lexer->whitespace_is_significant ()
1647  && curr_lexer->space_follows_previous_token ())
1648  {
1649  int tok = curr_lexer->previous_token_value ();
1650 
1651  if (! (tok == '[' || tok == '{'
1652  || curr_lexer->previous_token_is_binop ()))
1653  unput_comma = true;
1654  }
1655 
1656  if (unput_comma)
1657  {
1658  yyless (0);
1659  curr_lexer->xunput (',');
1660  // Adjust for comma that was not really in the input stream.
1661  curr_lexer->current_input_column--;
1662  }
1663  else
1664  {
1665  curr_lexer->nesting_level.bracket ();
1666 
1667  curr_lexer->looking_at_object_index.push_front (false);
1668 
1669  curr_lexer->current_input_column += yyleng;
1670  curr_lexer->looking_for_object_index = false;
1671  curr_lexer->at_beginning_of_statement = false;
1672 
1673  if (curr_lexer->defining_func
1674  && ! curr_lexer->parsed_function_name.top ())
1675  curr_lexer->looking_at_return_list = true;
1676  else
1677  curr_lexer->looking_at_matrix_or_assign_lhs = true;
1678 
1679  curr_lexer->decrement_promptflag ();
1680 
1681  curr_lexer->bracketflag++;
1682 
1683  curr_lexer->push_start_state (MATRIX_START);
1684 
1685  return curr_lexer->count_token ('[');
1686  }
1687  }
1688  YY_BREAK
1689 case 15:
1691 #line 629 "../libinterp/parse-tree/lex.ll"
1692 {
1693  curr_lexer->lexer_debug ("\\]");
1694 
1695  curr_lexer->nesting_level.remove ();
1696 
1697  curr_lexer->looking_at_object_index.pop_front ();
1698 
1699  curr_lexer->looking_for_object_index = true;
1700  curr_lexer->at_beginning_of_statement = false;
1701 
1702  return curr_lexer->handle_token (']');
1703  }
1704  YY_BREAK
1705 
1706 // Gobble comments.
1707 
1708 
1709 // Start of a block comment. If the comment marker appears immediately
1710 // after a block of full-line comments, finish the full line comment
1711 // block.
1712 
1713 case 16:
1714 /* rule 16 can match eol */
1716 #line 652 "../libinterp/parse-tree/lex.ll"
1717 {
1718  curr_lexer->lexer_debug ("^{S}*{CCHAR}\\{{S}*{NL}");
1719 
1720  yyless (0);
1721 
1722  if (curr_lexer->start_state () == LINE_COMMENT_START)
1723  {
1724  if (! curr_lexer->comment_text.empty ())
1725  curr_lexer->finish_comment (octave_comment_elt::full_line);
1726 
1727  curr_lexer->pop_start_state ();
1728  }
1729 
1730  curr_lexer->decrement_promptflag ();
1731 
1732  curr_lexer->push_start_state (BLOCK_COMMENT_START);
1733 
1734  }
1735  YY_BREAK
1736 case 17:
1737 /* rule 17 can match eol */
1739 #line 671 "../libinterp/parse-tree/lex.ll"
1740 {
1741  curr_lexer->lexer_debug ("<BLOCK_COMMENT_START>^{S}*{CCHAR}\\{{S}*{NL}");
1742 
1743  curr_lexer->input_line_number++;
1744  curr_lexer->current_input_column = 1;
1745 
1746  if (curr_lexer->block_comment_nesting_level)
1747  curr_lexer->comment_text = "\n";
1748 
1749  curr_lexer->block_comment_nesting_level++;
1750  }
1751  YY_BREAK
1752 
1753 // End of a block comment. If this block comment is nested inside
1754 // another, wait for the outermost block comment block to be closed
1755 // before storing the comment.
1756 
1757 case 18:
1758 /* rule 18 can match eol */
1760 #line 689 "../libinterp/parse-tree/lex.ll"
1761 {
1762  curr_lexer->lexer_debug ("<BLOCK_COMMENT_START>^{S}*{CCHAR}\\}{S}*{NL}");
1763 
1764  curr_lexer->input_line_number++;
1765  curr_lexer->current_input_column = 1;
1766 
1767  if (curr_lexer->block_comment_nesting_level > 1)
1768  curr_lexer->comment_text = "\n";
1769  else
1770  curr_lexer->finish_comment (octave_comment_elt::block);
1771 
1772  curr_lexer->block_comment_nesting_level--;
1773 
1774  if (curr_lexer->block_comment_nesting_level == 0)
1775  {
1776  curr_lexer->increment_promptflag ();
1777 
1778  curr_lexer->pop_start_state ();
1779  }
1780  }
1781  YY_BREAK
1782 
1783 // Body of a block comment.
1784 
1785 case 19:
1786 /* rule 19 can match eol */
1788 #line 714 "../libinterp/parse-tree/lex.ll"
1789 {
1790  curr_lexer->lexer_debug ("<BLOCK_COMMENT_START>{ANY_EXCEPT_NL}*{NL}");
1791 
1792  curr_lexer->input_line_number++;
1793  curr_lexer->current_input_column = 1;
1794  curr_lexer->comment_text += yytext;
1795  }
1796  YY_BREAK
1797 
1798 // Full-line or end-of-line comment.
1799 
1800 case 20:
1801 /* rule 20 can match eol */
1803 #line 726 "../libinterp/parse-tree/lex.ll"
1804 {
1805  curr_lexer->lexer_debug ("{S}*{CCHAR}{ANY_EXCEPT_NL}*{NL}");
1806 
1807  curr_lexer->push_start_state (LINE_COMMENT_START);
1808  yyless (0);
1809  }
1810  YY_BREAK
1811 case 21:
1812 /* rule 21 can match eol */
1814 #line 733 "../libinterp/parse-tree/lex.ll"
1815 {
1816  curr_lexer->lexer_debug ("<LINE_COMMENT_START>{S}*{CCHAR}{ANY_EXCEPT_NL}*{NL}");
1817 
1818  bool full_line_comment = curr_lexer->current_input_column == 1;
1819  curr_lexer->input_line_number++;
1820  curr_lexer->current_input_column = 1;
1821 
1822  bool have_space = false;
1823  size_t len = yyleng;
1824  size_t i = 0;
1825  while (i < len)
1826  {
1827  char c = yytext[i];
1828  if (c == ' ' || c == '\t')
1829  {
1830  have_space = true;
1831  i++;
1832  }
1833  else
1834  break;
1835  }
1836 
1837  size_t num_comment_chars = 0;
1838 
1839  while (i < len)
1840  {
1841  char c = yytext[i];
1842  if (c == '#' || c == '%')
1843  {
1844  num_comment_chars++;
1845  i++;
1846  }
1847  else
1848  break;
1849  }
1850 
1851  curr_lexer->comment_text += &yytext[i];
1852 
1853  if (full_line_comment)
1854  {
1855  if (num_comment_chars == 1 && yytext[i++] == '{')
1856  {
1857  bool looks_like_block_comment = true;
1858 
1859  while (i < len)
1860  {
1861  char c = yytext[i++];
1862  if (! (c == ' ' || c == '\t' || c == '\n' || c == '\r'))
1863  {
1864  looks_like_block_comment = false;
1865  break;
1866  }
1867  }
1868 
1869  if (looks_like_block_comment)
1870  {
1871  yyless (0);
1872 
1873  curr_lexer->finish_comment (octave_comment_elt::full_line);
1874 
1875  curr_lexer->pop_start_state ();
1876  }
1877  }
1878  }
1879  else
1880  {
1881  if (have_space)
1882  curr_lexer->mark_previous_token_trailing_space ();
1883 
1884  curr_lexer->finish_comment (octave_comment_elt::end_of_line);
1885 
1886  curr_lexer->pop_start_state ();
1887 
1888  curr_lexer->xunput ('\n');
1889  curr_lexer->input_line_number--;
1890  }
1891  }
1892  YY_BREAK
1893 
1894 // End of a block of full-line comments.
1895 
1896 case 22:
1897 /* rule 22 can match eol */
1899 #line 815 "../libinterp/parse-tree/lex.ll"
1900 {
1901  curr_lexer->lexer_debug ("<LINE_COMMENT_START>{ANY_INCLUDING_NL}");
1902 
1903  curr_lexer->xunput (yytext[0]);
1904 
1905  curr_lexer->finish_comment (octave_comment_elt::full_line);
1906 
1907  curr_lexer->pop_start_state ();
1908  }
1909  YY_BREAK
1910 
1911 // End of a block of full-line comments.
1912 
1914 #line 829 "../libinterp/parse-tree/lex.ll"
1915 {
1916  curr_lexer->lexer_debug ("<LINE_COMMENT_START><<EOF>>");
1917 
1918  curr_lexer->finish_comment (octave_comment_elt::full_line);
1919 
1920  curr_lexer->pop_start_state ();
1921  }
1922  YY_BREAK
1923 
1924 // Double-quoted character strings.
1925 
1926 case 23:
1928 #line 841 "../libinterp/parse-tree/lex.ll"
1929 {
1930  curr_lexer->lexer_debug ("<DQ_STRING_START>\\\"\\\"");
1931 
1932  curr_lexer->current_input_column += yyleng;
1933  curr_lexer->string_text += '"';
1934  }
1935  YY_BREAK
1936 case 24:
1938 #line 848 "../libinterp/parse-tree/lex.ll"
1939 {
1940  curr_lexer->lexer_debug ("<DQ_STRING_START>\\\"");
1941 
1942  curr_lexer->current_input_column++;
1943 
1944  curr_lexer->pop_start_state ();
1945 
1946  if (curr_lexer->start_state() != COMMAND_START)
1947  {
1948  curr_lexer->looking_for_object_index = true;
1949  curr_lexer->at_beginning_of_statement = false;
1950 
1951  curr_lexer->push_token (new token (DQ_STRING,
1952  curr_lexer->string_text,
1953  curr_lexer->string_line,
1954  curr_lexer->string_column));
1955 
1956  curr_lexer->string_text = "";
1957 
1958  return curr_lexer->count_token_internal (DQ_STRING);
1959  }
1960  }
1961  YY_BREAK
1962 case 25:
1964 #line 871 "../libinterp/parse-tree/lex.ll"
1965 {
1966  curr_lexer->lexer_debug ("<DQ_STRING_START>\\\\[0-7]{1,3}");
1967 
1968  curr_lexer->current_input_column += yyleng;
1969 
1970  int result;
1971  sscanf (yytext+1, "%o", &result);
1972 
1973  if (result > 0xff)
1974  {
1975  token *tok
1976  = new token (LEXICAL_ERROR,
1977  "invalid octal escape sequence in character string",
1978  curr_lexer->input_line_number,
1979  curr_lexer->current_input_column);
1980 
1981  curr_lexer->push_token (tok);
1982 
1983  return curr_lexer->count_token_internal (LEXICAL_ERROR);
1984  }
1985  else
1986  curr_lexer->string_text += static_cast<unsigned char> (result);
1987  }
1988  YY_BREAK
1989 case 26:
1991 #line 895 "../libinterp/parse-tree/lex.ll"
1992 {
1993  curr_lexer->lexer_debug ("<DQ_STRING_START>\\\\x[0-9a-fA-F]+");
1994 
1995  curr_lexer->current_input_column += yyleng;
1996 
1997  int result;
1998  sscanf (yytext+2, "%x", &result);
1999 
2000  // Truncate the value silently instead of checking the range like
2001  // we do for octal above. This is to match C/C++ where any number
2002  // of digits is allowed but the value is implementation-defined if
2003  // it exceeds the range of the character type.
2004  curr_lexer->string_text += static_cast<unsigned char> (result);
2005  }
2006  YY_BREAK
2007 case 27:
2009 #line 910 "../libinterp/parse-tree/lex.ll"
2010 {
2011  curr_lexer->lexer_debug ("<DQ_STRING_START>\"\\\\a\"");
2012 
2013  curr_lexer->current_input_column += yyleng;
2014  curr_lexer->string_text += '\a';
2015  }
2016  YY_BREAK
2017 case 28:
2019 #line 917 "../libinterp/parse-tree/lex.ll"
2020 {
2021  curr_lexer->lexer_debug ("<DQ_STRING_START>\"\\\\b\"");
2022 
2023  curr_lexer->current_input_column += yyleng;
2024  curr_lexer->string_text += '\b';
2025  }
2026  YY_BREAK
2027 case 29:
2029 #line 924 "../libinterp/parse-tree/lex.ll"
2030 {
2031  curr_lexer->lexer_debug ("<DQ_STRING_START>\"\\\\f\"");
2032 
2033  curr_lexer->current_input_column += yyleng;
2034  curr_lexer->string_text += '\f';
2035  }
2036  YY_BREAK
2037 case 30:
2039 #line 931 "../libinterp/parse-tree/lex.ll"
2040 {
2041  curr_lexer->lexer_debug ("<DQ_STRING_START>\"\\\\n\"");
2042 
2043  curr_lexer->current_input_column += yyleng;
2044  curr_lexer->string_text += '\n';
2045  }
2046  YY_BREAK
2047 case 31:
2049 #line 938 "../libinterp/parse-tree/lex.ll"
2050 {
2051  curr_lexer->lexer_debug ("<DQ_STRING_START>\"\\\\r\"");
2052 
2053  curr_lexer->current_input_column += yyleng;
2054  curr_lexer->string_text += '\r';
2055  }
2056  YY_BREAK
2057 case 32:
2059 #line 945 "../libinterp/parse-tree/lex.ll"
2060 {
2061  curr_lexer->lexer_debug ("<DQ_STRING_START>\"\\\\t\"");
2062 
2063  curr_lexer->current_input_column += yyleng;
2064  curr_lexer->string_text += '\t';
2065  }
2066  YY_BREAK
2067 case 33:
2069 #line 952 "../libinterp/parse-tree/lex.ll"
2070 {
2071  curr_lexer->lexer_debug ("<DQ_STRING_START>\"\\\\v\"");
2072 
2073  curr_lexer->current_input_column += yyleng;
2074  curr_lexer->string_text += '\v';
2075  }
2076  YY_BREAK
2077 case 34:
2078 /* rule 34 can match eol */
2080 #line 959 "../libinterp/parse-tree/lex.ll"
2081 {
2082  curr_lexer->lexer_debug ("<DQ_STRING_START>(\\.\\.\\.){S}*{NL}");
2083 
2084  static const char *msg = "'...' continuations in double-quoted character strings are obsolete and will not be allowed in a future version of Octave; please use '\\' instead";
2085 
2086  std::string nm = curr_lexer->fcn_file_full_name;
2087 
2088  if (nm.empty ())
2089  warning_with_id ("Octave:deprecated-syntax", "%s", msg);
2090  else
2091  warning_with_id ("Octave:deprecated-syntax",
2092  "%s; near line %d of file '%s'", msg,
2093  curr_lexer->input_line_number, nm.c_str ());
2094 
2096  }
2097  YY_BREAK
2098 case 35:
2099 /* rule 35 can match eol */
2101 #line 976 "../libinterp/parse-tree/lex.ll"
2102 {
2103  curr_lexer->lexer_debug ("<DQ_STRING_START>\\\\{S}+{NL}");
2104 
2105  static const char *msg = "white space and comments after continuation markers in double-quoted character strings are obsolete and will not be allowed in a future version of Octave";
2106 
2107  std::string nm = curr_lexer->fcn_file_full_name;
2108 
2109  if (nm.empty ())
2110  warning_with_id ("Octave:deprecated-syntax", "%s", msg);
2111  else
2112  warning_with_id ("Octave:deprecated-syntax",
2113  "%s; near line %d of file '%s'", msg,
2114  curr_lexer->input_line_number, nm.c_str ());
2115 
2117  }
2118  YY_BREAK
2119 case 36:
2120 /* rule 36 can match eol */
2122 #line 993 "../libinterp/parse-tree/lex.ll"
2123 {
2124  curr_lexer->lexer_debug ("<DQ_STRING_START>\\\\{NL}");
2125 
2127  }
2128  YY_BREAK
2129 case 37:
2131 #line 999 "../libinterp/parse-tree/lex.ll"
2132 {
2133  curr_lexer->lexer_debug ("<DQ_STRING_START>\\\\.");
2134 
2135  curr_lexer->current_input_column += yyleng;
2136  curr_lexer->string_text += yytext[1];
2137  }
2138  YY_BREAK
2139 case 38:
2141 #line 1006 "../libinterp/parse-tree/lex.ll"
2142 {
2143  curr_lexer->lexer_debug ("<DQ_STRING_START>\\.");
2144 
2145  curr_lexer->current_input_column++;
2146  curr_lexer->string_text += yytext[0];
2147  }
2148  YY_BREAK
2149 case 39:
2151 #line 1013 "../libinterp/parse-tree/lex.ll"
2152 {
2153  curr_lexer->lexer_debug ("<DQ_STRING_START>[^\\.\\\\\\r\\n\\\"]+");
2154 
2155  curr_lexer->current_input_column += yyleng;
2156  curr_lexer->string_text += yytext;
2157  }
2158  YY_BREAK
2159 case 40:
2160 /* rule 40 can match eol */
2162 #line 1020 "../libinterp/parse-tree/lex.ll"
2163 {
2164  curr_lexer->lexer_debug ("<DQ_STRING_START>{NL}");
2165 
2166  token *tok = new token (LEXICAL_ERROR,
2167  "unterminated character string constant",
2168  curr_lexer->input_line_number,
2169  curr_lexer->current_input_column);
2170 
2171  curr_lexer->push_token (tok);
2172 
2173  curr_lexer->input_line_number++;
2174  curr_lexer->current_input_column = 1;
2175 
2176  return curr_lexer->count_token_internal (LEXICAL_ERROR);
2177  }
2178  YY_BREAK
2179 
2180 // Single-quoted character strings.
2181 
2182 case 41:
2184 #line 1040 "../libinterp/parse-tree/lex.ll"
2185 {
2186  curr_lexer->lexer_debug ("<SQ_STRING_START>\\'\\'");
2187 
2188  curr_lexer->current_input_column += yyleng;
2189  curr_lexer->string_text += '\'';
2190  }
2191  YY_BREAK
2192 case 42:
2194 #line 1047 "../libinterp/parse-tree/lex.ll"
2195 {
2196  curr_lexer->lexer_debug ("<SQ_STRING_START>\\'");
2197 
2198  curr_lexer->current_input_column++;
2199 
2200  curr_lexer->pop_start_state ();
2201 
2202  if (curr_lexer->start_state() != COMMAND_START)
2203  {
2204  curr_lexer->looking_for_object_index = true;
2205  curr_lexer->at_beginning_of_statement = false;
2206 
2207  curr_lexer->push_token (new token (SQ_STRING,
2208  curr_lexer->string_text,
2209  curr_lexer->string_line,
2210  curr_lexer->string_column));
2211 
2212  curr_lexer->string_text = "";
2213 
2214  return curr_lexer->count_token_internal (SQ_STRING);
2215  }
2216  }
2217  YY_BREAK
2218 case 43:
2220 #line 1070 "../libinterp/parse-tree/lex.ll"
2221 {
2222  curr_lexer->lexer_debug ("<SQ_STRING_START>[^\\'\\n\\r]+");
2223 
2224  curr_lexer->current_input_column += yyleng;
2225  curr_lexer->string_text += yytext;
2226  }
2227  YY_BREAK
2228 case 44:
2229 /* rule 44 can match eol */
2231 #line 1077 "../libinterp/parse-tree/lex.ll"
2232 {
2233  curr_lexer->lexer_debug ("<SQ_STRING_START>{NL}");
2234 
2235  token *tok = new token (LEXICAL_ERROR,
2236  "unterminated character string constant",
2237  curr_lexer->input_line_number,
2238  curr_lexer->current_input_column);
2239 
2240  curr_lexer->push_token (tok);
2241 
2242  curr_lexer->input_line_number++;
2243  curr_lexer->current_input_column = 1;
2244 
2245  return curr_lexer->count_token_internal (LEXICAL_ERROR);
2246  }
2247  YY_BREAK
2248 
2249 // Fully-qualified identifiers (used for classdef).
2250 
2251 case 45:
2253 #line 1097 "../libinterp/parse-tree/lex.ll"
2254 {
2255  curr_lexer->lexer_debug ("<FQ_IDENT_START>{FQIDENT}");
2256  curr_lexer->pop_start_state ();
2257 
2258  int id_tok = curr_lexer->handle_fq_identifier ();
2259 
2260  if (id_tok >= 0)
2261  {
2262  curr_lexer->looking_for_object_index = true;
2263 
2264  return curr_lexer->count_token_internal (id_tok);
2265  }
2266  }
2267  YY_BREAK
2268 case 46:
2270 #line 1111 "../libinterp/parse-tree/lex.ll"
2271 {
2272  curr_lexer->current_input_column += yyleng;
2273 
2274  curr_lexer->mark_previous_token_trailing_space ();
2275  }
2276  YY_BREAK
2277 case 47:
2279 #line 1117 "../libinterp/parse-tree/lex.ll"
2280 {
2281  yyless (0);
2282  curr_lexer->pop_start_state ();
2283  }
2284  YY_BREAK
2285 
2286 // Imaginary numbers.
2287 
2288 case 48:
2290 #line 1126 "../libinterp/parse-tree/lex.ll"
2291 {
2292  curr_lexer->lexer_debug ("{NUMBER}{Im}");
2293 
2294  if (curr_lexer->previous_token_may_be_command ()
2295  && curr_lexer->space_follows_previous_token ())
2296  {
2297  yyless (0);
2298  curr_lexer->push_start_state (COMMAND_START);
2299  }
2300  else
2301  {
2302  int tok = curr_lexer->previous_token_value ();
2303 
2304  if (curr_lexer->whitespace_is_significant ()
2305  && curr_lexer->space_follows_previous_token ()
2306  && ! (tok == '[' || tok == '{'
2307  || curr_lexer->previous_token_is_binop ()))
2308  {
2309  yyless (0);
2310  unput (',');
2311  }
2312  else
2313  {
2314  curr_lexer->handle_number ();
2315  return curr_lexer->count_token_internal (IMAG_NUM);
2316  }
2317  }
2318  }
2319  YY_BREAK
2320 
2321 // Real numbers. Don't grab the '.' part of a dot operator as part of
2322 // the constant.
2323 
2324 case 49:
2325 *yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */
2326 yyg->yy_c_buf_p = yy_cp -= 2;
2327 YY_DO_BEFORE_ACTION; /* set up yytext again */
2328 #line 1161 "../libinterp/parse-tree/lex.ll"
2329 case 50:
2331 #line 1161 "../libinterp/parse-tree/lex.ll"
2332 {
2333  curr_lexer->lexer_debug ("{D}{D_}*/\\.[\\*/\\\\^\\']|{NUMBER}");
2334 
2335  if (curr_lexer->previous_token_may_be_command ()
2336  && curr_lexer->space_follows_previous_token ())
2337  {
2338  yyless (0);
2339  curr_lexer->push_start_state (COMMAND_START);
2340  }
2341  else
2342  {
2343  int tok = curr_lexer->previous_token_value ();
2344 
2345  if (curr_lexer->whitespace_is_significant ()
2346  && curr_lexer->space_follows_previous_token ()
2347  && ! (tok == '[' || tok == '{'
2348  || curr_lexer->previous_token_is_binop ()))
2349  {
2350  yyless (0);
2351  unput (',');
2352  }
2353  else
2354  {
2355  curr_lexer->handle_number ();
2356  return curr_lexer->count_token_internal (NUM);
2357  }
2358  }
2359  }
2360  YY_BREAK
2361 
2362 // Eat whitespace. Whitespace inside matrix constants is handled by
2363 // the <MATRIX_START> start state code above.
2364 
2365 case 51:
2367 #line 1195 "../libinterp/parse-tree/lex.ll"
2368 {
2369  curr_lexer->current_input_column += yyleng;
2370 
2371  curr_lexer->mark_previous_token_trailing_space ();
2372  }
2373  YY_BREAK
2374 
2375 // Continuation lines. Allow arbitrary text after continuations.
2376 
2377 case 52:
2378 /* rule 52 can match eol */
2380 #line 1205 "../libinterp/parse-tree/lex.ll"
2381 {
2382  curr_lexer->lexer_debug ("\\.\\.\\.{ANY_EXCEPT_NL}*{NL}");
2383 
2384  curr_lexer->handle_continuation ();
2385  }
2386  YY_BREAK
2387 
2388 // Deprecated C preprocessor style continuation markers.
2389 
2390 case 53:
2391 /* rule 53 can match eol */
2392 #line 1216 "../libinterp/parse-tree/lex.ll"
2393 case 54:
2394 /* rule 54 can match eol */
2396 #line 1216 "../libinterp/parse-tree/lex.ll"
2397 {
2398  curr_lexer->lexer_debug ("\\\\{S}*{NL}|\\\\{S}*{CCHAR}{ANY_EXCEPT_NL}*{NL}");
2399 
2400  static const char *msg = "using continuation marker \\ outside of double quoted strings is deprecated and will be removed from a future version of Octave, use ... instead";
2401 
2402  std::string nm = curr_lexer->fcn_file_full_name;
2403 
2404  if (nm.empty ())
2405  warning_with_id ("Octave:deprecated-syntax", "%s", msg);
2406  else
2407  warning_with_id ("Octave:deprecated-syntax",
2408  "%s; near line %d of file '%s'", msg,
2409  curr_lexer->input_line_number, nm.c_str ());
2410 
2411  curr_lexer->handle_continuation ();
2412  }
2413  YY_BREAK
2414 
2415 // End of file.
2416 
2417 case YY_STATE_EOF(INITIAL):
2424 #line 1237 "../libinterp/parse-tree/lex.ll"
2425 {
2426  return curr_lexer->handle_end_of_input ();
2427  }
2428  YY_BREAK
2429 
2430 // Identifiers.
2431 
2432 // Don't allow get and set to be recognized as keywords if they are
2433 // followed by "(".
2434 
2435 case 55:
2437 #line 1248 "../libinterp/parse-tree/lex.ll"
2438 {
2439  HANDLE_IDENTIFIER ("(set|get){S}*\\(", true);
2440  }
2441  YY_BREAK
2442 case 56:
2444 #line 1252 "../libinterp/parse-tree/lex.ll"
2445 {
2446  HANDLE_IDENTIFIER ("{IDENT}", false);
2447  }
2448  YY_BREAK
2449 
2450 // Superclass method identifiers.
2451 
2452 case 57:
2454 #line 1260 "../libinterp/parse-tree/lex.ll"
2455 {
2456  curr_lexer->lexer_debug ("{IDENT}@{FQIDENT}");
2457 
2458  if (curr_lexer->previous_token_may_be_command ())
2459  {
2460  yyless (0);
2461  curr_lexer->push_start_state (COMMAND_START);
2462  }
2463  else
2464  {
2465  int id_tok = curr_lexer->handle_superclass_identifier ();
2466 
2467  if (id_tok >= 0)
2468  {
2469  curr_lexer->looking_for_object_index = true;
2470 
2471  return curr_lexer->count_token_internal (id_tok);
2472  }
2473  }
2474  }
2475  YY_BREAK
2476 
2477 // Metaclass query
2478 
2479 case 58:
2481 #line 1285 "../libinterp/parse-tree/lex.ll"
2482 {
2483  curr_lexer->lexer_debug ("\\?{FQIDENT}");
2484 
2485  if (curr_lexer->previous_token_may_be_command ()
2486  && curr_lexer->space_follows_previous_token ())
2487  {
2488  yyless (0);
2489  curr_lexer->push_start_state (COMMAND_START);
2490  }
2491  else
2492  {
2493  int id_tok = curr_lexer->handle_meta_identifier ();
2494 
2495  if (id_tok >= 0)
2496  {
2497  curr_lexer->looking_for_object_index = true;
2498 
2499  return curr_lexer->count_token_internal (id_tok);
2500  }
2501  }
2502  }
2503  YY_BREAK
2504 case 59:
2506 #line 1307 "../libinterp/parse-tree/lex.ll"
2507 {
2508  curr_lexer->lexer_debug ("@");
2509 
2510  if (curr_lexer->previous_token_may_be_command ()
2511  && curr_lexer->space_follows_previous_token ())
2512  {
2513  yyless (0);
2514  curr_lexer->push_start_state (COMMAND_START);
2515  }
2516  else
2517  {
2518  int tok = curr_lexer->previous_token_value ();
2519 
2520  if (curr_lexer->whitespace_is_significant ()
2521  && curr_lexer->space_follows_previous_token ()
2522  && ! (tok == '[' || tok == '{'
2523  || curr_lexer->previous_token_is_binop ()))
2524  {
2525  yyless (0);
2526  unput (',');
2527  }
2528  else
2529  {
2530  curr_lexer->current_input_column++;
2531 
2532  curr_lexer->looking_at_function_handle++;
2533  curr_lexer->looking_for_object_index = false;
2534  curr_lexer->at_beginning_of_statement = false;
2535 
2536  return curr_lexer->count_token ('@');
2537  }
2538  }
2539  }
2540  YY_BREAK
2541 
2542 // A new line character. New line characters inside matrix constants
2543 // are handled by the <MATRIX_START> start state code above. If closest
2544 // nesting is inside parentheses, don't return a row separator.
2545 
2546 case 60:
2547 /* rule 60 can match eol */
2549 #line 1347 "../libinterp/parse-tree/lex.ll"
2550 {
2551  curr_lexer->lexer_debug ("{NL}");
2552 
2553  if (curr_lexer->nesting_level.is_paren ())
2554  {
2555  curr_lexer->input_line_number++;
2556  curr_lexer->current_input_column = 1;
2557 
2558  curr_lexer->at_beginning_of_statement = false;
2559  curr_lexer->warn_language_extension
2560  ("bare newline inside parentheses");
2561  }
2562  else if (curr_lexer->nesting_level.none ()
2563  || curr_lexer->nesting_level.is_anon_fcn_body ())
2564  {
2565  curr_lexer->input_line_number++;
2566  curr_lexer->current_input_column = 1;
2567 
2568  curr_lexer->at_beginning_of_statement = true;
2569 
2570  return curr_lexer->count_token ('\n');
2571  }
2572  else if (curr_lexer->nesting_level.is_bracket_or_brace ())
2573  {
2574  token *tok = new token (LEXICAL_ERROR,
2575  "unexpected internal lexer error",
2576  curr_lexer->input_line_number,
2577  curr_lexer->current_input_column);
2578 
2579  curr_lexer->push_token (tok);
2580 
2581  curr_lexer->input_line_number++;
2582  curr_lexer->current_input_column = 1;
2583 
2584  return curr_lexer->count_token_internal (LEXICAL_ERROR);
2585  }
2586  }
2587  YY_BREAK
2588 
2589 // Single quote can either be the beginning of a string or a transpose
2590 // operator.
2591 
2592 case 61:
2594 #line 1390 "../libinterp/parse-tree/lex.ll"
2595 {
2596  curr_lexer->lexer_debug ("'");
2597 
2598  if (curr_lexer->previous_token_may_be_command ()
2599  && curr_lexer->space_follows_previous_token ())
2600  {
2601  curr_lexer->current_input_column++;
2602  curr_lexer->push_start_state (COMMAND_START);
2603  curr_lexer->begin_string (SQ_STRING_START);
2604  }
2605  else if (curr_lexer->at_beginning_of_statement)
2606  {
2607  curr_lexer->current_input_column++;
2608  curr_lexer->begin_string (SQ_STRING_START);
2609  }
2610  else
2611  {
2612  int tok = curr_lexer->previous_token_value ();
2613 
2614  if (curr_lexer->whitespace_is_significant ())
2615  {
2616  if (curr_lexer->space_follows_previous_token ())
2617  {
2618  if (tok == '[' || tok == '{'
2619  || curr_lexer->previous_token_is_binop ())
2620  {
2621  curr_lexer->current_input_column++;
2622  curr_lexer->begin_string (SQ_STRING_START);
2623  }
2624  else
2625  {
2626  yyless (0);
2627  curr_lexer->xunput (',');
2628  // Adjust for comma that was not really in the input stream.
2629  curr_lexer->current_input_column--;
2630  }
2631  }
2632  else
2633  {
2634  if (tok == '[' || tok == '{'
2635  || curr_lexer->previous_token_is_binop ()
2636  || curr_lexer->previous_token_is_keyword ())
2637  {
2638  curr_lexer->current_input_column++;
2639  curr_lexer->begin_string (SQ_STRING_START);
2640  }
2641  else
2642  return curr_lexer->count_token (HERMITIAN);
2643  }
2644  }
2645  else
2646  {
2647  if (! tok || tok == '[' || tok == '{' || tok == '('
2648  || curr_lexer->previous_token_is_binop ()
2649  || curr_lexer->previous_token_is_keyword ())
2650  {
2651  curr_lexer->current_input_column++;
2652  curr_lexer->begin_string (SQ_STRING_START);
2653  }
2654  else
2655  return curr_lexer->count_token (HERMITIAN);
2656  }
2657  }
2658  }
2659  YY_BREAK
2660 
2661 // Double quotes always begin strings.
2662 
2663 case 62:
2665 #line 1459 "../libinterp/parse-tree/lex.ll"
2666 {
2667  curr_lexer->lexer_debug ("\\\"");
2668 
2669  if (curr_lexer->previous_token_may_be_command ()
2670  && curr_lexer->space_follows_previous_token ())
2671  {
2672  curr_lexer->current_input_column++;
2673  curr_lexer->push_start_state (COMMAND_START);
2674  curr_lexer->begin_string (DQ_STRING_START);
2675  }
2676  else
2677  {
2678  int tok = curr_lexer->previous_token_value ();
2679 
2680  if (curr_lexer->whitespace_is_significant ())
2681  {
2682  if (curr_lexer->space_follows_previous_token ())
2683  {
2684  if (tok == '[' || tok == '{'
2685  || curr_lexer->previous_token_is_binop ())
2686  {
2687  curr_lexer->current_input_column++;
2688  curr_lexer->begin_string (DQ_STRING_START);
2689  }
2690  else
2691  {
2692  yyless (0);
2693  curr_lexer->xunput (',');
2694  // Adjust for comma that was not really in the input stream.
2695  curr_lexer->current_input_column--;
2696  }
2697  }
2698  else
2699  {
2700  curr_lexer->current_input_column++;
2701  curr_lexer->begin_string (DQ_STRING_START);
2702  }
2703  }
2704  else
2705  {
2706  curr_lexer->current_input_column++;
2707  curr_lexer->begin_string (DQ_STRING_START);
2708  }
2709  }
2710  }
2711  YY_BREAK
2712 
2713 // Other operators.
2714 
2715 case 63:
2717 #line 1509 "../libinterp/parse-tree/lex.ll"
2718 { CMD_OR_OP (":", ':', true); }
2719  YY_BREAK
2720 case 64:
2722 #line 1510 "../libinterp/parse-tree/lex.ll"
2723 { CMD_OR_OP (".+", EPLUS, false); }
2724  YY_BREAK
2725 case 65:
2727 #line 1511 "../libinterp/parse-tree/lex.ll"
2728 { CMD_OR_OP (".-", EMINUS, false); }
2729  YY_BREAK
2730 case 66:
2732 #line 1512 "../libinterp/parse-tree/lex.ll"
2733 { CMD_OR_OP (".*", EMUL, true); }
2734  YY_BREAK
2735 case 67:
2737 #line 1513 "../libinterp/parse-tree/lex.ll"
2738 { CMD_OR_OP ("./", EDIV, true); }
2739  YY_BREAK
2740 case 68:
2742 #line 1514 "../libinterp/parse-tree/lex.ll"
2743 { CMD_OR_OP (".\\", ELEFTDIV, true); }
2744  YY_BREAK
2745 case 69:
2747 #line 1515 "../libinterp/parse-tree/lex.ll"
2748 { CMD_OR_OP (".^", EPOW, true); }
2749  YY_BREAK
2750 case 70:
2752 #line 1516 "../libinterp/parse-tree/lex.ll"
2753 { CMD_OR_OP (".**", EPOW, false); }
2754  YY_BREAK
2755 case 71:
2757 #line 1517 "../libinterp/parse-tree/lex.ll"
2758 { CMD_OR_OP ("<=", EXPR_LE, true); }
2759  YY_BREAK
2760 case 72:
2762 #line 1518 "../libinterp/parse-tree/lex.ll"
2763 { CMD_OR_OP ("==", EXPR_EQ, true); }
2764  YY_BREAK
2765 case 73:
2767 #line 1519 "../libinterp/parse-tree/lex.ll"
2768 { CMD_OR_OP ("~=", EXPR_NE, true); }
2769  YY_BREAK
2770 case 74:
2772 #line 1520 "../libinterp/parse-tree/lex.ll"
2773 { CMD_OR_OP ("!=", EXPR_NE, false); }
2774  YY_BREAK
2775 case 75:
2777 #line 1521 "../libinterp/parse-tree/lex.ll"
2778 { CMD_OR_OP (">=", EXPR_GE, true); }
2779  YY_BREAK
2780 case 76:
2782 #line 1522 "../libinterp/parse-tree/lex.ll"
2783 { CMD_OR_OP ("&", EXPR_AND, true); }
2784  YY_BREAK
2785 case 77:
2787 #line 1523 "../libinterp/parse-tree/lex.ll"
2788 { CMD_OR_OP ("|", EXPR_OR, true); }
2789  YY_BREAK
2790 case 78:
2792 #line 1524 "../libinterp/parse-tree/lex.ll"
2793 { CMD_OR_OP ("<", EXPR_LT, true); }
2794  YY_BREAK
2795 case 79:
2797 #line 1525 "../libinterp/parse-tree/lex.ll"
2798 { CMD_OR_OP (">", EXPR_GT, true); }
2799  YY_BREAK
2800 case 80:
2802 #line 1526 "../libinterp/parse-tree/lex.ll"
2803 { CMD_OR_OP ("*", '*', true); }
2804  YY_BREAK
2805 case 81:
2807 #line 1527 "../libinterp/parse-tree/lex.ll"
2808 { CMD_OR_OP ("/", '/', true); }
2809  YY_BREAK
2810 
2811 // In Matlab, '\' may also trigger command syntax.
2812 
2813 case 82:
2815 #line 1533 "../libinterp/parse-tree/lex.ll"
2816 { return curr_lexer->handle_op ("\\", LEFTDIV); }
2817  YY_BREAK
2818 case 83:
2820 #line 1535 "../libinterp/parse-tree/lex.ll"
2821 { CMD_OR_OP ("^", POW, true); }
2822  YY_BREAK
2823 case 84:
2825 #line 1536 "../libinterp/parse-tree/lex.ll"
2826 { CMD_OR_OP ("**", POW, false); }
2827  YY_BREAK
2828 case 85:
2830 #line 1537 "../libinterp/parse-tree/lex.ll"
2831 { CMD_OR_OP ("&&", EXPR_AND_AND, true); }
2832  YY_BREAK
2833 case 86:
2835 #line 1538 "../libinterp/parse-tree/lex.ll"
2836 { CMD_OR_OP ("||", EXPR_OR_OR, true); }
2837  YY_BREAK
2838 case 87:
2840 #line 1540 "../libinterp/parse-tree/lex.ll"
2841 {
2842  bool at_beginning_of_statement
2843  = (! (curr_lexer->whitespace_is_significant ()
2844  || curr_lexer->looking_at_object_index.front ()));
2845 
2846  return curr_lexer->handle_op (";", ';', at_beginning_of_statement);
2847  }
2848  YY_BREAK
2849 case 88:
2851 #line 1548 "../libinterp/parse-tree/lex.ll"
2852 { CMD_OR_UNARY_OP ("+", '+', true); }
2853  YY_BREAK
2854 case 89:
2856 #line 1549 "../libinterp/parse-tree/lex.ll"
2857 { CMD_OR_UNARY_OP ("-", '-', true); }
2858  YY_BREAK
2859 case 90:
2861 #line 1551 "../libinterp/parse-tree/lex.ll"
2862 { CMD_OR_UNARY_OP ("~", EXPR_NOT, true); }
2863  YY_BREAK
2864 case 91:
2866 #line 1552 "../libinterp/parse-tree/lex.ll"
2867 { CMD_OR_UNARY_OP ("!", EXPR_NOT, false); }
2868  YY_BREAK
2869 case 92:
2871 #line 1554 "../libinterp/parse-tree/lex.ll"
2872 {
2873  bool at_beginning_of_statement
2874  = (! (curr_lexer->whitespace_is_significant ()
2875  || curr_lexer->looking_at_object_index.front ()));
2876 
2877  return curr_lexer->handle_op (",", ',', at_beginning_of_statement);
2878  }
2879  YY_BREAK
2880 case 93:
2882 #line 1562 "../libinterp/parse-tree/lex.ll"
2883 {
2884  return curr_lexer->handle_op (".'", TRANSPOSE, false);
2885  }
2886  YY_BREAK
2887 case 94:
2889 #line 1566 "../libinterp/parse-tree/lex.ll"
2890 { CMD_OR_UNARY_OP ("++", PLUS_PLUS, false); }
2891  YY_BREAK
2892 case 95:
2894 #line 1567 "../libinterp/parse-tree/lex.ll"
2895 { CMD_OR_UNARY_OP ("--", MINUS_MINUS, false); }
2896  YY_BREAK
2897 case 96:
2899 #line 1569 "../libinterp/parse-tree/lex.ll"
2900 {
2901  curr_lexer->lexer_debug ("(");
2902 
2903  bool unput_comma = false;
2904 
2905  if (curr_lexer->whitespace_is_significant ()
2906  && curr_lexer->space_follows_previous_token ())
2907  {
2908  int tok = curr_lexer->previous_token_value ();
2909 
2910  if (! (tok == '[' || tok == '{'
2911  || curr_lexer->previous_token_is_binop ()))
2912  unput_comma = true;
2913  }
2914 
2915  if (unput_comma)
2916  {
2917  yyless (0);
2918  curr_lexer->xunput (',');
2919  // Adjust for comma that was not really in the input stream.
2920  curr_lexer->current_input_column--;
2921  }
2922  else
2923  {
2924  // If we are looking for an object index, then push TRUE for
2925  // looking_at_object_index. Otherwise, just push whatever state
2926  // is current (so that we can pop it off the stack when we find
2927  // the matching close paren).
2928 
2929  curr_lexer->looking_at_object_index.push_front
2930  (curr_lexer->looking_for_object_index);
2931 
2932  curr_lexer->looking_at_indirect_ref = false;
2933  curr_lexer->looking_for_object_index = false;
2934  curr_lexer->at_beginning_of_statement = false;
2935 
2936  curr_lexer->nesting_level.paren ();
2937  curr_lexer->decrement_promptflag ();
2938 
2939  return curr_lexer->handle_token ('(');
2940  }
2941  }
2942  YY_BREAK
2943 case 97:
2945 #line 1612 "../libinterp/parse-tree/lex.ll"
2946 {
2947  curr_lexer->lexer_debug (")");
2948 
2949  curr_lexer->nesting_level.remove ();
2950  curr_lexer->current_input_column++;
2951 
2952  curr_lexer->looking_at_object_index.pop_front ();
2953 
2954  curr_lexer->looking_for_object_index = true;
2955  curr_lexer->at_beginning_of_statement = false;
2956 
2957  if (curr_lexer->looking_at_anon_fcn_args)
2958  {
2959  curr_lexer->looking_at_anon_fcn_args = false;
2960  curr_lexer->nesting_level.anon_fcn_body ();
2961  }
2962 
2963  return curr_lexer->count_token (')');
2964  }
2965  YY_BREAK
2966 case 98:
2968 #line 1632 "../libinterp/parse-tree/lex.ll"
2969 {
2970  curr_lexer->lexer_debug (".");
2971 
2972  if (curr_lexer->previous_token_may_be_command ()
2973  && curr_lexer->space_follows_previous_token ())
2974  {
2975  yyless (0);
2976  curr_lexer->push_start_state (COMMAND_START);
2977  }
2978  else
2979  {
2980  curr_lexer->looking_for_object_index = false;
2981  curr_lexer->at_beginning_of_statement = false;
2982 
2983  return curr_lexer->handle_token ('.');
2984  }
2985  }
2986  YY_BREAK
2987 
2988 // = and op= operators.
2989 
2990 case 99:
2992 #line 1654 "../libinterp/parse-tree/lex.ll"
2993 {
2994  curr_lexer->maybe_mark_previous_token_as_variable ();
2995 
2996  return curr_lexer->handle_op ("=", '=');
2997  }
2998  YY_BREAK
2999 case 100:
3001 #line 1660 "../libinterp/parse-tree/lex.ll"
3002 { CMD_OR_COMPUTED_ASSIGN_OP ("+=", ADD_EQ); }
3003  YY_BREAK
3004 case 101:
3006 #line 1661 "../libinterp/parse-tree/lex.ll"
3007 { CMD_OR_COMPUTED_ASSIGN_OP ("-=", SUB_EQ); }
3008  YY_BREAK
3009 case 102:
3011 #line 1662 "../libinterp/parse-tree/lex.ll"
3012 { CMD_OR_COMPUTED_ASSIGN_OP ("*=", MUL_EQ); }
3013  YY_BREAK
3014 case 103:
3016 #line 1663 "../libinterp/parse-tree/lex.ll"
3017 { CMD_OR_COMPUTED_ASSIGN_OP ("/=", DIV_EQ); }
3018  YY_BREAK
3019 case 104:
3021 #line 1664 "../libinterp/parse-tree/lex.ll"
3023  YY_BREAK
3024 case 105:
3026 #line 1665 "../libinterp/parse-tree/lex.ll"
3027 { CMD_OR_COMPUTED_ASSIGN_OP (".+=", ADD_EQ); }
3028  YY_BREAK
3029 case 106:
3031 #line 1666 "../libinterp/parse-tree/lex.ll"
3032 { CMD_OR_COMPUTED_ASSIGN_OP (".-=", SUB_EQ); }
3033  YY_BREAK
3034 case 107:
3036 #line 1667 "../libinterp/parse-tree/lex.ll"
3037 { CMD_OR_COMPUTED_ASSIGN_OP (".*=", EMUL_EQ); }
3038  YY_BREAK
3039 case 108:
3041 #line 1668 "../libinterp/parse-tree/lex.ll"
3042 { CMD_OR_COMPUTED_ASSIGN_OP ("./=", EDIV_EQ); }
3043  YY_BREAK
3044 case 109:
3046 #line 1669 "../libinterp/parse-tree/lex.ll"
3048  YY_BREAK
3049 case 110:
3051 #line 1670 "../libinterp/parse-tree/lex.ll"
3052 { CMD_OR_COMPUTED_ASSIGN_OP ("^=", POW_EQ); }
3053  YY_BREAK
3054 case 111:
3056 #line 1671 "../libinterp/parse-tree/lex.ll"
3057 { CMD_OR_COMPUTED_ASSIGN_OP ("^=", POW_EQ); }
3058  YY_BREAK
3059 case 112:
3061 #line 1672 "../libinterp/parse-tree/lex.ll"
3062 { CMD_OR_COMPUTED_ASSIGN_OP (".^=", EPOW_EQ); }
3063  YY_BREAK
3064 case 113:
3066 #line 1673 "../libinterp/parse-tree/lex.ll"
3067 { CMD_OR_COMPUTED_ASSIGN_OP (".^=", EPOW_EQ); }
3068  YY_BREAK
3069 case 114:
3071 #line 1674 "../libinterp/parse-tree/lex.ll"
3072 { CMD_OR_COMPUTED_ASSIGN_OP ("&=", AND_EQ); }
3073  YY_BREAK
3074 case 115:
3076 #line 1675 "../libinterp/parse-tree/lex.ll"
3077 { CMD_OR_COMPUTED_ASSIGN_OP ("|=", OR_EQ); }
3078  YY_BREAK
3079 
3080 // In Matlab, '{' may also trigger command syntax.
3081 
3082 case 116:
3084 #line 1681 "../libinterp/parse-tree/lex.ll"
3085 {
3086  curr_lexer->lexer_debug ("{");
3087 
3088  bool unput_comma = false;
3089 
3090  if (curr_lexer->whitespace_is_significant ()
3091  && curr_lexer->space_follows_previous_token ())
3092  {
3093  int tok = curr_lexer->previous_token_value ();
3094 
3095  if (! (tok == '[' || tok == '{'
3096  || curr_lexer->previous_token_is_binop ()))
3097  unput_comma = true;
3098  }
3099 
3100  if (unput_comma)
3101  {
3102  yyless (0);
3103  curr_lexer->xunput (',');
3104  // Adjust for comma that was not really in the input stream.
3105  curr_lexer->current_input_column--;
3106  }
3107  else
3108  {
3109  curr_lexer->nesting_level.brace ();
3110 
3111  curr_lexer->looking_at_object_index.push_front
3112  (curr_lexer->looking_for_object_index);
3113 
3114  curr_lexer->current_input_column += yyleng;
3115  curr_lexer->looking_for_object_index = false;
3116  curr_lexer->at_beginning_of_statement = false;
3117 
3118  curr_lexer->decrement_promptflag ();
3119 
3120  curr_lexer->braceflag++;
3121 
3122  curr_lexer->push_start_state (MATRIX_START);
3123 
3124  return curr_lexer->count_token ('{');
3125  }
3126  }
3127  YY_BREAK
3128 case 117:
3130 #line 1724 "../libinterp/parse-tree/lex.ll"
3131 {
3132  curr_lexer->lexer_debug ("}");
3133 
3134  curr_lexer->looking_at_object_index.pop_front ();
3135 
3136  curr_lexer->looking_for_object_index = true;
3137  curr_lexer->at_beginning_of_statement = false;
3138 
3139  curr_lexer->nesting_level.remove ();
3140 
3141  return curr_lexer->handle_token ('}');
3142  }
3143  YY_BREAK
3144 
3145 // Unrecognized input is a lexical error.
3146 
3147 case 118:
3149 #line 1741 "../libinterp/parse-tree/lex.ll"
3150 {
3151  curr_lexer->lexer_debug (".");
3152 
3153  curr_lexer->xunput (yytext[0]);
3154 
3155  int c = curr_lexer->text_yyinput ();
3156 
3157  if (c == 1)
3158  return -1;
3159  else if (c == EOF)
3160  return curr_lexer->handle_end_of_input ();
3161  else
3162  {
3163  std::ostringstream buf;
3164 
3165  buf << "invalid character '"
3166  << undo_string_escape (static_cast<char> (c))
3167  << "' (ASCII " << c << ")";
3168 
3169  token *tok = new token (LEXICAL_ERROR, buf.str (),
3170  curr_lexer->input_line_number,
3171  curr_lexer->current_input_column);
3172 
3173  curr_lexer->push_token (tok);
3174 
3175  curr_lexer->current_input_column++;
3176 
3177  return curr_lexer->count_token_internal (LEXICAL_ERROR);
3178  }
3179  }
3180  YY_BREAK
3181 
3182 #if defined (HAVE_PRAGMA_GCC_DIAGNOSTIC)
3183 // Disable this warning for code that is generated by flex.
3184 #pragma GCC diagnostic push
3185 #pragma GCC diagnostic ignored "-Wold-style-cast"
3186 #endif
3187 
3188 
3189 #if defined (HAVE_PRAGMA_GCC_DIAGNOSTIC)
3190 // Also disable this warning for functions that is generated by flex
3191 // after the pattern rules.
3192 #pragma GCC diagnostic ignored "-Wunused-parameter"
3193 #endif
3194 
3195 case 119:
3197 #line 1788 "../libinterp/parse-tree/lex.ll"
3198 ECHO;
3199  YY_BREAK
3200 #line 3201 "libinterp/parse-tree/lex.cc"
3201 
3202  case YY_END_OF_BUFFER:
3203  {
3204  /* Amount of text matched not including the EOB char. */
3205  int yy_amount_of_matched_text = (int) (yy_cp - yyg->yytext_ptr) - 1;
3206 
3207  /* Undo the effects of YY_DO_BEFORE_ACTION. */
3208  *yy_cp = yyg->yy_hold_char;
3210 
3211  if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
3212  {
3213  /* We're scanning a new file or input source. It's
3214  * possible that this happened because the user
3215  * just pointed yyin at a new source and called
3216  * octave_lex(). If so, then we have to assure
3217  * consistency between YY_CURRENT_BUFFER and our
3218  * globals. Here is the right place to do so, because
3219  * this is the first action (other than possibly a
3220  * back-up) that will match for the new input source.
3221  */
3222  yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
3223  YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
3224  YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
3225  }
3226 
3227  /* Note that here we test for yy_c_buf_p "<=" to the position
3228  * of the first EOB in the buffer, since yy_c_buf_p will
3229  * already have been incremented past the NUL character
3230  * (since all states make transitions on EOB to the
3231  * end-of-buffer state). Contrast this with the test
3232  * in input().
3233  */
3234  if ( yyg->yy_c_buf_p <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] )
3235  { /* This was really a NUL. */
3236  yy_state_type yy_next_state;
3237 
3238  yyg->yy_c_buf_p = yyg->yytext_ptr + yy_amount_of_matched_text;
3239 
3240  yy_current_state = yy_get_previous_state( yyscanner );
3241 
3242  /* Okay, we're now positioned to make the NUL
3243  * transition. We couldn't have
3244  * yy_get_previous_state() go ahead and do it
3245  * for us because it doesn't know how to deal
3246  * with the possibility of jamming (and we don't
3247  * want to build jamming into it because then it
3248  * will run more slowly).
3249  */
3250 
3251  yy_next_state = yy_try_NUL_trans( yy_current_state , yyscanner);
3252 
3253  yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
3254 
3255  if ( yy_next_state )
3256  {
3257  /* Consume the NUL. */
3258  yy_cp = ++yyg->yy_c_buf_p;
3259  yy_current_state = yy_next_state;
3260  goto yy_match;
3261  }
3262 
3263  else
3264  {
3265  yy_cp = yyg->yy_c_buf_p;
3266  goto yy_find_action;
3267  }
3268  }
3269 
3270  else switch ( yy_get_next_buffer( yyscanner ) )
3271  {
3272  case EOB_ACT_END_OF_FILE:
3273  {
3274  yyg->yy_did_buffer_switch_on_eof = 0;
3275 
3276  if ( octave_wrap(yyscanner ) )
3277  {
3278  /* Note: because we've taken care in
3279  * yy_get_next_buffer() to have set up
3280  * yytext, we can now set up
3281  * yy_c_buf_p so that if some total
3282  * hoser (like flex itself) wants to
3283  * call the scanner after we return the
3284  * YY_NULL, it'll still work - another
3285  * YY_NULL will get returned.
3286  */
3287  yyg->yy_c_buf_p = yyg->yytext_ptr + YY_MORE_ADJ;
3288 
3289  yy_act = YY_STATE_EOF(YY_START);
3290  goto do_action;
3291  }
3292 
3293  else
3294  {
3295  if ( ! yyg->yy_did_buffer_switch_on_eof )
3296  YY_NEW_FILE;
3297  }
3298  break;
3299  }
3300 
3301  case EOB_ACT_CONTINUE_SCAN:
3302  yyg->yy_c_buf_p =
3303  yyg->yytext_ptr + yy_amount_of_matched_text;
3304 
3305  yy_current_state = yy_get_previous_state( yyscanner );
3306 
3307  yy_cp = yyg->yy_c_buf_p;
3308  yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
3309  goto yy_match;
3310 
3311  case EOB_ACT_LAST_MATCH:
3312  yyg->yy_c_buf_p =
3313  &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars];
3314 
3315  yy_current_state = yy_get_previous_state( yyscanner );
3316 
3317  yy_cp = yyg->yy_c_buf_p;
3318  yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
3319  goto yy_find_action;
3320  }
3321  break;
3322  }
3323 
3324  default:
3326  "fatal flex scanner internal error--no action found" );
3327  } /* end of action switch */
3328  } /* end of scanning one token */
3329  } /* end of user's declarations */
3330 } /* end of octave_lex */
3331 
3332 /* yy_get_next_buffer - try to read in a new buffer
3333  *
3334  * Returns a code representing an action:
3335  * EOB_ACT_LAST_MATCH -
3336  * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
3337  * EOB_ACT_END_OF_FILE - end of file
3338  */
3339 static int yy_get_next_buffer (yyscan_t yyscanner)
3340 {
3341  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
3342  char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
3343  char *source = yyg->yytext_ptr;
3344  yy_size_t number_to_move, i;
3345  int ret_val;
3346 
3347  if ( yyg->yy_c_buf_p > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] )
3349  "fatal flex scanner internal error--end of buffer missed" );
3350 
3351  if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
3352  { /* Don't try to fill the buffer, so this is an EOF. */
3353  if ( yyg->yy_c_buf_p - yyg->yytext_ptr - YY_MORE_ADJ == 1 )
3354  {
3355  /* We matched a single character, the EOB, so
3356  * treat this as a final EOF.
3357  */
3358  return EOB_ACT_END_OF_FILE;
3359  }
3360 
3361  else
3362  {
3363  /* We matched some text prior to the EOB, first
3364  * process it.
3365  */
3366  return EOB_ACT_LAST_MATCH;
3367  }
3368  }
3369 
3370  /* Try to read more data. */
3371 
3372  /* First move last chars to start of buffer. */
3373  number_to_move = (yy_size_t) (yyg->yy_c_buf_p - yyg->yytext_ptr) - 1;
3374 
3375  for ( i = 0; i < number_to_move; ++i )
3376  *(dest++) = *(source++);
3377 
3378  if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
3379  /* don't do the read, it's not guaranteed to return an EOF,
3380  * just force an EOF
3381  */
3382  YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars = 0;
3383 
3384  else
3385  {
3386  int num_to_read =
3387  YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
3388 
3389  while ( num_to_read <= 0 )
3390  { /* Not enough room in the buffer - grow it. */
3391 
3392  /* just a shorter name for the current buffer */
3393  YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE;
3394 
3395  int yy_c_buf_p_offset =
3396  (int) (yyg->yy_c_buf_p - b->yy_ch_buf);
3397 
3398  if ( b->yy_is_our_buffer )
3399  {
3400  int new_size = b->yy_buf_size * 2;
3401 
3402  if ( new_size <= 0 )
3403  b->yy_buf_size += b->yy_buf_size / 8;
3404  else
3405  b->yy_buf_size *= 2;
3406 
3407  b->yy_ch_buf = (char *)
3408  /* Include room in for 2 EOB chars. */
3409  octave_realloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ,yyscanner );
3410  }
3411  else
3412  /* Can't grow it, we don't own it. */
3413  b->yy_ch_buf = NULL;
3414 
3415  if ( ! b->yy_ch_buf )
3417  "fatal error - scanner input buffer overflow" );
3418 
3419  yyg->yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
3420 
3421  num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
3422  number_to_move - 1;
3423 
3424  }
3425 
3426  if ( num_to_read > YY_READ_BUF_SIZE )
3427  num_to_read = YY_READ_BUF_SIZE;
3428 
3429  /* Read in more data. */
3430  YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
3431  yyg->yy_n_chars, num_to_read );
3432 
3433  YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
3434  }
3435 
3436  if ( yyg->yy_n_chars == 0 )
3437  {
3438  if ( number_to_move == YY_MORE_ADJ )
3439  {
3440  ret_val = EOB_ACT_END_OF_FILE;
3441  octave_restart(yyin ,yyscanner);
3442  }
3443 
3444  else
3445  {
3446  ret_val = EOB_ACT_LAST_MATCH;
3447  YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
3449  }
3450  }
3451 
3452  else
3453  ret_val = EOB_ACT_CONTINUE_SCAN;
3454 
3455  if ((int) (yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
3456  /* Extend the array by 50%, plus the number we really need. */
3457  int new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1);
3458  YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) octave_realloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ,yyscanner );
3459  if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
3460  YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
3461  }
3462 
3463  yyg->yy_n_chars += number_to_move;
3466 
3467  yyg->yytext_ptr = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
3468 
3469  return ret_val;
3470 }
3471 
3472 /* yy_get_previous_state - get the state just before the EOB char was reached */
3473 
3475 {
3476  yy_state_type yy_current_state;
3477  char *yy_cp;
3478  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
3479 
3480  yy_current_state = yyg->yy_start;
3481  yy_current_state += YY_AT_BOL();
3482 
3483  for ( yy_cp = yyg->yytext_ptr + YY_MORE_ADJ; yy_cp < yyg->yy_c_buf_p; ++yy_cp )
3484  {
3485  YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
3486  if ( yy_accept[yy_current_state] )
3487  {
3488  yyg->yy_last_accepting_state = yy_current_state;
3489  yyg->yy_last_accepting_cpos = yy_cp;
3490  }
3491  while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
3492  {
3493  yy_current_state = (int) yy_def[yy_current_state];
3494  if ( yy_current_state >= 266 )
3495  yy_c = yy_meta[(unsigned int) yy_c];
3496  }
3497  yy_current_state = yy_nxt[yy_base[yy_current_state] + (flex_int16_t) yy_c];
3498  }
3499 
3500  return yy_current_state;
3501 }
3502 
3503 /* yy_try_NUL_trans - try to make a transition on the NUL character
3504  *
3505  * synopsis
3506  * next_state = yy_try_NUL_trans( current_state );
3507  */
3508  static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state , yyscan_t yyscanner)
3509 {
3510  int yy_is_jam;
3511  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* This var may be unused depending upon options. */
3512  char *yy_cp = yyg->yy_c_buf_p;
3513 
3514  YY_CHAR yy_c = 1;
3515  if ( yy_accept[yy_current_state] )
3516  {
3517  yyg->yy_last_accepting_state = yy_current_state;
3518  yyg->yy_last_accepting_cpos = yy_cp;
3519  }
3520  while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
3521  {
3522  yy_current_state = (int) yy_def[yy_current_state];
3523  if ( yy_current_state >= 266 )
3524  yy_c = yy_meta[(unsigned int) yy_c];
3525  }
3526  yy_current_state = yy_nxt[yy_base[yy_current_state] + (flex_int16_t) yy_c];
3527  yy_is_jam = (yy_current_state == 265);
3528 
3529  (void)yyg;
3530  return yy_is_jam ? 0 : yy_current_state;
3531 }
3532 
3533 #ifndef YY_NO_UNPUT
3534 
3535  static void yyunput (int c, char * yy_bp , yyscan_t yyscanner)
3536 {
3537  char *yy_cp;
3538  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
3539 
3540  yy_cp = yyg->yy_c_buf_p;
3541 
3542  /* undo effects of setting up yytext */
3543  *yy_cp = yyg->yy_hold_char;
3544 
3545  if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
3546  { /* need to shift things up to make room */
3547  /* +2 for EOB chars. */
3548  int number_to_move = yyg->yy_n_chars + 2;
3549  char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
3550  YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
3551  char *source =
3552  &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
3553 
3554  while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
3555  *--dest = *--source;
3556 
3557  yy_cp += (int) (dest - source);
3558  yy_bp += (int) (dest - source);
3559  YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
3560  yyg->yy_n_chars = (int) YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
3561 
3562  if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
3563  YY_FATAL_ERROR( "flex scanner push-back overflow" );
3564  }
3565 
3566  *--yy_cp = (char) c;
3567 
3568  yyg->yytext_ptr = yy_bp;
3569  yyg->yy_hold_char = *yy_cp;
3570  yyg->yy_c_buf_p = yy_cp;
3571 }
3572 
3573 #endif
3574 
3575 #ifndef YY_NO_INPUT
3576 #ifdef __cplusplus
3577  static int yyinput (yyscan_t yyscanner)
3578 #else
3579  static int input (yyscan_t yyscanner)
3580 #endif
3581 
3582 {
3583  int c;
3584  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
3585 
3586  *yyg->yy_c_buf_p = yyg->yy_hold_char;
3587 
3588  if ( *yyg->yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
3589  {
3590  /* yy_c_buf_p now points to the character we want to return.
3591  * If this occurs *before* the EOB characters, then it's a
3592  * valid NUL; if not, then we've hit the end of the buffer.
3593  */
3594  if ( yyg->yy_c_buf_p < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] )
3595  /* This was really a NUL. */
3596  *yyg->yy_c_buf_p = '\0';
3597 
3598  else
3599  { /* need more input */
3600  int offset = yyg->yy_c_buf_p - yyg->yytext_ptr;
3601  ++yyg->yy_c_buf_p;
3602 
3603  switch ( yy_get_next_buffer( yyscanner ) )
3604  {
3605  case EOB_ACT_LAST_MATCH:
3606  /* This happens because yy_g_n_b()
3607  * sees that we've accumulated a
3608  * token and flags that we need to
3609  * try matching the token before
3610  * proceeding. But for input(),
3611  * there's no matching to consider.
3612  * So convert the EOB_ACT_LAST_MATCH
3613  * to EOB_ACT_END_OF_FILE.
3614  */
3615 
3616  /* Reset buffer status. */
3617  octave_restart(yyin ,yyscanner);
3618 
3619  /*FALLTHROUGH*/
3620 
3621  case EOB_ACT_END_OF_FILE:
3622  {
3623  if ( octave_wrap(yyscanner ) )
3624  return 0;
3625 
3626  if ( ! yyg->yy_did_buffer_switch_on_eof )
3627  YY_NEW_FILE;
3628 #ifdef __cplusplus
3629  return yyinput(yyscanner);
3630 #else
3631  return input(yyscanner);
3632 #endif
3633  }
3634 
3635  case EOB_ACT_CONTINUE_SCAN:
3636  yyg->yy_c_buf_p = yyg->yytext_ptr + offset;
3637  break;
3638  }
3639  }
3640  }
3641 
3642  c = *(unsigned char *) yyg->yy_c_buf_p; /* cast for 8-bit char's */
3643  *yyg->yy_c_buf_p = '\0'; /* preserve yytext */
3644  yyg->yy_hold_char = *++yyg->yy_c_buf_p;
3645 
3646  YY_CURRENT_BUFFER_LVALUE->yy_at_bol = (c == '\n');
3647 
3648  return c;
3649 }
3650 #endif /* ifndef YY_NO_INPUT */
3651 
3652 /** Immediately switch to a different input stream.
3653  * @param input_file A readable stream.
3654  * @param yyscanner The scanner object.
3655  * @note This function does not reset the start condition to @c INITIAL .
3656  */
3657  void octave_restart (FILE * input_file , yyscan_t yyscanner)
3658 {
3659  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
3660 
3661  if ( ! YY_CURRENT_BUFFER ){
3662  octave_ensure_buffer_stack (yyscanner);
3665  }
3666 
3667  octave__init_buffer(YY_CURRENT_BUFFER,input_file ,yyscanner);
3668  octave__load_buffer_state(yyscanner );
3669 }
3670 
3671 /** Switch to a different input buffer.
3672  * @param new_buffer The new input buffer.
3673  * @param yyscanner The scanner object.
3674  */
3675  void octave__switch_to_buffer (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner)
3676 {
3677  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
3678 
3679  /* TODO. We should be able to replace this entire function body
3680  * with
3681  * octave_pop_buffer_state();
3682  * octave_push_buffer_state(new_buffer);
3683  */
3684  octave_ensure_buffer_stack (yyscanner);
3685  if ( YY_CURRENT_BUFFER == new_buffer )
3686  return;
3687 
3688  if ( YY_CURRENT_BUFFER )
3689  {
3690  /* Flush out information for old buffer. */
3691  *yyg->yy_c_buf_p = yyg->yy_hold_char;
3692  YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p;
3693  YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
3694  }
3695 
3696  YY_CURRENT_BUFFER_LVALUE = new_buffer;
3697  octave__load_buffer_state(yyscanner );
3698 
3699  /* We don't actually know whether we did this switch during
3700  * EOF (octave_wrap()) processing, but the only time this flag
3701  * is looked at is after octave_wrap() is called, so it's safe
3702  * to go ahead and always set it.
3703  */
3704  yyg->yy_did_buffer_switch_on_eof = 1;
3705 }
3706 
3707 static void octave__load_buffer_state (yyscan_t yyscanner)
3708 {
3709  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
3710  yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
3711  yyg->yytext_ptr = yyg->yy_c_buf_p = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
3712  yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
3713  yyg->yy_hold_char = *yyg->yy_c_buf_p;
3714 }
3715 
3716 /** Allocate and initialize an input buffer state.
3717  * @param file A readable stream.
3718  * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
3719  * @param yyscanner The scanner object.
3720  * @return the allocated buffer state.
3721  */
3722  YY_BUFFER_STATE octave__create_buffer (FILE * file, int size , yyscan_t yyscanner)
3723 {
3724  YY_BUFFER_STATE b;
3725 
3726  b = (YY_BUFFER_STATE) octave_alloc(sizeof( struct yy_buffer_state ) ,yyscanner );
3727  if ( ! b )
3728  YY_FATAL_ERROR( "out of dynamic memory in octave__create_buffer()" );
3729 
3730  b->yy_buf_size = (yy_size_t)size;
3731 
3732  /* yy_ch_buf has to be 2 characters longer than the size given because
3733  * we need to put in 2 end-of-buffer characters.
3734  */
3735  b->yy_ch_buf = (char *) octave_alloc(b->yy_buf_size + 2 ,yyscanner );
3736  if ( ! b->yy_ch_buf )
3737  YY_FATAL_ERROR( "out of dynamic memory in octave__create_buffer()" );
3738 
3739  b->yy_is_our_buffer = 1;
3740 
3741  octave__init_buffer(b,file ,yyscanner);
3742 
3743  return b;
3744 }
3745 
3746 /** Destroy the buffer.
3747  * @param b a buffer created with octave__create_buffer()
3748  * @param yyscanner The scanner object.
3749  */
3750  void octave__delete_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner)
3751 {
3752  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
3753 
3754  if ( ! b )
3755  return;
3756 
3757  if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
3759 
3760  if ( b->yy_is_our_buffer )
3761  octave_free((void *) b->yy_ch_buf ,yyscanner );
3762 
3763  octave_free((void *) b ,yyscanner );
3764 }
3765 
3766 /* Initializes or reinitializes a buffer.
3767  * This function is sometimes called more than once on the same buffer,
3768  * such as during a octave_restart() or at EOF.
3769  */
3770  static void octave__init_buffer (YY_BUFFER_STATE b, FILE * file , yyscan_t yyscanner)
3771 
3772 {
3773  int oerrno = errno;
3774  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
3775 
3776  octave__flush_buffer(b ,yyscanner);
3777 
3778  b->yy_input_file = file;
3779  b->yy_fill_buffer = 1;
3780 
3781  /* If b is the current buffer, then octave__init_buffer was _probably_
3782  * called from octave_restart() or through yy_get_next_buffer.
3783  * In that case, we don't want to reset the lineno or column.
3784  */
3785  if (b != YY_CURRENT_BUFFER){
3786  b->yy_bs_lineno = 1;
3787  b->yy_bs_column = 0;
3788  }
3789 
3790  b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
3791 
3792  errno = oerrno;
3793 }
3794 
3795 /** Discard all buffered characters. On the next scan, YY_INPUT will be called.
3796  * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
3797  * @param yyscanner The scanner object.
3798  */
3799  void octave__flush_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner)
3800 {
3801  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
3802  if ( ! b )
3803  return;
3804 
3805  b->yy_n_chars = 0;
3806 
3807  /* We always need two end-of-buffer characters. The first causes
3808  * a transition to the end-of-buffer state. The second causes
3809  * a jam in that state.
3810  */
3813 
3814  b->yy_buf_pos = &b->yy_ch_buf[0];
3815 
3816  b->yy_at_bol = 1;
3818 
3819  if ( b == YY_CURRENT_BUFFER )
3820  octave__load_buffer_state(yyscanner );
3821 }
3822 
3823 /** Pushes the new state onto the stack. The new state becomes
3824  * the current state. This function will allocate the stack
3825  * if necessary.
3826  * @param new_buffer The new state.
3827  * @param yyscanner The scanner object.
3828  */
3829 void octave_push_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner)
3830 {
3831  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
3832  if (new_buffer == NULL)
3833  return;
3834 
3835  octave_ensure_buffer_stack(yyscanner);
3836 
3837  /* This block is copied from octave__switch_to_buffer. */
3838  if ( YY_CURRENT_BUFFER )
3839  {
3840  /* Flush out information for old buffer. */
3841  *yyg->yy_c_buf_p = yyg->yy_hold_char;
3842  YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p;
3843  YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
3844  }
3845 
3846  /* Only push if top exists. Otherwise, replace top. */
3847  if (YY_CURRENT_BUFFER)
3848  yyg->yy_buffer_stack_top++;
3849  YY_CURRENT_BUFFER_LVALUE = new_buffer;
3850 
3851  /* copied from octave__switch_to_buffer. */
3852  octave__load_buffer_state(yyscanner );
3853  yyg->yy_did_buffer_switch_on_eof = 1;
3854 }
3855 
3856 /** Removes and deletes the top of the stack, if present.
3857  * The next element becomes the new top.
3858  * @param yyscanner The scanner object.
3859  */
3861 {
3862  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
3863  if (!YY_CURRENT_BUFFER)
3864  return;
3865 
3867  YY_CURRENT_BUFFER_LVALUE = NULL;
3868  if (yyg->yy_buffer_stack_top > 0)
3869  --yyg->yy_buffer_stack_top;
3870 
3871  if (YY_CURRENT_BUFFER) {
3872  octave__load_buffer_state(yyscanner );
3873  yyg->yy_did_buffer_switch_on_eof = 1;
3874  }
3875 }
3876 
3877 /* Allocates the stack if it does not exist.
3878  * Guarantees space for at least one push.
3879  */
3880 static void octave_ensure_buffer_stack (yyscan_t yyscanner)
3881 {
3882  int num_to_alloc;
3883  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
3884 
3885  if (!yyg->yy_buffer_stack) {
3886 
3887  /* First allocation is just for 2 elements, since we don't know if this
3888  * scanner will even need a stack. We use 2 instead of 1 to avoid an
3889  * immediate realloc on the next call.
3890  */
3891  num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */
3893  (num_to_alloc * sizeof(struct yy_buffer_state*)
3894  , yyscanner);
3895  if ( ! yyg->yy_buffer_stack )
3896  YY_FATAL_ERROR( "out of dynamic memory in octave_ensure_buffer_stack()" );
3897 
3898  memset(yyg->yy_buffer_stack, 0, num_to_alloc * sizeof(struct yy_buffer_state*));
3899 
3900  yyg->yy_buffer_stack_max = num_to_alloc;
3901  yyg->yy_buffer_stack_top = 0;
3902  return;
3903  }
3904 
3905  if (yyg->yy_buffer_stack_top >= (yyg->yy_buffer_stack_max) - 1){
3906 
3907  /* Increase the buffer to prepare for a possible push. */
3908  yy_size_t grow_size = 8 /* arbitrary grow size */;
3909 
3910  num_to_alloc = yyg->yy_buffer_stack_max + grow_size;
3912  (yyg->yy_buffer_stack,
3913  num_to_alloc * sizeof(struct yy_buffer_state*)
3914  , yyscanner);
3915  if ( ! yyg->yy_buffer_stack )
3916  YY_FATAL_ERROR( "out of dynamic memory in octave_ensure_buffer_stack()" );
3917 
3918  /* zero only the new slots.*/
3919  memset(yyg->yy_buffer_stack + yyg->yy_buffer_stack_max, 0, grow_size * sizeof(struct yy_buffer_state*));
3920  yyg->yy_buffer_stack_max = num_to_alloc;
3921  }
3922 }
3923 
3924 /** Setup the input buffer state to scan directly from a user-specified character buffer.
3925  * @param base the character buffer
3926  * @param size the size in bytes of the character buffer
3927  * @param yyscanner The scanner object.
3928  * @return the newly allocated buffer state object.
3929  */
3930 YY_BUFFER_STATE octave__scan_buffer (char * base, yy_size_t size , yyscan_t yyscanner)
3931 {
3932  YY_BUFFER_STATE b;
3933 
3934  if ( size < 2 ||
3935  base[size-2] != YY_END_OF_BUFFER_CHAR ||
3936  base[size-1] != YY_END_OF_BUFFER_CHAR )
3937  /* They forgot to leave room for the EOB's. */
3938  return NULL;
3939 
3940  b = (YY_BUFFER_STATE) octave_alloc(sizeof( struct yy_buffer_state ) ,yyscanner );
3941  if ( ! b )
3942  YY_FATAL_ERROR( "out of dynamic memory in octave__scan_buffer()" );
3943 
3944  b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
3945  b->yy_buf_pos = b->yy_ch_buf = base;
3946  b->yy_is_our_buffer = 0;
3947  b->yy_input_file = NULL;
3948  b->yy_n_chars = b->yy_buf_size;
3949  b->yy_is_interactive = 0;
3950  b->yy_at_bol = 1;
3951  b->yy_fill_buffer = 0;
3953 
3954  octave__switch_to_buffer(b ,yyscanner );
3955 
3956  return b;
3957 }
3958 
3959 /** Setup the input buffer state to scan a string. The next call to octave_lex() will
3960  * scan from a @e copy of @a str.
3961  * @param yystr a NUL-terminated string to scan
3962  * @param yyscanner The scanner object.
3963  * @return the newly allocated buffer state object.
3964  * @note If you want to scan bytes that may contain NUL values, then use
3965  * octave__scan_bytes() instead.
3966  */
3967 YY_BUFFER_STATE octave__scan_string (yyconst char * yystr , yyscan_t yyscanner)
3968 {
3969 
3970  return octave__scan_bytes(yystr,(int) strlen(yystr) ,yyscanner);
3971 }
3972 
3973 /** Setup the input buffer state to scan the given bytes. The next call to octave_lex() will
3974  * scan from a @e copy of @a bytes.
3975  * @param yybytes the byte buffer to scan
3976  * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
3977  * @param yyscanner The scanner object.
3978  * @return the newly allocated buffer state object.
3979  */
3980 YY_BUFFER_STATE octave__scan_bytes (yyconst char * yybytes, int _yybytes_len , yyscan_t yyscanner)
3981 {
3982  YY_BUFFER_STATE b;
3983  char *buf;
3984  yy_size_t n;
3985  yy_size_t i;
3986 
3987  /* Get memory for full buffer, including space for trailing EOB's. */
3988  n = (yy_size_t) _yybytes_len + 2;
3989  buf = (char *) octave_alloc(n ,yyscanner );
3990  if ( ! buf )
3991  YY_FATAL_ERROR( "out of dynamic memory in octave__scan_bytes()" );
3992 
3993  for ( i = 0; i < _yybytes_len; ++i )
3994  buf[i] = yybytes[i];
3995 
3996  buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
3997 
3998  b = octave__scan_buffer(buf,n ,yyscanner);
3999  if ( ! b )
4000  YY_FATAL_ERROR( "bad buffer in octave__scan_bytes()" );
4001 
4002  /* It's okay to grow etc. this buffer, and we should throw it
4003  * away when we're done.
4004  */
4005  b->yy_is_our_buffer = 1;
4006 
4007  return b;
4008 }
4009 
4010 #ifndef YY_EXIT_FAILURE
4011 #define YY_EXIT_FAILURE 2
4012 #endif
4013 
4014 static void yynoreturn yy_fatal_error (yyconst char* msg , yyscan_t yyscanner)
4015 {
4016  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
4017  (void)yyg;
4018  (void) fprintf( stderr, "%s\n", msg );
4019  exit( YY_EXIT_FAILURE );
4020 }
4021 
4022 /* Redefine yyless() so it works in section 3 code. */
4023 
4024 #undef yyless
4025 #define yyless(n) \
4026  do \
4027  { \
4028  /* Undo effects of setting up yytext. */ \
4029  int yyless_macro_arg = (n); \
4030  YY_LESS_LINENO(yyless_macro_arg);\
4031  yytext[yyleng] = yyg->yy_hold_char; \
4032  yyg->yy_c_buf_p = yytext + yyless_macro_arg; \
4033  yyg->yy_hold_char = *yyg->yy_c_buf_p; \
4034  *yyg->yy_c_buf_p = '\0'; \
4035  yyleng = yyless_macro_arg; \
4036  } \
4037  while ( 0 )
4038 
4039 /* Accessor methods (get/set functions) to struct members. */
4040 
4041 /** Get the user-defined data for this scanner.
4042  * @param yyscanner The scanner object.
4043  */
4045 {
4046  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
4047  return yyextra;
4048 }
4049 
4050 /** Get the current line number.
4051  * @param yyscanner The scanner object.
4052  */
4054 {
4055  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
4056 
4057  if (! YY_CURRENT_BUFFER)
4058  return 0;
4059 
4060  return yylineno;
4061 }
4062 
4063 /** Get the current column number.
4064  * @param yyscanner The scanner object.
4065  */
4067 {
4068  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
4069 
4070  if (! YY_CURRENT_BUFFER)
4071  return 0;
4072 
4073  return yycolumn;
4074 }
4075 
4076 /** Get the input stream.
4077  * @param yyscanner The scanner object.
4078  */
4079 FILE *octave_get_in (yyscan_t yyscanner)
4080 {
4081  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
4082  return yyin;
4083 }
4084 
4085 /** Get the output stream.
4086  * @param yyscanner The scanner object.
4087  */
4088 FILE *octave_get_out (yyscan_t yyscanner)
4089 {
4090  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
4091  return yyout;
4092 }
4093 
4094 /** Get the length of the current token.
4095  * @param yyscanner The scanner object.
4096  */
4097 int octave_get_leng (yyscan_t yyscanner)
4098 {
4099  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
4100  return yyleng;
4101 }
4102 
4103 /** Get the current token.
4104  * @param yyscanner The scanner object.
4105  */
4106 
4107 char *octave_get_text (yyscan_t yyscanner)
4108 {
4109  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
4110  return yytext;
4111 }
4112 
4113 /** Set the user-defined data. This data is never touched by the scanner.
4114  * @param user_defined The data to be associated with this scanner.
4115  * @param yyscanner The scanner object.
4116  */
4117 void octave_set_extra (YY_EXTRA_TYPE user_defined , yyscan_t yyscanner)
4118 {
4119  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
4120  yyextra = user_defined ;
4121 }
4122 
4123 /** Set the current line number.
4124  * @param _line_number line number
4125  * @param yyscanner The scanner object.
4126  */
4127 void octave_set_lineno (int _line_number , yyscan_t yyscanner)
4128 {
4129  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
4130 
4131  /* lineno is only valid if an input buffer exists. */
4132  if (! YY_CURRENT_BUFFER )
4133  YY_FATAL_ERROR( "octave_set_lineno called with no buffer" );
4134 
4135  yylineno = _line_number;
4136 }
4137 
4138 /** Set the current column.
4139  * @param _column_no column number
4140  * @param yyscanner The scanner object.
4141  */
4142 void octave_set_column (int _column_no , yyscan_t yyscanner)
4143 {
4144  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
4145 
4146  /* column is only valid if an input buffer exists. */
4147  if (! YY_CURRENT_BUFFER )
4148  YY_FATAL_ERROR( "octave_set_column called with no buffer" );
4149 
4150  yycolumn = _column_no;
4151 }
4152 
4153 /** Set the input stream. This does not discard the current
4154  * input buffer.
4155  * @param _in_str A readable stream.
4156  * @param yyscanner The scanner object.
4157  * @see octave__switch_to_buffer
4158  */
4159 void octave_set_in (FILE * _in_str , yyscan_t yyscanner)
4160 {
4161  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
4162  yyin = _in_str ;
4163 }
4164 
4165 void octave_set_out (FILE * _out_str , yyscan_t yyscanner)
4166 {
4167  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
4168  yyout = _out_str ;
4169 }
4170 
4172 {
4173  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
4174  return yy_flex_debug;
4175 }
4176 
4177 void octave_set_debug (int _bdebug , yyscan_t yyscanner)
4178 {
4179  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
4180  yy_flex_debug = _bdebug ;
4181 }
4182 
4183 /* Accessor methods for yylval and yylloc */
4184 
4186 {
4187  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
4188  return yylval;
4189 }
4190 
4191 void octave_set_lval (YYSTYPE * yylval_param , yyscan_t yyscanner)
4192 {
4193  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
4194  yylval = yylval_param;
4195 }
4196 
4197 /* User-visible API */
4198 
4199 /* octave_lex_init is special because it creates the scanner itself, so it is
4200  * the ONLY reentrant function that doesn't take the scanner as the last argument.
4201  * That's why we explicitly handle the declaration, instead of using our macros.
4202  */
4203 
4204 int octave_lex_init(yyscan_t* ptr_yy_globals)
4205 
4206 {
4207  if (ptr_yy_globals == NULL){
4208  errno = EINVAL;
4209  return 1;
4210  }
4211 
4212  *ptr_yy_globals = (yyscan_t) octave_alloc ( sizeof( struct yyguts_t ), NULL );
4213 
4214  if (*ptr_yy_globals == NULL){
4215  errno = ENOMEM;
4216  return 1;
4217  }
4218 
4219  /* By setting to 0xAA, we expose bugs in yy_init_globals. Leave at 0x00 for releases. */
4220  memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
4221 
4222  return yy_init_globals ( *ptr_yy_globals );
4223 }
4224 
4225 /* octave_lex_init_extra has the same functionality as octave_lex_init, but follows the
4226  * convention of taking the scanner as the last argument. Note however, that
4227  * this is a *pointer* to a scanner, as it will be allocated by this call (and
4228  * is the reason, too, why this function also must handle its own declaration).
4229  * The user defined value in the first argument will be available to octave_alloc in
4230  * the yyextra field.
4231  */
4232 
4233 int octave_lex_init_extra(YY_EXTRA_TYPE yy_user_defined,yyscan_t* ptr_yy_globals )
4234 
4235 {
4236  struct yyguts_t dummy_yyguts;
4237 
4238  octave_set_extra (yy_user_defined, &dummy_yyguts);
4239 
4240  if (ptr_yy_globals == NULL){
4241  errno = EINVAL;
4242  return 1;
4243  }
4244 
4245  *ptr_yy_globals = (yyscan_t) octave_alloc ( sizeof( struct yyguts_t ), &dummy_yyguts );
4246 
4247  if (*ptr_yy_globals == NULL){
4248  errno = ENOMEM;
4249  return 1;
4250  }
4251 
4252  /* By setting to 0xAA, we expose bugs in
4253  yy_init_globals. Leave at 0x00 for releases. */
4254  memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
4255 
4256  octave_set_extra (yy_user_defined, *ptr_yy_globals);
4257 
4258  return yy_init_globals ( *ptr_yy_globals );
4259 }
4260 
4261 static int yy_init_globals (yyscan_t yyscanner)
4262 {
4263  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
4264  /* Initialization is the same as for the non-reentrant scanner.
4265  * This function is called from octave_lex_destroy(), so don't allocate here.
4266  */
4267 
4268  yyg->yy_buffer_stack = NULL;
4269  yyg->yy_buffer_stack_top = 0;
4270  yyg->yy_buffer_stack_max = 0;
4271  yyg->yy_c_buf_p = NULL;
4272  yyg->yy_init = 0;
4273  yyg->yy_start = 0;
4274 
4275  yyg->yy_start_stack_ptr = 0;
4276  yyg->yy_start_stack_depth = 0;
4277  yyg->yy_start_stack = NULL;
4278 
4279 /* Defined in main.c */
4280 #ifdef YY_STDINIT
4281  yyin = stdin;
4282  yyout = stdout;
4283 #else
4284  yyin = NULL;
4285  yyout = NULL;
4286 #endif
4287 
4288  /* For future reference: Set errno on error, since we are called by
4289  * octave_lex_init()
4290  */
4291  return 0;
4292 }
4293 
4294 /* octave_lex_destroy is for both reentrant and non-reentrant scanners. */
4296 {
4297  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
4298 
4299  /* Pop the buffer stack, destroying each element. */
4300  while(YY_CURRENT_BUFFER){
4302  YY_CURRENT_BUFFER_LVALUE = NULL;
4303  octave_pop_buffer_state(yyscanner);
4304  }
4305 
4306  /* Destroy the stack itself. */
4307  octave_free(yyg->yy_buffer_stack ,yyscanner);
4308  yyg->yy_buffer_stack = NULL;
4309 
4310  /* Destroy the start condition stack. */
4311  octave_free(yyg->yy_start_stack ,yyscanner );
4312  yyg->yy_start_stack = NULL;
4313 
4314  /* Reset the globals. This is important in a non-reentrant scanner so the next time
4315  * octave_lex() is called, initialization will occur. */
4316  yy_init_globals( yyscanner);
4317 
4318  /* Destroy the main struct (reentrant only). */
4319  octave_free ( yyscanner , yyscanner );
4320  yyscanner = NULL;
4321  return 0;
4322 }
4323 
4324 /*
4325  * Internal utility routines.
4326  */
4327 
4328 #ifndef yytext_ptr
4329 static void yy_flex_strncpy (char* s1, yyconst char * s2, int n , yyscan_t yyscanner)
4330 {
4331  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
4332  (void)yyg;
4333 
4334  int i;
4335  for ( i = 0; i < n; ++i )
4336  s1[i] = s2[i];
4337 }
4338 #endif
4339 
4340 #ifdef YY_NEED_STRLEN
4341 static int yy_flex_strlen (yyconst char * s , yyscan_t yyscanner)
4342 {
4343  int n;
4344  for ( n = 0; s[n]; ++n )
4345  ;
4346 
4347  return n;
4348 }
4349 #endif
4350 
4351 #define YYTABLES_NAME "yytables"
4352 
4353 #line 1788 "../libinterp/parse-tree/lex.ll"
4354 
4355 
4356 
4357 #if defined (HAVE_PRAGMA_GCC_DIAGNOSTIC)
4358 // Restore prevailing warning state for remainder of the file.
4359 #pragma GCC diagnostic pop
4360 #endif
4361 
4362 void *
4364 {
4365  return std::malloc (size);
4366 }
4367 
4368 void *
4370 {
4371  return std::realloc (ptr, size);
4372 }
4373 
4374 void
4375 octave_free (void *ptr, yyscan_t)
4376 {
4377  std::free (ptr);
4378 }
4379 
4380 static void
4382 {
4383  if (isgraph (c))
4384  std::cerr << c;
4385  else
4386  switch (c)
4387  {
4388  case 0:
4389  std::cerr << "NUL";
4390  break;
4391 
4392  case 1:
4393  std::cerr << "SOH";
4394  break;
4395 
4396  case 2:
4397  std::cerr << "STX";
4398  break;
4399 
4400  case 3:
4401  std::cerr << "ETX";
4402  break;
4403 
4404  case 4:
4405  std::cerr << "EOT";
4406  break;
4407 
4408  case 5:
4409  std::cerr << "ENQ";
4410  break;
4411 
4412  case 6:
4413  std::cerr << "ACK";
4414  break;
4415 
4416  case 7:
4417  std::cerr << "\\a";
4418  break;
4419 
4420  case 8:
4421  std::cerr << "\\b";
4422  break;
4423 
4424  case 9:
4425  std::cerr << "\\t";
4426  break;
4427 
4428  case 10:
4429  std::cerr << "\\n";
4430  break;
4431 
4432  case 11:
4433  std::cerr << "\\v";
4434  break;
4435 
4436  case 12:
4437  std::cerr << "\\f";
4438  break;
4439 
4440  case 13:
4441  std::cerr << "\\r";
4442  break;
4443 
4444  case 14:
4445  std::cerr << "SO";
4446  break;
4447 
4448  case 15:
4449  std::cerr << "SI";
4450  break;
4451 
4452  case 16:
4453  std::cerr << "DLE";
4454  break;
4455 
4456  case 17:
4457  std::cerr << "DC1";
4458  break;
4459 
4460  case 18:
4461  std::cerr << "DC2";
4462  break;
4463 
4464  case 19:
4465  std::cerr << "DC3";
4466  break;
4467 
4468  case 20:
4469  std::cerr << "DC4";
4470  break;
4471 
4472  case 21:
4473  std::cerr << "NAK";
4474  break;
4475 
4476  case 22:
4477  std::cerr << "SYN";
4478  break;
4479 
4480  case 23:
4481  std::cerr << "ETB";
4482  break;
4483 
4484  case 24:
4485  std::cerr << "CAN";
4486  break;
4487 
4488  case 25:
4489  std::cerr << "EM";
4490  break;
4491 
4492  case 26:
4493  std::cerr << "SUB";
4494  break;
4495 
4496  case 27:
4497  std::cerr << "ESC";
4498  break;
4499 
4500  case 28:
4501  std::cerr << "FS";
4502  break;
4503 
4504  case 29:
4505  std::cerr << "GS";
4506  break;
4507 
4508  case 30:
4509  std::cerr << "RS";
4510  break;
4511 
4512  case 31:
4513  std::cerr << "US";
4514  break;
4515 
4516  case 32:
4517  std::cerr << "SPACE";
4518  break;
4519 
4520  case 127:
4521  std::cerr << "DEL";
4522  break;
4523  }
4524 }
4525 
4526 namespace octave
4527 {
4528  bool
4530  {
4531  // Parsing function names like "set.property_name" inside
4532  // classdef-style class definitions is simplified by handling the
4533  // "set" and "get" portions of the names using the same mechanism
4534  // as is used for keywords. However, they are not really keywords
4535  // in the language, so omit them from the list of possible
4536  // keywords. Likewise for "enumeration", "events", "methods", and
4537  // "properties".
4538 
4539  return (octave_kw_hash::in_word_set (s.c_str (), s.length ()) != 0
4540  && ! (s == "set" || s == "get"
4541  || s == "enumeration" || s == "events"
4542  || s == "methods" || s == "properties"));
4543  }
4544 }
4545 
4546 DEFUN (iskeyword, args, ,
4547  doc: /* -*- texinfo -*-
4548 @deftypefn {} {} iskeyword ()
4549 @deftypefnx {} {} iskeyword (@var{name})
4550 Return true if @var{name} is an Octave keyword.
4551 
4552 If @var{name} is omitted, return a list of keywords.
4553 @seealso{isvarname, exist}
4554 @end deftypefn */)
4555 {
4557 
4558  int nargin = args.length ();
4559 
4560  if (nargin > 1)
4561  print_usage ();
4562 
4563  if (nargin == 0)
4564  {
4565  // Neither set nor get are keywords. See the note in the
4566  // is_keyword function for additional details.
4567 
4569 
4570  int j = 0;
4571 
4572  for (int i = 0; i < TOTAL_KEYWORDS; i++)
4573  {
4574  std::string kword = wordlist[i].name;
4575 
4576  if (kword != "set" && kword != "get")
4577  lst[j++] = kword;
4578  }
4579 
4580  lst.resize (j);
4581 
4582  retval = Cell (lst.sort ());
4583  }
4584  else
4585  {
4586  std::string name = args(0).xstring_value ("iskeyword: NAME must be a string");
4587  retval = octave::is_keyword (name);
4588  }
4589 
4590  return retval;
4591 }
4592 
4593 /*
4594 
4595 %!assert (iskeyword ("for"))
4596 %!assert (iskeyword ("fort"), false)
4597 %!assert (iskeyword ("fft"), false)
4598 %!assert (iskeyword ("get"), false)
4599 %!assert (iskeyword ("set"), false)
4600 
4601 %!error iskeyword ("A", "B")
4602 %!error <NAME must be a string> iskeyword (1)
4603 
4604 */
4605 
4606 DEFUN (__display_tokens__, args, nargout,
4607  doc: /* -*- texinfo -*-
4608 @deftypefn {} {} __display_tokens__ ()
4609 Query or set the internal variable that determines whether Octave's
4610 lexer displays tokens as they are read.
4611 @seealso{__lexer_debug_flag__, __token_count__}
4612 @end deftypefn */)
4613 {
4614  return SET_INTERNAL_VARIABLE (display_tokens);
4615 }
4616 
4617 DEFUN (__token_count__, , ,
4618  doc: /* -*- texinfo -*-
4619 @deftypefn {} {} __token_count__ ()
4620 Return the number of language tokens processed since Octave startup.
4621 @seealso{__lexer_debug_flag__, __display_tokens__}
4622 @end deftypefn */)
4623 {
4624  return octave_value (Vtoken_count);
4626 
4627 DEFUN (__lexer_debug_flag__, args, nargout,
4628  doc: /* -*- texinfo -*-
4629 @deftypefn {} {@var{val} =} __lexer_debug_flag__ ()
4630 @deftypefnx {} {@var{old_val} =} __lexer_debug_flag__ (@var{new_val})
4631 Query or set the internal flag that determines whether Octave's lexer prints
4632 debug information as it processes an expression.
4633 @seealso{__display_tokens__, __token_count__, __parse_debug_flag__}
4634 @end deftypefn */)
4635 {
4637 
4638  retval = set_internal_variable (lexer_debug_flag, args, nargout,
4639  "__lexer_debug_flag__");
4640 
4641  return retval;
4642 }
4643 
4644 namespace octave
4645 {
4647  {
4648  tokens.clear ();
4649  }
4650 
4651  void
4652  lexical_feedback::init (void)
4653  {
4654  // The closest paren, brace, or bracket nesting is not an object
4655  // index.
4656  looking_at_object_index.push_front (false);
4657  }
4658 
4659  void
4661  {
4662  end_of_input = false;
4664  looking_at_anon_fcn_args = false;
4665  looking_at_return_list = false;
4666  looking_at_parameter_list = false;
4667  looking_at_decl_list = false;
4670  looking_for_object_index = false;
4671  looking_at_indirect_ref = false;
4672  parsing_class_method = false;
4673  parsing_classdef = false;
4677  quote_is_transpose = false;
4678  force_script = false;
4679  reading_fcn_file = false;
4680  reading_script_file = false;
4681  reading_classdef_file = false;
4682  input_line_number = 1;
4684  bracketflag = 0;
4685  braceflag = 0;
4686  looping = 0;
4687  defining_func = 0;
4691  token_count = 0;
4693  comment_text = "";
4694  help_text = "";
4695  string_text = "";
4696  string_line = 0;
4697  string_column = 0;
4698  fcn_file_name = "";
4700  looking_at_object_index.clear ();
4701  looking_at_object_index.push_front (false);
4702 
4703  while (! parsed_function_name.empty ())
4704  parsed_function_name.pop ();
4705 
4707  symtab_context.clear ();
4708  nesting_level.reset ();
4709  tokens.clear ();
4710  }
4711 
4712  int
4714  {
4715  const token *tok = tokens.front ();
4716  return tok ? tok->token_value () : 0;
4717  }
4718 
4719  bool
4720  lexical_feedback::previous_token_value_is (int tok_val) const
4721  {
4722  const token *tok = tokens.front ();
4723  return tok ? tok->token_value_is (tok_val) : false;
4724  }
4725 
4726  void
4728  {
4729  token *tok = tokens.front ();
4730  if (tok && ! previous_token_value_is ('\n'))
4731  tok->mark_trailing_space ();
4732  }
4733 
4734  bool
4736  {
4737  const token *tok = tokens.front ();
4738  return tok ? tok->space_follows_token () : false;
4739  }
4740 
4741  bool
4743  {
4744  int tok = previous_token_value ();
4745 
4746  return (tok == '+' || tok == '-' || tok == '@'
4747  || tok == ',' || tok == ';' || tok == '*' || tok == '/'
4748  || tok == ':' || tok == '=' || tok == ADD_EQ
4749  || tok == AND_EQ || tok == DIV_EQ || tok == EDIV
4750  || tok == EDIV_EQ || tok == ELEFTDIV || tok == ELEFTDIV_EQ
4751  || tok == EMINUS || tok == EMUL || tok == EMUL_EQ
4752  || tok == EPOW || tok == EPOW_EQ || tok == EXPR_AND
4753  || tok == EXPR_AND_AND || tok == EXPR_EQ || tok == EXPR_GE
4754  || tok == EXPR_GT || tok == EXPR_LE || tok == EXPR_LT
4755  || tok == EXPR_NE || tok == EXPR_NOT || tok == EXPR_OR
4756  || tok == EXPR_OR_OR || tok == LEFTDIV || tok == LEFTDIV_EQ
4757  || tok == MUL_EQ || tok == OR_EQ || tok == POW
4758  || tok == POW_EQ || tok == SUB_EQ);
4759  }
4760 
4761  bool
4763  {
4764  const token *tok = tokens.front ();
4765  return tok ? tok->is_keyword () : false;
4766  }
4767 
4768  bool
4770  {
4771  const token *tok = tokens.front ();
4772  return tok ? tok->may_be_command () : false;
4773  }
4774 
4775  void
4777  {
4778  token *tok = tokens.front ();
4779 
4780  if (tok && tok->is_symbol ())
4781  pending_local_variables.insert (tok->symbol_name ());
4782  }
4783 
4784  void
4785  lexical_feedback::mark_as_variables (const std::list<std::string>& lst)
4786  {
4787  for (std::list<std::string>::const_iterator p = lst.begin ();
4788  p != lst.end (); p++)
4789  {
4790  pending_local_variables.insert (*p);
4791  }
4792  }
4793 }
4794 
4795 static bool
4797 {
4798  bool retval = false;
4799 
4800  if (! s.empty ())
4801  {
4802  size_t offset = s.find_first_not_of (" \t");
4803 
4804  retval = (s.substr (offset, 9) == "Copyright" || s.substr (offset, 6) == "Author");
4805  }
4806 
4807  return retval;
4808 }
4809 
4810 namespace octave
4811 {
4812  void
4813  base_lexer::input_buffer::fill (const std::string& input, bool eof_arg)
4814  {
4815  buffer = input;
4816  chars_left = buffer.length ();
4817  pos = buffer.c_str ();
4818  eof = eof_arg;
4819  }
4820 
4821  int
4822  base_lexer::input_buffer::copy_chunk (char *buf, size_t max_size)
4823  {
4824  static const char * const eol = "\n";
4825 
4826  size_t len = max_size > chars_left ? chars_left : max_size;
4827  assert (len > 0);
4828 
4829  memcpy (buf, pos, len);
4830 
4831  chars_left -= len;
4832  pos += len;
4833 
4834  // Make sure input ends with a new line character.
4835  if (chars_left == 0 && buf[len-1] != '\n')
4836  {
4837  if (len < max_size)
4838  {
4839  // There is enough room to plug the newline character in
4840  // the buffer.
4841  buf[len++] = '\n';
4842  }
4843  else
4844  {
4845  // There isn't enough room to plug the newline character
4846  // in the buffer so arrange to have it returned on the next
4847  // call to base_lexer::read.
4848  pos = eol;
4849  chars_left = 1;
4850  }
4851  }
4852 
4853  return len;
4854  }
4855 
4857  {
4859  }
4860 
4861  void
4863  {
4865 
4866  // Make base_lexer object available through yyextra in
4867  // flex-generated lexer.
4868  octave_set_extra (this, scanner);
4869 
4870  clear_start_state ();
4871  }
4872 
4873  // Inside Flex-generated functions, yyg is the scanner cast to its real
4874  // type. Some flex macros that we use in base_lexer member functions
4875  // (for example, BEGIN) use yyg. If we could perform the actions of
4876  // these macros with functions instead, we could eliminate the
4877  // OCTAVE_YYG macro.
4878 
4879 #define OCTAVE_YYG \
4880  struct yyguts_t *yyg = static_cast<struct yyguts_t*> (scanner)
4881 
4882  void
4883  base_lexer::reset (void)
4884  {
4885  // Start off on the right foot.
4886  clear_start_state ();
4887 
4889 
4890  // We do want a prompt by default.
4891  promptflag (1);
4892 
4893  // Only ask for input from stdin if we are expecting interactive
4894  // input.
4895 
4896  if (octave::application::interactive ()
4897  && ! (reading_fcn_file
4900  || input_from_eval_string ()))
4901  octave_restart (stdin, scanner);
4902 
4904 
4906  }
4907 
4908  void
4910  {
4911  reading_script_file = true;
4912 
4914  }
4915 
4916  void
4918  {
4921 
4922  push_start_state (state);
4923  }
4924 
4925  int
4927  {
4928  lexer_debug ("<<EOF>>");
4930  if (block_comment_nesting_level != 0)
4931  {
4932  warning ("block comment open at end of input");
4933 
4935  && ! fcn_file_name.empty ())
4936  warning ("near line %d of file '%s.m'",
4937  input_line_number, fcn_file_name.c_str ());
4938  }
4939 
4940  return handle_token (END_OF_INPUT);
4941  }
4942 
4943  char *
4945  {
4946  return octave_get_text (scanner);
4947  }
4948 
4949  int
4951  {
4952  return octave_get_leng (scanner);
4953  }
4954 
4955  int
4957  {
4958  int c = yyinput (scanner);
4959 
4960  if (lexer_debug_flag)
4961  {
4962  std::cerr << "I: ";
4963  display_character (c);
4964  std::cerr << std::endl;
4965  }
4966 
4967  // Convert CRLF into just LF and single CR into LF.
4968 
4969  if (c == '\r')
4970  {
4971  c = yyinput (scanner);
4972 
4973  if (lexer_debug_flag)
4974  {
4975  std::cerr << "I: ";
4976  display_character (c);
4977  std::cerr << std::endl;
4978  }
4979 
4980  if (c != '\n')
4981  {
4982  xunput (c);
4983  c = '\n';
4984  }
4985  }
4987  return c;
4988  }
4989 
4990  void
4991  base_lexer::xunput (char c, char *buf)
4992  {
4993  if (c != EOF)
4994  {
4995  if (lexer_debug_flag)
4996  {
4997  std::cerr << "U: ";
4998  display_character (c);
4999  std::cerr << std::endl;
5000  }
5001 
5002  yyunput (c, buf, scanner);
5003  }
5004  }
5005 
5006  void
5007  base_lexer::xunput (char c)
5008  {
5009  char *yytxt = flex_yytext ();
5010 
5011  xunput (c, yytxt);
5012  }
5013 
5014  bool
5016  {
5017  int c = text_yyinput ();
5018  xunput (c);
5019  return (c == ' ' || c == '\t');
5020  }
5021 
5022  bool
5024  {
5025  bool retval = false;
5026 
5027  for (std::list<bool>::const_iterator i = looking_at_object_index.begin ();
5028  i != looking_at_object_index.end (); i++)
5029  {
5030  if (*i)
5031  {
5032  retval = true;
5033  break;
5034  }
5035  }
5036 
5037  return retval;
5038  }
5039 
5040  bool
5042  symbol_table::scope_id scope)
5043  {
5044  return (symbol_table::is_variable (name, scope)
5045  || (pending_local_variables.find (name)
5046  != pending_local_variables.end ()));
5047  }
5048 
5049  // Handle keywords. Return -1 if the keyword should be ignored.
5050 
5051  int
5053  {
5054  int l = input_line_number;
5055  int c = current_input_column;
5056 
5057  int len = s.length ();
5058 
5059  const octave_kw *kw = octave_kw_hash::in_word_set (s.c_str (), len);
5060 
5061  if (kw)
5062  {
5063  bool previous_at_bos = at_beginning_of_statement;
5064 
5065  // May be reset to true for some token types.
5066  at_beginning_of_statement = false;
5067 
5068  token *tok_val = 0;
5069 
5070  switch (kw->kw_id)
5071  {
5072  case break_kw:
5073  case catch_kw:
5074  case continue_kw:
5075  case else_kw:
5076  case otherwise_kw:
5077  case return_kw:
5080  break;
5081 
5082  case persistent_kw:
5083  case global_kw:
5084  looking_at_decl_list = true;
5085  break;
5086 
5087  case case_kw:
5088  case elseif_kw:
5089  case until_kw:
5090  break;
5091 
5092  case end_kw:
5094  || (defining_func
5096  || parsed_function_name.top ())))
5097  {
5098  at_beginning_of_statement = previous_at_bos;
5099  return 0;
5100  }
5101 
5102  tok_val = new token (end_kw, token::simple_end, l, c);
5104  break;
5105 
5106  case end_try_catch_kw:
5107  tok_val = new token (end_try_catch_kw, token::try_catch_end, l, c);
5109  break;
5110 
5111  case end_unwind_protect_kw:
5112  tok_val = new token (end_unwind_protect_kw,
5115  break;
5116 
5117  case endfor_kw:
5118  tok_val = new token (endfor_kw, token::for_end, l, c);
5120  break;
5121 
5122  case endfunction_kw:
5123  tok_val = new token (endfunction_kw, token::function_end, l, c);
5125  break;
5126 
5127  case endif_kw:
5128  tok_val = new token (endif_kw, token::if_end, l, c);
5130  break;
5131 
5132  case endparfor_kw:
5133  tok_val = new token (endparfor_kw, token::parfor_end, l, c);
5135  break;
5136 
5137  case endswitch_kw:
5138  tok_val = new token (endswitch_kw, token::switch_end, l, c);
5140  break;
5141 
5142  case endwhile_kw:
5143  tok_val = new token (endwhile_kw, token::while_end, l, c);
5145  break;
5146 
5147  case endclassdef_kw:
5148  tok_val = new token (endclassdef_kw, token::classdef_end, l, c);
5150  break;
5151 
5152  case endenumeration_kw:
5153  tok_val = new token (endenumeration_kw, token::enumeration_end, l, c);
5155  break;
5156 
5157  case endevents_kw:
5158  tok_val = new token (endevents_kw, token::events_end, l, c);
5160  break;
5161 
5162  case endmethods_kw:
5163  tok_val = new token (endmethods_kw, token::methods_end, l, c);
5165  break;
5166 
5167  case endproperties_kw:
5168  tok_val = new token (endproperties_kw, token::properties_end, l, c);
5170  break;
5171 
5172 
5173  case for_kw:
5174  case parfor_kw:
5175  case while_kw:
5177  looping++;
5178  break;
5179 
5180  case do_kw:
5183  looping++;
5184  break;
5185 
5186  case try_kw:
5187  case unwind_protect_kw:
5190  break;
5191 
5192  case if_kw:
5193  case switch_kw:
5195  break;
5196 
5197  case get_kw:
5198  case set_kw:
5199  // 'get' and 'set' are keywords in classdef method
5200  // declarations.
5202  {
5203  at_beginning_of_statement = previous_at_bos;
5204  return 0;
5205  }
5206  break;
5207 
5208  case enumeration_kw:
5209  case events_kw:
5210  case methods_kw:
5211  case properties_kw:
5212  // 'properties', 'methods' and 'events' are keywords for
5213  // classdef blocks.
5214  if (! parsing_classdef)
5215  {
5216  at_beginning_of_statement = previous_at_bos;
5217  return 0;
5218  }
5219  // fall through ...
5220 
5221  case classdef_kw:
5222  // 'classdef' is always a keyword.
5224 
5225  if (! force_script && token_count == 0 && input_from_file ())
5226  {
5227  reading_classdef_file = true;
5228  reading_script_file = false;
5229  }
5230  break;
5231 
5232  case function_kw:
5234 
5235  defining_func++;
5236  parsed_function_name.push (false);
5237 
5238  if (! force_script && token_count == 0 && input_from_file ())
5239  {
5240  reading_fcn_file = true;
5241  reading_script_file = false;
5242  }
5243 
5246  input_line_number = 1;
5247  break;
5248 
5249  case magic_file_kw:
5250  {
5253  && ! fcn_file_full_name.empty ())
5254  tok_val = new token (magic_file_kw, fcn_file_full_name, l, c);
5255  else
5256  tok_val = new token (magic_file_kw, "stdin", l, c);
5257  }
5258  break;
5259 
5261  tok_val = new token (magic_line_kw, static_cast<double> (l),
5262  "", l, c);
5263  break;
5264 
5265  default:
5266  panic_impossible ();
5267  }
5268 
5269  if (! tok_val)
5270  tok_val = new token (kw->tok, true, l, c);
5271 
5272  push_token (tok_val);
5273 
5274  return kw->tok;
5275  }
5276 
5277  return 0;
5278  }
5279 
5280  bool
5282  {
5283  size_t p1 = 0;
5284  size_t p2;
5285 
5286  std::string s_part;
5287 
5288  do
5289  {
5290  p2 = s.find ('.', p1);
5291 
5292  if (p2 != std::string::npos)
5293  {
5294  s_part = s.substr (p1, p2 - p1);
5295  p1 = p2 + 1;
5296  }
5297  else
5298  s_part = s.substr (p1);
5299 
5300  if (is_keyword_token (s_part))
5301  return true;
5302  }
5303  while (p2 != std::string::npos);
5304 
5305  return false;
5306  }
5307 
5308  bool
5310  {
5312  || (nesting_level.is_brace ()
5313  && ! looking_at_object_index.front ()));
5314  }
5315 }
5316 
5317 static inline bool
5318 looks_like_bin (const char *s, int len)
5319 {
5320  return (len > 2 && s[0] == '0' && (s[1] == 'b' || s[1] == 'B'));
5321 }
5322 
5323 static inline bool
5324 looks_like_hex (const char *s, int len)
5325 {
5326  return (len > 2 && s[0] == '0' && (s[1] == 'x' || s[1] == 'X'));
5327 }
5328 
5329 namespace octave
5330 {
5331  void
5333  {
5334  double value = 0.0;
5335  int nread = 0;
5336 
5337  char *yytxt = flex_yytext ();
5338 
5339  // Strip any underscores
5340  char *tmptxt = strsave (yytxt);
5341  char *rptr = tmptxt;
5342  char *wptr = tmptxt;
5343  while (*rptr)
5344  {
5345  *wptr = *rptr++;
5346  wptr += (*wptr != '_');
5347  }
5348  *wptr = '\0';
5349 
5350  if (looks_like_hex (tmptxt, strlen (tmptxt)))
5351  {
5352  uintmax_t long_int_value;
5353 
5354  nread = sscanf (tmptxt, "%jx", &long_int_value);
5355 
5356  value = static_cast<double> (long_int_value);
5357  }
5358  else if (looks_like_bin (tmptxt, strlen (tmptxt)))
5359  {
5360  uintmax_t long_int_value = 0;
5361 
5362  for (size_t i = 0; i < strlen (tmptxt); i++)
5363  {
5364  if (tmptxt[i] == '0')
5365  long_int_value <<= 1;
5366  else if (tmptxt[i] == '1')
5367  {
5368  long_int_value <<= 1;
5369  long_int_value += 1;
5370  }
5371  }
5372 
5373  value = static_cast<double> (long_int_value);
5374 
5375  nread = 1; // Just to pass the assert stmt below
5376  }
5377  else
5378  {
5379  char *idx = strpbrk (tmptxt, "Dd");
5380 
5381  if (idx)
5382  *idx = 'e';
5383 
5384  nread = sscanf (tmptxt, "%lf", &value);
5385  }
5386 
5387  delete [] tmptxt;
5388 
5389  // If yytext doesn't contain a valid number, we are in deep doo doo.
5390 
5391  assert (nread == 1);
5392 
5393  looking_for_object_index = false;
5394  at_beginning_of_statement = false;
5395 
5396  push_token (new token (NUM, value, yytxt, input_line_number,
5398 
5400  }
5401 
5402  void
5404  {
5405  char *yytxt = flex_yytext ();
5406  int yylng = flex_yyleng ();
5407 
5408  int offset = 1;
5409  if (yytxt[0] == '\\')
5411  else
5412  offset = 3;
5413 
5414  bool have_space = false;
5415  while (offset < yylng)
5416  {
5417  char c = yytxt[offset];
5418  if (c == ' ' || c == '\t')
5419  {
5420  have_space = true;
5421  offset++;
5422  }
5423  else
5424  break;
5425  }
5426 
5427  if (have_space)
5429 
5430  bool have_comment = false;
5431  while (offset < yylng)
5432  {
5433  char c = yytxt[offset];
5434  if (c == '#' || c == '%')
5435  {
5436  have_comment = true;
5437  offset++;
5438  }
5439  else
5440  break;
5441  }
5442 
5443  if (have_comment)
5444  {
5445  comment_text = &yytxt[offset];
5446 
5447  // finish_comment sets at_beginning_of_statement to true but
5448  // that's not be correct if we are handling a continued
5449  // statement. Preserve the current state.
5450 
5451  bool saved_bos = at_beginning_of_statement;
5452 
5454 
5455  at_beginning_of_statement = saved_bos;
5456  }
5457 
5461  }
5463  void
5465  {
5466  bool copyright = looks_like_copyright (comment_text);
5467 
5468  if (nesting_level.none () && help_text.empty ()
5469  && ! comment_text.empty () && ! copyright)
5471 
5472  if (copyright)
5474 
5476 
5477  comment_text = "";
5478 
5480  }
5481 
5482  int
5483  base_lexer::handle_close_bracket (int bracket_type)
5484  {
5485  int retval = bracket_type;
5486 
5487  if (! nesting_level.none ())
5488  {
5489  nesting_level.remove ();
5490 
5491  if (bracket_type == ']')
5492  bracketflag--;
5493  else if (bracket_type == '}')
5495  else
5496  panic_impossible ();
5497  }
5498 
5499  pop_start_state ();
5500 
5501  return retval;
5502  }
5503 
5504  bool
5506  {
5507  bool space_before = space_follows_previous_token ();
5508  bool space_after = looking_at_space ();
5509 
5510  return (space_before && ! space_after
5512  }
5513 
5514  int
5516  {
5517  std::string meth = flex_yytext ();
5518 
5519  size_t pos = meth.find ("@");
5520  std::string cls = meth.substr (pos + 1);
5521  meth = meth.substr (0, pos);
5522 
5523  bool kw_token = (is_keyword_token (meth)
5525 
5526  if (kw_token)
5527  {
5528  token *tok
5529  = new token (LEXICAL_ERROR,
5530  "method, class, and package names may not be keywords",
5532 
5533  push_token (tok);
5534 
5536  }
5537 
5538  push_token (new token (SUPERCLASSREF, meth, cls,
5540 
5542 
5543  return SUPERCLASSREF;
5544  }
5545 
5546  int
5548  {
5549  std::string cls = std::string(flex_yytext ()).substr (1);
5550 
5552  {
5553  token *tok = new token (LEXICAL_ERROR,
5554  "class and package names may not be keywords",
5556  push_token (tok);
5557 
5559  }
5560 
5563 
5565 
5566  return METAQUERY;
5567  }
5568 
5569  int
5571  {
5572  std::string fq_id = flex_yytext ();
5573 
5574  if (fq_identifier_contains_keyword (fq_id))
5575  {
5576  token *tok
5577  = new token (LEXICAL_ERROR,
5578  "function, method, class, and package names may not be keywords",
5580 
5581  push_token (tok);
5582 
5584  }
5585 
5588 
5590 
5591  return FQ_IDENT;
5592  }
5593 
5594  // Figure out exactly what kind of token to return when we have seen
5595  // an identifier. Handles keywords. Return -1 if the identifier
5596  // should be ignored.
5597 
5598  int
5600  {
5601  std::string ident = flex_yytext ();
5602 
5603  // If we are expecting a structure element, avoid recognizing
5604  // keywords and other special names and return STRUCT_ELT, which is
5605  // a string that is also a valid identifier.
5606 
5608  {
5611 
5612  looking_for_object_index = true;
5613 
5615 
5616  return STRUCT_ELT;
5617  }
5618 
5619  // If ident is a keyword token, then is_keyword_token will set
5620  // at_beginning_of_statement. For example, if tok is an IF
5621  // token, then at_beginning_of_statement will be false.
5622 
5623  int kw_token = is_keyword_token (ident);
5624 
5626  {
5627  if (kw_token)
5628  {
5629  token *tok
5630  = new token (LEXICAL_ERROR,
5631  "function handles may not refer to keywords",
5633 
5634  push_token (tok);
5635 
5637  }
5638  else
5639  {
5642 
5644  looking_for_object_index = true;
5645 
5646  at_beginning_of_statement = false;
5647 
5648  return FCN_HANDLE;
5649  }
5650  }
5651 
5652  // If we have a regular keyword, return it.
5653  // Keywords can be followed by identifiers.
5654 
5655  if (kw_token)
5656  {
5657  if (kw_token >= 0)
5658  {
5660  looking_for_object_index = false;
5661  }
5662 
5663  // The call to is_keyword_token set at_beginning_of_statement.
5664 
5665  return kw_token;
5666  }
5667 
5668  // Find the token in the symbol table.
5669 
5671 
5672  token *tok = new token (NAME, &(symbol_table::insert (ident, sid)),
5674 
5675  // The following symbols are handled specially so that things like
5676  //
5677  // pi +1
5678  //
5679  // are parsed as an addition expression instead of as a command-style
5680  // function call with the argument "+1".
5681 
5683  && (! (is_variable (ident, sid)
5684  || ident == "e" || ident == "pi"
5685  || ident == "I" || ident == "i"
5686  || ident == "J" || ident == "j"
5687  || ident == "Inf" || ident == "inf"
5688  || ident == "NaN" || ident == "nan")))
5689  tok->mark_may_be_command ();
5690 
5691  push_token (tok);
5692 
5694 
5695  // The magic end index can't be indexed.
5696 
5697  if (ident != "end")
5698  looking_for_object_index = true;
5699 
5701 
5702  return NAME;
5703  }
5704 
5705  void
5707  {
5709 
5710  if (nm.empty ())
5711  warning_with_id ("Octave:separator-insert",
5712  "potential auto-insertion of '%c' near line %d",
5713  sep, input_line_number);
5714  else
5715  warning_with_id ("Octave:separator-insert",
5716  "potential auto-insertion of '%c' near line %d of file %s",
5717  sep, input_line_number, nm.c_str ());
5718  }
5719 
5720  void
5722  {
5724 
5725  if (nm.empty ())
5726  warning_with_id ("Octave:single-quote-string",
5727  "single quote delimited string near line %d",
5729  else
5730  warning_with_id ("Octave:single-quote-string",
5731  "single quote delimited string near line %d of file %s",
5732  input_line_number, nm.c_str ());
5733  }
5734 
5735  void
5737  {
5739 
5740  if (nm.empty ())
5741  warning_with_id ("Octave:language-extension",
5742  "Octave language extension used: %s",
5743  msg.c_str ());
5744  else
5745  warning_with_id ("Octave:language-extension",
5746  "Octave language extension used: %s near line %d offile %s",
5747  msg.c_str (), input_line_number, nm.c_str ());
5748  }
5749 
5750  void
5752  {
5753  if (c == '#')
5754  warn_language_extension ("# used as comment character");
5755  }
5756 
5757  void
5759  {
5760  warn_language_extension ("\\ used as line continuation marker");
5761  }
5762 
5763  void
5765  {
5766  std::string t = op;
5767  int n = t.length ();
5768  if (t[n-1] == '\n')
5769  t.resize (n-1);
5770  warn_language_extension (t + " used as operator");
5771  }
5772 
5773  void
5775  {
5776  YYSTYPE *lval = octave_get_lval (scanner);
5777  lval->tok_val = tok;
5778  tokens.push (tok);
5779  }
5780 
5781  token *
5783  {
5784  YYSTYPE *lval = octave_get_lval (scanner);
5785  return lval->tok_val;
5786  }
5787 
5788  void
5789  base_lexer::display_token (int tok)
5790  {
5791  switch (tok)
5792  {
5793  case '=': std::cerr << "'='\n"; break;
5794  case ':': std::cerr << "':'\n"; break;
5795  case '-': std::cerr << "'-'\n"; break;
5796  case '+': std::cerr << "'+'\n"; break;
5797  case '*': std::cerr << "'*'\n"; break;
5798  case '/': std::cerr << "'/'\n"; break;
5799  case ADD_EQ: std::cerr << "ADD_EQ\n"; break;
5800  case SUB_EQ: std::cerr << "SUB_EQ\n"; break;
5801  case MUL_EQ: std::cerr << "MUL_EQ\n"; break;
5802  case DIV_EQ: std::cerr << "DIV_EQ\n"; break;
5803  case LEFTDIV_EQ: std::cerr << "LEFTDIV_EQ\n"; break;
5804  case POW_EQ: std::cerr << "POW_EQ\n"; break;
5805  case EMUL_EQ: std::cerr << "EMUL_EQ\n"; break;
5806  case EDIV_EQ: std::cerr << "EDIV_EQ\n"; break;
5807  case ELEFTDIV_EQ: std::cerr << "ELEFTDIV_EQ\n"; break;
5808  case EPOW_EQ: std::cerr << "EPOW_EQ\n"; break;
5809  case AND_EQ: std::cerr << "AND_EQ\n"; break;
5810  case OR_EQ: std::cerr << "OR_EQ\n"; break;
5811  case EXPR_AND_AND: std::cerr << "EXPR_AND_AND\n"; break;
5812  case EXPR_OR_OR: std::cerr << "EXPR_OR_OR\n"; break;
5813  case EXPR_AND: std::cerr << "EXPR_AND\n"; break;
5814  case EXPR_OR: std::cerr << "EXPR_OR\n"; break;
5815  case EXPR_NOT: std::cerr << "EXPR_NOT\n"; break;
5816  case EXPR_LT: std::cerr << "EXPR_LT\n"; break;
5817  case EXPR_LE: std::cerr << "EXPR_LE\n"; break;
5818  case EXPR_EQ: std::cerr << "EXPR_EQ\n"; break;
5819  case EXPR_NE: std::cerr << "EXPR_NE\n"; break;
5820  case EXPR_GE: std::cerr << "EXPR_GE\n"; break;
5821  case EXPR_GT: std::cerr << "EXPR_GT\n"; break;
5822  case LEFTDIV: std::cerr << "LEFTDIV\n"; break;
5823  case EMUL: std::cerr << "EMUL\n"; break;
5824  case EDIV: std::cerr << "EDIV\n"; break;
5825  case ELEFTDIV: std::cerr << "ELEFTDIV\n"; break;
5826  case EPLUS: std::cerr << "EPLUS\n"; break;
5827  case EMINUS: std::cerr << "EMINUS\n"; break;
5828  case HERMITIAN: std::cerr << "HERMITIAN\n"; break;
5829  case TRANSPOSE: std::cerr << "TRANSPOSE\n"; break;
5830  case PLUS_PLUS: std::cerr << "PLUS_PLUS\n"; break;
5831  case MINUS_MINUS: std::cerr << "MINUS_MINUS\n"; break;
5832  case POW: std::cerr << "POW\n"; break;
5833  case EPOW: std::cerr << "EPOW\n"; break;
5834 
5835  case NUM:
5836  case IMAG_NUM:
5837  {
5838  token *tok_val = current_token ();
5839  std::cerr << (tok == NUM ? "NUM" : "IMAG_NUM")
5840  << " [" << tok_val->number () << "]\n";
5841  }
5842  break;
5843 
5844  case STRUCT_ELT:
5845  {
5846  token *tok_val = current_token ();
5847  std::cerr << "STRUCT_ELT [" << tok_val->text () << "]\n";
58