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