4
#define YY_INT_ALIGNED short int
6
/* A lexical scanner generated by flex */
9
#define YY_FLEX_MAJOR_VERSION 2
10
#define YY_FLEX_MINOR_VERSION 5
11
#define YY_FLEX_SUBMINOR_VERSION 33
12
#if YY_FLEX_SUBMINOR_VERSION > 0
16
/* First, we deal with platform-specific or compiler-specific issues. */
18
/* begin standard C headers. */
24
/* end standard C headers. */
26
/* flex integer type definitions */
31
/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
33
#if __STDC_VERSION__ >= 199901L
35
/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
36
* if you want the limit (max/min) macros for int types.
38
#ifndef __STDC_LIMIT_MACROS
39
#define __STDC_LIMIT_MACROS 1
43
typedef int8_t flex_int8_t;
44
typedef uint8_t flex_uint8_t;
45
typedef int16_t flex_int16_t;
46
typedef uint16_t flex_uint16_t;
47
typedef int32_t flex_int32_t;
48
typedef uint32_t flex_uint32_t;
50
typedef signed char flex_int8_t;
51
typedef short int flex_int16_t;
52
typedef int flex_int32_t;
53
typedef unsigned char flex_uint8_t;
54
typedef unsigned short int flex_uint16_t;
55
typedef unsigned int flex_uint32_t;
58
/* Limits of integral types. */
60
#define INT8_MIN (-128)
63
#define INT16_MIN (-32767-1)
66
#define INT32_MIN (-2147483647-1)
69
#define INT8_MAX (127)
72
#define INT16_MAX (32767)
75
#define INT32_MAX (2147483647)
78
#define UINT8_MAX (255U)
81
#define UINT16_MAX (65535U)
84
#define UINT32_MAX (4294967295U)
87
#endif /* ! FLEXINT_H */
91
/* The "const" storage-class-modifier is valid. */
94
#else /* ! __cplusplus */
100
#endif /* __STDC__ */
101
#endif /* ! __cplusplus */
104
#define yyconst const
109
/* Returned upon end-of-file. */
112
/* Promotes a possibly negative, possibly signed char to an unsigned
113
* integer for use as an array index. If the signed char is negative,
114
* we want to instead treat it as an 8-bit unsigned char, hence the
117
#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
119
/* Enter a start condition. This macro really ought to take a parameter,
120
* but we do it the disgusting crufty way forced on us by the ()-less
121
* definition of BEGIN.
123
#define BEGIN (yy_start) = 1 + 2 *
125
/* Translate the current start state into a value that can be later handed
126
* to BEGIN to return to the state. The YYSTATE alias is for lex
129
#define YY_START (((yy_start) - 1) / 2)
130
#define YYSTATE YY_START
132
/* Action number for EOF rule of a given start state. */
133
#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
135
/* Special action meaning "start processing a new file". */
136
#define YY_NEW_FILE octave_restart(octave_in )
138
#define YY_END_OF_BUFFER_CHAR 0
140
/* Size of default input buffer. */
142
#define YY_BUF_SIZE 16384
145
/* The state buf must be large enough to hold one state per character in the main buffer.
147
#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
149
#ifndef YY_TYPEDEF_YY_BUFFER_STATE
150
#define YY_TYPEDEF_YY_BUFFER_STATE
151
typedef struct yy_buffer_state *YY_BUFFER_STATE;
154
extern int octave_leng;
156
extern FILE *octave_in, *octave_out;
158
#define EOB_ACT_CONTINUE_SCAN 0
159
#define EOB_ACT_END_OF_FILE 1
160
#define EOB_ACT_LAST_MATCH 2
162
#define YY_LESS_LINENO(n)
164
/* Return all but the first "n" matched characters back to the input stream. */
168
/* Undo effects of setting up octave_text. */ \
169
int yyless_macro_arg = (n); \
170
YY_LESS_LINENO(yyless_macro_arg);\
171
*yy_cp = (yy_hold_char); \
172
YY_RESTORE_YY_MORE_OFFSET \
173
(yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
174
YY_DO_BEFORE_ACTION; /* set up octave_text again */ \
178
#define unput(c) yyunput( c, (yytext_ptr) )
180
/* The following is because we cannot portably get our hands on size_t
181
* (without autoconf's help, which isn't available because we want
182
* flex-generated scanners to compile on their own).
185
#ifndef YY_TYPEDEF_YY_SIZE_T
186
#define YY_TYPEDEF_YY_SIZE_T
187
typedef unsigned int yy_size_t;
190
#ifndef YY_STRUCT_YY_BUFFER_STATE
191
#define YY_STRUCT_YY_BUFFER_STATE
192
struct yy_buffer_state
196
char *yy_ch_buf; /* input buffer */
197
char *yy_buf_pos; /* current position in input buffer */
199
/* Size of input buffer in bytes, not including room for EOB
202
yy_size_t yy_buf_size;
204
/* Number of characters read into yy_ch_buf, not including EOB
209
/* Whether we "own" the buffer - i.e., we know we created it,
210
* and can realloc() it to grow it, and should free() it to
213
int yy_is_our_buffer;
215
/* Whether this is an "interactive" input source; if so, and
216
* if we're using stdio for input, then we want to use getc()
217
* instead of fread(), to make sure we stop fetching input after
220
int yy_is_interactive;
222
/* Whether we're considered to be at the beginning of a line.
223
* If so, '^' rules will be active on the next match, otherwise
228
int yy_bs_lineno; /**< The line count. */
229
int yy_bs_column; /**< The column count. */
231
/* Whether to try to fill the input buffer when we reach the
236
int yy_buffer_status;
238
#define YY_BUFFER_NEW 0
239
#define YY_BUFFER_NORMAL 1
240
/* When an EOF's been seen but there's still some text to process
241
* then we mark the buffer as YY_EOF_PENDING, to indicate that we
242
* shouldn't try reading from the input source any more. We might
243
* still have a bunch of tokens to match, though, because of
244
* possible backing-up.
246
* When we actually see the EOF, we change the status to "new"
247
* (via octave_restart()), so that the user can continue scanning by
248
* just pointing octave_in at a new input file.
250
#define YY_BUFFER_EOF_PENDING 2
253
#endif /* !YY_STRUCT_YY_BUFFER_STATE */
255
/* Stack of input buffers. */
256
static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */
257
static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */
258
static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */
260
/* We provide macros for accessing buffer states in case in the
261
* future we want to put the buffer states in a more general
264
* Returns the top of the stack, or NULL.
266
#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
267
? (yy_buffer_stack)[(yy_buffer_stack_top)] \
270
/* Same as previous macro, but useful when we know that the buffer stack is not
271
* NULL or when we need an lvalue. For internal use only.
273
#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
275
/* yy_hold_char holds the character lost when octave_text is formed. */
276
static char yy_hold_char;
277
static int yy_n_chars; /* number of characters read into yy_ch_buf */
280
/* Points to current character in buffer. */
281
static char *yy_c_buf_p = (char *) 0;
282
static int yy_init = 0; /* whether we need to initialize */
283
static int yy_start = 0; /* start state number */
285
/* Flag which is used to allow octave_wrap()'s to do buffer switches
286
* instead of setting up a fresh octave_in. A bit of a hack ...
288
static int yy_did_buffer_switch_on_eof;
290
void octave_restart (FILE *input_file );
291
void octave__switch_to_buffer (YY_BUFFER_STATE new_buffer );
292
YY_BUFFER_STATE octave__create_buffer (FILE *file,int size );
293
void octave__delete_buffer (YY_BUFFER_STATE b );
294
void octave__flush_buffer (YY_BUFFER_STATE b );
295
void octave_push_buffer_state (YY_BUFFER_STATE new_buffer );
296
void octave_pop_buffer_state (void );
298
static void octave_ensure_buffer_stack (void );
299
static void octave__load_buffer_state (void );
300
static void octave__init_buffer (YY_BUFFER_STATE b,FILE *file );
302
#define YY_FLUSH_BUFFER octave__flush_buffer(YY_CURRENT_BUFFER )
304
YY_BUFFER_STATE octave__scan_buffer (char *base,yy_size_t size );
305
YY_BUFFER_STATE octave__scan_string (yyconst char *yy_str );
306
YY_BUFFER_STATE octave__scan_bytes (yyconst char *bytes,int len );
308
void *octave_alloc (yy_size_t );
309
void *octave_realloc (void *,yy_size_t );
310
void octave_free (void * );
312
#define yy_new_buffer octave__create_buffer
314
#define yy_set_interactive(is_interactive) \
316
if ( ! YY_CURRENT_BUFFER ){ \
317
octave_ensure_buffer_stack (); \
318
YY_CURRENT_BUFFER_LVALUE = \
319
octave__create_buffer(octave_in,YY_BUF_SIZE ); \
321
YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
324
#define yy_set_bol(at_bol) \
326
if ( ! YY_CURRENT_BUFFER ){\
327
octave_ensure_buffer_stack (); \
328
YY_CURRENT_BUFFER_LVALUE = \
329
octave__create_buffer(octave_in,YY_BUF_SIZE ); \
331
YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
334
#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
336
/* Begin user sect3 */
338
typedef unsigned char YY_CHAR;
340
FILE *octave_in = (FILE *) 0, *octave_out = (FILE *) 0;
342
typedef int yy_state_type;
344
extern int octave_lineno;
346
int octave_lineno = 1;
348
extern char *octave_text;
349
#define yytext_ptr octave_text
351
static yy_state_type yy_get_previous_state (void );
352
static yy_state_type yy_try_NUL_trans (yy_state_type current_state );
353
static int yy_get_next_buffer (void );
354
static void yy_fatal_error (yyconst char msg[] );
356
/* Done after the current pattern has been matched and before the
357
* corresponding action - sets up octave_text.
359
#define YY_DO_BEFORE_ACTION \
360
(yytext_ptr) = yy_bp; \
361
octave_leng = (size_t) (yy_cp - yy_bp); \
362
(yy_hold_char) = *yy_cp; \
364
(yy_c_buf_p) = yy_cp;
366
#define YY_NUM_RULES 85
367
#define YY_END_OF_BUFFER 86
368
/* This struct is not used in this scanner,
369
but its presence is necessary. */
372
flex_int32_t yy_verify;
375
static yyconst flex_int16_t yy_accept[433] =
377
19, 19, 19, 19, 19, 19, 0, 0, 0, 0,
378
86, 84, 19, 24, 24, 62, 26, 27, 22, 44,
379
25, 63, 64, 50, 48, 54, 49, 65, 51, 18,
380
18, 28, 53, 46, 57, 47, 23, 14, 52, 15,
381
55, 82, 45, 83, 62, 6, 3, 3, 6, 5,
382
6, 6, 5, 6, 6, 6, 6, 4, 6, 6,
383
6, 6, 6, 6, 4, 6, 6, 6, 6, 6,
384
6, 6, 6, 6, 6, 6, 6, 10, 13, 13,
385
27, 9, 11, 7, 8, 1, 85, 2, 19, 24,
386
42, 22, 22, 58, 78, 56, 68, 37, 66, 38,
388
67, 36, 31, 29, 30, 0, 32, 18, 33, 34,
389
69, 18, 18, 0, 16, 0, 60, 39, 40, 43,
390
61, 14, 0, 20, 20, 0, 70, 76, 82, 79,
391
59, 41, 6, 6, 3, 6, 6, 6, 6, 6,
392
6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
393
6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
394
6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
395
6, 6, 6, 6, 6, 10, 13, 13, 0, 9,
396
11, 7, 8, 13, 13, 0, 13, 0, 12, 12,
397
9, 11, 11, 0, 7, 8, 35, 73, 71, 72,
399
0, 74, 0, 75, 77, 17, 18, 0, 18, 18,
400
80, 81, 0, 21, 21, 6, 6, 6, 6, 6,
401
6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
402
6, 6, 6, 13, 13, 0, 13, 13, 12, 12,
403
0, 12, 12, 12, 0, 11, 7, 8, 11, 0,
404
11, 11, 0, 18, 21, 6, 6, 13, 13, 13,
405
0, 11, 7, 8, 12, 0, 12, 12, 12, 12,
406
0, 12, 12, 11, 11, 11, 0, 7, 8, 11,
407
11, 11, 0, 13, 13, 11, 11, 11, 0, 7,
408
8, 12, 12, 12, 0, 11, 7, 8, 12, 12,
410
12, 0, 11, 7, 8, 11, 11, 0, 11, 11,
411
11, 0, 0, 11, 11, 11, 11, 11, 11, 0,
412
11, 11, 11, 0, 0, 11, 11, 12, 12, 11,
413
11, 11, 0, 7, 8, 12, 12, 11, 11, 11,
414
0, 7, 8, 11, 0, 11, 11, 11, 11, 0,
415
11, 11, 11, 11, 11, 0, 11, 7, 8, 11,
416
11, 11, 11, 11, 11, 0, 11, 7, 8, 11,
417
11, 11, 0, 11, 11, 11, 0, 11, 11, 11,
418
0, 11, 7, 8, 11, 11, 11, 0, 11, 7,
419
8, 11, 11, 11, 11, 11, 0, 7, 8, 11,
421
11, 11, 11, 11, 0, 7, 8, 11, 11, 11,
422
11, 11, 11, 11, 11, 11, 0, 7, 8, 11,
423
11, 11, 11, 11, 0, 7, 8, 11, 11, 11,
427
static yyconst flex_int32_t yy_ec[256] =
429
1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
430
1, 1, 4, 1, 1, 1, 1, 1, 1, 1,
431
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
432
1, 2, 5, 6, 7, 8, 7, 9, 10, 11,
433
12, 13, 14, 15, 16, 17, 18, 19, 20, 20,
434
20, 20, 20, 20, 20, 20, 20, 21, 22, 23,
435
24, 25, 1, 26, 27, 27, 27, 28, 28, 27,
436
8, 8, 29, 29, 8, 8, 8, 8, 8, 8,
437
8, 8, 8, 8, 8, 8, 8, 30, 8, 8,
438
31, 32, 33, 34, 8, 1, 27, 27, 27, 28,
440
28, 27, 8, 8, 29, 29, 8, 8, 8, 8,
441
8, 8, 8, 8, 8, 8, 8, 8, 8, 30,
442
8, 8, 35, 36, 37, 38, 1, 1, 1, 1,
443
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
444
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
445
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
446
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
447
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
448
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
449
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
451
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
452
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
453
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
454
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
455
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
459
static yyconst flex_int32_t yy_meta[39] =
461
1, 2, 3, 3, 1, 1, 1, 2, 1, 1,
462
1, 1, 1, 1, 3, 1, 1, 1, 2, 2,
463
1, 3, 1, 1, 1, 1, 2, 2, 2, 2,
464
1, 1, 1, 1, 1, 1, 1, 1
467
static yyconst flex_int16_t yy_base[448] =
469
0, 0, 38, 0, 75, 0, 816, 815, 814, 813,
470
815, 1982, 812, 1982, 810, 788, 1982, 1982, 809, 71,
471
1982, 1982, 1982, 68, 69, 1982, 70, 103, 786, 121,
472
81, 1982, 1982, 61, 784, 63, 1982, 805, 100, 1982,
473
782, 803, 75, 1982, 780, 801, 1982, 799, 94, 1982,
474
150, 123, 1982, 799, 798, 129, 112, 1982, 132, 179,
475
103, 212, 769, 796, 1982, 131, 104, 137, 795, 794,
476
161, 793, 142, 791, 158, 790, 143, 241, 277, 780,
477
126, 776, 169, 775, 770, 1982, 1982, 1982, 769, 1982,
478
1982, 761, 760, 1982, 1982, 733, 1982, 1982, 1982, 1982,
480
1982, 1982, 133, 732, 723, 725, 717, 155, 712, 711,
481
1982, 305, 187, 189, 1982, 198, 703, 1982, 1982, 1982,
482
702, 719, 184, 1982, 717, 197, 1982, 1982, 709, 1982,
483
1982, 1982, 704, 703, 1982, 698, 697, 0, 673, 637,
484
188, 601, 565, 529, 497, 495, 470, 222, 225, 226,
485
217, 228, 257, 231, 234, 451, 330, 401, 251, 423,
486
270, 236, 417, 410, 407, 237, 402, 289, 298, 397,
487
393, 379, 361, 359, 355, 0, 0, 341, 217, 340,
488
301, 336, 327, 0, 316, 219, 0, 265, 363, 399,
489
315, 324, 349, 279, 307, 273, 242, 1982, 1982, 1982,
491
369, 1982, 316, 1982, 1982, 1982, 326, 268, 287, 355,
492
1982, 1982, 291, 1982, 308, 249, 262, 260, 255, 384,
493
252, 378, 245, 235, 208, 388, 339, 391, 435, 200,
494
157, 411, 375, 0, 0, 318, 0, 463, 0, 140,
495
365, 499, 0, 535, 386, 420, 426, 436, 439, 413,
496
445, 454, 415, 431, 1982, 457, 469, 571, 0, 607,
497
441, 471, 477, 480, 0, 465, 0, 643, 0, 0,
498
483, 0, 679, 488, 715, 751, 490, 505, 508, 511,
499
520, 526, 501, 0, 0, 541, 787, 823, 513, 547,
500
550, 859, 0, 895, 516, 556, 562, 567, 931, 0,
502
967, 522, 577, 583, 586, 0, 112, 531, 1003, 0,
503
1039, 537, 543, 0, 1075, 592, 598, 0, 88, 552,
504
1111, 0, 1147, 558, 573, 0, 1183, 0, 0, 613,
505
0, 1219, 579, 619, 622, 0, 0, 628, 0, 1255,
506
588, 634, 639, 0, 594, 0, 1291, 0, 0, 603,
507
0, 1327, 1363, 0, 1399, 609, 649, 655, 658, 0,
508
0, 0, 1435, 0, 1471, 615, 664, 670, 675, 1507,
509
0, 1543, 624, 1579, 0, 1615, 630, 1651, 0, 1687,
510
645, 685, 691, 694, 1723, 0, 1759, 651, 700, 706,
511
711, 0, 0, 721, 0, 1795, 660, 727, 730, 0,
513
0, 736, 0, 1831, 666, 742, 747, 0, 0, 0,
514
0, 0, 0, 757, 0, 1867, 681, 763, 766, 0,
515
0, 772, 0, 1903, 687, 778, 783, 0, 0, 0,
516
0, 1982, 1940, 1943, 87, 1946, 1948, 1951, 1954, 1957,
517
1960, 1963, 1966, 1969, 1972, 1975, 1978
520
static yyconst flex_int16_t yy_def[448] =
522
432, 1, 432, 3, 1, 5, 433, 433, 434, 434,
523
432, 432, 432, 432, 432, 432, 432, 432, 435, 432,
524
432, 432, 432, 432, 432, 432, 432, 432, 432, 432,
525
432, 432, 432, 432, 432, 432, 432, 432, 432, 432,
526
432, 432, 432, 432, 432, 436, 432, 432, 436, 432,
527
436, 436, 432, 436, 436, 436, 436, 432, 436, 436,
528
436, 436, 62, 436, 432, 436, 436, 436, 436, 436,
529
436, 436, 436, 436, 436, 436, 436, 432, 432, 79,
530
437, 432, 432, 432, 432, 432, 432, 432, 432, 432,
531
432, 432, 435, 432, 432, 432, 432, 432, 432, 432,
533
432, 432, 432, 432, 432, 432, 432, 432, 432, 432,
534
432, 432, 432, 432, 432, 432, 432, 432, 432, 432,
535
432, 432, 432, 432, 432, 438, 432, 432, 432, 432,
536
432, 432, 436, 432, 432, 436, 432, 51, 436, 436,
537
436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
538
436, 436, 436, 436, 436, 436, 62, 62, 436, 436,
539
436, 436, 436, 436, 436, 436, 432, 432, 439, 436,
540
436, 432, 436, 436, 436, 78, 79, 79, 437, 432,
541
432, 432, 432, 79, 79, 440, 79, 437, 432, 437,
542
432, 432, 432, 441, 432, 432, 432, 432, 432, 432,
544
432, 432, 432, 432, 432, 432, 432, 432, 432, 432,
545
432, 432, 438, 432, 438, 436, 436, 436, 436, 436,
546
436, 436, 436, 436, 436, 62, 436, 436, 436, 436,
547
436, 439, 438, 79, 79, 440, 79, 440, 189, 189,
548
442, 437, 189, 437, 443, 437, 437, 437, 432, 441,
549
432, 441, 432, 432, 432, 436, 436, 440, 79, 440,
550
440, 440, 440, 440, 189, 442, 189, 442, 189, 189,
551
443, 189, 443, 437, 432, 437, 444, 437, 437, 441,
552
432, 441, 441, 79, 79, 440, 432, 440, 445, 440,
553
440, 442, 189, 442, 442, 442, 442, 442, 443, 189,
555
443, 443, 443, 443, 443, 275, 275, 446, 437, 275,
556
437, 447, 444, 275, 444, 432, 432, 287, 287, 445,
557
440, 287, 440, 445, 445, 287, 445, 189, 189, 442,
558
275, 442, 446, 442, 442, 189, 189, 443, 275, 443,
559
447, 443, 443, 275, 446, 275, 446, 275, 275, 447,
560
275, 447, 444, 275, 444, 447, 444, 444, 444, 287,
561
287, 287, 445, 287, 445, 445, 445, 445, 445, 442,
562
275, 442, 446, 443, 275, 443, 447, 446, 275, 446,
563
446, 446, 446, 446, 447, 275, 447, 447, 447, 447,
564
447, 275, 275, 444, 275, 444, 444, 444, 444, 287,
566
287, 445, 287, 445, 445, 445, 445, 275, 275, 275,
567
275, 275, 275, 446, 275, 446, 446, 446, 446, 275,
568
275, 447, 275, 447, 447, 447, 447, 275, 287, 275,
569
275, 0, 432, 432, 432, 432, 432, 432, 432, 432,
570
432, 432, 432, 432, 432, 432, 432
573
static yyconst flex_int16_t yy_nxt[2021] =
575
12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
576
22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
577
32, 33, 34, 35, 36, 37, 19, 19, 19, 19,
578
38, 39, 40, 41, 42, 43, 44, 45, 46, 13,
579
47, 48, 49, 50, 18, 51, 52, 53, 54, 55,
580
56, 57, 58, 59, 60, 61, 62, 63, 64, 65,
581
66, 67, 68, 69, 51, 51, 51, 51, 70, 71,
582
72, 73, 74, 75, 76, 77, 78, 79, 80, 94,
583
96, 81, 98, 117, 118, 100, 120, 121, 93, 82,
584
360, 97, 99, 101, 95, 134, 83, 112, 130, 113,
586
113, 123, 124, 125, 134, 134, 126, 84, 114, 115,
587
131, 85, 102, 134, 344, 103, 104, 136, 105, 106,
588
107, 108, 108, 127, 134, 143, 156, 164, 189, 190,
589
134, 139, 134, 134, 109, 144, 110, 112, 134, 113,
590
113, 141, 265, 134, 134, 197, 140, 145, 114, 115,
591
116, 137, 142, 162, 163, 146, 198, 138, 134, 134,
592
165, 166, 168, 124, 125, 171, 175, 169, 138, 138,
593
192, 192, 193, 108, 108, 194, 138, 138, 138, 138,
594
134, 173, 203, 115, 170, 123, 124, 125, 147, 134,
595
126, 148, 149, 174, 150, 151, 152, 153, 153, 214,
597
215, 134, 208, 112, 208, 113, 113, 209, 209, 134,
598
154, 171, 155, 134, 114, 115, 210, 210, 134, 189,
599
190, 237, 238, 134, 210, 210, 134, 134, 157, 134,
600
158, 158, 134, 220, 216, 134, 134, 134, 134, 159,
601
160, 161, 176, 177, 178, 217, 134, 179, 218, 219,
602
134, 221, 134, 134, 223, 180, 134, 224, 134, 230,
603
231, 134, 181, 134, 227, 205, 227, 189, 190, 228,
604
228, 134, 224, 182, 196, 153, 153, 183, 184, 184,
605
185, 251, 252, 186, 222, 160, 209, 209, 229, 229,
606
168, 124, 125, 214, 215, 126, 229, 229, 181, 233,
608
214, 215, 192, 192, 193, 209, 209, 194, 195, 182,
609
255, 215, 213, 183, 206, 115, 191, 206, 235, 213,
610
237, 238, 206, 207, 207, 192, 192, 193, 196, 253,
611
194, 253, 114, 115, 254, 254, 206, 195, 206, 225,
612
134, 191, 225, 234, 207, 207, 133, 225, 226, 226,
613
192, 249, 193, 114, 115, 194, 134, 228, 228, 133,
614
134, 225, 134, 225, 239, 239, 240, 267, 268, 241,
615
123, 124, 125, 210, 210, 126, 233, 214, 215, 134,
616
172, 210, 210, 115, 181, 168, 124, 125, 272, 273,
617
169, 256, 134, 256, 134, 182, 257, 257, 134, 183,
619
242, 243, 244, 167, 133, 245, 226, 226, 134, 228,
620
228, 134, 233, 214, 215, 251, 252, 133, 134, 160,
621
246, 274, 275, 276, 134, 213, 277, 278, 189, 190,
622
133, 247, 213, 254, 254, 248, 134, 279, 189, 190,
623
192, 192, 193, 237, 238, 194, 192, 192, 193, 254,
624
254, 194, 134, 229, 229, 280, 281, 282, 134, 115,
625
283, 229, 229, 160, 258, 259, 260, 267, 268, 261,
626
134, 134, 286, 287, 288, 257, 257, 289, 290, 237,
627
238, 291, 237, 238, 262, 272, 273, 257, 257, 274,
628
275, 276, 314, 315, 277, 263, 134, 160, 134, 264,
630
242, 269, 244, 251, 252, 245, 278, 189, 190, 279,
631
189, 190, 280, 316, 282, 326, 327, 283, 267, 268,
632
246, 192, 192, 193, 272, 273, 194, 280, 317, 282,
633
134, 247, 283, 346, 347, 248, 242, 270, 244, 351,
634
352, 245, 286, 287, 288, 314, 315, 289, 290, 237,
635
238, 291, 237, 238, 326, 327, 246, 330, 331, 332,
636
326, 327, 333, 334, 267, 268, 134, 247, 335, 267,
637
268, 248, 258, 284, 260, 326, 327, 261, 338, 339,
638
340, 346, 347, 341, 342, 272, 273, 343, 272, 273,
639
351, 352, 262, 192, 192, 193, 346, 347, 194, 192,
641
192, 193, 134, 263, 194, 351, 352, 264, 258, 285,
642
260, 351, 352, 261, 330, 331, 332, 326, 327, 333,
643
334, 267, 268, 335, 267, 268, 346, 347, 262, 338,
644
339, 340, 351, 352, 341, 342, 272, 273, 134, 263,
645
343, 272, 273, 264, 292, 293, 294, 346, 347, 295,
646
394, 395, 396, 351, 352, 397, 398, 314, 315, 399,
647
314, 315, 314, 315, 296, 402, 403, 404, 326, 327,
648
405, 406, 326, 327, 134, 297, 407, 326, 327, 298,
649
299, 300, 301, 346, 347, 302, 414, 415, 416, 351,
650
352, 417, 418, 346, 347, 419, 346, 347, 137, 134,
652
303, 422, 423, 424, 134, 134, 425, 426, 351, 352,
653
129, 304, 427, 351, 352, 305, 306, 306, 307, 124,
654
122, 308, 394, 395, 396, 212, 211, 397, 398, 314,
655
315, 399, 314, 315, 205, 204, 181, 402, 403, 404,
656
202, 201, 405, 406, 326, 327, 200, 182, 407, 326,
657
327, 183, 309, 310, 311, 199, 128, 312, 414, 415,
658
416, 92, 92, 417, 418, 346, 347, 419, 346, 347,
659
89, 196, 246, 422, 423, 424, 195, 191, 425, 426,
660
351, 352, 187, 247, 427, 351, 352, 248, 318, 318,
661
319, 134, 172, 320, 134, 167, 134, 134, 133, 134,
663
134, 135, 134, 132, 129, 128, 122, 119, 181, 111,
664
92, 91, 90, 89, 432, 87, 87, 87, 87, 182,
665
432, 432, 432, 183, 321, 322, 323, 432, 432, 324,
666
432, 432, 432, 432, 432, 432, 432, 432, 432, 432,
667
432, 432, 432, 432, 262, 432, 432, 432, 432, 432,
668
432, 432, 432, 432, 432, 263, 432, 432, 432, 264,
669
292, 328, 294, 432, 432, 295, 432, 432, 432, 432,
670
432, 432, 432, 432, 432, 432, 432, 432, 432, 432,
671
296, 432, 432, 432, 432, 432, 432, 432, 432, 432,
672
432, 297, 432, 432, 432, 298, 292, 329, 294, 432,
674
432, 295, 432, 432, 432, 432, 432, 432, 432, 432,
675
432, 432, 432, 432, 432, 432, 296, 432, 432, 432,
676
432, 432, 432, 432, 432, 432, 432, 297, 432, 432,
677
432, 298, 299, 336, 301, 432, 432, 302, 432, 432,
678
432, 432, 432, 432, 432, 432, 432, 432, 432, 432,
679
432, 432, 303, 432, 432, 432, 432, 432, 432, 432,
680
432, 432, 432, 304, 432, 432, 432, 305, 299, 337,
681
301, 432, 432, 302, 432, 432, 432, 432, 432, 432,
682
432, 432, 432, 432, 432, 432, 432, 432, 303, 432,
683
432, 432, 432, 432, 432, 432, 432, 432, 432, 304,
685
432, 432, 432, 305, 309, 348, 311, 432, 432, 312,
686
432, 432, 432, 432, 432, 432, 432, 432, 432, 432,
687
432, 432, 432, 432, 246, 432, 432, 432, 432, 432,
688
432, 432, 432, 432, 432, 247, 432, 432, 432, 248,
689
309, 349, 311, 432, 432, 312, 432, 432, 432, 432,
690
432, 432, 432, 432, 432, 432, 432, 432, 432, 432,
691
246, 432, 432, 432, 432, 432, 432, 432, 432, 432,
692
432, 247, 432, 432, 432, 248, 353, 354, 355, 432,
693
432, 356, 432, 432, 432, 432, 432, 432, 432, 432,
694
432, 432, 432, 432, 432, 432, 357, 432, 432, 432,
696
432, 432, 432, 432, 432, 432, 432, 358, 432, 432,
697
432, 359, 321, 361, 323, 432, 432, 324, 432, 432,
698
432, 432, 432, 432, 432, 432, 432, 432, 432, 432,
699
432, 432, 262, 432, 432, 432, 432, 432, 432, 432,
700
432, 432, 432, 263, 432, 432, 432, 264, 321, 362,
701
323, 432, 432, 324, 432, 432, 432, 432, 432, 432,
702
432, 432, 432, 432, 432, 432, 432, 432, 262, 432,
703
432, 432, 432, 432, 432, 432, 432, 432, 432, 263,
704
432, 432, 432, 264, 363, 364, 365, 432, 432, 366,
705
432, 432, 432, 432, 432, 432, 432, 432, 432, 432,
707
432, 432, 432, 432, 367, 432, 432, 432, 432, 432,
708
432, 432, 432, 432, 432, 368, 432, 432, 432, 369,
709
370, 371, 372, 432, 432, 373, 432, 432, 432, 432,
710
432, 432, 432, 432, 432, 432, 432, 432, 432, 432,
711
296, 432, 432, 432, 432, 432, 432, 432, 432, 432,
712
432, 297, 432, 432, 432, 298, 374, 375, 376, 432,
713
432, 377, 432, 432, 432, 432, 432, 432, 432, 432,
714
432, 432, 432, 432, 432, 432, 303, 432, 432, 432,
715
432, 432, 432, 432, 432, 432, 432, 304, 432, 432,
716
432, 305, 378, 379, 380, 432, 432, 381, 432, 432,
718
432, 432, 432, 432, 432, 432, 432, 432, 432, 432,
719
432, 432, 382, 432, 432, 432, 432, 432, 432, 432,
720
432, 432, 432, 383, 432, 432, 432, 384, 385, 386,
721
387, 432, 432, 388, 432, 432, 432, 432, 432, 432,
722
432, 432, 432, 432, 432, 432, 432, 432, 389, 432,
723
432, 432, 432, 432, 432, 432, 432, 432, 432, 390,
724
432, 432, 432, 391, 353, 392, 355, 432, 432, 356,
725
432, 432, 432, 432, 432, 432, 432, 432, 432, 432,
726
432, 432, 432, 432, 357, 432, 432, 432, 432, 432,
727
432, 432, 432, 432, 432, 358, 432, 432, 432, 359,
729
353, 393, 355, 432, 432, 356, 432, 432, 432, 432,
730
432, 432, 432, 432, 432, 432, 432, 432, 432, 432,
731
357, 432, 432, 432, 432, 432, 432, 432, 432, 432,
732
432, 358, 432, 432, 432, 359, 363, 400, 365, 432,
733
432, 366, 432, 432, 432, 432, 432, 432, 432, 432,
734
432, 432, 432, 432, 432, 432, 367, 432, 432, 432,
735
432, 432, 432, 432, 432, 432, 432, 368, 432, 432,
736
432, 369, 363, 401, 365, 432, 432, 366, 432, 432,
737
432, 432, 432, 432, 432, 432, 432, 432, 432, 432,
738
432, 432, 367, 432, 432, 432, 432, 432, 432, 432,
740
432, 432, 432, 368, 432, 432, 432, 369, 370, 408,
741
372, 432, 432, 373, 432, 432, 432, 432, 432, 432,
742
432, 432, 432, 432, 432, 432, 432, 432, 296, 432,
743
432, 432, 432, 432, 432, 432, 432, 432, 432, 297,
744
432, 432, 432, 298, 370, 409, 372, 432, 432, 373,
745
432, 432, 432, 432, 432, 432, 432, 432, 432, 432,
746
432, 432, 432, 432, 296, 432, 432, 432, 432, 432,
747
432, 432, 432, 432, 432, 297, 432, 432, 432, 298,
748
374, 410, 376, 432, 432, 377, 432, 432, 432, 432,
749
432, 432, 432, 432, 432, 432, 432, 432, 432, 432,
751
303, 432, 432, 432, 432, 432, 432, 432, 432, 432,
752
432, 304, 432, 432, 432, 305, 374, 411, 376, 432,
753
432, 377, 432, 432, 432, 432, 432, 432, 432, 432,
754
432, 432, 432, 432, 432, 432, 303, 432, 432, 432,
755
432, 432, 432, 432, 432, 432, 432, 304, 432, 432,
756
432, 305, 378, 412, 380, 432, 432, 381, 432, 432,
757
432, 432, 432, 432, 432, 432, 432, 432, 432, 432,
758
432, 432, 382, 432, 432, 432, 432, 432, 432, 432,
759
432, 432, 432, 383, 432, 432, 432, 384, 378, 413,
760
380, 432, 432, 381, 432, 432, 432, 432, 432, 432,
762
432, 432, 432, 432, 432, 432, 432, 432, 382, 432,
763
432, 432, 432, 432, 432, 432, 432, 432, 432, 383,
764
432, 432, 432, 384, 385, 420, 387, 432, 432, 388,
765
432, 432, 432, 432, 432, 432, 432, 432, 432, 432,
766
432, 432, 432, 432, 389, 432, 432, 432, 432, 432,
767
432, 432, 432, 432, 432, 390, 432, 432, 432, 391,
768
385, 421, 387, 432, 432, 388, 432, 432, 432, 432,
769
432, 432, 432, 432, 432, 432, 432, 432, 432, 432,
770
389, 432, 432, 432, 432, 432, 432, 432, 432, 432,
771
432, 390, 432, 432, 432, 391, 353, 428, 355, 432,
773
432, 356, 432, 432, 432, 432, 432, 432, 432, 432,
774
432, 432, 432, 432, 432, 432, 357, 432, 432, 432,
775
432, 432, 432, 432, 432, 432, 432, 358, 432, 432,
776
432, 359, 363, 429, 365, 432, 432, 366, 432, 432,
777
432, 432, 432, 432, 432, 432, 432, 432, 432, 432,
778
432, 432, 367, 432, 432, 432, 432, 432, 432, 432,
779
432, 432, 432, 368, 432, 432, 432, 369, 378, 430,
780
380, 432, 432, 381, 432, 432, 432, 432, 432, 432,
781
432, 432, 432, 432, 432, 432, 432, 432, 382, 432,
782
432, 432, 432, 432, 432, 432, 432, 432, 432, 383,
784
432, 432, 432, 384, 385, 431, 387, 432, 432, 388,
785
432, 432, 432, 432, 432, 432, 432, 432, 432, 432,
786
432, 432, 432, 432, 389, 432, 432, 432, 432, 432,
787
432, 432, 432, 432, 432, 390, 432, 432, 432, 391,
788
86, 86, 86, 88, 88, 88, 133, 133, 188, 188,
789
188, 213, 213, 213, 232, 232, 232, 236, 236, 236,
790
250, 250, 250, 266, 266, 266, 271, 271, 271, 313,
791
313, 313, 325, 325, 325, 345, 345, 345, 350, 350,
792
350, 11, 432, 432, 432, 432, 432, 432, 432, 432,
793
432, 432, 432, 432, 432, 432, 432, 432, 432, 432,
795
432, 432, 432, 432, 432, 432, 432, 432, 432, 432,
796
432, 432, 432, 432, 432, 432, 432, 432, 432, 432
799
static yyconst flex_int16_t yy_chk[2021] =
801
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
802
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
803
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
804
1, 1, 1, 1, 1, 1, 1, 1, 3, 3,
805
3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
806
3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
807
3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
808
3, 3, 3, 3, 3, 3, 5, 5, 5, 20,
809
24, 5, 25, 34, 34, 27, 36, 36, 435, 5,
810
319, 24, 25, 27, 20, 49, 5, 31, 43, 31,
812
31, 39, 39, 39, 61, 67, 39, 5, 31, 31,
813
43, 5, 28, 57, 307, 28, 28, 49, 28, 28,
814
28, 28, 28, 39, 52, 57, 61, 67, 81, 81,
815
56, 52, 66, 59, 28, 57, 28, 30, 68, 30,
816
30, 56, 240, 73, 77, 103, 52, 59, 30, 30,
817
30, 51, 56, 66, 66, 59, 103, 51, 231, 75,
818
68, 68, 71, 71, 71, 73, 77, 71, 51, 51,
819
83, 83, 83, 108, 108, 83, 51, 51, 51, 51,
820
60, 75, 108, 108, 71, 123, 123, 123, 60, 141,
821
123, 60, 60, 75, 60, 60, 60, 60, 60, 126,
823
126, 230, 114, 113, 114, 113, 113, 114, 114, 225,
824
60, 141, 60, 62, 113, 113, 116, 116, 151, 179,
825
179, 186, 186, 148, 116, 116, 149, 150, 62, 152,
826
62, 62, 154, 151, 148, 155, 224, 162, 166, 62,
827
62, 62, 78, 78, 78, 148, 223, 78, 149, 150,
828
216, 152, 159, 221, 154, 78, 219, 155, 153, 162,
829
166, 218, 78, 217, 159, 197, 159, 188, 188, 159,
830
159, 161, 216, 78, 196, 153, 153, 78, 79, 79,
831
79, 194, 194, 79, 153, 153, 208, 208, 161, 161,
832
168, 168, 168, 213, 213, 168, 161, 161, 79, 169,
834
169, 169, 181, 181, 181, 209, 209, 181, 195, 79,
835
215, 215, 169, 79, 112, 209, 191, 112, 185, 169,
836
236, 236, 112, 112, 112, 192, 192, 192, 183, 203,
837
192, 203, 112, 112, 203, 203, 112, 182, 112, 157,
838
227, 180, 157, 178, 207, 207, 157, 157, 157, 157,
839
193, 193, 193, 207, 207, 193, 175, 227, 227, 157,
840
174, 157, 173, 157, 189, 189, 189, 241, 241, 189,
841
201, 201, 201, 210, 210, 201, 233, 233, 233, 222,
842
172, 210, 210, 210, 189, 220, 220, 220, 245, 245,
843
220, 222, 228, 222, 171, 189, 222, 222, 170, 189,
845
190, 190, 190, 167, 226, 190, 226, 226, 165, 228,
846
228, 164, 232, 232, 232, 250, 250, 226, 163, 228,
847
190, 246, 246, 246, 160, 232, 246, 247, 247, 247,
848
158, 190, 232, 253, 253, 190, 229, 248, 248, 248,
849
249, 249, 249, 261, 261, 249, 251, 251, 251, 254,
850
254, 251, 156, 229, 229, 252, 252, 252, 256, 254,
851
252, 229, 229, 229, 238, 238, 238, 266, 266, 238,
852
257, 147, 262, 262, 262, 256, 256, 262, 263, 263,
853
263, 264, 264, 264, 238, 271, 271, 257, 257, 274,
854
274, 274, 277, 277, 274, 238, 146, 257, 145, 238,
856
242, 242, 242, 283, 283, 242, 278, 278, 278, 279,
857
279, 279, 280, 280, 280, 289, 289, 280, 295, 295,
858
242, 281, 281, 281, 302, 302, 281, 282, 282, 282,
859
144, 242, 282, 308, 308, 242, 244, 244, 244, 312,
860
312, 244, 286, 286, 286, 313, 313, 286, 290, 290,
861
290, 291, 291, 291, 320, 320, 244, 296, 296, 296,
862
324, 324, 296, 297, 297, 297, 143, 244, 298, 298,
863
298, 244, 258, 258, 258, 325, 325, 258, 303, 303,
864
303, 333, 333, 303, 304, 304, 304, 305, 305, 305,
865
341, 341, 258, 316, 316, 316, 345, 345, 316, 317,
867
317, 317, 142, 258, 317, 350, 350, 258, 260, 260,
868
260, 356, 356, 260, 330, 330, 330, 366, 366, 330,
869
334, 334, 334, 335, 335, 335, 373, 373, 260, 338,
870
338, 338, 377, 377, 338, 342, 342, 342, 140, 260,
871
343, 343, 343, 260, 268, 268, 268, 381, 381, 268,
872
357, 357, 357, 388, 388, 357, 358, 358, 358, 359,
873
359, 359, 397, 397, 268, 367, 367, 367, 405, 405,
874
367, 368, 368, 368, 139, 268, 369, 369, 369, 268,
875
273, 273, 273, 417, 417, 273, 382, 382, 382, 425,
876
425, 382, 383, 383, 383, 384, 384, 384, 137, 136,
878
273, 389, 389, 389, 134, 133, 389, 390, 390, 390,
879
129, 273, 391, 391, 391, 273, 275, 275, 275, 125,
880
122, 275, 394, 394, 394, 121, 117, 394, 398, 398,
881
398, 399, 399, 399, 110, 109, 275, 402, 402, 402,
882
107, 106, 402, 406, 406, 406, 105, 275, 407, 407,
883
407, 275, 276, 276, 276, 104, 96, 276, 414, 414,
884
414, 93, 92, 414, 418, 418, 418, 419, 419, 419,
885
89, 85, 276, 422, 422, 422, 84, 82, 422, 426,
886
426, 426, 80, 276, 427, 427, 427, 276, 287, 287,
887
287, 76, 74, 287, 72, 70, 69, 64, 63, 55,
889
54, 48, 46, 45, 42, 41, 38, 35, 287, 29,
890
19, 16, 15, 13, 11, 10, 9, 8, 7, 287,
891
0, 0, 0, 287, 288, 288, 288, 0, 0, 288,
892
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
893
0, 0, 0, 0, 288, 0, 0, 0, 0, 0,
894
0, 0, 0, 0, 0, 288, 0, 0, 0, 288,
895
292, 292, 292, 0, 0, 292, 0, 0, 0, 0,
896
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
897
292, 0, 0, 0, 0, 0, 0, 0, 0, 0,
898
0, 292, 0, 0, 0, 292, 294, 294, 294, 0,
900
0, 294, 0, 0, 0, 0, 0, 0, 0, 0,
901
0, 0, 0, 0, 0, 0, 294, 0, 0, 0,
902
0, 0, 0, 0, 0, 0, 0, 294, 0, 0,
903
0, 294, 299, 299, 299, 0, 0, 299, 0, 0,
904
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
905
0, 0, 299, 0, 0, 0, 0, 0, 0, 0,
906
0, 0, 0, 299, 0, 0, 0, 299, 301, 301,
907
301, 0, 0, 301, 0, 0, 0, 0, 0, 0,
908
0, 0, 0, 0, 0, 0, 0, 0, 301, 0,
909
0, 0, 0, 0, 0, 0, 0, 0, 0, 301,
911
0, 0, 0, 301, 309, 309, 309, 0, 0, 309,
912
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
913
0, 0, 0, 0, 309, 0, 0, 0, 0, 0,
914
0, 0, 0, 0, 0, 309, 0, 0, 0, 309,
915
311, 311, 311, 0, 0, 311, 0, 0, 0, 0,
916
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
917
311, 0, 0, 0, 0, 0, 0, 0, 0, 0,
918
0, 311, 0, 0, 0, 311, 315, 315, 315, 0,
919
0, 315, 0, 0, 0, 0, 0, 0, 0, 0,
920
0, 0, 0, 0, 0, 0, 315, 0, 0, 0,
922
0, 0, 0, 0, 0, 0, 0, 315, 0, 0,
923
0, 315, 321, 321, 321, 0, 0, 321, 0, 0,
924
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
925
0, 0, 321, 0, 0, 0, 0, 0, 0, 0,
926
0, 0, 0, 321, 0, 0, 0, 321, 323, 323,
927
323, 0, 0, 323, 0, 0, 0, 0, 0, 0,
928
0, 0, 0, 0, 0, 0, 0, 0, 323, 0,
929
0, 0, 0, 0, 0, 0, 0, 0, 0, 323,
930
0, 0, 0, 323, 327, 327, 327, 0, 0, 327,
931
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
933
0, 0, 0, 0, 327, 0, 0, 0, 0, 0,
934
0, 0, 0, 0, 0, 327, 0, 0, 0, 327,
935
332, 332, 332, 0, 0, 332, 0, 0, 0, 0,
936
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
937
332, 0, 0, 0, 0, 0, 0, 0, 0, 0,
938
0, 332, 0, 0, 0, 332, 340, 340, 340, 0,
939
0, 340, 0, 0, 0, 0, 0, 0, 0, 0,
940
0, 0, 0, 0, 0, 0, 340, 0, 0, 0,
941
0, 0, 0, 0, 0, 0, 0, 340, 0, 0,
942
0, 340, 347, 347, 347, 0, 0, 347, 0, 0,
944
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
945
0, 0, 347, 0, 0, 0, 0, 0, 0, 0,
946
0, 0, 0, 347, 0, 0, 0, 347, 352, 352,
947
352, 0, 0, 352, 0, 0, 0, 0, 0, 0,
948
0, 0, 0, 0, 0, 0, 0, 0, 352, 0,
949
0, 0, 0, 0, 0, 0, 0, 0, 0, 352,
950
0, 0, 0, 352, 353, 353, 353, 0, 0, 353,
951
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
952
0, 0, 0, 0, 353, 0, 0, 0, 0, 0,
953
0, 0, 0, 0, 0, 353, 0, 0, 0, 353,
955
355, 355, 355, 0, 0, 355, 0, 0, 0, 0,
956
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
957
355, 0, 0, 0, 0, 0, 0, 0, 0, 0,
958
0, 355, 0, 0, 0, 355, 363, 363, 363, 0,
959
0, 363, 0, 0, 0, 0, 0, 0, 0, 0,
960
0, 0, 0, 0, 0, 0, 363, 0, 0, 0,
961
0, 0, 0, 0, 0, 0, 0, 363, 0, 0,
962
0, 363, 365, 365, 365, 0, 0, 365, 0, 0,
963
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
964
0, 0, 365, 0, 0, 0, 0, 0, 0, 0,
966
0, 0, 0, 365, 0, 0, 0, 365, 370, 370,
967
370, 0, 0, 370, 0, 0, 0, 0, 0, 0,
968
0, 0, 0, 0, 0, 0, 0, 0, 370, 0,
969
0, 0, 0, 0, 0, 0, 0, 0, 0, 370,
970
0, 0, 0, 370, 372, 372, 372, 0, 0, 372,
971
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
972
0, 0, 0, 0, 372, 0, 0, 0, 0, 0,
973
0, 0, 0, 0, 0, 372, 0, 0, 0, 372,
974
374, 374, 374, 0, 0, 374, 0, 0, 0, 0,
975
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
977
374, 0, 0, 0, 0, 0, 0, 0, 0, 0,
978
0, 374, 0, 0, 0, 374, 376, 376, 376, 0,
979
0, 376, 0, 0, 0, 0, 0, 0, 0, 0,
980
0, 0, 0, 0, 0, 0, 376, 0, 0, 0,
981
0, 0, 0, 0, 0, 0, 0, 376, 0, 0,
982
0, 376, 378, 378, 378, 0, 0, 378, 0, 0,
983
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
984
0, 0, 378, 0, 0, 0, 0, 0, 0, 0,
985
0, 0, 0, 378, 0, 0, 0, 378, 380, 380,
986
380, 0, 0, 380, 0, 0, 0, 0, 0, 0,
988
0, 0, 0, 0, 0, 0, 0, 0, 380, 0,
989
0, 0, 0, 0, 0, 0, 0, 0, 0, 380,
990
0, 0, 0, 380, 385, 385, 385, 0, 0, 385,
991
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
992
0, 0, 0, 0, 385, 0, 0, 0, 0, 0,
993
0, 0, 0, 0, 0, 385, 0, 0, 0, 385,
994
387, 387, 387, 0, 0, 387, 0, 0, 0, 0,
995
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
996
387, 0, 0, 0, 0, 0, 0, 0, 0, 0,
997
0, 387, 0, 0, 0, 387, 396, 396, 396, 0,
999
0, 396, 0, 0, 0, 0, 0, 0, 0, 0,
1000
0, 0, 0, 0, 0, 0, 396, 0, 0, 0,
1001
0, 0, 0, 0, 0, 0, 0, 396, 0, 0,
1002
0, 396, 404, 404, 404, 0, 0, 404, 0, 0,
1003
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1004
0, 0, 404, 0, 0, 0, 0, 0, 0, 0,
1005
0, 0, 0, 404, 0, 0, 0, 404, 416, 416,
1006
416, 0, 0, 416, 0, 0, 0, 0, 0, 0,
1007
0, 0, 0, 0, 0, 0, 0, 0, 416, 0,
1008
0, 0, 0, 0, 0, 0, 0, 0, 0, 416,
1010
0, 0, 0, 416, 424, 424, 424, 0, 0, 424,
1011
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1012
0, 0, 0, 0, 424, 0, 0, 0, 0, 0,
1013
0, 0, 0, 0, 0, 424, 0, 0, 0, 424,
1014
433, 433, 433, 434, 434, 434, 436, 436, 437, 437,
1015
437, 438, 438, 438, 439, 439, 439, 440, 440, 440,
1016
441, 441, 441, 442, 442, 442, 443, 443, 443, 444,
1017
444, 444, 445, 445, 445, 446, 446, 446, 447, 447,
1018
447, 432, 432, 432, 432, 432, 432, 432, 432, 432,
1019
432, 432, 432, 432, 432, 432, 432, 432, 432, 432,
1021
432, 432, 432, 432, 432, 432, 432, 432, 432, 432,
1022
432, 432, 432, 432, 432, 432, 432, 432, 432, 432
1025
static yy_state_type yy_last_accepting_state;
1026
static char *yy_last_accepting_cpos;
1028
extern int octave__flex_debug;
1029
int octave__flex_debug = 0;
1031
/* The intent behind this definition is that it'll catch
1032
* any uses of REJECT which flex missed.
1034
#define REJECT reject_used_but_not_detected
1035
#define yymore() yymore_used_but_not_detected
1036
#define YY_MORE_ADJ 0
1037
#define YY_RESTORE_YY_MORE_OFFSET
1042
Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
1043
2002, 2003, 2004, 2005, 2006, 2007 John W. Eaton
1045
This file is part of Octave.
1047
Octave is free software; you can redistribute it and/or modify it
1048
under the terms of the GNU General Public License as published by the
1049
Free Software Foundation; either version 3 of the License, or (at your
1050
option) any later version.
1052
Octave is distributed in the hope that it will be useful, but WITHOUT
1053
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1054
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
1057
You should have received a copy of the GNU General Public License
1058
along with Octave; see the file COPYING. If not, see
1059
<http://www.gnu.org/licenses/>.
1067
#ifdef HAVE_CONFIG_H
1078
#ifdef HAVE_UNISTD_H
1079
#ifdef HAVE_SYS_TYPES_H
1080
#include <sys/types.h>
1085
#include "cmd-edit.h"
1087
#include "lo-mappers.h"
1089
// These would be alphabetical, but y.tab.h must be included before
1090
// oct-gperf.h and y.tab.h must be included after token.h and the tree
1091
// class declarations. We can't include y.tab.h in oct-gperf.h
1092
// because it may not be protected to allow it to be included multiple
1096
#include "comment-list.h"
1109
#include "variables.h"
1111
#include <oct-gperf.h>
1113
#if ! (defined (FLEX_SCANNER) \
1114
&& defined (YY_FLEX_MAJOR_VERSION) && YY_FLEX_MAJOR_VERSION >= 2 \
1115
&& defined (YY_FLEX_MINOR_VERSION) && YY_FLEX_MINOR_VERSION >= 5)
1116
#error lex.l requires flex version 2.5.4 or later
1119
#define yylval octave_lval
1121
// Arrange to get input via readline.
1126
#define YY_INPUT(buf, result, max_size) \
1127
if ((result = octave_read (buf, max_size)) < 0) \
1128
YY_FATAL_ERROR ("octave_read () in flex scanner failed");
1130
// Try to avoid crashing out completely on fatal scanner errors.
1131
// The call to yy_fatal_error should never happen, but it avoids a
1132
// `static function defined but not used' warning from gcc.
1134
#ifdef YY_FATAL_ERROR
1135
#undef YY_FATAL_ERROR
1137
#define YY_FATAL_ERROR(msg) \
1142
yy_fatal_error (msg); \
1146
#define COUNT_TOK_AND_RETURN(tok) \
1154
#define TOK_RETURN(tok) \
1157
current_input_column += octave_leng; \
1158
lexer_flags.quote_is_transpose = false; \
1159
lexer_flags.convert_spaces_to_comma = true; \
1160
COUNT_TOK_AND_RETURN (tok); \
1164
#define TOK_PUSH_AND_RETURN(name, tok) \
1167
yylval.tok_val = new token (name, input_line_number, \
1168
current_input_column); \
1169
token_stack.push (yylval.tok_val); \
1174
#define BIN_OP_RETURN(tok, convert) \
1177
yylval.tok_val = new token (input_line_number, current_input_column); \
1178
token_stack.push (yylval.tok_val); \
1179
current_input_column += octave_leng; \
1180
lexer_flags.quote_is_transpose = false; \
1181
lexer_flags.convert_spaces_to_comma = convert; \
1182
COUNT_TOK_AND_RETURN (tok); \
1186
#define XBIN_OP_RETURN(tok, convert) \
1189
gripe_matlab_incompatible_operator (octave_text); \
1190
BIN_OP_RETURN (tok, convert); \
1194
// TRUE means that we have encountered EOF on the input stream.
1195
bool parser_end_of_input = false;
1197
// Flags that need to be shared between the lexer and parser.
1198
lexical_feedback lexer_flags;
1200
// Stack to hold tokens so that we can delete them when the parser is
1201
// reset and avoid growing forever just because we are stashing some
1202
// information. This has to appear before lex.h is included, because
1203
// one of the macros defined there uses token_stack.
1205
// FIXME -- this should really be static, but that causes
1206
// problems on some systems.
1207
std::stack <token*> token_stack;
1209
// Did eat_whitespace() eat a space or tab, or a newline, or both?
1211
typedef int yum_yum;
1213
const yum_yum ATE_NOTHING = 0;
1214
const yum_yum ATE_SPACE_OR_TAB = 1;
1215
const yum_yum ATE_NEWLINE = 2;
1217
// Is the closest nesting level a square bracket, squiggly brace or a paren?
1219
class bracket_brace_paren_nesting_level
1223
bracket_brace_paren_nesting_level (void) : context () { }
1225
~bracket_brace_paren_nesting_level (void) { }
1227
void bracket (void) { context.push (BRACKET); }
1228
bool is_bracket (void)
1229
{ return ! context.empty () && context.top () == BRACKET; }
1231
void brace (void) { context.push (BRACE); }
1232
bool is_brace (void)
1233
{ return ! context.empty () && context.top () == BRACE; }
1235
void paren (void) { context.push (PAREN); }
1236
bool is_paren (void)
1237
{ return ! context.empty () && context.top () == PAREN; }
1239
bool is_bracket_or_brace (void)
1240
{ return (! context.empty ()
1241
&& (context.top () == BRACKET || context.top () == BRACE)); }
1243
bool none (void) { return context.empty (); }
1245
void remove (void) { if (! context.empty ()) context.pop (); }
1247
void clear (void) { while (! context.empty ()) context.pop (); }
1251
std::stack<int> context;
1253
static const int BRACKET;
1254
static const int BRACE;
1255
static const int PAREN;
1257
bracket_brace_paren_nesting_level (const bracket_brace_paren_nesting_level&);
1259
bracket_brace_paren_nesting_level&
1260
operator = (const bracket_brace_paren_nesting_level&);
1263
const int bracket_brace_paren_nesting_level::BRACKET = 1;
1264
const int bracket_brace_paren_nesting_level::BRACE = 2;
1265
const int bracket_brace_paren_nesting_level::PAREN = 3;
1267
static bracket_brace_paren_nesting_level nesting_level;
1269
static unsigned int Vtoken_count = 0;
1271
// Forward declarations for functions defined at the bottom of this
1274
static void fixup_column_count (char *s);
1275
static void do_comma_insert_check (void);
1276
static int is_keyword_token (const std::string& s);
1277
static void prep_for_function (void);
1278
static void prep_for_nested_function (void);
1279
static symbol_record *lookup_identifier (const std::string& s);
1280
static std::string grab_help_text (void);
1281
static bool match_any (char c, const char *s);
1282
static bool next_token_is_sep_op (void);
1283
static bool next_token_is_bin_op (bool spc_prev);
1284
static bool next_token_is_postfix_unary_op (bool spc_prev);
1285
static std::string strip_trailing_whitespace (char *s);
1286
static void handle_number (void);
1287
static int handle_string (char delim, int text_style = 0);
1288
static int handle_close_bracket (bool spc_gobbled, int bracket_type);
1289
static int handle_identifier (void);
1290
static bool have_continuation (bool trailing_comments_ok = true);
1291
static bool have_ellipsis_continuation (bool trailing_comments_ok = true);
1292
static void scan_for_comments (const char *);
1293
static yum_yum eat_whitespace (void);
1294
static yum_yum eat_continuation (void);
1295
static void maybe_warn_separator_insert (char sep);
1296
static void gripe_single_quote_string (void);
1297
static void gripe_matlab_incompatible (const std::string& msg);
1298
static void maybe_gripe_matlab_incompatible_comment (char c);
1299
static void gripe_matlab_incompatible_continuation (void);
1300
static void gripe_matlab_incompatible_operator (const std::string& op);
1302
#line 1303 "<stdout>"
1305
#define COMMAND_START 1
1306
#define MATRIX_START 2
1307
#define NESTED_FUNCTION_END 3
1308
#define NESTED_FUNCTION_BEGIN 4
1310
#ifndef YY_NO_UNISTD_H
1311
/* Special case for "unistd.h", since it is non-ANSI. We include it way
1312
* down here because we want the user's section 1 to have been scanned first.
1313
* The user has a chance to override it with an option.
1318
#ifndef YY_EXTRA_TYPE
1319
#define YY_EXTRA_TYPE void *
1322
static int yy_init_globals (void );
1324
/* Macros after this point can all be overridden by user definitions in
1328
#ifndef YY_SKIP_YYWRAP
1330
extern "C" int octave_wrap (void );
1332
extern int octave_wrap (void );
1336
static void yyunput (int c,char *buf_ptr );
1339
static void yy_flex_strncpy (char *,yyconst char *,int );
1342
#ifdef YY_NEED_STRLEN
1343
static int yy_flex_strlen (yyconst char * );
1349
static int yyinput (void );
1351
static int input (void );
1356
/* Amount of stuff to slurp up with each read. */
1357
#ifndef YY_READ_BUF_SIZE
1358
#define YY_READ_BUF_SIZE 8192
1361
/* Copy whatever the last rule matched to the standard output. */
1363
/* This used to be an fputs(), but since the string might contain NUL's,
1364
* we now use fwrite().
1366
#define ECHO (void) fwrite( octave_text, octave_leng, 1, octave_out )
1369
/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
1370
* is returned in "result".
1373
#define YY_INPUT(buf,result,max_size) \
1374
if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
1378
for ( n = 0; n < max_size && \
1379
(c = getc( octave_in )) != EOF && c != '\n'; ++n ) \
1380
buf[n] = (char) c; \
1382
buf[n++] = (char) c; \
1383
if ( c == EOF && ferror( octave_in ) ) \
1384
YY_FATAL_ERROR( "input in flex scanner failed" ); \
1390
while ( (result = fread(buf, 1, max_size, octave_in))==0 && ferror(octave_in)) \
1392
if( errno != EINTR) \
1394
YY_FATAL_ERROR( "input in flex scanner failed" ); \
1398
clearerr(octave_in); \
1405
/* No semi-colon after return; correct usage is to write "yyterminate();" -
1406
* we don't want an extra ';' after the "return" because that will cause
1407
* some compilers to complain about unreachable statements.
1410
#define yyterminate() return YY_NULL
1413
/* Number of entries by which start-condition stack grows. */
1414
#ifndef YY_START_STACK_INCR
1415
#define YY_START_STACK_INCR 25
1418
/* Report a fatal error. */
1419
#ifndef YY_FATAL_ERROR
1420
#define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
1423
/* end tables serialization structures and prototypes */
1425
/* Default declaration of generated scanner - a define so the user can
1426
* easily add parameters.
1429
#define YY_DECL_IS_OURS 1
1431
extern int octave_lex (void);
1433
#define YY_DECL int octave_lex (void)
1434
#endif /* !YY_DECL */
1436
/* Code executed at the beginning of each rule, after octave_text and octave_leng
1439
#ifndef YY_USER_ACTION
1440
#define YY_USER_ACTION
1443
/* Code executed at the end of each rule. */
1445
#define YY_BREAK break;
1448
#define YY_RULE_SETUP \
1451
/** The main scanner function which does all the work.
1455
register yy_state_type yy_current_state;
1456
register char *yy_cp, *yy_bp;
1457
register int yy_act;
1462
#line 1463 "<stdout>"
1473
(yy_start) = 1; /* first start state */
1479
octave_out = stdout;
1481
if ( ! YY_CURRENT_BUFFER ) {
1482
octave_ensure_buffer_stack ();
1483
YY_CURRENT_BUFFER_LVALUE =
1484
octave__create_buffer(octave_in,YY_BUF_SIZE );
1487
octave__load_buffer_state( );
1490
while ( 1 ) /* loops until end-of-file is reached */
1492
yy_cp = (yy_c_buf_p);
1494
/* Support of octave_text. */
1495
*yy_cp = (yy_hold_char);
1497
/* yy_bp points to the position in yy_ch_buf of the start of
1502
yy_current_state = (yy_start);
1506
register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
1507
if ( yy_accept[yy_current_state] )
1509
(yy_last_accepting_state) = yy_current_state;
1510
(yy_last_accepting_cpos) = yy_cp;
1512
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1514
yy_current_state = (int) yy_def[yy_current_state];
1515
if ( yy_current_state >= 433 )
1516
yy_c = yy_meta[(unsigned int) yy_c];
1518
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1521
while ( yy_base[yy_current_state] != 1982 );
1524
yy_act = yy_accept[yy_current_state];
1526
{ /* have to back up */
1527
yy_cp = (yy_last_accepting_cpos);
1528
yy_current_state = (yy_last_accepting_state);
1529
yy_act = yy_accept[yy_current_state];
1532
YY_DO_BEFORE_ACTION;
1534
do_action: /* This label is used only to access EOF actions. */
1537
{ /* beginning of action switch */
1538
case 0: /* must back up */
1539
/* undo the effects of YY_DO_BEFORE_ACTION */
1540
*yy_cp = (yy_hold_char);
1541
yy_cp = (yy_last_accepting_cpos);
1542
yy_current_state = (yy_last_accepting_state);
1543
goto yy_find_action;
1549
BEGIN (NESTED_FUNCTION_BEGIN);
1550
yyunput (octave_text[0], octave_text);
1551
COUNT_TOK_AND_RETURN (';');
1559
yyunput (octave_text[0], octave_text);
1560
prep_for_nested_function ();
1561
COUNT_TOK_AND_RETURN (FCN);
1565
// Help and other command-style functions are a pain in the ass. This
1566
// stuff needs to be simplified. May require some changes in the
1570
/* rule 3 can match eol */
1575
current_input_column = 1;
1576
lexer_flags.quote_is_transpose = false;
1577
lexer_flags.convert_spaces_to_comma = true;
1578
lexer_flags.doing_rawcommand = false;
1579
COUNT_TOK_AND_RETURN ('\n');
1586
if (lexer_flags.doing_rawcommand)
1587
TOK_PUSH_AND_RETURN (octave_text, SQ_STRING);
1591
if (strcmp (octave_text, ",") == 0)
1601
current_input_column++;
1602
COUNT_TOK_AND_RETURN (handle_string (octave_text[0], true));
1609
std::string tok = strip_trailing_whitespace (octave_text);
1610
TOK_PUSH_AND_RETURN (tok, SQ_STRING);
1614
// For this and the next two rules, we're looking at ']', and we
1615
// need to know if the next token is `=' or `=='.
1617
// It would have been so much easier if the delimiters were simply
1618
// different for the expression on the left hand side of the equals
1621
// It's also a pain in the ass to decide whether to insert a comma
1622
// after seeing a ']' character...
1625
/* rule 7 can match eol */
1629
scan_for_comments (octave_text);
1630
fixup_column_count (octave_text);
1631
int c = octave_text[octave_leng-1];
1632
int cont_is_spc = eat_continuation ();
1633
bool spc_gobbled = (cont_is_spc || c == ' ' || c == '\t');
1634
int tok_to_return = handle_close_bracket (spc_gobbled, ']');
1636
yyunput (' ', octave_text);
1637
COUNT_TOK_AND_RETURN (tok_to_return);
1641
/* rule 8 can match eol */
1645
scan_for_comments (octave_text);
1646
fixup_column_count (octave_text);
1647
int c = octave_text[octave_leng-1];
1648
int cont_is_spc = eat_continuation ();
1649
bool spc_gobbled = (cont_is_spc || c == ' ' || c == '\t');
1650
int tok_to_return = handle_close_bracket (spc_gobbled, '}');
1652
yyunput (' ', octave_text);
1653
COUNT_TOK_AND_RETURN (tok_to_return);
1657
// Commas are element separators in matrix constants. If we don't
1658
// check for continuations here we can end up inserting too many
1665
current_input_column += octave_leng;
1667
int tmp = eat_continuation ();
1669
lexer_flags.quote_is_transpose = false;
1670
lexer_flags.convert_spaces_to_comma = true;
1672
if ((tmp & ATE_NEWLINE) == ATE_NEWLINE)
1674
maybe_warn_separator_insert (';');
1676
yyunput (';', octave_text);
1679
COUNT_TOK_AND_RETURN (',');
1683
// In some cases, spaces in matrix constants can turn into commas.
1684
// If commas are required, spaces are not important in matrix
1685
// constants so we just eat them. If we don't check for continuations
1686
// here we can end up inserting too many commas.
1692
current_input_column += octave_leng;
1694
int tmp = eat_continuation ();
1695
int bin_op = next_token_is_bin_op (true);
1696
int postfix_un_op = next_token_is_postfix_unary_op (true);
1698
if (! (postfix_un_op || bin_op)
1699
&& nesting_level.is_bracket_or_brace ()
1700
&& lexer_flags.convert_spaces_to_comma)
1702
if ((tmp & ATE_NEWLINE) == ATE_NEWLINE)
1704
maybe_warn_separator_insert (';');
1706
yyunput (';', octave_text);
1709
lexer_flags.quote_is_transpose = false;
1710
lexer_flags.convert_spaces_to_comma = true;
1712
maybe_warn_separator_insert (',');
1714
COUNT_TOK_AND_RETURN (',');
1719
// Semicolons are handled as row seprators in matrix constants. If we
1720
// don't eat whitespace here we can end up inserting too many
1724
/* rule 11 can match eol */
1728
scan_for_comments (octave_text);
1729
fixup_column_count (octave_text);
1731
lexer_flags.quote_is_transpose = false;
1732
lexer_flags.convert_spaces_to_comma = true;
1733
COUNT_TOK_AND_RETURN (';');
1737
// In some cases, new lines can also become row separators. If we
1738
// don't eat whitespace here we can end up inserting too many
1742
/* rule 12 can match eol */
1745
/* rule 13 can match eol */
1749
scan_for_comments (octave_text);
1750
fixup_column_count (octave_text);
1753
lexer_flags.quote_is_transpose = false;
1754
lexer_flags.convert_spaces_to_comma = true;
1756
if (nesting_level.none ())
1757
return LEXICAL_ERROR;
1759
if (nesting_level.is_bracket_or_brace ())
1761
maybe_warn_separator_insert (';');
1763
COUNT_TOK_AND_RETURN (';');
1771
nesting_level.bracket ();
1773
current_input_column += octave_leng;
1774
lexer_flags.quote_is_transpose = false;
1775
lexer_flags.convert_spaces_to_comma = true;
1777
if (lexer_flags.defining_func && ! lexer_flags.parsed_function_name)
1778
lexer_flags.looking_at_return_list = true;
1780
lexer_flags.looking_at_matrix_or_assign_lhs = true;
1785
lexer_flags.bracketflag++;
1786
BEGIN (MATRIX_START);
1787
COUNT_TOK_AND_RETURN ('[');
1794
nesting_level.remove ();
1800
// Imaginary numbers.
1807
COUNT_TOK_AND_RETURN (IMAG_NUM);
1811
// Real numbers. Don't grab the `.' part of a dot operator as part of
1815
*yy_cp = (yy_hold_char); /* undo effects of setting up octave_text */
1816
(yy_c_buf_p) = yy_cp -= 2;
1817
YY_DO_BEFORE_ACTION; /* set up octave_text again */
1824
COUNT_TOK_AND_RETURN (NUM);
1828
// Eat whitespace. Whitespace inside matrix constants is handled by
1829
// the <MATRIX_START> start state code above.
1835
current_input_column += octave_leng;
1839
// Continuation lines. Allow comments after continuations.
1842
/* rule 20 can match eol */
1845
/* rule 21 can match eol */
1849
if (octave_text[0] == '\\')
1850
gripe_matlab_incompatible_continuation ();
1851
scan_for_comments (octave_text);
1853
current_input_column = 1;
1859
case YY_STATE_EOF(INITIAL):
1860
case YY_STATE_EOF(COMMAND_START):
1861
case YY_STATE_EOF(MATRIX_START):
1862
case YY_STATE_EOF(NESTED_FUNCTION_END):
1863
case YY_STATE_EOF(NESTED_FUNCTION_BEGIN):
1866
TOK_RETURN (END_OF_INPUT);
1870
// Identifiers. Truncate the token at the first space or tab but
1871
// don't write directly on octave_text.
1877
int id_tok = handle_identifier ();
1880
COUNT_TOK_AND_RETURN (id_tok);
1884
// Function handles.
1890
current_input_column++;
1891
lexer_flags.quote_is_transpose = false;
1892
lexer_flags.convert_spaces_to_comma = false;
1893
lexer_flags.looking_at_function_handle++;
1894
COUNT_TOK_AND_RETURN ('@');
1898
// A new line character. New line characters inside matrix constants
1899
// are handled by the <MATRIX_START> start state code above. If closest
1900
// nesting is inside parentheses, don't return a row separator.
1903
/* rule 24 can match eol */
1907
current_input_column = 1;
1908
lexer_flags.quote_is_transpose = false;
1909
lexer_flags.convert_spaces_to_comma = true;
1910
if (nesting_level.none ())
1911
COUNT_TOK_AND_RETURN ('\n');
1912
else if (nesting_level.is_paren ())
1913
gripe_matlab_incompatible ("bare newline inside parentheses");
1914
else if (nesting_level.is_bracket_or_brace ())
1915
return LEXICAL_ERROR;
1919
// Single quote can either be the beginning of a string or a transpose
1926
current_input_column++;
1927
lexer_flags.convert_spaces_to_comma = true;
1929
if (lexer_flags.quote_is_transpose)
1931
do_comma_insert_check ();
1932
COUNT_TOK_AND_RETURN (QUOTE);
1935
COUNT_TOK_AND_RETURN (handle_string ('\''));
1939
// Double quotes always begin strings.
1945
current_input_column++;
1946
COUNT_TOK_AND_RETURN (handle_string ('"'));
1950
// Gobble comments. If closest nesting is inside parentheses, don't
1951
// return a new line.
1957
std::string help_txt;
1959
if (! help_buf.empty ())
1960
help_txt = help_buf.top ();
1962
if (help_txt.empty ()
1963
&& lexer_flags.beginning_of_function
1964
&& nesting_level.none ())
1966
lexer_flags.beginning_of_function = false;
1968
std::string txt = grab_help_text ();
1970
if (! help_buf.empty ())
1973
help_buf.push (txt);
1975
octave_comment_buffer::append (txt);
1981
bool begin_comment = true;
1984
while ((c = yyinput ()) != EOF && c != '\n')
1986
if (begin_comment && (c == '#' || c == '%'))
1987
; /* Skip leading comment characters. */
1989
buf += static_cast<char> (c);
1992
octave_comment_buffer::append (buf);
1995
current_input_column = 1;
1996
lexer_flags.quote_is_transpose = false;
1997
lexer_flags.convert_spaces_to_comma = true;
1999
maybe_gripe_matlab_incompatible_comment (octave_text[0]);
2001
if (YY_START == COMMAND_START)
2004
if (nesting_level.none ())
2006
lexer_flags.doing_rawcommand = false;
2007
COUNT_TOK_AND_RETURN ('\n');
2009
else if (nesting_level.is_bracket_or_brace ())
2010
COUNT_TOK_AND_RETURN (';');
2019
{ BIN_OP_RETURN (':', false); }
2024
{ XBIN_OP_RETURN (EPLUS, false); }
2029
{ XBIN_OP_RETURN (EMINUS, false); }
2034
{ BIN_OP_RETURN (EMUL, false); }
2039
{ BIN_OP_RETURN (EDIV, false); }
2044
{ BIN_OP_RETURN (ELEFTDIV, false); }
2049
{ BIN_OP_RETURN (EPOW, false); }
2054
{ XBIN_OP_RETURN (EPOW, false); }
2059
{ do_comma_insert_check (); BIN_OP_RETURN (TRANSPOSE, true); }
2064
{ do_comma_insert_check (); XBIN_OP_RETURN (PLUS_PLUS, true); }
2069
{ do_comma_insert_check (); XBIN_OP_RETURN (MINUS_MINUS, true); }
2074
{ BIN_OP_RETURN (EXPR_LE, false); }
2079
{ BIN_OP_RETURN (EXPR_EQ, false); }
2084
{ BIN_OP_RETURN (EXPR_NE, false); }
2089
{ XBIN_OP_RETURN (EXPR_NE, false); }
2094
{ BIN_OP_RETURN (EXPR_GE, false); }
2099
{ BIN_OP_RETURN (EXPR_AND, false); }
2104
{ BIN_OP_RETURN (EXPR_OR, false); }
2109
{ BIN_OP_RETURN (EXPR_LT, false); }
2114
{ BIN_OP_RETURN (EXPR_GT, false); }
2119
{ BIN_OP_RETURN ('+', false); }
2124
{ BIN_OP_RETURN ('-', false); }
2129
{ BIN_OP_RETURN ('*', false); }
2134
{ BIN_OP_RETURN ('/', false); }
2139
{ BIN_OP_RETURN (LEFTDIV, false); }
2144
{ BIN_OP_RETURN (';', true); }
2149
{ BIN_OP_RETURN (',', true); }
2154
{ BIN_OP_RETURN (POW, false); }
2159
{ XBIN_OP_RETURN (POW, false); }
2164
{ BIN_OP_RETURN ('=', true); }
2169
{ BIN_OP_RETURN (EXPR_AND_AND, false); }
2174
{ BIN_OP_RETURN (EXPR_OR_OR, false); }
2179
{ XBIN_OP_RETURN (LSHIFT, false); }
2184
{ XBIN_OP_RETURN (RSHIFT, false); }
2190
if (octave_text[0] == '~')
2191
BIN_OP_RETURN (EXPR_NOT, false);
2193
XBIN_OP_RETURN (EXPR_NOT, false);
2200
lexer_flags.looking_at_indirect_ref = false;
2201
nesting_level.paren ();
2210
nesting_level.remove ();
2211
current_input_column++;
2212
lexer_flags.quote_is_transpose = true;
2213
lexer_flags.convert_spaces_to_comma = nesting_level.is_bracket_or_brace ();
2214
do_comma_insert_check ();
2215
COUNT_TOK_AND_RETURN (')');
2221
{ TOK_RETURN ('.'); }
2226
{ XBIN_OP_RETURN (ADD_EQ, false); }
2231
{ XBIN_OP_RETURN (SUB_EQ, false); }
2236
{ XBIN_OP_RETURN (MUL_EQ, false); }
2241
{ XBIN_OP_RETURN (DIV_EQ, false); }
2246
{ XBIN_OP_RETURN (LEFTDIV_EQ, false); }
2251
{ XBIN_OP_RETURN (ADD_EQ, false); }
2256
{ XBIN_OP_RETURN (SUB_EQ, false); }
2261
{ XBIN_OP_RETURN (EMUL_EQ, false); }
2266
{ XBIN_OP_RETURN (EDIV_EQ, false); }
2271
{ XBIN_OP_RETURN (ELEFTDIV_EQ, false); }
2276
{ XBIN_OP_RETURN (POW_EQ, false); }
2281
{ XBIN_OP_RETURN (EPOW_EQ, false); }
2286
{ XBIN_OP_RETURN (AND_EQ, false); }
2291
{ XBIN_OP_RETURN (OR_EQ, false); }
2296
{ XBIN_OP_RETURN (LSHIFT_EQ, false); }
2301
{ XBIN_OP_RETURN (RSHIFT_EQ, false); }
2307
nesting_level.brace ();
2309
current_input_column += octave_leng;
2310
lexer_flags.quote_is_transpose = false;
2311
lexer_flags.convert_spaces_to_comma = true;
2316
lexer_flags.braceflag++;
2317
BEGIN (MATRIX_START);
2318
COUNT_TOK_AND_RETURN ('{');
2325
nesting_level.remove ();
2331
// Unrecognized input is a lexical error.
2337
// EOF happens here if we are parsing nested functions.
2339
yyunput (octave_text[0], octave_text);
2345
current_input_column++;
2347
error ("invalid character `%s' (ASCII %d) near line %d, column %d",
2348
undo_string_escape (static_cast<char> (c)), c,
2349
input_line_number, current_input_column);
2351
return LEXICAL_ERROR;
2354
TOK_RETURN (END_OF_INPUT);
2362
#line 2363 "<stdout>"
2364
case YY_END_OF_BUFFER:
2366
/* Amount of text matched not including the EOB char. */
2367
int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
2369
/* Undo the effects of YY_DO_BEFORE_ACTION. */
2370
*yy_cp = (yy_hold_char);
2371
YY_RESTORE_YY_MORE_OFFSET
2373
if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
2375
/* We're scanning a new file or input source. It's
2376
* possible that this happened because the user
2377
* just pointed octave_in at a new source and called
2378
* octave_lex(). If so, then we have to assure
2379
* consistency between YY_CURRENT_BUFFER and our
2380
* globals. Here is the right place to do so, because
2381
* this is the first action (other than possibly a
2382
* back-up) that will match for the new input source.
2384
(yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
2385
YY_CURRENT_BUFFER_LVALUE->yy_input_file = octave_in;
2386
YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
2389
/* Note that here we test for yy_c_buf_p "<=" to the position
2390
* of the first EOB in the buffer, since yy_c_buf_p will
2391
* already have been incremented past the NUL character
2392
* (since all states make transitions on EOB to the
2393
* end-of-buffer state). Contrast this with the test
2396
if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
2397
{ /* This was really a NUL. */
2398
yy_state_type yy_next_state;
2400
(yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
2402
yy_current_state = yy_get_previous_state( );
2404
/* Okay, we're now positioned to make the NUL
2405
* transition. We couldn't have
2406
* yy_get_previous_state() go ahead and do it
2407
* for us because it doesn't know how to deal
2408
* with the possibility of jamming (and we don't
2409
* want to build jamming into it because then it
2410
* will run more slowly).
2413
yy_next_state = yy_try_NUL_trans( yy_current_state );
2415
yy_bp = (yytext_ptr) + YY_MORE_ADJ;
2417
if ( yy_next_state )
2419
/* Consume the NUL. */
2420
yy_cp = ++(yy_c_buf_p);
2421
yy_current_state = yy_next_state;
2427
yy_cp = (yy_c_buf_p);
2428
goto yy_find_action;
2432
else switch ( yy_get_next_buffer( ) )
2434
case EOB_ACT_END_OF_FILE:
2436
(yy_did_buffer_switch_on_eof) = 0;
2438
if ( octave_wrap( ) )
2440
/* Note: because we've taken care in
2441
* yy_get_next_buffer() to have set up
2442
* octave_text, we can now set up
2443
* yy_c_buf_p so that if some total
2444
* hoser (like flex itself) wants to
2445
* call the scanner after we return the
2446
* YY_NULL, it'll still work - another
2447
* YY_NULL will get returned.
2449
(yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
2451
yy_act = YY_STATE_EOF(YY_START);
2457
if ( ! (yy_did_buffer_switch_on_eof) )
2463
case EOB_ACT_CONTINUE_SCAN:
2465
(yytext_ptr) + yy_amount_of_matched_text;
2467
yy_current_state = yy_get_previous_state( );
2469
yy_cp = (yy_c_buf_p);
2470
yy_bp = (yytext_ptr) + YY_MORE_ADJ;
2473
case EOB_ACT_LAST_MATCH:
2475
&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
2477
yy_current_state = yy_get_previous_state( );
2479
yy_cp = (yy_c_buf_p);
2480
yy_bp = (yytext_ptr) + YY_MORE_ADJ;
2481
goto yy_find_action;
2488
"fatal flex scanner internal error--no action found" );
2489
} /* end of action switch */
2490
} /* end of scanning one token */
2491
} /* end of octave_lex */
2493
/* yy_get_next_buffer - try to read in a new buffer
2495
* Returns a code representing an action:
2496
* EOB_ACT_LAST_MATCH -
2497
* EOB_ACT_CONTINUE_SCAN - continue scanning from current position
2498
* EOB_ACT_END_OF_FILE - end of file
2500
static int yy_get_next_buffer (void)
2502
register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
2503
register char *source = (yytext_ptr);
2504
register int number_to_move, i;
2507
if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
2509
"fatal flex scanner internal error--end of buffer missed" );
2511
if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
2512
{ /* Don't try to fill the buffer, so this is an EOF. */
2513
if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
2515
/* We matched a single character, the EOB, so
2516
* treat this as a final EOF.
2518
return EOB_ACT_END_OF_FILE;
2523
/* We matched some text prior to the EOB, first
2526
return EOB_ACT_LAST_MATCH;
2530
/* Try to read more data. */
2532
/* First move last chars to start of buffer. */
2533
number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;
2535
for ( i = 0; i < number_to_move; ++i )
2536
*(dest++) = *(source++);
2538
if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
2539
/* don't do the read, it's not guaranteed to return an EOF,
2542
YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
2547
YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
2549
while ( num_to_read <= 0 )
2550
{ /* Not enough room in the buffer - grow it. */
2552
/* just a shorter name for the current buffer */
2553
YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
2555
int yy_c_buf_p_offset =
2556
(int) ((yy_c_buf_p) - b->yy_ch_buf);
2558
if ( b->yy_is_our_buffer )
2560
int new_size = b->yy_buf_size * 2;
2562
if ( new_size <= 0 )
2563
b->yy_buf_size += b->yy_buf_size / 8;
2565
b->yy_buf_size *= 2;
2567
b->yy_ch_buf = (char *)
2568
/* Include room in for 2 EOB chars. */
2569
octave_realloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 );
2572
/* Can't grow it, we don't own it. */
2575
if ( ! b->yy_ch_buf )
2577
"fatal error - scanner input buffer overflow" );
2579
(yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
2581
num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
2586
if ( num_to_read > YY_READ_BUF_SIZE )
2587
num_to_read = YY_READ_BUF_SIZE;
2589
/* Read in more data. */
2590
YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
2591
(yy_n_chars), (size_t) num_to_read );
2593
YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
2596
if ( (yy_n_chars) == 0 )
2598
if ( number_to_move == YY_MORE_ADJ )
2600
ret_val = EOB_ACT_END_OF_FILE;
2601
octave_restart(octave_in );
2606
ret_val = EOB_ACT_LAST_MATCH;
2607
YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
2608
YY_BUFFER_EOF_PENDING;
2613
ret_val = EOB_ACT_CONTINUE_SCAN;
2615
(yy_n_chars) += number_to_move;
2616
YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
2617
YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
2619
(yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
2624
/* yy_get_previous_state - get the state just before the EOB char was reached */
2626
static yy_state_type yy_get_previous_state (void)
2628
register yy_state_type yy_current_state;
2629
register char *yy_cp;
2631
yy_current_state = (yy_start);
2633
for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
2635
register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
2636
if ( yy_accept[yy_current_state] )
2638
(yy_last_accepting_state) = yy_current_state;
2639
(yy_last_accepting_cpos) = yy_cp;
2641
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
2643
yy_current_state = (int) yy_def[yy_current_state];
2644
if ( yy_current_state >= 433 )
2645
yy_c = yy_meta[(unsigned int) yy_c];
2647
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
2650
return yy_current_state;
2653
/* yy_try_NUL_trans - try to make a transition on the NUL character
2656
* next_state = yy_try_NUL_trans( current_state );
2658
static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state )
2660
register int yy_is_jam;
2661
register char *yy_cp = (yy_c_buf_p);
2663
register YY_CHAR yy_c = 1;
2664
if ( yy_accept[yy_current_state] )
2666
(yy_last_accepting_state) = yy_current_state;
2667
(yy_last_accepting_cpos) = yy_cp;
2669
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
2671
yy_current_state = (int) yy_def[yy_current_state];
2672
if ( yy_current_state >= 433 )
2673
yy_c = yy_meta[(unsigned int) yy_c];
2675
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
2676
yy_is_jam = (yy_current_state == 432);
2678
return yy_is_jam ? 0 : yy_current_state;
2681
static void yyunput (int c, register char * yy_bp )
2683
register char *yy_cp;
2685
yy_cp = (yy_c_buf_p);
2687
/* undo effects of setting up octave_text */
2688
*yy_cp = (yy_hold_char);
2690
if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
2691
{ /* need to shift things up to make room */
2692
/* +2 for EOB chars. */
2693
register int number_to_move = (yy_n_chars) + 2;
2694
register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
2695
YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
2696
register char *source =
2697
&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
2699
while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
2700
*--dest = *--source;
2702
yy_cp += (int) (dest - source);
2703
yy_bp += (int) (dest - source);
2704
YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
2705
(yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
2707
if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
2708
YY_FATAL_ERROR( "flex scanner push-back overflow" );
2711
*--yy_cp = (char) c;
2713
(yytext_ptr) = yy_bp;
2714
(yy_hold_char) = *yy_cp;
2715
(yy_c_buf_p) = yy_cp;
2720
static int yyinput (void)
2722
static int input (void)
2728
*(yy_c_buf_p) = (yy_hold_char);
2730
if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
2732
/* yy_c_buf_p now points to the character we want to return.
2733
* If this occurs *before* the EOB characters, then it's a
2734
* valid NUL; if not, then we've hit the end of the buffer.
2736
if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
2737
/* This was really a NUL. */
2738
*(yy_c_buf_p) = '\0';
2741
{ /* need more input */
2742
int offset = (yy_c_buf_p) - (yytext_ptr);
2745
switch ( yy_get_next_buffer( ) )
2747
case EOB_ACT_LAST_MATCH:
2748
/* This happens because yy_g_n_b()
2749
* sees that we've accumulated a
2750
* token and flags that we need to
2751
* try matching the token before
2752
* proceeding. But for input(),
2753
* there's no matching to consider.
2754
* So convert the EOB_ACT_LAST_MATCH
2755
* to EOB_ACT_END_OF_FILE.
2758
/* Reset buffer status. */
2759
octave_restart(octave_in );
2763
case EOB_ACT_END_OF_FILE:
2765
if ( octave_wrap( ) )
2768
if ( ! (yy_did_buffer_switch_on_eof) )
2777
case EOB_ACT_CONTINUE_SCAN:
2778
(yy_c_buf_p) = (yytext_ptr) + offset;
2784
c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */
2785
*(yy_c_buf_p) = '\0'; /* preserve octave_text */
2786
(yy_hold_char) = *++(yy_c_buf_p);
2790
#endif /* ifndef YY_NO_INPUT */
2792
/** Immediately switch to a different input stream.
2793
* @param input_file A readable stream.
2795
* @note This function does not reset the start condition to @c INITIAL .
2797
void octave_restart (FILE * input_file )
2800
if ( ! YY_CURRENT_BUFFER ){
2801
octave_ensure_buffer_stack ();
2802
YY_CURRENT_BUFFER_LVALUE =
2803
octave__create_buffer(octave_in,YY_BUF_SIZE );
2806
octave__init_buffer(YY_CURRENT_BUFFER,input_file );
2807
octave__load_buffer_state( );
2810
/** Switch to a different input buffer.
2811
* @param new_buffer The new input buffer.
2814
void octave__switch_to_buffer (YY_BUFFER_STATE new_buffer )
2817
/* TODO. We should be able to replace this entire function body
2819
* octave_pop_buffer_state();
2820
* octave_push_buffer_state(new_buffer);
2822
octave_ensure_buffer_stack ();
2823
if ( YY_CURRENT_BUFFER == new_buffer )
2826
if ( YY_CURRENT_BUFFER )
2828
/* Flush out information for old buffer. */
2829
*(yy_c_buf_p) = (yy_hold_char);
2830
YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
2831
YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
2834
YY_CURRENT_BUFFER_LVALUE = new_buffer;
2835
octave__load_buffer_state( );
2837
/* We don't actually know whether we did this switch during
2838
* EOF (octave_wrap()) processing, but the only time this flag
2839
* is looked at is after octave_wrap() is called, so it's safe
2840
* to go ahead and always set it.
2842
(yy_did_buffer_switch_on_eof) = 1;
2845
static void octave__load_buffer_state (void)
2847
(yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
2848
(yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
2849
octave_in = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
2850
(yy_hold_char) = *(yy_c_buf_p);
2853
/** Allocate and initialize an input buffer state.
2854
* @param file A readable stream.
2855
* @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
2857
* @return the allocated buffer state.
2859
YY_BUFFER_STATE octave__create_buffer (FILE * file, int size )
2863
b = (YY_BUFFER_STATE) octave_alloc(sizeof( struct yy_buffer_state ) );
2865
YY_FATAL_ERROR( "out of dynamic memory in octave__create_buffer()" );
2867
b->yy_buf_size = size;
2869
/* yy_ch_buf has to be 2 characters longer than the size given because
2870
* we need to put in 2 end-of-buffer characters.
2872
b->yy_ch_buf = (char *) octave_alloc(b->yy_buf_size + 2 );
2873
if ( ! b->yy_ch_buf )
2874
YY_FATAL_ERROR( "out of dynamic memory in octave__create_buffer()" );
2876
b->yy_is_our_buffer = 1;
2878
octave__init_buffer(b,file );
2883
/** Destroy the buffer.
2884
* @param b a buffer created with octave__create_buffer()
2887
void octave__delete_buffer (YY_BUFFER_STATE b )
2893
if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
2894
YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
2896
if ( b->yy_is_our_buffer )
2897
octave_free((void *) b->yy_ch_buf );
2899
octave_free((void *) b );
2903
extern int isatty (int );
2904
#endif /* __cplusplus */
2906
/* Initializes or reinitializes a buffer.
2907
* This function is sometimes called more than once on the same buffer,
2908
* such as during a octave_restart() or at EOF.
2910
static void octave__init_buffer (YY_BUFFER_STATE b, FILE * file )
2915
octave__flush_buffer(b );
2917
b->yy_input_file = file;
2918
b->yy_fill_buffer = 1;
2920
/* If b is the current buffer, then octave__init_buffer was _probably_
2921
* called from octave_restart() or through yy_get_next_buffer.
2922
* In that case, we don't want to reset the lineno or column.
2924
if (b != YY_CURRENT_BUFFER){
2925
b->yy_bs_lineno = 1;
2926
b->yy_bs_column = 0;
2929
b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
2934
/** Discard all buffered characters. On the next scan, YY_INPUT will be called.
2935
* @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
2938
void octave__flush_buffer (YY_BUFFER_STATE b )
2945
/* We always need two end-of-buffer characters. The first causes
2946
* a transition to the end-of-buffer state. The second causes
2947
* a jam in that state.
2949
b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
2950
b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
2952
b->yy_buf_pos = &b->yy_ch_buf[0];
2955
b->yy_buffer_status = YY_BUFFER_NEW;
2957
if ( b == YY_CURRENT_BUFFER )
2958
octave__load_buffer_state( );
2961
/** Pushes the new state onto the stack. The new state becomes
2962
* the current state. This function will allocate the stack
2964
* @param new_buffer The new state.
2967
void octave_push_buffer_state (YY_BUFFER_STATE new_buffer )
2969
if (new_buffer == NULL)
2972
octave_ensure_buffer_stack();
2974
/* This block is copied from octave__switch_to_buffer. */
2975
if ( YY_CURRENT_BUFFER )
2977
/* Flush out information for old buffer. */
2978
*(yy_c_buf_p) = (yy_hold_char);
2979
YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
2980
YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
2983
/* Only push if top exists. Otherwise, replace top. */
2984
if (YY_CURRENT_BUFFER)
2985
(yy_buffer_stack_top)++;
2986
YY_CURRENT_BUFFER_LVALUE = new_buffer;
2988
/* copied from octave__switch_to_buffer. */
2989
octave__load_buffer_state( );
2990
(yy_did_buffer_switch_on_eof) = 1;
2993
/** Removes and deletes the top of the stack, if present.
2994
* The next element becomes the new top.
2997
void octave_pop_buffer_state (void)
2999
if (!YY_CURRENT_BUFFER)
3002
octave__delete_buffer(YY_CURRENT_BUFFER );
3003
YY_CURRENT_BUFFER_LVALUE = NULL;
3004
if ((yy_buffer_stack_top) > 0)
3005
--(yy_buffer_stack_top);
3007
if (YY_CURRENT_BUFFER) {
3008
octave__load_buffer_state( );
3009
(yy_did_buffer_switch_on_eof) = 1;
3013
/* Allocates the stack if it does not exist.
3014
* Guarantees space for at least one push.
3016
static void octave_ensure_buffer_stack (void)
3020
if (!(yy_buffer_stack)) {
3022
/* First allocation is just for 2 elements, since we don't know if this
3023
* scanner will even need a stack. We use 2 instead of 1 to avoid an
3024
* immediate realloc on the next call.
3027
(yy_buffer_stack) = (struct yy_buffer_state**)octave_alloc
3028
(num_to_alloc * sizeof(struct yy_buffer_state*)
3031
memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
3033
(yy_buffer_stack_max) = num_to_alloc;
3034
(yy_buffer_stack_top) = 0;
3038
if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
3040
/* Increase the buffer to prepare for a possible push. */
3041
int grow_size = 8 /* arbitrary grow size */;
3043
num_to_alloc = (yy_buffer_stack_max) + grow_size;
3044
(yy_buffer_stack) = (struct yy_buffer_state**)octave_realloc
3046
num_to_alloc * sizeof(struct yy_buffer_state*)
3049
/* zero only the new slots.*/
3050
memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
3051
(yy_buffer_stack_max) = num_to_alloc;
3055
/** Setup the input buffer state to scan directly from a user-specified character buffer.
3056
* @param base the character buffer
3057
* @param size the size in bytes of the character buffer
3059
* @return the newly allocated buffer state object.
3061
YY_BUFFER_STATE octave__scan_buffer (char * base, yy_size_t size )
3066
base[size-2] != YY_END_OF_BUFFER_CHAR ||
3067
base[size-1] != YY_END_OF_BUFFER_CHAR )
3068
/* They forgot to leave room for the EOB's. */
3071
b = (YY_BUFFER_STATE) octave_alloc(sizeof( struct yy_buffer_state ) );
3073
YY_FATAL_ERROR( "out of dynamic memory in octave__scan_buffer()" );
3075
b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
3076
b->yy_buf_pos = b->yy_ch_buf = base;
3077
b->yy_is_our_buffer = 0;
3078
b->yy_input_file = 0;
3079
b->yy_n_chars = b->yy_buf_size;
3080
b->yy_is_interactive = 0;
3082
b->yy_fill_buffer = 0;
3083
b->yy_buffer_status = YY_BUFFER_NEW;
3085
octave__switch_to_buffer(b );
3090
/** Setup the input buffer state to scan a string. The next call to octave_lex() will
3091
* scan from a @e copy of @a str.
3092
* @param yystr a NUL-terminated string to scan
3094
* @return the newly allocated buffer state object.
3095
* @note If you want to scan bytes that may contain NUL values, then use
3096
* octave__scan_bytes() instead.
3098
YY_BUFFER_STATE octave__scan_string (yyconst char * yystr )
3101
return octave__scan_bytes(yystr,strlen(yystr) );
3104
/** Setup the input buffer state to scan the given bytes. The next call to octave_lex() will
3105
* scan from a @e copy of @a bytes.
3106
* @param bytes the byte buffer to scan
3107
* @param len the number of bytes in the buffer pointed to by @a bytes.
3109
* @return the newly allocated buffer state object.
3111
YY_BUFFER_STATE octave__scan_bytes (yyconst char * yybytes, int _yybytes_len )
3118
/* Get memory for full buffer, including space for trailing EOB's. */
3119
n = _yybytes_len + 2;
3120
buf = (char *) octave_alloc(n );
3122
YY_FATAL_ERROR( "out of dynamic memory in octave__scan_bytes()" );
3124
for ( i = 0; i < _yybytes_len; ++i )
3125
buf[i] = yybytes[i];
3127
buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
3129
b = octave__scan_buffer(buf,n );
3131
YY_FATAL_ERROR( "bad buffer in octave__scan_bytes()" );
3133
/* It's okay to grow etc. this buffer, and we should throw it
3134
* away when we're done.
3136
b->yy_is_our_buffer = 1;
3141
#ifndef YY_EXIT_FAILURE
3142
#define YY_EXIT_FAILURE 2
3145
static void yy_fatal_error (yyconst char* msg )
3147
(void) fprintf( stderr, "%s\n", msg );
3148
exit( YY_EXIT_FAILURE );
3151
/* Redefine yyless() so it works in section 3 code. */
3157
/* Undo effects of setting up octave_text. */ \
3158
int yyless_macro_arg = (n); \
3159
YY_LESS_LINENO(yyless_macro_arg);\
3160
octave_text[octave_leng] = (yy_hold_char); \
3161
(yy_c_buf_p) = octave_text + yyless_macro_arg; \
3162
(yy_hold_char) = *(yy_c_buf_p); \
3163
*(yy_c_buf_p) = '\0'; \
3164
octave_leng = yyless_macro_arg; \
3168
/* Accessor methods (get/set functions) to struct members. */
3170
/** Get the current line number.
3173
int octave_get_lineno (void)
3176
return octave_lineno;
3179
/** Get the input stream.
3182
FILE *octave_get_in (void)
3187
/** Get the output stream.
3190
FILE *octave_get_out (void)
3195
/** Get the length of the current token.
3198
int octave_get_leng (void)
3203
/** Get the current token.
3207
char *octave_get_text (void)
3212
/** Set the current line number.
3213
* @param line_number
3216
void octave_set_lineno (int line_number )
3219
octave_lineno = line_number;
3222
/** Set the input stream. This does not discard the current
3224
* @param in_str A readable stream.
3226
* @see octave__switch_to_buffer
3228
void octave_set_in (FILE * in_str )
3230
octave_in = in_str ;
3233
void octave_set_out (FILE * out_str )
3235
octave_out = out_str ;
3238
int octave_get_debug (void)
3240
return octave__flex_debug;
3243
void octave_set_debug (int bdebug )
3245
octave__flex_debug = bdebug ;
3248
static int yy_init_globals (void)
3250
/* Initialization is the same as for the non-reentrant scanner.
3251
* This function is called from octave_lex_destroy(), so don't allocate here.
3254
(yy_buffer_stack) = 0;
3255
(yy_buffer_stack_top) = 0;
3256
(yy_buffer_stack_max) = 0;
3257
(yy_c_buf_p) = (char *) 0;
3261
/* Defined in main.c */
3264
octave_out = stdout;
3266
octave_in = (FILE *) 0;
3267
octave_out = (FILE *) 0;
3270
/* For future reference: Set errno on error, since we are called by
3276
/* octave_lex_destroy is for both reentrant and non-reentrant scanners. */
3277
int octave_lex_destroy (void)
3280
/* Pop the buffer stack, destroying each element. */
3281
while(YY_CURRENT_BUFFER){
3282
octave__delete_buffer(YY_CURRENT_BUFFER );
3283
YY_CURRENT_BUFFER_LVALUE = NULL;
3284
octave_pop_buffer_state();
3287
/* Destroy the stack itself. */
3288
octave_free((yy_buffer_stack) );
3289
(yy_buffer_stack) = NULL;
3291
/* Reset the globals. This is important in a non-reentrant scanner so the next time
3292
* octave_lex() is called, initialization will occur. */
3299
* Internal utility routines.
3303
static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
3306
for ( i = 0; i < n; ++i )
3311
#ifdef YY_NEED_STRLEN
3312
static int yy_flex_strlen (yyconst char * s )
3315
for ( n = 0; s[n]; ++n )
3322
void *octave_alloc (yy_size_t size )
3324
return (void *) malloc( size );
3327
void *octave_realloc (void * ptr, yy_size_t size )
3329
/* The cast to (char *) in the following accommodates both
3330
* implementations that use char* generic pointers, and those
3331
* that use void* generic pointers. It works with the latter
3332
* because both ANSI C and C++ allow castless assignment from
3333
* any pointer type to void*, and deal with argument conversions
3334
* as though doing an assignment.
3336
return (void *) realloc( (char *) ptr, size );
3339
void octave_free (void * ptr )
3341
free( (char *) ptr ); /* see octave_realloc() for (char *) cast */
3344
#define YYTABLES_NAME "yytables"
3352
// If we're reading a matrix and the next character is '[', make sure
3353
// that we insert a comma ahead of it.
3356
do_comma_insert_check (void)
3358
int spc_gobbled = eat_continuation ();
3362
yyunput (c, octave_text);
3365
yyunput (' ', octave_text);
3367
lexer_flags.do_comma_insert = (lexer_flags.bracketflag && c == '[');
3370
// Fix things up for errors or interrupts. The parser is never called
3371
// recursively, so it is always safe to reinitialize its state before
3372
// doing any parsing.
3377
// Start off on the right foot.
3380
parser_end_of_input = false;
3381
end_tokens_expected = 0;
3383
while (! symtab_context.empty ())
3384
symtab_context.pop ();
3386
// We do want a prompt by default.
3389
// Error may have occurred inside some brackets, braces, or parentheses.
3390
nesting_level.clear ();
3392
// Clear out the stack of token info used to track line and column
3394
while (! token_stack.empty ())
3396
delete token_stack.top ();
3400
// Can be reset by defining a function.
3401
if (! (reading_script_file || reading_fcn_file))
3403
current_input_column = 1;
3404
input_line_number = command_editor::current_command_number () - 1;
3407
// Only ask for input from stdin if we are expecting interactive
3409
if ((interactive || forced_interactive)
3410
&& ! (reading_fcn_file
3411
|| reading_script_file
3412
|| get_input_from_eval_string
3413
|| input_from_startup_file))
3414
octave_restart (stdin);
3416
// Clear the buffer for help text.
3417
while (! help_buf.empty ())
3420
// Reset other flags.
3421
lexer_flags.init ();
3424
// If we read some newlines, we need figure out what column we're
3425
// really looking at.
3428
fixup_column_count (char *s)
3431
while ((c = *s++) != '\0')
3434
current_input_column = 1;
3436
current_input_column++;
3440
// Include these so that we don't have to link to libfl.a.
3448
// Tell us all what the current buffer is.
3451
current_buffer (void)
3453
return YY_CURRENT_BUFFER;
3456
// Create a new buffer.
3459
create_buffer (FILE *f)
3461
return octave__create_buffer (f, YY_BUF_SIZE);
3464
// Start reading a new buffer.
3467
switch_to_buffer (YY_BUFFER_STATE buf)
3469
octave__switch_to_buffer (buf);
3475
delete_buffer (YY_BUFFER_STATE buf)
3477
octave__delete_buffer (buf);
3480
// Restore a buffer (for unwind-prot).
3483
restore_input_buffer (void *buf)
3485
switch_to_buffer (static_cast<YY_BUFFER_STATE> (buf));
3488
// Delete a buffer (for unwind-prot).
3491
delete_input_buffer (void *buf)
3493
delete_buffer (static_cast<YY_BUFFER_STATE> (buf));
3497
prep_for_function (void)
3499
end_tokens_expected++;
3501
// Prepare for local symbols.
3503
tmp_local_sym_tab = new symbol_table ();
3507
lexer_flags.defining_func = true;
3508
lexer_flags.parsed_function_name = false;
3509
lexer_flags.beginning_of_function = true;
3511
if (! (reading_fcn_file || reading_script_file))
3512
input_line_number = 1;
3516
prep_for_nested_function (void)
3518
lexer_flags.parsing_nested_function = 1;
3519
help_buf.push (std::string ());
3520
prep_for_function ();
3521
// We're still only expecting one end token for this set of functions.
3522
end_tokens_expected--;
3523
yylval.tok_val = new token (input_line_number, current_input_column);
3524
token_stack.push (yylval.tok_val);
3527
// Handle keywords. Return -1 if the keyword should be ignored.
3530
is_keyword_token (const std::string& s)
3532
int l = input_line_number;
3533
int c = current_input_column;
3535
int len = s.length ();
3537
const octave_kw *kw = octave_kw_hash::in_word_set (s.c_str (), len);
3556
case unwind_protect_cleanup_kw:
3560
if (lexer_flags.looking_at_object_index)
3564
if (reading_fcn_file && end_tokens_expected == 1)
3568
yylval.tok_val = new token (token::simple_end, l, c);
3569
end_tokens_expected--;
3574
case end_try_catch_kw:
3575
end_tokens_expected--;
3576
yylval.tok_val = new token (token::try_catch_end, l, c);
3579
case end_unwind_protect_kw:
3580
end_tokens_expected--;
3581
yylval.tok_val = new token (token::unwind_protect_end, l, c);
3585
end_tokens_expected--;
3586
yylval.tok_val = new token (token::for_end, l, c);
3589
case endfunction_kw:
3591
if (reading_fcn_file && end_tokens_expected == 1)
3595
yylval.tok_val = new token (token::function_end, l, c);
3596
end_tokens_expected--;
3602
end_tokens_expected--;
3603
yylval.tok_val = new token (token::if_end, l, c);
3607
end_tokens_expected--;
3608
yylval.tok_val = new token (token::switch_end, l, c);
3612
end_tokens_expected--;
3613
yylval.tok_val = new token (token::while_end, l, c);
3618
end_tokens_expected++;
3623
lexer_flags.looping++;
3629
case unwind_protect_kw:
3630
end_tokens_expected++;
3636
if (lexer_flags.defining_func)
3638
if (reading_fcn_file)
3640
if (lexer_flags.parsing_nested_function)
3642
BEGIN (NESTED_FUNCTION_END);
3644
yylval.tok_val = new token (token::function_end, l, c);
3645
token_stack.push (yylval.tok_val);
3651
prep_for_nested_function ();
3658
error ("nested functions not implemented in this context");
3660
if ((reading_fcn_file || reading_script_file)
3661
&& ! curr_fcn_file_name.empty ())
3662
error ("near line %d of file `%s.m'",
3663
input_line_number, curr_fcn_file_name.c_str ());
3665
error ("near line %d", input_line_number);
3667
return LEXICAL_ERROR;
3671
prep_for_function ();
3677
if ((reading_fcn_file || reading_script_file)
3678
&& ! curr_fcn_file_full_name.empty ())
3679
yylval.tok_val = new token (curr_fcn_file_full_name, l, c);
3681
yylval.tok_val = new token ("stdin", l, c);
3686
yylval.tok_val = new token (static_cast<double> (l), "", l, c);
3690
if (! lexer_flags.looking_at_parameter_list)
3695
if (! (lexer_flags.looking_at_return_list
3696
|| (lexer_flags.defining_func
3697
&& ! lexer_flags.parsed_function_name)))
3702
panic_impossible ();
3705
if (! yylval.tok_val)
3706
yylval.tok_val = new token (l, c);
3708
token_stack.push (yylval.tok_val);
3716
// Try to find an identifier. All binding to global or builtin
3717
// variables occurs when expressions are evaluated.
3719
static symbol_record *
3720
lookup_identifier (const std::string& name)
3722
std::string sym_name = name;
3724
if (curr_sym_tab == fbi_sym_tab
3725
&& lexer_flags.parsing_nested_function)
3726
sym_name = parent_function_name + ":" + sym_name;
3728
return curr_sym_tab->lookup (sym_name, true);
3732
is_variable (const std::string& name)
3734
symbol_record *sr = curr_sym_tab->lookup (name);
3736
return sr && sr->is_variable ();
3740
force_local_variable (const std::string& name)
3742
if (! is_variable (name))
3743
curr_sym_tab->clear (name);
3745
symbol_record *sr = curr_sym_tab->lookup (name, true);
3748
sr->define (octave_value ());
3751
// Grab the help text from an function file.
3753
// FIXME -- gobble_leading_white_space() in parse.y
3754
// duplicates some of this code!
3757
grab_help_text (void)
3761
bool begin_comment = true;
3762
bool in_comment = true;
3763
bool discard_space = true;
3767
while ((c = yyinput ()) != EOF)
3771
if (c == '%' || c == '#')
3773
else if (discard_space && c == ' ')
3775
discard_space = false;
3779
begin_comment = false;
3784
buf += static_cast<char> (c);
3789
discard_space = true;
3798
maybe_gripe_matlab_incompatible_comment (octave_text[0]);
3800
begin_comment = true;
3816
yyunput (c, octave_text);
3821
// Return 1 if the given character matches any character in the given
3825
match_any (char c, const char *s)
3828
while ((tmp = *s++) != '\0')
3836
// Given information about the spacing surrounding an operator,
3837
// return 1 if it looks like it should be treated as a binary
3838
// operator. For example,
3840
// [ 1 + 2 ] or [ 1+ 2] or [ 1+2 ] ==> binary
3842
// [ 1 +2 ] ==> unary
3845
looks_like_bin_op (bool spc_prev, int next_char)
3847
bool spc_next = (next_char == ' ' || next_char == '\t');
3849
return ((spc_prev && spc_next) || ! spc_prev);
3852
// Recognize separators. If the separator is a CRLF pair, it is
3853
// replaced by a single LF.
3856
next_token_is_sep_op (void)
3858
bool retval = false;
3860
int c1 = yyinput ();
3864
int c2 = yyinput ();
3873
yyunput (c2, octave_text);
3876
retval = match_any (c1, ",;\n]");
3878
yyunput (c1, octave_text);
3883
// Try to determine if the next token should be treated as a postfix
3884
// unary operator. This is ugly, but it seems to do the right thing.
3887
next_token_is_postfix_unary_op (bool spc_prev)
3891
int c0 = yyinput ();
3893
if (c0 == '\'' && ! spc_prev)
3899
int c1 = yyinput ();
3900
un_op = (c1 == '\'');
3901
yyunput (c1, octave_text);
3905
int c1 = yyinput ();
3906
un_op = (c1 == '+');
3907
yyunput (c1, octave_text);
3911
int c1 = yyinput ();
3912
un_op = (c1 == '-');
3913
yyunput (c1, octave_text);
3916
yyunput (c0, octave_text);
3921
// Try to determine if the next token should be treated as a binary
3924
// This kluge exists because whitespace is not always ignored inside
3925
// the square brackets that are used to create matrix objects (though
3926
// spacing only really matters in the cases that can be interpreted
3927
// either as binary ops or prefix unary ops: currently just +, -).
3929
// Note that a line continuation directly following a + or - operator
3930
// (e.g., the characters '[' 'a' ' ' '+' '\' LFD 'b' ']') will be
3931
// parsed as a binary operator.
3934
next_token_is_bin_op (bool spc_prev)
3936
bool bin_op = false;
3938
int c0 = yyinput ();
3945
int c1 = yyinput ();
3951
// Unary ops, spacing doesn't matter.
3955
// Binary ops, spacing doesn't matter.
3960
// Could be either, spacing matters.
3961
bin_op = looks_like_bin_op (spc_prev, c1);
3965
yyunput (c1, octave_text);
3973
// Always a binary op (may also include /=, \=, and ^=).
3977
// .+ .- ./ .\ .^ .* .**
3980
int c1 = yyinput ();
3982
if (match_any (c1, "+-/\\^*"))
3983
// Always a binary op (may also include .+=, .-=, ./=, ...).
3985
else if (! isdigit (c1) && c1 != ' ' && c1 != '\t' && c1 != '.')
3986
// A structure element reference is a binary op.
3989
yyunput (c1, octave_text);
3993
// = == & && | || * **
3998
// Always a binary op (may also include ==, &&, ||, **).
4005
// Always a binary op (may also include <=, <>, >=).
4013
int c1 = yyinput ();
4015
// ~ and ! can be unary ops, so require following =.
4019
yyunput (c1, octave_text);
4027
yyunput (c0, octave_text);
4032
// Used to delete trailing white space from tokens.
4035
strip_trailing_whitespace (char *s)
4037
std::string retval = s;
4039
size_t pos = retval.find_first_of (" \t");
4042
retval.resize (pos);
4048
scan_for_comments (const char *text)
4050
std::string comment_buf;
4052
bool in_comment = false;
4053
bool beginning_of_comment = false;
4055
int len = strlen (text);
4068
if (! beginning_of_comment)
4069
comment_buf += static_cast<char> (c);
4073
maybe_gripe_matlab_incompatible_comment (c);
4075
beginning_of_comment = true;
4082
comment_buf += static_cast<char> (c);
4083
octave_comment_buffer::append (comment_buf);
4084
comment_buf.resize (0);
4086
beginning_of_comment = false;
4092
comment_buf += static_cast<char> (c);
4101
comment_buf += static_cast<char> (c);
4102
octave_comment_buffer::append (comment_buf);
4104
beginning_of_comment = false;
4112
comment_buf += static_cast<char> (c);
4113
beginning_of_comment = false;
4119
if (! comment_buf.empty ())
4120
octave_comment_buffer::append (comment_buf);
4123
// Discard whitespace, including comments and continuations.
4125
// Return value is logical OR of the following values:
4127
// ATE_NOTHING : no spaces to eat
4128
// ATE_SPACE_OR_TAB : space or tab in input
4129
// ATE_NEWLINE : bare new line in input
4132
eat_whitespace (void)
4134
yum_yum retval = ATE_NOTHING;
4136
std::string comment_buf;
4138
bool in_comment = false;
4139
bool beginning_of_comment = false;
4143
while ((c = yyinput ()) != EOF)
4145
current_input_column++;
4153
comment_buf += static_cast<char> (c);
4154
beginning_of_comment = false;
4156
retval |= ATE_SPACE_OR_TAB;
4160
retval |= ATE_NEWLINE;
4163
comment_buf += static_cast<char> (c);
4164
octave_comment_buffer::append (comment_buf);
4165
comment_buf.resize (0);
4167
beginning_of_comment = false;
4169
current_input_column = 0;
4176
if (! beginning_of_comment)
4177
comment_buf += static_cast<char> (c);
4181
maybe_gripe_matlab_incompatible_comment (c);
4183
beginning_of_comment = true;
4190
comment_buf += static_cast<char> (c);
4191
beginning_of_comment = false;
4196
if (have_ellipsis_continuation ())
4205
comment_buf += static_cast<char> (c);
4206
beginning_of_comment = false;
4211
if (have_continuation ())
4219
comment_buf += static_cast<char> (c);
4225
retval |= ATE_NEWLINE;
4228
comment_buf += static_cast<char> (c);
4229
octave_comment_buffer::append (comment_buf);
4231
beginning_of_comment = false;
4233
current_input_column = 0;
4242
comment_buf += static_cast<char> (c);
4243
beginning_of_comment = false;
4251
if (! comment_buf.empty ())
4252
octave_comment_buffer::append (comment_buf);
4255
yyunput (c, octave_text);
4256
current_input_column--;
4261
looks_like_hex (const char *s, int len)
4263
return (len > 2 && s[0] == '0' && (s[1] == 'x' || s[1] == 'X'));
4267
handle_number (void)
4272
if (looks_like_hex (octave_text, strlen (octave_text)))
4276
nread = sscanf (octave_text, "%lx", &ival);
4278
value = static_cast<double> (ival);
4282
char *tmp = strsave (octave_text);
4284
char *idx = strpbrk (tmp, "Dd");
4289
nread = sscanf (tmp, "%lf", &value);
4294
// If octave_text doesn't contain a valid number, we are in deep doo doo.
4296
assert (nread == 1);
4298
lexer_flags.quote_is_transpose = true;
4299
lexer_flags.convert_spaces_to_comma = true;
4301
yylval.tok_val = new token (value, octave_text, input_line_number,
4302
current_input_column);
4304
token_stack.push (yylval.tok_val);
4306
current_input_column += octave_leng;
4308
do_comma_insert_check ();
4311
// We have seen a backslash and need to find out if it should be
4312
// treated as a continuation character. If so, this eats it, up to
4313
// and including the new line character.
4315
// Match whitespace only, followed by a comment character or newline.
4316
// Once a comment character is found, discard all input until newline.
4317
// If non-whitespace characters are found before comment
4318
// characters, return 0. Otherwise, return 1.
4321
have_continuation (bool trailing_comments_ok)
4323
std::ostringstream buf;
4325
std::string comment_buf;
4327
bool in_comment = false;
4328
bool beginning_of_comment = false;
4332
while ((c = yyinput ()) != EOF)
4334
buf << static_cast<char> (c);
4342
comment_buf += static_cast<char> (c);
4343
beginning_of_comment = false;
4349
if (trailing_comments_ok)
4353
if (! beginning_of_comment)
4354
comment_buf += static_cast<char> (c);
4358
maybe_gripe_matlab_incompatible_comment (c);
4360
beginning_of_comment = true;
4370
comment_buf += static_cast<char> (c);
4371
octave_comment_buffer::append (comment_buf);
4373
current_input_column = 0;
4375
gripe_matlab_incompatible_continuation ();
4380
comment_buf += static_cast<char> (c);
4388
comment_buf += static_cast<char> (c);
4389
octave_comment_buffer::append (comment_buf);
4391
current_input_column = 0;
4393
gripe_matlab_incompatible_continuation ();
4402
comment_buf += static_cast<char> (c);
4403
beginning_of_comment = false;
4411
yyunput (c, octave_text);
4416
std::string s = buf.str ();
4418
int len = s.length ();
4420
yyunput (s[len], octave_text);
4425
// We have seen a `.' and need to see if it is the start of a
4426
// continuation. If so, this eats it, up to and including the new
4430
have_ellipsis_continuation (bool trailing_comments_ok)
4432
char c1 = yyinput ();
4435
char c2 = yyinput ();
4436
if (c2 == '.' && have_continuation (trailing_comments_ok))
4440
yyunput (c2, octave_text);
4441
yyunput (c1, octave_text);
4445
yyunput (c1, octave_text);
4450
// See if we have a continuation line. If so, eat it and the leading
4451
// whitespace on the next line.
4453
// Return value is the same as described for eat_whitespace().
4456
eat_continuation (void)
4458
int retval = ATE_NOTHING;
4462
if ((c == '.' && have_ellipsis_continuation ())
4463
|| (c == '\\' && have_continuation ()))
4464
retval = eat_whitespace ();
4466
yyunput (c, octave_text);
4472
handle_string (char delim, int text_style)
4474
std::ostringstream buf;
4476
int bos_line = input_line_number;
4477
int bos_col = current_input_column;
4480
int escape_pending = 0;
4482
while ((c = yyinput ()) != EOF)
4484
current_input_column++;
4488
if (delim == '\'' || escape_pending)
4490
buf << static_cast<char> (c);
4495
if (have_continuation (false))
4499
buf << static_cast<char> (c);
4507
if (delim == '\'' || ! have_ellipsis_continuation (false))
4508
buf << static_cast<char> (c);
4512
error ("unterminated string constant");
4515
else if (c == delim)
4518
buf << static_cast<char> (c);
4524
buf << static_cast<char> (c);
4525
if (lexer_flags.doing_rawcommand)
4526
buf << static_cast<char> (c);
4531
yyunput (c, octave_text);
4533
if (lexer_flags.doing_rawcommand || delim == '\'')
4536
s = do_string_escapes (buf.str ());
4538
if (text_style && lexer_flags.doing_rawcommand)
4539
s = std::string (1, delim) + s + std::string (1, delim);
4542
lexer_flags.quote_is_transpose = true;
4543
lexer_flags.convert_spaces_to_comma = true;
4546
yylval.tok_val = new token (s, bos_line, bos_col);
4547
token_stack.push (yylval.tok_val);
4550
gripe_matlab_incompatible ("\" used as string delimiter");
4551
else if (delim == '\'')
4552
gripe_single_quote_string ();
4554
return delim == '"' ? DQ_STRING : SQ_STRING;
4560
buf << static_cast<char> (c);
4566
return LEXICAL_ERROR;
4570
next_token_is_assign_op (void)
4572
bool retval = false;
4574
int c0 = yyinput ();
4580
int c1 = yyinput ();
4581
yyunput (c1, octave_text);
4595
int c1 = yyinput ();
4596
yyunput (c1, octave_text);
4604
int c1 = yyinput ();
4605
if (match_any (c1, "+-*/\\"))
4607
int c2 = yyinput ();
4608
yyunput (c2, octave_text);
4612
yyunput (c1, octave_text);
4618
int c1 = yyinput ();
4621
int c2 = yyinput ();
4622
yyunput (c2, octave_text);
4626
yyunput (c1, octave_text);
4632
int c1 = yyinput ();
4635
int c2 = yyinput ();
4636
yyunput (c2, octave_text);
4640
yyunput (c1, octave_text);
4648
yyunput (c0, octave_text);
4654
next_token_is_index_op (void)
4657
yyunput (c, octave_text);
4658
return c == '(' || c == '{';
4662
handle_close_bracket (bool spc_gobbled, int bracket_type)
4664
int retval = bracket_type;
4666
if (! nesting_level.none ())
4668
nesting_level.remove ();
4670
if (bracket_type == ']')
4671
lexer_flags.bracketflag--;
4672
else if (bracket_type == '}')
4673
lexer_flags.braceflag--;
4675
panic_impossible ();
4678
if (lexer_flags.bracketflag == 0 && lexer_flags.braceflag == 0)
4681
if (bracket_type == ']'
4682
&& next_token_is_assign_op ()
4683
&& ! lexer_flags.looking_at_return_list)
4685
retval = CLOSE_BRACE;
4687
else if ((lexer_flags.bracketflag || lexer_flags.braceflag)
4688
&& lexer_flags.convert_spaces_to_comma
4689
&& (nesting_level.is_bracket ()
4690
|| (nesting_level.is_brace ()
4691
&& ! lexer_flags.looking_at_object_index)))
4693
bool index_op = next_token_is_index_op ();
4695
// Don't insert comma if we are looking at something like
4697
// [x{i}{j}] or [x{i}(j)]
4699
// but do if we are looking at
4701
// [x{i} {j}] or [x{i} (j)]
4703
if (spc_gobbled || ! (bracket_type == '}' && index_op))
4705
bool bin_op = next_token_is_bin_op (spc_gobbled);
4707
bool postfix_un_op = next_token_is_postfix_unary_op (spc_gobbled);
4709
bool sep_op = next_token_is_sep_op ();
4711
if (! (postfix_un_op || bin_op || sep_op))
4713
maybe_warn_separator_insert (',');
4715
yyunput (',', octave_text);
4721
lexer_flags.quote_is_transpose = true;
4722
lexer_flags.convert_spaces_to_comma = true;
4728
maybe_unput_comma (int spc_gobbled)
4730
if (nesting_level.is_bracket ()
4731
|| (nesting_level.is_brace ()
4732
&& ! lexer_flags.looking_at_object_index))
4734
int bin_op = next_token_is_bin_op (spc_gobbled);
4736
int postfix_un_op = next_token_is_postfix_unary_op (spc_gobbled);
4738
int c1 = yyinput ();
4739
int c2 = yyinput ();
4741
yyunput (c2, octave_text);
4742
yyunput (c1, octave_text);
4744
int sep_op = next_token_is_sep_op ();
4746
int dot_op = (c1 == '.'
4747
&& (isalpha (c2) || isspace (c2) || c2 == '_'));
4749
if (postfix_un_op || bin_op || sep_op || dot_op)
4752
int index_op = (c1 == '(' || c1 == '{');
4754
// If there is no space before the indexing op, we don't insert
4757
if (index_op && ! spc_gobbled)
4760
maybe_warn_separator_insert (',');
4762
yyunput (',', octave_text);
4766
// Figure out exactly what kind of token to return when we have seen
4767
// an identifier. Handles keywords. Return -1 if the identifier
4768
// should be ignored.
4771
handle_identifier (void)
4773
std::string tok = strip_trailing_whitespace (octave_text);
4775
int c = octave_text[octave_leng-1];
4777
int cont_is_spc = eat_continuation ();
4779
int spc_gobbled = (cont_is_spc || c == ' ' || c == '\t');
4781
// If we are expecting a structure element, avoid recognizing
4782
// keywords and other special names and return STRUCT_ELT, which is
4783
// a string that is also a valid identifier. But first, we have to
4784
// decide whether to insert a comma.
4786
if (lexer_flags.looking_at_indirect_ref)
4788
do_comma_insert_check ();
4790
maybe_unput_comma (spc_gobbled);
4792
yylval.tok_val = new token (tok, input_line_number,
4793
current_input_column);
4795
token_stack.push (yylval.tok_val);
4797
lexer_flags.quote_is_transpose = true;
4798
lexer_flags.convert_spaces_to_comma = true;
4800
current_input_column += octave_leng;
4805
int kw_token = is_keyword_token (tok);
4807
if (lexer_flags.looking_at_function_handle)
4811
error ("function handles may not refer to keywords");
4813
return LEXICAL_ERROR;
4816
TOK_PUSH_AND_RETURN (tok, FCN_HANDLE);
4819
// If we have a regular keyword, return it.
4820
// Keywords can be followed by identifiers (TOK_RETURN handles
4828
TOK_RETURN (kw_token);
4831
// See if we have a plot keyword (title, using, with, or clear).
4833
int c1 = yyinput ();
4835
bool next_tok_is_paren = (c1 == '(');
4837
bool next_tok_is_eq = false;
4840
int c2 = yyinput ();
4841
yyunput (c2, octave_text);
4844
next_tok_is_eq = true;
4847
yyunput (c1, octave_text);
4849
// Make sure we put the return values of a function in the symbol
4850
// table that is local to the function.
4852
// If we are defining a function and we have not seen the function
4853
// name yet and the next token is `=', then this identifier must be
4854
// the only return value for the function and it belongs in the
4855
// local symbol table.
4858
&& lexer_flags.defining_func
4859
&& ! lexer_flags.parsed_function_name)
4860
curr_sym_tab = tmp_local_sym_tab;
4864
// If we are looking at a text style function, set up to gobble its
4867
// If the following token is `=', or if we are parsing a function
4868
// return list or function parameter list, or if we are looking at
4869
// something like [ab,cd] = foo (), force the symbol to be inserted
4870
// as a variable in the current symbol table.
4872
if (is_command_name (tok) && ! is_variable (tok))
4875
|| lexer_flags.looking_at_return_list
4876
|| lexer_flags.looking_at_parameter_list
4877
|| lexer_flags.looking_at_matrix_or_assign_lhs)
4879
force_local_variable (tok);
4881
else if (! (next_tok_is_paren || lexer_flags.looking_at_object_index))
4883
BEGIN (COMMAND_START);
4886
if (is_rawcommand_name (tok) && ! lexer_flags.looking_at_object_index)
4888
lexer_flags.doing_rawcommand = true;
4889
BEGIN (COMMAND_START);
4893
// Find the token in the symbol table. Beware the magic
4894
// transformation of the end keyword...
4899
yylval.tok_val = new token (lookup_identifier (tok),
4901
current_input_column);
4903
token_stack.push (yylval.tok_val);
4905
// After seeing an identifer, it is ok to convert spaces to a comma
4908
lexer_flags.convert_spaces_to_comma = true;
4910
if (! next_tok_is_eq)
4912
lexer_flags.quote_is_transpose = true;
4914
do_comma_insert_check ();
4916
maybe_unput_comma (spc_gobbled);
4919
current_input_column += octave_leng;
4925
lexical_feedback::init (void)
4927
// Not initially defining a matrix list.
4930
// Not initially defining a cell array list.
4933
// Not initially inside a loop or if statement.
4936
// Not initially defining a function.
4937
beginning_of_function = false;
4938
defining_func = false;
4939
parsed_function_name = false;
4940
parsing_nested_function = 0;
4942
// Not initiallly looking at a function handle.
4943
looking_at_function_handle = 0;
4945
// Not parsing a function return or parameter list.
4946
looking_at_return_list = false;
4947
looking_at_parameter_list = false;
4949
// Not parsing a matrix or the left hand side of multi-value
4950
// assignment statement.
4951
looking_at_matrix_or_assign_lhs = false;
4953
// Not parsing an object index.
4954
looking_at_object_index = 0;
4956
// No need to do comma insert or convert spaces to comma at
4957
// beginning of input.
4958
convert_spaces_to_comma = true;
4959
do_comma_insert = false;
4961
// Not initially doing any plotting or setting of plot attributes.
4962
doing_rawcommand = false;
4964
// Not initially looking at indirect references.
4965
looking_at_indirect_ref = false;
4967
// Quote marks strings intially.
4968
quote_is_transpose = false;
4972
is_keyword (const std::string& s)
4974
return octave_kw_hash::in_word_set (s.c_str (), s.length ()) != 0;
4977
DEFCMD (iskeyword, args, ,
4979
@deftypefn {Built-in Function} {} iskeyword (@var{name})\n\
4980
Return true if @var{name} is an Octave keyword. If @var{name}\n\
4981
is omitted, return a list of keywords.\n\
4984
octave_value retval;
4986
int argc = args.length () + 1;
4988
string_vector argv = args.make_argv ("iskeyword");
4995
string_vector lst (TOTAL_KEYWORDS);
4997
for (int i = 0; i < TOTAL_KEYWORDS; i++)
4998
lst[i] = wordlist[i].name;
5000
retval = Cell (lst.qsort ());
5004
retval = is_keyword (argv[1]);
5014
maybe_warn_separator_insert (char sep)
5016
std::string nm = curr_fcn_file_full_name;
5019
warning_with_id ("Octave:separator-insert",
5020
"potential auto-insertion of `%c' near line %d",
5021
sep, input_line_number);
5023
warning_with_id ("Octave:separator-insert",
5024
"potential auto-insertion of `%c' near line %d of file %s",
5025
sep, input_line_number, nm.c_str ());
5029
gripe_single_quote_string (void)
5031
std::string nm = curr_fcn_file_full_name;
5034
warning_with_id ("Octave:single-quote-string",
5035
"single quote delimited string near line %d",
5038
warning_with_id ("Octave:single-quote-string",
5039
"single quote delimited string near line %d of file %s",
5040
input_line_number, nm.c_str ());
5044
gripe_matlab_incompatible (const std::string& msg)
5046
warning_with_id ("Octave:matlab-incompatible",
5047
"potential Matlab compatibility problem: %s",
5052
maybe_gripe_matlab_incompatible_comment (char c)
5055
gripe_matlab_incompatible ("# used as comment character");
5059
gripe_matlab_incompatible_continuation (void)
5061
gripe_matlab_incompatible ("\\ used as line continuation marker");
5065
gripe_matlab_incompatible_operator (const std::string& op)
5068
int n = t.length ();
5071
gripe_matlab_incompatible (t + " used as operator");
5074
DEFUN (__token_count__, , ,
5076
@deftypefn {Built-in Function} {} __token_count__\n\
5077
Number of language tokens processed since Octave startup.\n\
5080
return octave_value (Vtoken_count);
5084
;;; Local Variables: ***