GNU Octave 7.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
lex.cc
Go to the documentation of this file.
1////////////////////////////////////////////////////////////////////////
2//
3// Copyright (C) 1993-2022 The Octave Project Developers
4//
5// See the file COPYRIGHT.md in the top-level directory of this
6// distribution or <https://octave.org/copyright/>.
7//
8// This file is part of Octave.
9//
10// Octave is free software: you can redistribute it and/or modify it
11// under the terms of the GNU General Public License as published by
12// the Free Software Foundation, either version 3 of the License, or
13// (at your option) any later version.
14//
15// Octave is distributed in the hope that it will be useful, but
16// WITHOUT ANY WARRANTY; without even the implied warranty of
17// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18// GNU General Public License for more details.
19//
20// You should have received a copy of the GNU General Public License
21// along with Octave; see the file COPYING. If not, see
22// <https://www.gnu.org/licenses/>.
23//
24////////////////////////////////////////////////////////////////////////
25
26#if defined (HAVE_CONFIG_H)
27# include "config.h"
28#endif
29
30#if defined (HAVE_PRAGMA_GCC_DIAGNOSTIC)
31 // This one needs to be global.
32# pragma GCC diagnostic ignored "-Wunused-function"
33 // Disable these warnings for code that is generated by flex,
34 // including pattern rules. Push the current state so we can
35 // restore the warning state prior to functions we define at
36 // the bottom of the file.
37# pragma GCC diagnostic push
38# pragma GCC diagnostic ignored "-Wold-style-cast"
39# pragma GCC diagnostic ignored "-Wsign-compare"
40# pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant"
41# if defined (HAVE_WARN_IMPLICIT_FALLTHROUGH)
42# pragma GCC diagnostic ignored "-Wimplicit-fallthrough"
43# endif
44#endif
45
46// Define away the deprecated register storage class specifier to avoid
47// potential warnings about it.
48#if ! defined (register)
49# define register
50#endif
51
52#line 53 "libinterp/parse-tree/lex.cc"
53
54#define YY_INT_ALIGNED short int
55
56/* A lexical scanner generated by flex */
57
58#define FLEX_SCANNER
59#define YY_FLEX_MAJOR_VERSION 2
60#define YY_FLEX_MINOR_VERSION 6
61#define YY_FLEX_SUBMINOR_VERSION 4
62#if YY_FLEX_SUBMINOR_VERSION > 0
63#define FLEX_BETA
64#endif
65
66#ifdef yy_create_buffer
67#define octave__create_buffer_ALREADY_DEFINED
68#else
69#define yy_create_buffer octave__create_buffer
70#endif
71
72#ifdef yy_delete_buffer
73#define octave__delete_buffer_ALREADY_DEFINED
74#else
75#define yy_delete_buffer octave__delete_buffer
76#endif
77
78#ifdef yy_scan_buffer
79#define octave__scan_buffer_ALREADY_DEFINED
80#else
81#define yy_scan_buffer octave__scan_buffer
82#endif
83
84#ifdef yy_scan_string
85#define octave__scan_string_ALREADY_DEFINED
86#else
87#define yy_scan_string octave__scan_string
88#endif
89
90#ifdef yy_scan_bytes
91#define octave__scan_bytes_ALREADY_DEFINED
92#else
93#define yy_scan_bytes octave__scan_bytes
94#endif
95
96#ifdef yy_init_buffer
97#define octave__init_buffer_ALREADY_DEFINED
98#else
99#define yy_init_buffer octave__init_buffer
100#endif
101
102#ifdef yy_flush_buffer
103#define octave__flush_buffer_ALREADY_DEFINED
104#else
105#define yy_flush_buffer octave__flush_buffer
106#endif
107
108#ifdef yy_load_buffer_state
109#define octave__load_buffer_state_ALREADY_DEFINED
110#else
111#define yy_load_buffer_state octave__load_buffer_state
112#endif
113
114#ifdef yy_switch_to_buffer
115#define octave__switch_to_buffer_ALREADY_DEFINED
116#else
117#define yy_switch_to_buffer octave__switch_to_buffer
118#endif
119
120#ifdef yypush_buffer_state
121#define octave_push_buffer_state_ALREADY_DEFINED
122#else
123#define yypush_buffer_state octave_push_buffer_state
124#endif
125
126#ifdef yypop_buffer_state
127#define octave_pop_buffer_state_ALREADY_DEFINED
128#else
129#define yypop_buffer_state octave_pop_buffer_state
130#endif
131
132#ifdef yyensure_buffer_stack
133#define octave_ensure_buffer_stack_ALREADY_DEFINED
134#else
135#define yyensure_buffer_stack octave_ensure_buffer_stack
136#endif
137
138#ifdef yylex
139#define octave_lex_ALREADY_DEFINED
140#else
141#define yylex octave_lex
142#endif
143
144#ifdef yyrestart
145#define octave_restart_ALREADY_DEFINED
146#else
147#define yyrestart octave_restart
148#endif
149
150#ifdef yylex_init
151#define octave_lex_init_ALREADY_DEFINED
152#else
153#define yylex_init octave_lex_init
154#endif
155
156#ifdef yylex_init_extra
157#define octave_lex_init_extra_ALREADY_DEFINED
158#else
159#define yylex_init_extra octave_lex_init_extra
160#endif
161
162#ifdef yylex_destroy
163#define octave_lex_destroy_ALREADY_DEFINED
164#else
165#define yylex_destroy octave_lex_destroy
166#endif
167
168#ifdef yyget_debug
169#define octave_get_debug_ALREADY_DEFINED
170#else
171#define yyget_debug octave_get_debug
172#endif
173
174#ifdef yyset_debug
175#define octave_set_debug_ALREADY_DEFINED
176#else
177#define yyset_debug octave_set_debug
178#endif
179
180#ifdef yyget_extra
181#define octave_get_extra_ALREADY_DEFINED
182#else
183#define yyget_extra octave_get_extra
184#endif
185
186#ifdef yyset_extra
187#define octave_set_extra_ALREADY_DEFINED
188#else
189#define yyset_extra octave_set_extra
190#endif
191
192#ifdef yyget_in
193#define octave_get_in_ALREADY_DEFINED
194#else
195#define yyget_in octave_get_in
196#endif
197
198#ifdef yyset_in
199#define octave_set_in_ALREADY_DEFINED
200#else
201#define yyset_in octave_set_in
202#endif
203
204#ifdef yyget_out
205#define octave_get_out_ALREADY_DEFINED
206#else
207#define yyget_out octave_get_out
208#endif
209
210#ifdef yyset_out
211#define octave_set_out_ALREADY_DEFINED
212#else
213#define yyset_out octave_set_out
214#endif
215
216#ifdef yyget_leng
217#define octave_get_leng_ALREADY_DEFINED
218#else
219#define yyget_leng octave_get_leng
220#endif
221
222#ifdef yyget_text
223#define octave_get_text_ALREADY_DEFINED
224#else
225#define yyget_text octave_get_text
226#endif
227
228#ifdef yyget_lineno
229#define octave_get_lineno_ALREADY_DEFINED
230#else
231#define yyget_lineno octave_get_lineno
232#endif
233
234#ifdef yyset_lineno
235#define octave_set_lineno_ALREADY_DEFINED
236#else
237#define yyset_lineno octave_set_lineno
238#endif
239
240#ifdef yyget_column
241#define octave_get_column_ALREADY_DEFINED
242#else
243#define yyget_column octave_get_column
244#endif
245
246#ifdef yyset_column
247#define octave_set_column_ALREADY_DEFINED
248#else
249#define yyset_column octave_set_column
250#endif
251
252#ifdef yywrap
253#define octave_wrap_ALREADY_DEFINED
254#else
255#define yywrap octave_wrap
256#endif
257
258#ifdef yyget_lval
259#define octave_get_lval_ALREADY_DEFINED
260#else
261#define yyget_lval octave_get_lval
262#endif
263
264#ifdef yyset_lval
265#define octave_set_lval_ALREADY_DEFINED
266#else
267#define yyset_lval octave_set_lval
268#endif
269
270#ifdef yyalloc
271#define octave_alloc_ALREADY_DEFINED
272#else
273#define yyalloc octave_alloc
274#endif
275
276#ifdef yyrealloc
277#define octave_realloc_ALREADY_DEFINED
278#else
279#define yyrealloc octave_realloc
280#endif
281
282#ifdef yyfree
283#define octave_free_ALREADY_DEFINED
284#else
285#define yyfree octave_free
286#endif
287
288/* First, we deal with platform-specific or compiler-specific issues. */
289
290/* begin standard C headers. */
291#include <stdio.h>
292#include <string.h>
293#include <errno.h>
294#include <stdlib.h>
295
296/* end standard C headers. */
297
298/* flex integer type definitions */
299
300#ifndef FLEXINT_H
301#define FLEXINT_H
302
303/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
304
305#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
306
307/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
308 * if you want the limit (max/min) macros for int types.
309 */
310#ifndef __STDC_LIMIT_MACROS
311#define __STDC_LIMIT_MACROS 1
312#endif
313
314#include <inttypes.h>
315typedef int8_t flex_int8_t;
316typedef uint8_t flex_uint8_t;
317typedef int16_t flex_int16_t;
318typedef uint16_t flex_uint16_t;
319typedef int32_t flex_int32_t;
320typedef uint32_t flex_uint32_t;
321#else
322typedef signed char flex_int8_t;
323typedef short int flex_int16_t;
324typedef int flex_int32_t;
325typedef unsigned char flex_uint8_t;
326typedef unsigned short int flex_uint16_t;
327typedef unsigned int flex_uint32_t;
328
329/* Limits of integral types. */
330#ifndef INT8_MIN
331#define INT8_MIN (-128)
332#endif
333#ifndef INT16_MIN
334#define INT16_MIN (-32767-1)
335#endif
336#ifndef INT32_MIN
337#define INT32_MIN (-2147483647-1)
338#endif
339#ifndef INT8_MAX
340#define INT8_MAX (127)
341#endif
342#ifndef INT16_MAX
343#define INT16_MAX (32767)
344#endif
345#ifndef INT32_MAX
346#define INT32_MAX (2147483647)
347#endif
348#ifndef UINT8_MAX
349#define UINT8_MAX (255U)
350#endif
351#ifndef UINT16_MAX
352#define UINT16_MAX (65535U)
353#endif
354#ifndef UINT32_MAX
355#define UINT32_MAX (4294967295U)
356#endif
357
358#ifndef SIZE_MAX
359#define SIZE_MAX (~(size_t)0)
360#endif
361
362#endif /* ! C99 */
363
364#endif /* ! FLEXINT_H */
365
366/* begin standard C++ headers. */
367
368/* TODO: this is always defined, so inline it */
369#define yyconst const
370
371#if defined(__GNUC__) && __GNUC__ >= 3
372#define yynoreturn __attribute__((__noreturn__))
373#else
374#define yynoreturn
375#endif
376
377/* Returned upon end-of-file. */
378#define YY_NULL 0
379
380/* Promotes a possibly negative, possibly signed char to an
381 * integer in range [0..255] for use as an array index.
382 */
383#define YY_SC_TO_UI(c) ((YY_CHAR) (c))
384
385/* An opaque pointer. */
386#ifndef YY_TYPEDEF_YY_SCANNER_T
387#define YY_TYPEDEF_YY_SCANNER_T
388typedef void* yyscan_t;
389#endif
390
391/* For convenience, these vars (plus the bison vars far below)
392 are macros in the reentrant scanner. */
393#define yyin yyg->yyin_r
394#define yyout yyg->yyout_r
395#define yyextra yyg->yyextra_r
396#define yyleng yyg->yyleng_r
397#define yytext yyg->yytext_r
398#define yylineno (YY_CURRENT_BUFFER_LVALUE->yy_bs_lineno)
399#define yycolumn (YY_CURRENT_BUFFER_LVALUE->yy_bs_column)
400#define yy_flex_debug yyg->yy_flex_debug_r
401
402/* Enter a start condition. This macro really ought to take a parameter,
403 * but we do it the disgusting crufty way forced on us by the ()-less
404 * definition of BEGIN.
405 */
406#define BEGIN yyg->yy_start = 1 + 2 *
407/* Translate the current start state into a value that can be later handed
408 * to BEGIN to return to the state. The YYSTATE alias is for lex
409 * compatibility.
410 */
411#define YY_START ((yyg->yy_start - 1) / 2)
412#define YYSTATE YY_START
413/* Action number for EOF rule of a given start state. */
414#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
415/* Special action meaning "start processing a new file". */
416#define YY_NEW_FILE yyrestart( yyin , yyscanner )
417#define YY_END_OF_BUFFER_CHAR 0
418
419/* Size of default input buffer. */
420#ifndef YY_BUF_SIZE
421#ifdef __ia64__
422/* On IA-64, the buffer size is 16k, not 8k.
423 * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
424 * Ditto for the __ia64__ case accordingly.
425 */
426#define YY_BUF_SIZE 32768
427#else
428#define YY_BUF_SIZE 16384
429#endif /* __ia64__ */
430#endif
431
432/* The state buf must be large enough to hold one state per character in the main buffer.
433 */
434#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
435
436#ifndef YY_TYPEDEF_YY_BUFFER_STATE
437#define YY_TYPEDEF_YY_BUFFER_STATE
439#endif
440
441#ifndef YY_TYPEDEF_YY_SIZE_T
442#define YY_TYPEDEF_YY_SIZE_T
443typedef size_t yy_size_t;
444#endif
445
446#define EOB_ACT_CONTINUE_SCAN 0
447#define EOB_ACT_END_OF_FILE 1
448#define EOB_ACT_LAST_MATCH 2
449
450 #define YY_LESS_LINENO(n)
451 #define YY_LINENO_REWIND_TO(ptr)
452
453/* Return all but the first "n" matched characters back to the input stream. */
454#define yyless(n) \
455 do \
456 { \
457 /* Undo effects of setting up yytext. */ \
458 int yyless_macro_arg = (n); \
459 YY_LESS_LINENO(yyless_macro_arg);\
460 *yy_cp = yyg->yy_hold_char; \
461 YY_RESTORE_YY_MORE_OFFSET \
462 yyg->yy_c_buf_p = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
463 YY_DO_BEFORE_ACTION; /* set up yytext again */ \
464 } \
465 while ( 0 )
466#define unput(c) yyunput( c, yyg->yytext_ptr , yyscanner )
467
468#ifndef YY_STRUCT_YY_BUFFER_STATE
469#define YY_STRUCT_YY_BUFFER_STATE
470struct yy_buffer_state
471 {
472 FILE *yy_input_file;
473
474 char *yy_ch_buf; /* input buffer */
475 char *yy_buf_pos; /* current position in input buffer */
476
477 /* Size of input buffer in bytes, not including room for EOB
478 * characters.
479 */
480 int yy_buf_size;
481
482 /* Number of characters read into yy_ch_buf, not including EOB
483 * characters.
484 */
485 int yy_n_chars;
486
487 /* Whether we "own" the buffer - i.e., we know we created it,
488 * and can realloc() it to grow it, and should free() it to
489 * delete it.
490 */
492
493 /* Whether this is an "interactive" input source; if so, and
494 * if we're using stdio for input, then we want to use getc()
495 * instead of fread(), to make sure we stop fetching input after
496 * each newline.
497 */
499
500 /* Whether we're considered to be at the beginning of a line.
501 * If so, '^' rules will be active on the next match, otherwise
502 * not.
503 */
504 int yy_at_bol;
505
506 int yy_bs_lineno; /**< The line count. */
507 int yy_bs_column; /**< The column count. */
508
509 /* Whether to try to fill the input buffer when we reach the
510 * end of it.
511 */
512 int yy_fill_buffer;
513
515
516#define YY_BUFFER_NEW 0
517#define YY_BUFFER_NORMAL 1
518 /* When an EOF's been seen but there's still some text to process
519 * then we mark the buffer as YY_EOF_PENDING, to indicate that we
520 * shouldn't try reading from the input source any more. We might
521 * still have a bunch of tokens to match, though, because of
522 * possible backing-up.
523 *
524 * When we actually see the EOF, we change the status to "new"
525 * (via yyrestart()), so that the user can continue scanning by
526 * just pointing yyin at a new input file.
527 */
528#define YY_BUFFER_EOF_PENDING 2
529
530 };
531#endif /* !YY_STRUCT_YY_BUFFER_STATE */
532
533/* We provide macros for accessing buffer states in case in the
534 * future we want to put the buffer states in a more general
535 * "scanner state".
536 *
537 * Returns the top of the stack, or NULL.
538 */
539#define YY_CURRENT_BUFFER ( yyg->yy_buffer_stack \
540 ? yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] \
541 : NULL)
542/* Same as previous macro, but useful when we know that the buffer stack is not
543 * NULL or when we need an lvalue. For internal use only.
544 */
545#define YY_CURRENT_BUFFER_LVALUE yyg->yy_buffer_stack[yyg->yy_buffer_stack_top]
546
547void yyrestart ( FILE *input_file , yyscan_t yyscanner );
548void yy_switch_to_buffer ( YY_BUFFER_STATE new_buffer , yyscan_t yyscanner );
549YY_BUFFER_STATE yy_create_buffer ( FILE *file, int size , yyscan_t yyscanner );
550void yy_delete_buffer ( YY_BUFFER_STATE b , yyscan_t yyscanner );
551void yy_flush_buffer ( YY_BUFFER_STATE b , yyscan_t yyscanner );
552void yypush_buffer_state ( YY_BUFFER_STATE new_buffer , yyscan_t yyscanner );
553void yypop_buffer_state ( yyscan_t yyscanner );
554
555static void yyensure_buffer_stack ( yyscan_t yyscanner );
556static void yy_load_buffer_state ( yyscan_t yyscanner );
557static void yy_init_buffer ( YY_BUFFER_STATE b, FILE *file , yyscan_t yyscanner );
558#define YY_FLUSH_BUFFER yy_flush_buffer( YY_CURRENT_BUFFER , yyscanner)
559
560YY_BUFFER_STATE yy_scan_buffer ( char *base, yy_size_t size , yyscan_t yyscanner );
561YY_BUFFER_STATE yy_scan_string ( const char *yy_str , yyscan_t yyscanner );
562YY_BUFFER_STATE yy_scan_bytes ( const char *bytes, int len , yyscan_t yyscanner );
563
564void *yyalloc ( yy_size_t , yyscan_t yyscanner );
565void *yyrealloc ( void *, yy_size_t , yyscan_t yyscanner );
566void yyfree ( void * , yyscan_t yyscanner );
567
568#define yy_new_buffer yy_create_buffer
569#define yy_set_interactive(is_interactive) \
570 { \
571 if ( ! YY_CURRENT_BUFFER ){ \
572 yyensure_buffer_stack (yyscanner); \
573 YY_CURRENT_BUFFER_LVALUE = \
574 yy_create_buffer( yyin, YY_BUF_SIZE , yyscanner); \
575 } \
576 YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
577 }
578#define yy_set_bol(at_bol) \
579 { \
580 if ( ! YY_CURRENT_BUFFER ){\
581 yyensure_buffer_stack (yyscanner); \
582 YY_CURRENT_BUFFER_LVALUE = \
583 yy_create_buffer( yyin, YY_BUF_SIZE , yyscanner); \
584 } \
585 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
586 }
587#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
588
589/* Begin user sect3 */
590
591#define octave_wrap(yyscanner) (/*CONSTCOND*/1)
592#define YY_SKIP_YYWRAP
594
595typedef int yy_state_type;
596
597#define yytext_ptr yytext_r
598
599static yy_state_type yy_get_previous_state ( yyscan_t yyscanner );
600static yy_state_type yy_try_NUL_trans ( yy_state_type current_state , yyscan_t yyscanner);
601static int yy_get_next_buffer ( yyscan_t yyscanner );
602static void yynoreturn yy_fatal_error ( const char* msg , yyscan_t yyscanner );
603
604/* Done after the current pattern has been matched and before the
605 * corresponding action - sets up yytext.
606 */
607#define YY_DO_BEFORE_ACTION \
608 yyg->yytext_ptr = yy_bp; \
609 yyleng = (int) (yy_cp - yy_bp); \
610 yyg->yy_hold_char = *yy_cp; \
611 *yy_cp = '\0'; \
612 yyg->yy_c_buf_p = yy_cp;
613#define YY_NUM_RULES 124
614#define YY_END_OF_BUFFER 125
615/* This struct is not used in this scanner,
616 but its presence is necessary. */
617struct yy_trans_info
618 {
621 };
622static const flex_int16_t yy_accept[314] =
623 { 0,
624 0, 0, 5, 5, 10, 10, 0, 0, 0, 0,
625 0, 0, 0, 0, 0, 0, 0, 0, 125, 123,
626 55, 65, 65, 96, 67, 123, 60, 81, 66, 101,
627 102, 85, 93, 97, 94, 103, 86, 53, 53, 68,
628 92, 83, 104, 84, 123, 63, 15, 87, 16, 88,
629 60, 60, 121, 82, 122, 95, 55, 123, 9, 8,
630 3, 3, 7, 124, 5, 6, 4, 9, 10, 11,
631 11, 103, 13, 14, 10, 1, 1, 124, 20, 20,
632 124, 124, 24, 24, 24, 24, 24, 24, 41, 42,
633 42, 26, 40, 124, 45, 46, 46, 44, 50, 48,
634
635 50, 47, 50, 55, 0, 65, 78, 0, 21, 21,
636 0, 60, 0, 0, 90, 119, 89, 107, 99, 105,
637 100, 106, 98, 71, 69, 70, 0, 72, 53, 73,
638 74, 108, 53, 53, 0, 0, 53, 0, 76, 77,
639 80, 0, 62, 0, 64, 0, 57, 57, 0, 109,
640 115, 60, 60, 120, 91, 79, 55, 0, 0, 9,
641 8, 3, 0, 3, 5, 6, 0, 10, 11, 0,
642 10, 1, 0, 20, 20, 0, 0, 0, 0, 0,
643 0, 24, 0, 23, 23, 0, 0, 0, 41, 42,
644 25, 0, 39, 39, 38, 38, 27, 29, 30, 31,
645
646 32, 33, 34, 35, 39, 45, 46, 43, 48, 50,
647 0, 47, 0, 0, 0, 0, 0, 61, 116, 75,
648 112, 110, 111, 0, 113, 53, 114, 117, 52, 51,
649 0, 53, 54, 0, 62, 0, 0, 64, 0, 0,
650 58, 58, 60, 0, 17, 17, 0, 0, 0, 18,
651 18, 0, 19, 19, 0, 22, 22, 0, 0, 37,
652 37, 27, 28, 0, 47, 0, 0, 0, 61, 0,
653 118, 0, 56, 56, 51, 0, 53, 54, 0, 0,
654 62, 0, 64, 0, 59, 0, 2, 2, 0, 12,
655 12, 0, 36, 36, 27, 47, 0, 49, 49, 0,
656
657 61, 0, 0, 0, 51, 0, 0, 0, 54, 62,
658 64, 61, 0
659 } ;
660
661static const YY_CHAR yy_ec[256] =
662 { 0,
663 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
664 1, 1, 4, 1, 1, 1, 1, 1, 1, 1,
665 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
666 1, 2, 5, 6, 7, 8, 7, 9, 10, 11,
667 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
668 22, 23, 24, 25, 24, 26, 27, 28, 29, 30,
669 31, 32, 33, 34, 35, 36, 35, 37, 37, 35,
670 8, 8, 38, 38, 8, 8, 8, 8, 8, 8,
671 8, 8, 8, 8, 8, 8, 8, 39, 8, 8,
672 40, 41, 42, 43, 44, 1, 45, 46, 35, 37,
673
674 47, 48, 49, 8, 38, 38, 8, 8, 8, 50,
675 8, 8, 8, 51, 52, 53, 54, 55, 8, 56,
676 8, 8, 57, 58, 59, 60, 1, 1, 1, 1,
677 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
678 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
679 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
680 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
681 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
682 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
683 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
684
685 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
686 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
687 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
688 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
689 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
690 1, 1, 1, 1, 1
691 } ;
692
693static const YY_CHAR yy_meta[61] =
694 { 0,
695 1, 2, 3, 3, 1, 4, 5, 6, 1, 7,
696 5, 5, 1, 8, 5, 8, 9, 1, 10, 10,
697 10, 10, 10, 10, 10, 10, 10, 1, 5, 1,
698 1, 1, 1, 11, 12, 12, 13, 14, 6, 5,
699 15, 5, 1, 16, 12, 12, 13, 12, 6, 6,
700 6, 17, 6, 17, 6, 6, 5, 1, 5, 1
701 } ;
702
703static const flex_int16_t yy_base[358] =
704 { 0,
705 0, 59, 65, 123, 61, 89, 903, 902, 70, 81,
706 93, 97, 106, 115, 133, 141, 181, 236, 905, 1227,
707 79, 1227, 898, 866, 1227, 86, 137, 119, 1227, 1227,
708 1227, 85, 48, 1227, 71, 283, 865, 310, 121, 1227,
709 1227, 864, 863, 862, 889, 888, 1227, 166, 1227, 858,
710 144, 147, 1227, 83, 1227, 854, 106, 155, 0, 879,
711 1227, 875, 1227, 171, 144, 150, 1227, 860, 186, 1227,
712 872, 857, 1227, 1227, 188, 1227, 870, 183, 1227, 858,
713 200, 202, 1227, 206, 854, 196, 208, 219, 0, 1227,
714 832, 823, 807, 365, 0, 1227, 820, 751, 1227, 757,
715
716 754, 194, 739, 239, 239, 1227, 1227, 244, 1227, 752,
717 222, 243, 752, 748, 1227, 1227, 715, 1227, 1227, 1227,
718 1227, 1227, 1227, 236, 714, 713, 726, 711, 217, 709,
719 708, 1227, 412, 0, 231, 101, 1227, 0, 1227, 1227,
720 1227, 736, 261, 732, 277, 309, 1227, 727, 254, 1227,
721 1227, 321, 326, 1227, 1227, 1227, 263, 265, 315, 0,
722 727, 1227, 311, 725, 340, 283, 710, 337, 1227, 709,
723 338, 1227, 317, 1227, 721, 368, 349, 359, 374, 357,
724 378, 1227, 388, 1227, 720, 391, 391, 397, 0, 1227,
725 1227, 705, 1227, 400, 1227, 715, 421, 1227, 1227, 1227,
726
727 1227, 1227, 1227, 1227, 0, 0, 1227, 1227, 709, 1227,
728 348, 356, 708, 691, 705, 445, 704, 407, 1227, 536,
729 1227, 1227, 1227, 423, 1227, 414, 1227, 1227, 1227, 437,
730 391, 526, 360, 452, 456, 561, 458, 461, 559, 425,
731 1227, 538, 463, 464, 1227, 519, 467, 473, 480, 1227,
732 492, 483, 1227, 469, 490, 1227, 461, 496, 499, 1227,
733 420, 485, 0, 394, 494, 509, 512, 513, 514, 381,
734 1227, 514, 1227, 338, 500, 501, 260, 365, 512, 264,
735 522, 260, 523, 531, 1227, 532, 1227, 249, 546, 1227,
736 218, 553, 1227, 211, 1227, 526, 555, 1227, 176, 174,
737
738 543, 147, 145, 130, 1227, 117, 90, 47, 1227, 545,
739 549, 551, 1227, 568, 585, 602, 619, 636, 653, 670,
740 687, 703, 719, 735, 752, 769, 786, 803, 820, 837,
741 854, 870, 886, 902, 910, 480, 917, 929, 945, 962,
742 970, 982, 998, 1014, 1031, 1039, 1046, 1062, 1078, 1095,
743 1112, 1128, 1145, 1161, 1177, 1193, 1209
744 } ;
745
746static const flex_int16_t yy_def[358] =
747 { 0,
748 313, 1, 314, 314, 1, 1, 315, 315, 316, 316,
749 317, 317, 318, 318, 319, 319, 320, 320, 313, 313,
750 313, 313, 313, 313, 313, 321, 322, 313, 313, 313,
751 313, 313, 313, 313, 313, 313, 313, 313, 38, 313,
752 313, 313, 313, 313, 323, 324, 313, 313, 313, 313,
753 322, 322, 313, 313, 313, 313, 313, 321, 325, 313,
754 313, 313, 313, 326, 313, 313, 313, 313, 313, 313,
755 313, 36, 313, 313, 313, 313, 313, 327, 313, 313,
756 327, 327, 313, 313, 313, 328, 313, 328, 329, 313,
757 313, 313, 313, 330, 331, 313, 313, 313, 313, 313,
758
759 313, 332, 313, 313, 321, 313, 313, 321, 313, 313,
760 313, 322, 333, 334, 313, 313, 313, 313, 313, 313,
761 313, 313, 313, 313, 313, 313, 313, 313, 335, 313,
762 313, 313, 313, 39, 313, 336, 313, 337, 313, 313,
763 313, 323, 338, 324, 339, 313, 313, 313, 340, 313,
764 313, 322, 322, 313, 313, 313, 313, 321, 321, 325,
765 313, 313, 326, 313, 313, 313, 313, 313, 313, 313,
766 313, 313, 327, 313, 313, 327, 327, 327, 327, 313,
767 328, 313, 328, 313, 313, 313, 328, 328, 329, 313,
768 313, 313, 313, 313, 313, 313, 313, 313, 313, 313,
769
770 313, 313, 313, 313, 341, 331, 313, 313, 313, 313,
771 313, 332, 342, 313, 333, 343, 334, 344, 313, 313,
772 313, 313, 313, 345, 313, 335, 313, 313, 313, 313,
773 336, 346, 347, 313, 338, 348, 313, 339, 349, 340,
774 313, 313, 322, 321, 313, 313, 350, 351, 327, 313,
775 313, 327, 313, 313, 328, 313, 313, 313, 313, 313,
776 313, 313, 341, 342, 352, 353, 343, 313, 344, 354,
777 313, 345, 313, 313, 313, 313, 346, 347, 313, 348,
778 355, 349, 356, 313, 313, 350, 313, 313, 351, 313,
779 313, 313, 313, 313, 313, 352, 353, 313, 313, 354,
780
781 357, 313, 313, 313, 313, 313, 313, 313, 313, 355,
782 356, 357, 0, 313, 313, 313, 313, 313, 313, 313,
783 313, 313, 313, 313, 313, 313, 313, 313, 313, 313,
784 313, 313, 313, 313, 313, 313, 313, 313, 313, 313,
785 313, 313, 313, 313, 313, 313, 313, 313, 313, 313,
786 313, 313, 313, 313, 313, 313, 313
787 } ;
788
789static const flex_int16_t yy_nxt[1288] =
790 { 0,
791 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
792 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
793 39, 39, 39, 39, 39, 39, 39, 40, 41, 42,
794 43, 44, 45, 46, 27, 27, 27, 27, 27, 47,
795 48, 49, 50, 27, 27, 27, 27, 27, 51, 27,
796 27, 52, 27, 27, 27, 27, 53, 54, 55, 56,
797 57, 119, 69, 70, 71, 58, 60, 61, 62, 309,
798 63, 64, 79, 80, 63, 65, 66, 72, 120, 67,
799 104, 68, 81, 79, 80, 105, 121, 82, 109, 110,
800 75, 70, 71, 67, 84, 58, 85, 117, 87, 86,
801
802 85, 122, 73, 88, 65, 72, 66, 157, 90, 91,
803 309, 92, 158, 154, 231, 118, 231, 90, 91, 74,
804 92, 65, 93, 66, 60, 61, 62, 115, 63, 64,
805 73, 93, 63, 65, 66, 96, 97, 67, 111, 68,
806 155, 309, 98, 96, 97, 111, 94, 74, 111, 116,
807 98, 67, 305, 113, 165, 94, 313, 109, 110, 313,
808 113, 166, 65, 113, 66, 305, 313, 146, 147, 148,
809 114, 305, 149, 162, 164, 300, 313, 114, 298, 65,
810 114, 66, 100, 165, 101, 174, 175, 168, 102, 171,
811 152, 166, 105, 153, 158, 211, 150, 103, 184, 185,
812
813 165, 176, 174, 175, 174, 175, 177, 180, 166, 186,
814 213, 159, 181, 293, 187, 102, 102, 102, 102, 102,
815 290, 184, 185, 111, 102, 102, 102, 102, 102, 102,
816 102, 102, 102, 102, 102, 102, 102, 100, 113, 101,
817 104, 109, 110, 102, 111, 105, 109, 110, 220, 230,
818 230, 287, 103, 136, 137, 114, 241, 242, 178, 113,
819 179, 282, 234, 136, 157, 280, 221, 109, 110, 158,
820 102, 102, 102, 102, 102, 188, 114, 236, 237, 102,
821 102, 102, 102, 102, 102, 102, 102, 102, 102, 102,
822 102, 102, 123, 239, 166, 124, 125, 137, 126, 127,
823
824 128, 129, 129, 129, 129, 129, 129, 129, 129, 129,
825 146, 147, 148, 162, 164, 149, 244, 245, 246, 174,
826 175, 159, 111, 130, 166, 131, 133, 111, 134, 134,
827 134, 134, 134, 134, 134, 134, 134, 113, 168, 171,
828 273, 166, 113, 105, 158, 135, 136, 137, 138, 211,
829 165, 174, 175, 134, 114, 135, 136, 211, 180, 114,
830 249, 250, 251, 181, 213, 138, 194, 195, 196, 176,
831 174, 175, 213, 243, 177, 252, 253, 254, 243, 165,
832 184, 185, 300, 197, 197, 197, 197, 197, 197, 197,
833 184, 185, 186, 184, 185, 264, 165, 187, 255, 256,
834
835 257, 259, 260, 261, 313, 178, 313, 179, 268, 198,
836 199, 279, 200, 279, 201, 202, 279, 203, 279, 204,
837 205, 229, 260, 270, 229, 273, 274, 241, 242, 229,
838 129, 129, 129, 129, 129, 129, 129, 129, 129, 262,
839 262, 262, 262, 262, 262, 262, 111, 188, 136, 137,
840 136, 137, 229, 234, 229, 275, 275, 234, 136, 237,
841 136, 113, 237, 256, 284, 244, 245, 246, 236, 287,
842 288, 253, 236, 285, 239, 290, 291, 239, 114, 113,
843 275, 249, 250, 251, 252, 253, 254, 232, 276, 232,
844 276, 255, 256, 257, 250, 211, 114, 292, 293, 294,
845
846 259, 260, 261, 295, 295, 295, 295, 295, 295, 295,
847 213, 298, 299, 111, 268, 268, 273, 274, 275, 275,
848 302, 245, 303, 234, 237, 304, 305, 211, 113, 270,
849 270, 306, 284, 307, 287, 288, 308, 309, 236, 239,
850 241, 285, 213, 275, 268, 114, 234, 113, 290, 291,
851 237, 276, 268, 276, 292, 293, 294, 298, 299, 270,
852 282, 236, 280, 137, 114, 239, 271, 270, 59, 59,
853 59, 59, 59, 59, 59, 59, 59, 59, 59, 59,
854 59, 59, 59, 59, 59, 76, 76, 76, 76, 76,
855 76, 76, 76, 76, 76, 76, 76, 76, 76, 76,
856
857 76, 76, 78, 78, 78, 78, 78, 78, 78, 78,
858 78, 78, 78, 78, 78, 78, 78, 78, 78, 83,
859 83, 83, 83, 83, 83, 83, 83, 83, 83, 83,
860 83, 83, 83, 83, 83, 83, 89, 89, 89, 89,
861 89, 89, 89, 89, 89, 89, 89, 89, 89, 89,
862 89, 89, 89, 95, 95, 95, 95, 95, 95, 95,
863 95, 95, 95, 95, 95, 95, 95, 95, 95, 95,
864 99, 99, 99, 99, 99, 99, 99, 99, 99, 99,
865 99, 99, 99, 99, 99, 99, 99, 108, 108, 108,
866 108, 108, 108, 108, 108, 108, 108, 108, 108, 108,
867
868 108, 108, 108, 108, 112, 217, 215, 266, 112, 264,
869 209, 112, 112, 112, 112, 112, 112, 195, 112, 112,
870 143, 258, 184, 174, 143, 248, 247, 162, 161, 147,
871 143, 143, 143, 144, 143, 143, 145, 142, 228, 227,
872 145, 225, 224, 223, 222, 219, 145, 145, 145, 217,
873 145, 145, 160, 215, 109, 214, 210, 160, 209, 160,
874 208, 160, 160, 160, 160, 160, 160, 160, 160, 163,
875 163, 163, 163, 163, 163, 163, 163, 163, 163, 163,
876 163, 163, 163, 163, 163, 163, 173, 173, 173, 173,
877 173, 173, 173, 173, 173, 173, 173, 173, 173, 173,
878
879 173, 173, 173, 183, 183, 183, 183, 183, 183, 183,
880 183, 183, 183, 183, 183, 183, 183, 183, 183, 183,
881 189, 189, 207, 192, 189, 189, 189, 189, 191, 189,
882 189, 189, 189, 189, 190, 189, 189, 193, 193, 193,
883 193, 193, 193, 193, 193, 193, 193, 193, 193, 193,
884 193, 193, 193, 193, 206, 206, 182, 206, 206, 206,
885 174, 206, 206, 206, 206, 206, 206, 206, 206, 206,
886 206, 212, 172, 170, 169, 212, 167, 162, 212, 212,
887 161, 212, 212, 212, 156, 212, 212, 216, 151, 144,
888 142, 216, 141, 140, 139, 132, 107, 216, 216, 216,
889
890 106, 216, 216, 218, 313, 77, 77, 218, 313, 313,
891 313, 313, 313, 218, 218, 218, 313, 218, 218, 226,
892 313, 313, 226, 226, 313, 226, 233, 313, 233, 233,
893 235, 313, 313, 313, 235, 313, 313, 235, 235, 313,
894 235, 235, 235, 313, 235, 235, 238, 313, 313, 313,
895 238, 313, 313, 238, 238, 313, 238, 238, 238, 313,
896 238, 238, 240, 240, 240, 240, 240, 240, 240, 240,
897 240, 240, 240, 240, 240, 240, 240, 240, 240, 263,
898 313, 263, 263, 265, 313, 313, 313, 265, 313, 313,
899 313, 313, 313, 265, 265, 265, 313, 265, 265, 267,
900
901 313, 313, 313, 267, 313, 313, 267, 267, 267, 267,
902 267, 267, 313, 267, 267, 269, 313, 313, 313, 269,
903 313, 313, 269, 269, 313, 269, 269, 269, 313, 269,
904 269, 272, 272, 272, 272, 272, 272, 272, 272, 272,
905 272, 272, 272, 272, 272, 272, 272, 272, 277, 313,
906 313, 313, 277, 313, 277, 278, 313, 278, 278, 313,
907 313, 278, 278, 281, 313, 313, 313, 281, 313, 313,
908 313, 313, 313, 281, 281, 281, 313, 281, 281, 283,
909 313, 313, 313, 283, 313, 313, 313, 313, 313, 283,
910 283, 283, 313, 283, 283, 286, 286, 286, 286, 286,
911
912 286, 286, 286, 286, 286, 286, 286, 286, 286, 286,
913 286, 286, 289, 289, 289, 289, 289, 289, 289, 289,
914 289, 289, 289, 289, 289, 289, 289, 289, 289, 296,
915 313, 313, 313, 296, 313, 313, 296, 296, 313, 296,
916 296, 296, 313, 296, 296, 297, 297, 297, 297, 297,
917 297, 297, 297, 297, 297, 297, 297, 297, 297, 297,
918 297, 297, 301, 313, 313, 313, 301, 313, 313, 313,
919 313, 313, 301, 301, 301, 313, 301, 301, 310, 313,
920 313, 313, 310, 313, 313, 310, 310, 313, 310, 310,
921 310, 313, 310, 310, 311, 313, 313, 313, 311, 313,
922
923 313, 311, 311, 313, 311, 311, 311, 313, 311, 311,
924 312, 313, 313, 313, 312, 313, 313, 312, 312, 313,
925 312, 312, 312, 313, 312, 312, 19, 313, 313, 313,
926 313, 313, 313, 313, 313, 313, 313, 313, 313, 313,
927 313, 313, 313, 313, 313, 313, 313, 313, 313, 313,
928 313, 313, 313, 313, 313, 313, 313, 313, 313, 313,
929 313, 313, 313, 313, 313, 313, 313, 313, 313, 313,
930 313, 313, 313, 313, 313, 313, 313, 313, 313, 313,
931 313, 313, 313, 313, 313, 313, 313
932 } ;
933
934static const flex_int16_t yy_chk[1288] =
935 { 0,
936 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
937 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
938 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
939 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
940 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
941 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
942 2, 33, 5, 5, 5, 2, 3, 3, 3, 308,
943 3, 3, 9, 9, 3, 3, 3, 5, 33, 3,
944 21, 3, 10, 10, 10, 21, 35, 10, 26, 26,
945 6, 6, 6, 3, 11, 6, 11, 32, 12, 11,
946
947 12, 35, 5, 12, 3, 6, 3, 57, 13, 13,
948 307, 13, 57, 54, 136, 32, 136, 14, 14, 5,
949 14, 3, 13, 3, 4, 4, 4, 28, 4, 4,
950 6, 14, 4, 4, 4, 15, 15, 4, 27, 4,
951 54, 306, 15, 16, 16, 51, 13, 6, 52, 28,
952 16, 4, 304, 27, 65, 14, 39, 58, 58, 39,
953 51, 66, 4, 52, 4, 303, 39, 48, 48, 48,
954 27, 302, 48, 64, 64, 300, 39, 51, 299, 4,
955 52, 4, 17, 65, 17, 78, 78, 69, 17, 75,
956 51, 66, 69, 52, 75, 102, 48, 17, 86, 86,
957
958 65, 81, 81, 81, 82, 82, 81, 84, 66, 87,
959 102, 58, 84, 294, 87, 17, 17, 17, 17, 17,
960 291, 88, 88, 111, 17, 17, 17, 17, 17, 17,
961 17, 17, 17, 17, 17, 17, 17, 18, 111, 18,
962 104, 105, 105, 18, 112, 104, 108, 108, 124, 135,
963 135, 288, 18, 129, 129, 111, 149, 149, 82, 112,
964 82, 282, 143, 129, 157, 280, 124, 158, 158, 157,
965 18, 18, 18, 18, 18, 88, 112, 143, 145, 18,
966 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
967 18, 18, 36, 145, 166, 36, 36, 277, 36, 36,
968
969 36, 36, 36, 36, 36, 36, 36, 36, 36, 36,
970 146, 146, 146, 163, 163, 146, 159, 159, 159, 173,
971 173, 158, 152, 36, 166, 36, 38, 153, 38, 38,
972 38, 38, 38, 38, 38, 38, 38, 152, 168, 171,
973 274, 166, 153, 168, 171, 38, 38, 38, 38, 211,
974 165, 177, 177, 38, 152, 38, 38, 212, 180, 153,
975 178, 178, 178, 180, 211, 38, 94, 94, 94, 176,
976 176, 176, 212, 152, 176, 179, 179, 179, 153, 165,
977 181, 181, 270, 94, 94, 94, 94, 94, 94, 94,
978 183, 183, 186, 187, 187, 264, 165, 186, 188, 188,
979
980 188, 194, 194, 194, 231, 177, 231, 177, 218, 94,
981 94, 233, 94, 233, 94, 94, 278, 94, 278, 94,
982 94, 133, 261, 218, 133, 224, 224, 240, 240, 133,
983 133, 133, 133, 133, 133, 133, 133, 133, 133, 197,
984 197, 197, 197, 197, 197, 197, 216, 187, 133, 133,
985 226, 226, 133, 234, 133, 230, 230, 235, 133, 237,
986 226, 216, 238, 257, 243, 244, 244, 244, 234, 247,
987 247, 254, 235, 243, 237, 248, 248, 238, 216, 243,
988 230, 249, 249, 249, 252, 252, 252, 336, 230, 336,
989 230, 255, 255, 255, 251, 265, 243, 258, 258, 258,
990
991 259, 259, 259, 262, 262, 262, 262, 262, 262, 262,
992 265, 266, 266, 267, 268, 269, 272, 272, 275, 275,
993 276, 246, 276, 281, 283, 276, 276, 296, 267, 268,
994 269, 279, 284, 279, 286, 286, 279, 279, 281, 283,
995 242, 284, 296, 275, 301, 267, 310, 284, 289, 289,
996 311, 275, 312, 275, 292, 292, 292, 297, 297, 301,
997 239, 310, 236, 232, 284, 311, 220, 312, 314, 314,
998 314, 314, 314, 314, 314, 314, 314, 314, 314, 314,
999 314, 314, 314, 314, 314, 315, 315, 315, 315, 315,
1000 315, 315, 315, 315, 315, 315, 315, 315, 315, 315,
1001
1002 315, 315, 316, 316, 316, 316, 316, 316, 316, 316,
1003 316, 316, 316, 316, 316, 316, 316, 316, 316, 317,
1004 317, 317, 317, 317, 317, 317, 317, 317, 317, 317,
1005 317, 317, 317, 317, 317, 317, 318, 318, 318, 318,
1006 318, 318, 318, 318, 318, 318, 318, 318, 318, 318,
1007 318, 318, 318, 319, 319, 319, 319, 319, 319, 319,
1008 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
1009 320, 320, 320, 320, 320, 320, 320, 320, 320, 320,
1010 320, 320, 320, 320, 320, 320, 320, 321, 321, 321,
1011 321, 321, 321, 321, 321, 321, 321, 321, 321, 321,
1012
1013 321, 321, 321, 321, 322, 217, 215, 214, 322, 213,
1014 209, 322, 322, 322, 322, 322, 322, 196, 322, 322,
1015 323, 192, 185, 175, 323, 170, 167, 164, 161, 148,
1016 323, 323, 323, 144, 323, 323, 324, 142, 131, 130,
1017 324, 128, 127, 126, 125, 117, 324, 324, 324, 114,
1018 324, 324, 325, 113, 110, 103, 101, 325, 100, 325,
1019 98, 325, 325, 325, 325, 325, 325, 325, 325, 326,
1020 326, 326, 326, 326, 326, 326, 326, 326, 326, 326,
1021 326, 326, 326, 326, 326, 326, 327, 327, 327, 327,
1022 327, 327, 327, 327, 327, 327, 327, 327, 327, 327,
1023
1024 327, 327, 327, 328, 328, 328, 328, 328, 328, 328,
1025 328, 328, 328, 328, 328, 328, 328, 328, 328, 328,
1026 329, 329, 97, 93, 329, 329, 329, 329, 92, 329,
1027 329, 329, 329, 329, 91, 329, 329, 330, 330, 330,
1028 330, 330, 330, 330, 330, 330, 330, 330, 330, 330,
1029 330, 330, 330, 330, 331, 331, 85, 331, 331, 331,
1030 80, 331, 331, 331, 331, 331, 331, 331, 331, 331,
1031 331, 332, 77, 72, 71, 332, 68, 62, 332, 332,
1032 60, 332, 332, 332, 56, 332, 332, 333, 50, 46,
1033 45, 333, 44, 43, 42, 37, 24, 333, 333, 333,
1034
1035 23, 333, 333, 334, 19, 8, 7, 334, 0, 0,
1036 0, 0, 0, 334, 334, 334, 0, 334, 334, 335,
1037 0, 0, 335, 335, 0, 335, 337, 0, 337, 337,
1038 338, 0, 0, 0, 338, 0, 0, 338, 338, 0,
1039 338, 338, 338, 0, 338, 338, 339, 0, 0, 0,
1040 339, 0, 0, 339, 339, 0, 339, 339, 339, 0,
1041 339, 339, 340, 340, 340, 340, 340, 340, 340, 340,
1042 340, 340, 340, 340, 340, 340, 340, 340, 340, 341,
1043 0, 341, 341, 342, 0, 0, 0, 342, 0, 0,
1044 0, 0, 0, 342, 342, 342, 0, 342, 342, 343,
1045
1046 0, 0, 0, 343, 0, 0, 343, 343, 343, 343,
1047 343, 343, 0, 343, 343, 344, 0, 0, 0, 344,
1048 0, 0, 344, 344, 0, 344, 344, 344, 0, 344,
1049 344, 345, 345, 345, 345, 345, 345, 345, 345, 345,
1050 345, 345, 345, 345, 345, 345, 345, 345, 346, 0,
1051 0, 0, 346, 0, 346, 347, 0, 347, 347, 0,
1052 0, 347, 347, 348, 0, 0, 0, 348, 0, 0,
1053 0, 0, 0, 348, 348, 348, 0, 348, 348, 349,
1054 0, 0, 0, 349, 0, 0, 0, 0, 0, 349,
1055 349, 349, 0, 349, 349, 350, 350, 350, 350, 350,
1056
1057 350, 350, 350, 350, 350, 350, 350, 350, 350, 350,
1058 350, 350, 351, 351, 351, 351, 351, 351, 351, 351,
1059 351, 351, 351, 351, 351, 351, 351, 351, 351, 352,
1060 0, 0, 0, 352, 0, 0, 352, 352, 0, 352,
1061 352, 352, 0, 352, 352, 353, 353, 353, 353, 353,
1062 353, 353, 353, 353, 353, 353, 353, 353, 353, 353,
1063 353, 353, 354, 0, 0, 0, 354, 0, 0, 0,
1064 0, 0, 354, 354, 354, 0, 354, 354, 355, 0,
1065 0, 0, 355, 0, 0, 355, 355, 0, 355, 355,
1066 355, 0, 355, 355, 356, 0, 0, 0, 356, 0,
1067
1068 0, 356, 356, 0, 356, 356, 356, 0, 356, 356,
1069 357, 0, 0, 0, 357, 0, 0, 357, 357, 0,
1070 357, 357, 357, 0, 357, 357, 313, 313, 313, 313,
1071 313, 313, 313, 313, 313, 313, 313, 313, 313, 313,
1072 313, 313, 313, 313, 313, 313, 313, 313, 313, 313,
1073 313, 313, 313, 313, 313, 313, 313, 313, 313, 313,
1074 313, 313, 313, 313, 313, 313, 313, 313, 313, 313,
1075 313, 313, 313, 313, 313, 313, 313, 313, 313, 313,
1076 313, 313, 313, 313, 313, 313, 313
1077 } ;
1078
1079/* The intent behind this definition is that it'll catch
1080 * any uses of REJECT which flex missed.
1081 */
1082#define REJECT reject_used_but_not_detected
1083#define yymore() yymore_used_but_not_detected
1084#define YY_MORE_ADJ 0
1085#define YY_RESTORE_YY_MORE_OFFSET
1086#line 1 "/home/jwe/src/octave-stable/libinterp/parse-tree/lex.ll"
1087/*
1088
1089We are using the pure parser interface and the reentrant lexer interface
1090but the Octave parser and lexer are NOT properly reentrant because both
1091still use many global variables. It should be safe to create a parser
1092object and call it while another parser object is active (to parse a
1093callback function while the main interactive parser is waiting for
1094input, for example) if you take care to properly save and restore
1095(typically with an unwind_protect object) relevant global values before
1096and after the nested call.
1097
1098*/
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108#line 91 "/home/jwe/src/octave-stable/libinterp/parse-tree/lex.ll"
1109
1110#include <cctype>
1111#include <cstring>
1112
1113#include <algorithm>
1114#include <iostream>
1115#include <set>
1116#include <sstream>
1117#include <string>
1118#include <stack>
1119
1120#include "cmd-edit.h"
1121#include "lo-mappers.h"
1122#include "quit.h"
1123#include "unistd-wrappers.h"
1124
1125// These would be alphabetical, but oct-parse.h must be included before
1126// oct-gperf.h and oct-parse.h must be included after token.h and the tree
1127// class declarations. We can't include oct-parse.h in oct-gperf.h
1128// because it may not be protected to allow it to be included multiple
1129// times.
1130
1131#include "Cell.h"
1132#include "defun.h"
1133#include "error.h"
1134#include "errwarn.h"
1135#include "input.h"
1136#include "interpreter.h"
1137#include "lex.h"
1138#include "octave.h"
1139#include "ov-magic-int.h"
1140#include "ov.h"
1141#include "parse.h"
1142#include "pt-all.h"
1143#include "symtab.h"
1144#include "token.h"
1145#include "utils.h"
1146#include "variables.h"
1147#include "oct-parse.h"
1148#include "oct-gperf.h"
1149
1150// FIXME: with bison 3.x, OCTAVE_STYPE appears in the generated
1151// oct-parse.h file, but there is no definition for YYSTYPE, which is
1152// needed by the code that is generated by flex. I can't seem to find a
1153// way to tell flex to use OCTAVE_STYPE instead of YYSTYPE in the code
1154// it generates, or to tell bison to provide the definition of YYSTYPE
1155// in the generated oct-parse.h file.
1156
1157#if defined (OCTAVE_STYPE_IS_DECLARED) && ! defined YYSTYPE
1158# define YYSTYPE OCTAVE_STYPE
1159#endif
1160
1161#define YY_NO_UNISTD_H 1
1162#define isatty octave_isatty_wrapper
1163
1164#if ! (defined (FLEX_SCANNER) \
1165 && defined (YY_FLEX_MAJOR_VERSION) && YY_FLEX_MAJOR_VERSION >= 2 \
1166 && defined (YY_FLEX_MINOR_VERSION) && YY_FLEX_MINOR_VERSION >= 5)
1167#error lex.l requires flex version 2.5.4 or later
1168#endif
1169
1170#define YY_EXTRA_TYPE octave::base_lexer *
1171#define curr_lexer yyextra
1172
1173// Arrange to get input via readline.
1174
1175#if defined (YY_INPUT)
1176# undef YY_INPUT
1177#endif
1178#define YY_INPUT(buf, result, max_size) \
1179 result = curr_lexer->fill_flex_buffer (buf, max_size)
1180
1181// Try to avoid crashing out completely on fatal scanner errors.
1182
1183#if defined (YY_FATAL_ERROR)
1184# undef YY_FATAL_ERROR
1185#endif
1186#define YY_FATAL_ERROR(msg) \
1187 (yyget_extra (yyscanner))->fatal_error (msg)
1188
1189#define CMD_OR_OP(PATTERN, TOK, COMPAT) \
1190 do \
1191 { \
1192 curr_lexer->lexer_debug (PATTERN); \
1193 \
1194 if (curr_lexer->looks_like_command_arg ()) \
1195 { \
1196 yyless (0); \
1197 curr_lexer->push_start_state (COMMAND_START); \
1198 } \
1199 else \
1200 return curr_lexer->handle_op (TOK, false, COMPAT); \
1201 } \
1202 while (0)
1203
1204#define CMD_OR_DEPRECATED_OP(PATTERN, REPLACEMENT, VERSION, TOK) \
1205 do \
1206 { \
1207 curr_lexer->lexer_debug (PATTERN); \
1208 \
1209 if (curr_lexer->looks_like_command_arg ()) \
1210 { \
1211 yyless (0); \
1212 curr_lexer->push_start_state (COMMAND_START); \
1213 } \
1214 else \
1215 { \
1216 curr_lexer->warn_deprecated_operator (PATTERN, REPLACEMENT, \
1217 #VERSION); \
1218 /* set COMPAT to true here to avoid warning about \
1219 compatibility since we've already warned about the \
1220 operator being deprecated. */ \
1221 return curr_lexer->handle_op (TOK, false, true); \
1222 } \
1223 } \
1224 while (0)
1225
1226#define CMD_OR_UNARY_OP(PATTERN, TOK, COMPAT) \
1227 do \
1228 { \
1229 curr_lexer->lexer_debug (PATTERN); \
1230 \
1231 if (curr_lexer->previous_token_may_be_command ()) \
1232 { \
1233 if (curr_lexer->looks_like_command_arg ()) \
1234 { \
1235 yyless (0); \
1236 curr_lexer->push_start_state (COMMAND_START); \
1237 } \
1238 else \
1239 return curr_lexer->handle_op (TOK, false, COMPAT); \
1240 } \
1241 else \
1242 { \
1243 if (curr_lexer->maybe_unput_comma_before_unary_op (TOK)) \
1244 { \
1245 yyless (0); \
1246 curr_lexer->xunput (','); \
1247 } \
1248 else \
1249 return curr_lexer->handle_op (TOK, false, COMPAT); \
1250 } \
1251 } \
1252 while (0)
1253
1254#define HANDLE_EOB_OR_EOF(STATUS) \
1255 do \
1256 { \
1257 if (curr_lexer->is_push_lexer ()) \
1258 { \
1259 if (curr_lexer->at_end_of_buffer ()) \
1260 return STATUS; \
1261 \
1262 if (curr_lexer->at_end_of_file ()) \
1263 return curr_lexer->handle_end_of_input (); \
1264 } \
1265 } \
1266 while (0)
1267
1268// If we are at the end of the buffer, ask for more input.
1269// If we are at the end of the file, deal with it.
1270// Otherwise, just keep going with the text from the current buffer.
1271#define HANDLE_STRING_CONTINUATION \
1272 do \
1273 { \
1274 curr_lexer->m_filepos.next_line (); \
1275 \
1276 HANDLE_EOB_OR_EOF (-1); \
1277 } \
1278 while (0)
1279
1280#define HANDLE_NUMBER(PATTERN, BASE) \
1281 do \
1282 { \
1283 curr_lexer->lexer_debug (PATTERN); \
1284 \
1285 if (curr_lexer->previous_token_may_be_command () \
1286 && curr_lexer->space_follows_previous_token ()) \
1287 { \
1288 yyless (0); \
1289 curr_lexer->push_start_state (COMMAND_START); \
1290 } \
1291 else \
1292 { \
1293 int tok = curr_lexer->previous_token_value (); \
1294 \
1295 if (curr_lexer->whitespace_is_significant () \
1296 && curr_lexer->space_follows_previous_token () \
1297 && ! (tok == '[' || tok == '{' \
1298 || curr_lexer->previous_token_is_binop ())) \
1299 { \
1300 yyless (0); \
1301 curr_lexer->xunput (','); \
1302 } \
1303 else \
1304 return curr_lexer->handle_number<BASE> (); \
1305 } \
1306 } \
1307 while (0)
1308
1309#define HANDLE_IDENTIFIER(pattern, get_set) \
1310 do \
1311 { \
1312 curr_lexer->lexer_debug (pattern); \
1313 \
1314 int tok = curr_lexer->previous_token_value (); \
1315 \
1316 if (curr_lexer->whitespace_is_significant () \
1317 && curr_lexer->space_follows_previous_token () \
1318 && ! (tok == '[' || tok == '{' \
1319 || curr_lexer->previous_token_is_binop ())) \
1320 { \
1321 yyless (0); \
1322 curr_lexer->xunput (','); \
1323 } \
1324 else \
1325 { \
1326 if (! curr_lexer->m_looking_at_decl_list \
1327 && curr_lexer->previous_token_may_be_command ()) \
1328 { \
1329 yyless (0); \
1330 curr_lexer->push_start_state (COMMAND_START); \
1331 } \
1332 else \
1333 { \
1334 if (get_set) \
1335 { \
1336 yyless (3); \
1337 curr_lexer->m_filepos.increment_column (3); \
1338 curr_lexer->m_maybe_classdef_get_set_method = false; \
1339 } \
1340 \
1341 return curr_lexer->handle_identifier (); \
1342 } \
1343 } \
1344 } \
1345 while (0)
1347static inline bool
1348is_space_or_tab (char c)
1349{
1350 return c == ' ' || c == '\t';
1351}
1353static inline bool
1355{
1356 return c == ' ' || c == '\t' || c == '\n' || c == '\r';
1357}
1358
1359OCTAVE_NAMESPACE_BEGIN
1360
1361 bool iskeyword (const std::string& s)
1362 {
1363 // Parsing function names like "set.property_name" inside
1364 // classdef-style class definitions is simplified by handling the
1365 // "set" and "get" portions of the names using the same mechanism
1366 // as is used for keywords. However, they are not really keywords
1367 // in the language, so omit them from the list of possible
1368 // keywords. Likewise for "arguments", "enumeration", "events",
1369 // "methods", and "properties".
1370
1371 // FIXME: The following check is duplicated in Fiskeyword.
1372 return (octave_kw_hash::in_word_set (s.c_str (), s.length ()) != nullptr
1373 && ! (s == "set" || s == "get" || s == "arguments"
1374 || s == "enumeration" || s == "events"
1375 || s == "methods" || s == "properties"));
1376 }
1377
1378OCTAVE_NAMESPACE_END
1379
1380#line 1381 "libinterp/parse-tree/lex.cc"
1381#line 373 "/home/jwe/src/octave-stable/libinterp/parse-tree/lex.ll"
1382// Decimal numbers may be real or imaginary but always create
1383// double precision constants initially. Any conversion to single
1384// precision happens as part of an expression evaluation in the
1385// interpreter, not the lexer and parser.
1386#line 1387 "libinterp/parse-tree/lex.cc"
1387#line 386 "/home/jwe/src/octave-stable/libinterp/parse-tree/lex.ll"
1388// It is possible to specify signedness and size for binary and
1389// hexadecimal numbers but there is no special syntax for imaginary
1390// constants. Binary and hexadecimal constants always create integer
1391// valued constants ({u,}int{8,16,32,64}). If a size is not specified,
1392// the smallest integer type that will hold the value is used. Negative
1393// values may be created with a signed size specification by applying
1394// twos-complement conversion (for example, 0xffs8 produces an 8-bit
1395// signed integer equal to -1 and 0b10000000s8 produces an 8-bit signed
1396// integer equal to -128).
1397#line 1398 "libinterp/parse-tree/lex.cc"
1398#line 1399 "libinterp/parse-tree/lex.cc"
1400#define INITIAL 0
1401#define COMMAND_START 1
1402#define MATRIX_START 2
1403#define INPUT_FILE_START 3
1404#define BLOCK_COMMENT_START 4
1405#define LINE_COMMENT_START 5
1406#define DQ_STRING_START 6
1407#define SQ_STRING_START 7
1408#define FQ_IDENT_START 8
1409
1410#ifndef YY_NO_UNISTD_H
1411/* Special case for "unistd.h", since it is non-ANSI. We include it way
1412 * down here because we want the user's section 1 to have been scanned first.
1413 * The user has a chance to override it with an option.
1414 */
1415#include <unistd.h>
1416#endif
1417
1418#ifndef YY_EXTRA_TYPE
1419#define YY_EXTRA_TYPE void *
1420#endif
1422/* Holds the entire state of the reentrant scanner. */
1423struct yyguts_t
1424 {
1426 /* User-defined. Not touched by flex. */
1429 /* The rest are the same as the globals declared in the non-reentrant scanner. */
1431 size_t yy_buffer_stack_top; /**< index of top of stack. */
1432 size_t yy_buffer_stack_max; /**< capacity of stack. */
1433 YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */
1447 int yylineno_r;
1451 int yy_more_flag;
1453
1454 YYSTYPE * yylval_r;
1455
1456 }; /* end struct yyguts_t */
1457
1458static int yy_init_globals ( yyscan_t yyscanner );
1459
1460 /* This must go here because YYSTYPE and YYLTYPE are included
1461 * from bison output in section 1.*/
1462 # define yylval yyg->yylval_r
1463
1465
1466int yylex_init_extra ( YY_EXTRA_TYPE user_defined, yyscan_t* scanner);
1467
1468/* Accessor methods to globals.
1469 These are made visible to non-reentrant scanners for convenience. */
1470
1471int yylex_destroy ( yyscan_t yyscanner );
1472
1473int yyget_debug ( yyscan_t yyscanner );
1474
1475void yyset_debug ( int debug_flag , yyscan_t yyscanner );
1476
1477YY_EXTRA_TYPE yyget_extra ( yyscan_t yyscanner );
1478
1479void yyset_extra ( YY_EXTRA_TYPE user_defined , yyscan_t yyscanner );
1480
1481FILE *yyget_in ( yyscan_t yyscanner );
1482
1483void yyset_in ( FILE * _in_str , yyscan_t yyscanner );
1484
1485FILE *yyget_out ( yyscan_t yyscanner );
1486
1487void yyset_out ( FILE * _out_str , yyscan_t yyscanner );
1488
1489 int yyget_leng ( yyscan_t yyscanner );
1490
1491char *yyget_text ( yyscan_t yyscanner );
1492
1493int yyget_lineno ( yyscan_t yyscanner );
1494
1495void yyset_lineno ( int _line_number , yyscan_t yyscanner );
1496
1497int yyget_column ( yyscan_t yyscanner );
1498
1499void yyset_column ( int _column_no , yyscan_t yyscanner );
1500
1501YYSTYPE * yyget_lval ( yyscan_t yyscanner );
1502
1503void yyset_lval ( YYSTYPE * yylval_param , yyscan_t yyscanner );
1504
1505/* Macros after this point can all be overridden by user definitions in
1506 * section 1.
1507 */
1508
1509#ifndef YY_SKIP_YYWRAP
1510#ifdef __cplusplus
1511extern "C" int yywrap ( yyscan_t yyscanner );
1512#else
1513extern int yywrap ( yyscan_t yyscanner );
1514#endif
1515#endif
1516
1517#ifndef YY_NO_UNPUT
1518
1519 static void yyunput ( int c, char *buf_ptr , yyscan_t yyscanner);
1520
1521#endif
1522
1523#ifndef yytext_ptr
1524static void yy_flex_strncpy ( char *, const char *, int , yyscan_t yyscanner);
1525#endif
1526
1527#ifdef YY_NEED_STRLEN
1528static int yy_flex_strlen ( const char * , yyscan_t yyscanner);
1529#endif
1530
1531#ifndef YY_NO_INPUT
1532#ifdef __cplusplus
1533static int yyinput ( yyscan_t yyscanner );
1534#else
1535static int input ( yyscan_t yyscanner );
1536#endif
1537
1538#endif
1539
1540/* Amount of stuff to slurp up with each read. */
1541#ifndef YY_READ_BUF_SIZE
1542#ifdef __ia64__
1543/* On IA-64, the buffer size is 16k, not 8k */
1544#define YY_READ_BUF_SIZE 16384
1545#else
1546#define YY_READ_BUF_SIZE 8192
1547#endif /* __ia64__ */
1548#endif
1549
1550/* Copy whatever the last rule matched to the standard output. */
1551#ifndef ECHO
1552/* This used to be an fputs(), but since the string might contain NUL's,
1553 * we now use fwrite().
1554 */
1555#define ECHO do { if (fwrite( yytext, (size_t) yyleng, 1, yyout )) {} } while (0)
1556#endif
1557
1558/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
1559 * is returned in "result".
1560 */
1561#ifndef YY_INPUT
1562#define YY_INPUT(buf,result,max_size) \
1563 if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
1564 { \
1565 int c = '*'; \
1566 int n; \
1567 for ( n = 0; n < max_size && \
1568 (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
1569 buf[n] = (char) c; \
1570 if ( c == '\n' ) \
1571 buf[n++] = (char) c; \
1572 if ( c == EOF && ferror( yyin ) ) \
1573 YY_FATAL_ERROR( "input in flex scanner failed" ); \
1574 result = n; \
1575 } \
1576 else \
1577 { \
1578 errno=0; \
1579 while ( (result = (int) fread(buf, 1, (yy_size_t) max_size, yyin)) == 0 && ferror(yyin)) \
1580 { \
1581 if( errno != EINTR) \
1582 { \
1583 YY_FATAL_ERROR( "input in flex scanner failed" ); \
1584 break; \
1585 } \
1586 errno=0; \
1587 clearerr(yyin); \
1588 } \
1589 }\
1590\
1591
1592#endif
1593
1594/* No semi-colon after return; correct usage is to write "yyterminate();" -
1595 * we don't want an extra ';' after the "return" because that will cause
1596 * some compilers to complain about unreachable statements.
1598#ifndef yyterminate
1599#define yyterminate() return YY_NULL
1600#endif
1601
1602/* Number of entries by which start-condition stack grows. */
1603#ifndef YY_START_STACK_INCR
1604#define YY_START_STACK_INCR 25
1605#endif
1606
1607/* Report a fatal error. */
1608#ifndef YY_FATAL_ERROR
1609#define YY_FATAL_ERROR(msg) yy_fatal_error( msg , yyscanner)
1610#endif
1611
1612/* end tables serialization structures and prototypes */
1613
1614/* Default declaration of generated scanner - a define so the user can
1615 * easily add parameters.
1617#ifndef YY_DECL
1618#define YY_DECL_IS_OURS 1
1619
1620extern int yylex \
1621 (YYSTYPE * yylval_param , yyscan_t yyscanner);
1622
1623#define YY_DECL int yylex \
1624 (YYSTYPE * yylval_param , yyscan_t yyscanner)
1625#endif /* !YY_DECL */
1626
1627/* Code executed at the beginning of each rule, after yytext and yyleng
1628 * have been set up.
1630#ifndef YY_USER_ACTION
1631#define YY_USER_ACTION
1632#endif
1633
1634/* Code executed at the end of each rule. */
1635#ifndef YY_BREAK
1636#define YY_BREAK /*LINTED*/break;
1637#endif
1638
1639#define YY_RULE_SETUP \
1640 if ( yyleng > 0 ) \
1641 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = \
1642 (yytext[yyleng - 1] == '\n'); \
1643 YY_USER_ACTION
1644
1645/** The main scanner function which does all the work.
1646 */
1647YY_DECL
1648{
1649 yy_state_type yy_current_state;
1650 char *yy_cp, *yy_bp;
1651 int yy_act;
1652 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1653
1654 yylval = yylval_param;
1655
1656 if ( !yyg->yy_init )
1657 {
1658 yyg->yy_init = 1;
1659
1660#ifdef YY_USER_INIT
1661 YY_USER_INIT;
1662#endif
1663
1664 if ( ! yyg->yy_start )
1665 yyg->yy_start = 1; /* first start state */
1666
1667 if ( ! yyin )
1668 yyin = stdin;
1669
1670 if ( ! yyout )
1671 yyout = stdout;
1672
1673 if ( ! YY_CURRENT_BUFFER ) {
1674 yyensure_buffer_stack (yyscanner);
1676 yy_create_buffer( yyin, YY_BUF_SIZE , yyscanner);
1677 }
1678
1679 yy_load_buffer_state( yyscanner );
1680 }
1681
1682 {
1683#line 406 "/home/jwe/src/octave-stable/libinterp/parse-tree/lex.ll"
1684
1685
1686
1687#line 410 "/home/jwe/src/octave-stable/libinterp/parse-tree/lex.ll"
1688// Make script and function files start with an invalid token. This makes
1689// the parser go down a special path.
1690
1691
1692#line 1693 "libinterp/parse-tree/lex.cc"
1693
1694 while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */
1695 {
1696 yy_cp = yyg->yy_c_buf_p;
1697
1698 /* Support of yytext. */
1699 *yy_cp = yyg->yy_hold_char;
1700
1701 /* yy_bp points to the position in yy_ch_buf of the start of
1702 * the current run.
1703 */
1704 yy_bp = yy_cp;
1705
1706 yy_current_state = yyg->yy_start;
1707 yy_current_state += YY_AT_BOL();
1708yy_match:
1709 do
1710 {
1711 YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ;
1712 if ( yy_accept[yy_current_state] )
1713 {
1714 yyg->yy_last_accepting_state = yy_current_state;
1715 yyg->yy_last_accepting_cpos = yy_cp;
1716 }
1717 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1718 {
1719 yy_current_state = (int) yy_def[yy_current_state];
1720 if ( yy_current_state >= 314 )
1721 yy_c = yy_meta[yy_c];
1722 }
1723 yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
1724 ++yy_cp;
1725 }
1726 while ( yy_base[yy_current_state] != 1227 );
1727
1728yy_find_action:
1729 yy_act = yy_accept[yy_current_state];
1730 if ( yy_act == 0 )
1731 { /* have to back up */
1732 yy_cp = yyg->yy_last_accepting_cpos;
1733 yy_current_state = yyg->yy_last_accepting_state;
1734 yy_act = yy_accept[yy_current_state];
1735 }
1736
1738
1739do_action: /* This label is used only to access EOF actions. */
1740
1741 switch ( yy_act )
1742 { /* beginning of action switch */
1743 case 0: /* must back up */
1744 /* undo the effects of YY_DO_BEFORE_ACTION */
1745 *yy_cp = yyg->yy_hold_char;
1746 yy_cp = yyg->yy_last_accepting_cpos;
1747 yy_current_state = yyg->yy_last_accepting_state;
1748 goto yy_find_action;
1749
1750case 1:
1751/* rule 1 can match eol */
1753#line 414 "/home/jwe/src/octave-stable/libinterp/parse-tree/lex.ll"
1754{
1755 curr_lexer->lexer_debug ("<INPUT_FILE_START>{ANY_INCLUDING_NL}");
1756
1757 curr_lexer->xunput (yytext[0]);
1758
1759 // May be reset later if we see "function" or "classdef" appears
1760 // as the first token.
1761 curr_lexer->m_reading_script_file = true;
1762
1763 curr_lexer->pop_start_state ();
1764
1765 return curr_lexer->show_token (INPUT_FILE);
1766 }
1767 YY_BREAK
1769#line 428 "/home/jwe/src/octave-stable/libinterp/parse-tree/lex.ll"
1770{
1771 curr_lexer->lexer_debug ("<INPUT_FILE_START><<EOF>>");
1772
1773 // May be reset later if we see "function" or "classdef" appears
1774 // as the first token.
1775 curr_lexer->m_reading_script_file = true;
1776
1777 curr_lexer->pop_start_state ();
1778
1779 return curr_lexer->show_token (INPUT_FILE);
1780 }
1781 YY_BREAK
1782
1783// Help and other command-style functions.
1784
1785
1786// Commands can be continued on a second line using the ellipsis.
1787// If an argument is in construction, it is completed.
1788
1789case 2:
1790/* rule 2 can match eol */
1792#line 449 "/home/jwe/src/octave-stable/libinterp/parse-tree/lex.ll"
1793{
1794 curr_lexer->lexer_debug ("<COMMAND_START>(\\.\\.\\.){ANY_EXCEPT_NL}*{NL}");
1795
1796 if (! curr_lexer->m_string_text.empty ())
1797 {
1798 yyless (0);
1799 curr_lexer->m_tok_end = curr_lexer->m_filepos;
1800 return curr_lexer->finish_command_arg ();
1801 }
1802
1804 }
1805 YY_BREAK
1806
1807// Commands normally end at the end of a line or a semicolon.
1808
1809case 3:
1810/* rule 3 can match eol */
1812#line 466 "/home/jwe/src/octave-stable/libinterp/parse-tree/lex.ll"
1813{
1814 curr_lexer->lexer_debug ("<COMMAND_START>({CCHAR}{ANY_EXCEPT_NL}*)?{NL}");
1815
1816 if (! curr_lexer->m_string_text.empty ())
1817 {
1818 yyless (0);
1819 curr_lexer->m_tok_end = curr_lexer->m_filepos;
1820 return curr_lexer->finish_command_arg ();
1821 }
1822
1823 curr_lexer->update_token_positions (yyleng);
1824
1825 curr_lexer->m_filepos.next_line ();
1826 curr_lexer->m_looking_for_object_index = false;
1827 curr_lexer->m_at_beginning_of_statement = true;
1828 curr_lexer->pop_start_state ();
1829
1830 return curr_lexer->handle_token ('\n');
1831 }
1832 YY_BREAK
1833case 4:
1835#line 486 "/home/jwe/src/octave-stable/libinterp/parse-tree/lex.ll"
1836{
1837 curr_lexer->lexer_debug ("<COMMAND_START>[\\,\\;]");
1838
1839 if (yytext[0] != ',' || curr_lexer->m_command_arg_paren_count == 0)
1840 {
1841 if (! curr_lexer->m_string_text.empty ())
1842 {
1843 yyless (0);
1844 curr_lexer->m_tok_end = curr_lexer->m_filepos;
1845 return curr_lexer->finish_command_arg ();
1846 }
1847
1848 curr_lexer->update_token_positions (yyleng);
1849
1850 curr_lexer->m_looking_for_object_index = false;
1851 curr_lexer->m_at_beginning_of_statement = true;
1852 curr_lexer->pop_start_state ();
1853
1854 return curr_lexer->handle_token (yytext[0]);
1855 }
1856 else
1857 {
1858 curr_lexer->m_string_text += yytext;
1859 curr_lexer->m_filepos.increment_column (yyleng);
1860 }
1861 }
1862 YY_BREAK
1863
1864// Unbalanced parentheses serve as pseudo-quotes: they are included in
1865// the final argument string, but they cause parentheses and quotes to
1866// be slurped into that argument as well.
1867
1868case 5:
1870#line 519 "/home/jwe/src/octave-stable/libinterp/parse-tree/lex.ll"
1871{
1872 curr_lexer->lexer_debug ("<COMMAND_START>[\\(\\[\\{]+");
1873
1874 curr_lexer->m_command_arg_paren_count += yyleng;
1875 curr_lexer->m_string_text += yytext;
1876 curr_lexer->m_filepos.increment_column (yyleng);
1877 }
1878 YY_BREAK
1879case 6:
1881#line 527 "/home/jwe/src/octave-stable/libinterp/parse-tree/lex.ll"
1882{
1883 curr_lexer->lexer_debug ("<COMMAND_START>[\\)\\]\\}]+");
1884
1885 curr_lexer->m_command_arg_paren_count -= yyleng;
1886 curr_lexer->m_string_text += yytext;
1887 curr_lexer->m_filepos.increment_column (yyleng);
1888}
1889 YY_BREAK
1890
1891// Handle quoted strings. Quoted strings that are not separated by
1892// whitespace from other argument text are combined with that previous
1893// text. For instance,
1894//
1895// command 'text1'"text2"
1896//
1897// has a single argument text1text2, not two separate arguments.
1898// That's why we must test to see if we are in command argument mode
1899// when processing the end of a string.
1900
1901case 7:
1903#line 547 "/home/jwe/src/octave-stable/libinterp/parse-tree/lex.ll"
1904{
1905 curr_lexer->lexer_debug ("<COMMAND_START>[\\\"\\']");
1906
1907 if (curr_lexer->m_command_arg_paren_count == 0)
1908 curr_lexer->begin_string (yytext[0] == '"'
1910 else
1911 curr_lexer->m_string_text += yytext;
1912
1913 curr_lexer->m_filepos.increment_column (yyleng);
1914 }
1915 YY_BREAK
1916
1917// In standard command argument processing, whitespace separates
1918// arguments. In the presence of unbalanced parentheses, it is
1919// incorporated into the argument.
1920
1921case 8:
1923#line 565 "/home/jwe/src/octave-stable/libinterp/parse-tree/lex.ll"
1924{
1925 curr_lexer->lexer_debug ("<COMMAND_START>{S}*");
1926
1927 if (curr_lexer->m_command_arg_paren_count == 0)
1928 {
1929 if (! curr_lexer->m_string_text.empty ())
1930 {
1931 yyless (0);
1932 curr_lexer->m_tok_end = curr_lexer->m_filepos;
1933 return curr_lexer->finish_command_arg ();
1934 }
1935 }
1936 else
1937 curr_lexer->m_string_text += yytext;
1938
1939 curr_lexer->m_filepos.increment_column (yyleng);
1940 }
1941 YY_BREAK
1942
1943// Everything else is slurped into the command arguments.
1944
1945case 9:
1947#line 587 "/home/jwe/src/octave-stable/libinterp/parse-tree/lex.ll"
1948{
1949 curr_lexer->lexer_debug ("<COMMAND_START>([\\.]|[^#% \\t\\r\\n\\.\\,\\;\\\"\\'\\(\\[\\{\\}\\]\\)]*");
1950
1951 curr_lexer->m_string_text += yytext;
1952 curr_lexer->m_filepos.increment_column (yyleng);
1953 }
1954 YY_BREAK
1955
1956// Whitespace inside matrix lists.
1957
1958case 10:
1960#line 598 "/home/jwe/src/octave-stable/libinterp/parse-tree/lex.ll"
1961{
1962 curr_lexer->lexer_debug ("<MATRIX_START>{S}*");
1963
1964 curr_lexer->m_filepos.increment_column (yyleng);
1965
1966 curr_lexer->mark_previous_token_trailing_space ();
1967 }
1968 YY_BREAK
1969case 11:
1970/* rule 11 can match eol */
1972#line 606 "/home/jwe/src/octave-stable/libinterp/parse-tree/lex.ll"
1973{
1974 curr_lexer->lexer_debug ("<MATRIX_START>{NL}");
1975
1976 curr_lexer->m_filepos.next_line ();
1977
1978 if (curr_lexer->m_nesting_level.is_paren ())
1979 curr_lexer->warn_language_extension ("bare newline inside parentheses");
1980 else
1981 {
1982 int tok = curr_lexer->previous_token_value ();
1983
1984 if (! (tok == ';' || tok == '[' || tok == '{'))
1985 curr_lexer->xunput (';');
1986 }
1987 }
1988 YY_BREAK
1989
1990// Continuation lines in matrix constants are handled as whitespace.
1991// Allow arbitrary text after the continuation marker.
1992
1993case 12:
1994/* rule 12 can match eol */
1996#line 627 "/home/jwe/src/octave-stable/libinterp/parse-tree/lex.ll"
1997{
1998 curr_lexer->lexer_debug ("<MATRIX_START>\\.\\.\\.{ANY_EXCEPT_NL}*{NL}");
1999
2000 curr_lexer->handle_continuation ();
2001
2002 // Even if there wasn't a space before or after the continuation
2003 // marker, treat the continuation as if it were. But since it will
2004 // be transformed to a separator later anyway, there's no need to
2005 // actually unput a space on the input stream.
2006
2007 curr_lexer->mark_previous_token_trailing_space ();
2008 }
2009 YY_BREAK
2010
2011// For this and the next two rules, we're looking at ']', and we
2012// need to know if the next token is '=' or '=='.
2013//
2014// It would have been so much easier if the delimiters were simply
2015// different for the expression on the left hand side of the equals
2016// operator.
2017//
2018// It's also a pain in the ass to decide whether to insert a comma
2019// after seeing a ']' character...
2020
2021// FIXME: we need to handle block comments here.
2022
2023case 13:
2025#line 654 "/home/jwe/src/octave-stable/libinterp/parse-tree/lex.ll"
2026{
2027 curr_lexer->lexer_debug ("<MATRIX_START>\\]");
2028
2029 curr_lexer->update_token_positions (yyleng);
2030 return curr_lexer->handle_close_bracket (']');
2031 }
2032 YY_BREAK
2033
2034// FIXME: we need to handle block comments here.
2035
2036case 14:
2038#line 665 "/home/jwe/src/octave-stable/libinterp/parse-tree/lex.ll"
2039{
2040 curr_lexer->lexer_debug ("<MATRIX_START>\\}*");
2041
2042 curr_lexer->update_token_positions (yyleng);
2043 return curr_lexer->handle_close_bracket ('}');
2044 }
2045 YY_BREAK
2046case 15:
2048#line 672 "/home/jwe/src/octave-stable/libinterp/parse-tree/lex.ll"
2049{
2050 curr_lexer->lexer_debug ("\\[");
2051
2052 bool unput_comma = false;
2053
2054 if (curr_lexer->whitespace_is_significant ()
2055 && curr_lexer->space_follows_previous_token ())
2056 {
2057 int tok = curr_lexer->previous_token_value ();
2058
2059 if (! (tok == '[' || tok == '{'
2060 || curr_lexer->previous_token_is_binop ()))
2061 unput_comma = true;
2062 }
2063
2064 if (unput_comma)
2065 {
2066 yyless (0);
2067 curr_lexer->xunput (',');
2068 }
2069 else
2070 {
2071 curr_lexer->update_token_positions (yyleng);
2072
2073 curr_lexer->m_nesting_level.bracket ();
2074
2075 curr_lexer->m_looking_at_object_index.push_front (false);
2076
2077 curr_lexer->m_looking_for_object_index = false;
2078 curr_lexer->m_at_beginning_of_statement = false;
2079
2080 if (curr_lexer->m_defining_func
2081 && ! curr_lexer->m_parsed_function_name.top ())
2082 curr_lexer->m_looking_at_return_list = true;
2083 else
2084 curr_lexer->m_looking_at_matrix_or_assign_lhs = true;
2085
2086 curr_lexer->m_bracketflag++;
2087
2088 curr_lexer->push_start_state (MATRIX_START);
2089
2090 return curr_lexer->count_token ('[');
2091 }
2092 }
2093 YY_BREAK
2094case 16:
2096#line 717 "/home/jwe/src/octave-stable/libinterp/parse-tree/lex.ll"
2097{
2098 curr_lexer->lexer_debug ("\\]");
2099
2100 curr_lexer->update_token_positions (yyleng);
2101
2102 curr_lexer->m_nesting_level.remove ();
2103
2104 curr_lexer->m_looking_at_object_index.pop_front ();
2105
2106 curr_lexer->m_looking_for_object_index = true;
2107 curr_lexer->m_at_beginning_of_statement = false;
2108
2109 return curr_lexer->handle_token (']');
2110 }
2111 YY_BREAK
2112
2113// Gobble comments. Both BLOCK_COMMENT_START and LINE_COMMENT_START
2114// are exclusive start states. We try to grab a continuous series of
2115// line-oriented comments as a single collection of comments.
2116
2117
2118// Start of a block comment. Since comment start states are exclusive,
2119// this pattern will not match a block comment that immediately follows
2120// a line-oriented comment. All we need to do is push the matched text
2121// back on the input stream and push the new start state.
2122
2123case 17:
2124/* rule 17 can match eol */
2126#line 745 "/home/jwe/src/octave-stable/libinterp/parse-tree/lex.ll"
2127{
2128 curr_lexer->lexer_debug ("^{S}*{CCHAR}\\{{S}*{NL}");
2129
2130 yyless (0);
2131
2132 curr_lexer->push_start_state (BLOCK_COMMENT_START);
2133 }
2134 YY_BREAK
2135case 18:
2136/* rule 18 can match eol */
2138#line 753 "/home/jwe/src/octave-stable/libinterp/parse-tree/lex.ll"
2139{
2140 curr_lexer->lexer_debug ("<BLOCK_COMMENT_START>^{S}*{CCHAR}\\{{S}*{NL}");
2141
2142 curr_lexer->m_filepos.next_line ();
2143
2144 if (curr_lexer->m_block_comment_nesting_level)
2145 curr_lexer->m_comment_text = "\n";
2146
2147 curr_lexer->m_block_comment_nesting_level++;
2148
2149 HANDLE_EOB_OR_EOF (-1);
2150 }
2151 YY_BREAK
2152
2153// End of a block comment. If this block comment is nested inside
2154// another, wait for the outermost block comment to be closed before
2155// storing the comment.
2156
2157// NOTE: This pattern must appear before the one below. Both may match
2158// the same text and this one should take precedence over the one that
2159// follows.
2160
2161case 19:
2162/* rule 19 can match eol */
2164#line 776 "/home/jwe/src/octave-stable/libinterp/parse-tree/lex.ll"
2165{
2166 curr_lexer->lexer_debug ("<BLOCK_COMMENT_START>^{S}*{CCHAR}\\}{S}*{NL}");
2167
2168 curr_lexer->m_filepos.next_line ();
2169
2170 if (curr_lexer->m_block_comment_nesting_level > 1)
2171 curr_lexer->m_comment_text = "\n";
2172 else
2173 curr_lexer->finish_comment (octave::comment_elt::block);
2174
2175 curr_lexer->m_block_comment_nesting_level--;
2176
2177 int status = -1;
2178
2179 if (curr_lexer->m_block_comment_nesting_level == 0)
2180 {
2181 status = -2;
2182
2183 curr_lexer->pop_start_state ();
2184 }
2185
2186 HANDLE_EOB_OR_EOF (status);
2187 }
2188 YY_BREAK
2189
2190// Body of a block comment.
2191
2192case 20:
2193/* rule 20 can match eol */
2195#line 804 "/home/jwe/src/octave-stable/libinterp/parse-tree/lex.ll"
2196{
2197 curr_lexer->lexer_debug ("<BLOCK_COMMENT_START>{ANY_EXCEPT_NL}*{NL}");
2198
2199 curr_lexer->m_filepos.next_line ();
2200 curr_lexer->m_comment_text += yytext;
2201
2202 HANDLE_EOB_OR_EOF (-1);
2203 }
2204 YY_BREAK
2205
2206// Full-line or end-of-line comment.
2207
2208case 21:
2209/* rule 21 can match eol */
2211#line 817 "/home/jwe/src/octave-stable/libinterp/parse-tree/lex.ll"
2212{
2213 curr_lexer->lexer_debug ("{S}*{CCHAR}{ANY_EXCEPT_NL}*{NL}");
2214
2215 curr_lexer->push_start_state (LINE_COMMENT_START);
2216 yyless (0);
2217 }
2218 YY_BREAK
2219
2220// Beginning of a block comment while we are looking at a series of
2221// line-oriented comments. Finish previous comment, push current
2222// text back on input stream, and switch start states.
2223
2224// NOTE: This pattern must appear before the one below. Both may match
2225// the same text and this one should take precedence over the one that
2226// follows.
2227
2228case 22:
2229/* rule 22 can match eol */
2231#line 834 "/home/jwe/src/octave-stable/libinterp/parse-tree/lex.ll"
2232{
2233 curr_lexer->lexer_debug ("<LINE_COMMENT_START>^{S}*{CCHAR}\\{{S}*{NL}");
2234
2235 if (! curr_lexer->m_comment_text.empty ())
2237
2238 curr_lexer->pop_start_state ();
2239 curr_lexer->push_start_state (BLOCK_COMMENT_START);
2240 yyless (0);
2241 }
2242 YY_BREAK
2243
2244// Line-oriented comment. If we are at the beginning of a line, this is
2245// part of a series of full-line comments. Otherwise, this is an end of
2246// line comment. We don't need to parse the matched text to determine
2247// whether we are looking at the start of a block comment as that
2248// pattern is handled above.
2249
2250// NOTE: This pattern must appear before the one below. Both may match
2251// the same text and this one should take precedence over the one that
2252// follows.
2253
2254case 23:
2255/* rule 23 can match eol */
2257#line 857 "/home/jwe/src/octave-stable/libinterp/parse-tree/lex.ll"
2258{
2259 curr_lexer->lexer_debug ("<LINE_COMMENT_START>{S}*{CCHAR}{ANY_EXCEPT_NL}*{NL}");
2260
2261 // Grab text of comment without leading space or comment
2262 // characters.
2263
2264 std::size_t i = 0;
2265 while (i < yyleng && is_space_or_tab (yytext[i]))
2266 i++;
2267
2268 bool have_space = (i > 0);
2269
2270 while (i < yyleng && (yytext[i] == '#' || yytext[i] == '%'))
2271 i++;
2272
2273 curr_lexer->m_comment_text += &yytext[i];
2274
2275 if (curr_lexer->m_filepos.column () == 1)
2276 {
2277 curr_lexer->m_filepos.next_line ();
2278 }
2279 else
2280 {
2281 // End of line comment.
2282
2283 if (have_space)
2284 curr_lexer->mark_previous_token_trailing_space ();
2285
2287
2288 curr_lexer->pop_start_state ();
2289
2290 // Push the newline character back on the input and skip
2291 // incrementing the line count so we don't have to duplicate
2292 // all the possible actions that happen with newlines here.
2293
2294 curr_lexer->xunput ('\n');
2295
2296 // The next action should recognize a newline character and set
2297 // the input column back to 1, but we should try to keep the
2298 // input column location accurate anyway, so update here.
2299 curr_lexer->m_filepos.increment_column (yyleng);
2300 }
2301 }
2302 YY_BREAK
2303
2304// End of a series of full-line because some other character was
2305// found on the input stream.
2306
2307case 24:
2308/* rule 24 can match eol */
2310#line 907 "/home/jwe/src/octave-stable/libinterp/parse-tree/lex.ll"
2311{
2312 curr_lexer->lexer_debug ("<LINE_COMMENT_START>{ANY_INCLUDING_NL}");
2313
2314 if (yytext[0] == '\001')
2315 {
2316 // We are here because we are using the push parser/lexer
2317 // interface and we hit the end of the input buffer or file.
2318 // The special ASCII 1 marker is added to the input by
2319 // push_lexer::fill_flex_buffer.
2320
2321 if (curr_lexer->pending_token_count () > 0)
2322 {
2323 // We are in the middle of parsing a command, expresison,
2324 // etc., so set the return status so that if we are at the
2325 // end of the buffer we'll continue looking for more input,
2326 // possibly buffering a series of line oriented comments as
2327 // a single block.
2328
2329 HANDLE_EOB_OR_EOF (-1);
2330 }
2331 else
2332 {
2333 // We are not in the process of parsing a command,
2334 // expression, etc., so end any current sequence of comments
2335 // with this full line comment, pop the start state and
2336 // return as if we have just finished parsing a complete
2337 // statement.
2338
2340
2341 curr_lexer->pop_start_state ();
2342
2343 HANDLE_EOB_OR_EOF (-2);
2344 }
2345 }
2346 else
2347 {
2348 // End any current sequence of comments, pop the start state,
2349 // and unput the pending input character that ended the series
2350 // of comments.
2351
2353
2354 curr_lexer->pop_start_state ();
2355
2356 curr_lexer->xunput (yytext[0]);
2357 }
2358 }
2359 YY_BREAK
2360
2361// End of file will also end a series of full-line comments.
2362
2364#line 960 "/home/jwe/src/octave-stable/libinterp/parse-tree/lex.ll"
2365{
2366 curr_lexer->lexer_debug ("<LINE_COMMENT_START><<EOF>>");
2367
2369
2370 curr_lexer->pop_start_state ();
2371 }
2372 YY_BREAK
2373
2374// Double-quoted character strings.
2375
2376case 25:
2378#line 972 "/home/jwe/src/octave-stable/libinterp/parse-tree/lex.ll"
2379{
2380 curr_lexer->lexer_debug ("<DQ_STRING_START>\\\"\\\"");
2381
2382 curr_lexer->m_filepos.increment_column (yyleng);
2383 curr_lexer->m_string_text += '"';
2384 }
2385 YY_BREAK
2386case 26:
2388#line 979 "/home/jwe/src/octave-stable/libinterp/parse-tree/lex.ll"
2389{
2390 curr_lexer->lexer_debug ("<DQ_STRING_START>\\\"");
2391
2392 // m_tok_beg was set when we started parsing the string.
2393 curr_lexer->m_tok_end = curr_lexer->m_filepos;
2394 curr_lexer->m_filepos.increment_column ();
2395
2396 curr_lexer->pop_start_state ();
2397
2398 if (curr_lexer->start_state() != COMMAND_START)
2399 {
2400 curr_lexer->m_looking_for_object_index = true;
2401 curr_lexer->m_at_beginning_of_statement = false;
2402
2403 curr_lexer->push_token (new octave::token (DQ_STRING,
2404 curr_lexer->m_string_text,
2405 curr_lexer->m_tok_beg,
2406 curr_lexer->m_tok_end));
2407
2408 curr_lexer->m_string_text = "";
2409
2410 return curr_lexer->count_token_internal (DQ_STRING);
2411 }
2412 }
2413 YY_BREAK
2414case 27:
2416#line 1004 "/home/jwe/src/octave-stable/libinterp/parse-tree/lex.ll"
2417{
2418 curr_lexer->lexer_debug ("<DQ_STRING_START>\\\\[0-7]{1,3}");
2419
2420 curr_lexer->update_token_positions (yyleng);
2421
2422 unsigned int result;
2423 sscanf (yytext+1, "%o", &result);
2424
2425 if (result > 0xff)
2426 {
2427 // Use location of octal digits for error token.
2428 octave::token *tok
2430 "invalid octal escape sequence in character string",
2431 curr_lexer->m_tok_beg, curr_lexer->m_tok_end);
2432
2433 curr_lexer->push_token (tok);
2434
2435 return curr_lexer->count_token_internal (LEXICAL_ERROR);
2436 }
2437 else
2438 curr_lexer->m_string_text += static_cast<unsigned char> (result);
2439 }
2440 YY_BREAK
2441case 28:
2443#line 1028 "/home/jwe/src/octave-stable/libinterp/parse-tree/lex.ll"
2444{
2445 curr_lexer->lexer_debug ("<DQ_STRING_START>\\\\x[0-9a-fA-F]+");
2446
2447 curr_lexer->m_filepos.increment_column (yyleng);
2448
2449 unsigned int result;
2450 sscanf (yytext+2, "%x", &result);
2451
2452 // Truncate the value silently instead of checking the range like
2453 // we do for octal above. This is to match C/C++ where any number
2454 // of digits is allowed but the value is implementation-defined if
2455 // it exceeds the range of the character type.
2456 curr_lexer->m_string_text += static_cast<unsigned char> (result);
2457 }
2458 YY_BREAK
2459case 29:
2461#line 1043 "/home/jwe/src/octave-stable/libinterp/parse-tree/lex.ll"
2462{
2463 curr_lexer->lexer_debug ("<DQ_STRING_START>\"\\\\a\"");
2464
2465 curr_lexer->m_filepos.increment_column (yyleng);
2466 curr_lexer->m_string_text += '\a';
2467 }
2468 YY_BREAK
2469case 30:
2471#line 1050 "/home/jwe/src/octave-stable/libinterp/parse-tree/lex.ll"
2472{
2473 curr_lexer->lexer_debug ("<DQ_STRING_START>\"\\\\b\"");
2474
2475 curr_lexer->m_filepos.increment_column (yyleng);
2476 curr_lexer->m_string_text += '\b';
2477 }
2478 YY_BREAK
2479case 31:
2481#line 1057 "/home/jwe/src/octave-stable/libinterp/parse-tree/lex.ll"
2482{
2483 curr_lexer->lexer_debug ("<DQ_STRING_START>\"\\\\f\"");
2484
2485 curr_lexer->m_filepos.increment_column (yyleng);
2486 curr_lexer->m_string_text += '\f';
2487 }
2488 YY_BREAK
2489case 32:
2491#line 1064 "/home/jwe/src/octave-stable/libinterp/parse-tree/lex.ll"
2492{
2493 curr_lexer->lexer_debug ("<DQ_STRING_START>\"\\\\n\"");
2494
2495 curr_lexer->m_filepos.increment_column (yyleng);
2496 curr_lexer->m_string_text += '\n';
2497 }
2498 YY_BREAK
2499case 33:
2501#line 1071 "/home/jwe/src/octave-stable/libinterp/parse-tree/lex.ll"
2502{
2503 curr_lexer->lexer_debug ("<DQ_STRING_START>\"\\\\r\"");
2504
2505 curr_lexer->m_filepos.increment_column (yyleng);
2506 curr_lexer->m_string_text += '\r';
2507 }
2508 YY_BREAK
2509case 34:
2511#line 1078 "/home/jwe/src/octave-stable/libinterp/parse-tree/lex.ll"
2512{
2513 curr_lexer->lexer_debug ("<DQ_STRING_START>\"\\\\t\"");
2514
2515 curr_lexer->m_filepos.increment_column (yyleng);
2516 curr_lexer->m_string_text += '\t';
2517 }
2518 YY_BREAK
2519case 35:
2521#line 1085 "/home/jwe/src/octave-stable/libinterp/parse-tree/lex.ll"
2522{
2523 curr_lexer->lexer_debug ("<DQ_STRING_START>\"\\\\v\"");
2524
2525 curr_lexer->m_filepos.increment_column (yyleng);
2526 curr_lexer->m_string_text += '\v';
2527 }
2528 YY_BREAK
2529case 36:
2530/* rule 36 can match eol */
2532#line 1092 "/home/jwe/src/octave-stable/libinterp/parse-tree/lex.ll"
2533{
2534 curr_lexer->lexer_debug ("<DQ_STRING_START>(\\.\\.\\.){S}*{NL}");
2535
2536 /* FIXME: Remove support for '...' continuation in Octave 9 */
2537 static const char *msg = "'...' continuations in double-quoted character strings were deprecated in version 7 and will not be allowed in a future version of Octave; please use '\\' instead";
2538
2539 curr_lexer->warn_deprecated_syntax (msg);
2540
2542 }
2543 YY_BREAK
2544case 37:
2545/* rule 37 can match eol */
2547#line 1103 "/home/jwe/src/octave-stable/libinterp/parse-tree/lex.ll"
2548{
2549 curr_lexer->lexer_debug ("<DQ_STRING_START>\\\\{S}+{NL}");
2550
2551 /* FIXME: Remove support for WS after line continuation in Octave 9 */
2552 static const char *msg = "whitespace after continuation markers in double-quoted character strings were deprecated in version 7 and will not be allowed in a future version of Octave";
2553
2554 curr_lexer->warn_deprecated_syntax (msg);
2555
2557 }
2558 YY_BREAK
2559case 38:
2560/* rule 38 can match eol */
2562#line 1114 "/home/jwe/src/octave-stable/libinterp/parse-tree/lex.ll"
2563{
2564 curr_lexer->lexer_debug ("<DQ_STRING_START>\\\\{NL}");
2565
2567 }
2568 YY_BREAK
2569case 39:
2571#line 1120 "/home/jwe/src/octave-stable/libinterp/parse-tree/lex.ll"
2572{
2573 curr_lexer->lexer_debug ("<DQ_STRING_START>\\\\.");
2574
2575 curr_lexer->m_filepos.increment_column (yyleng);
2576 curr_lexer->m_string_text += yytext[1];
2577 }
2578 YY_BREAK
2579case 40:
2581#line 1127 "/home/jwe/src/octave-stable/libinterp/parse-tree/lex.ll"
2582{
2583 curr_lexer->lexer_debug ("<DQ_STRING_START>\\.");
2584
2585 curr_lexer->m_filepos.increment_column ();
2586 curr_lexer->m_string_text += yytext[0];
2587 }
2588 YY_BREAK
2589case 41:
2591#line 1134 "/home/jwe/src/octave-stable/libinterp/parse-tree/lex.ll"
2592{
2593 curr_lexer->lexer_debug ("<DQ_STRING_START>[^\\.\\\\\\r\\n\\\"]+");
2594
2595 curr_lexer->m_filepos.increment_column (yyleng);
2596 curr_lexer->m_string_text += yytext;
2597 }
2598 YY_BREAK
2599case 42:
2600/* rule 42 can match eol */
2602#line 1141 "/home/jwe/src/octave-stable/libinterp/parse-tree/lex.ll"
2603{
2604 curr_lexer->lexer_debug ("<DQ_STRING_START>{NL}");
2605
2606 // Use current file position for error token.
2607 octave::token *tok
2609 "unterminated character string constant",
2610 curr_lexer->m_filepos, curr_lexer->m_filepos);
2611
2612 curr_lexer->push_token (tok);
2613
2614 curr_lexer->m_filepos.next_line ();
2615
2616 return curr_lexer->count_token_internal (LEXICAL_ERROR);
2617 }
2618 YY_BREAK
2619
2620// Single-quoted character strings.
2621
2622case 43:
2624#line 1161 "/home/jwe/src/octave-stable/libinterp/parse-tree/lex.ll"
2625{
2626 curr_lexer->lexer_debug ("<SQ_STRING_START>\\'\\'");
2627
2628 curr_lexer->m_filepos.increment_column (yyleng);
2629 curr_lexer->m_string_text += '\'';
2630 }
2631 YY_BREAK
2632case 44:
2634#line 1168 "/home/jwe/src/octave-stable/libinterp/parse-tree/lex.ll"
2635{
2636 curr_lexer->lexer_debug ("<SQ_STRING_START>\\'");
2637
2638 // m_tok_beg was set when we started parsing the string.
2639 curr_lexer->m_tok_end = curr_lexer->m_filepos;
2640 curr_lexer->m_filepos.increment_column ();
2641
2642 curr_lexer->pop_start_state ();
2643
2644 if (curr_lexer->start_state() != COMMAND_START)
2645 {
2646 curr_lexer->m_looking_for_object_index = true;
2647 curr_lexer->m_at_beginning_of_statement = false;
2648
2649 curr_lexer->push_token (new octave::token (SQ_STRING,
2650 curr_lexer->m_string_text,
2651 curr_lexer->m_tok_beg,
2652 curr_lexer->m_tok_end));
2653
2654 curr_lexer->m_string_text = "";
2655
2656 return curr_lexer->count_token_internal (SQ_STRING);
2657 }
2658 }
2659 YY_BREAK
2660case 45:
2662#line 1193 "/home/jwe/src/octave-stable/libinterp/parse-tree/lex.ll"
2663{
2664 curr_lexer->lexer_debug ("<SQ_STRING_START>[^\\'\\n\\r]+");
2665
2666 curr_lexer->m_filepos.increment_column (yyleng);
2667 curr_lexer->m_string_text += yytext;
2668 }
2669 YY_BREAK
2670case 46:
2671/* rule 46 can match eol */
2673#line 1200 "/home/jwe/src/octave-stable/libinterp/parse-tree/lex.ll"
2674{
2675 curr_lexer->lexer_debug ("<SQ_STRING_START>{NL}");
2676
2677 // Use current file position for error token.
2678 octave::token *tok
2680 "unterminated character string constant",
2681 curr_lexer->m_filepos, curr_lexer->m_filepos);
2682
2683 curr_lexer->push_token (tok);
2684
2685 curr_lexer->m_filepos.next_line ();
2686
2687 return curr_lexer->count_token_internal (LEXICAL_ERROR);
2688 }
2689 YY_BREAK
2690
2691// Fully-qualified identifiers (used for classdef).
2692
2693case 47:
2695#line 1220 "/home/jwe/src/octave-stable/libinterp/parse-tree/lex.ll"
2696{
2697 curr_lexer->lexer_debug ("<FQ_IDENT_START>{FQIDENT}{S}*");
2698
2699 curr_lexer->pop_start_state ();
2700
2701 curr_lexer->update_token_positions (yyleng);
2702
2703 int id_tok = curr_lexer->handle_fq_identifier ();
2704
2705 if (id_tok >= 0)
2706 {
2707 curr_lexer->m_looking_for_object_index = true;
2708
2709 return curr_lexer->count_token_internal (id_tok);
2710 }
2711 }
2712 YY_BREAK
2713case 48:
2715#line 1237 "/home/jwe/src/octave-stable/libinterp/parse-tree/lex.ll"
2716{
2717 curr_lexer->lexer_debug ("<FQ_IDENT_START>{S}+");
2718
2719 curr_lexer->m_filepos.increment_column (yyleng);
2720
2721 curr_lexer->mark_previous_token_trailing_space ();
2722 }
2723 YY_BREAK
2724case 49:
2725/* rule 49 can match eol */
2727#line 1245 "/home/jwe/src/octave-stable/libinterp/parse-tree/lex.ll"
2728{
2729 curr_lexer->lexer_debug ("<FQ_IDENT_START>(\\.\\.\\.){ANY_EXCEPT_NL}*{NL}");
2730
2731 curr_lexer->m_filepos.next_line ();
2732 }
2733 YY_BREAK
2734case 50:
2735/* rule 50 can match eol */
2737#line 1251 "/home/jwe/src/octave-stable/libinterp/parse-tree/lex.ll"
2738{
2739 curr_lexer->lexer_debug ("<FQ_IDENT_START>{ANY_INCLUDING_NL}");
2740
2741 // If input doesn't match FQIDENT, return char and go to previous
2742 // start state.
2743
2744 yyless (0);
2745 curr_lexer->pop_start_state ();
2746 }
2747 YY_BREAK
2748case 51:
2750#line 1261 "/home/jwe/src/octave-stable/libinterp/parse-tree/lex.ll"
2751{
2752 HANDLE_NUMBER ("{BINARY_NUMBER}", 2);
2753 }
2754 YY_BREAK
2755
2756// Decimal numbers. For expressions that are just digits followed
2757// directly by an element-by-element operator, don't grab the '.'
2758// part of the operator as part of the constant (for example, in an
2759// expression like "13./x").
2760
2761case 52:
2762*yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */
2763yyg->yy_c_buf_p = yy_cp -= 2;
2764YY_DO_BEFORE_ACTION; /* set up yytext again */
2765#line 1273 "/home/jwe/src/octave-stable/libinterp/parse-tree/lex.ll"
2766case 53:
2768#line 1273 "/home/jwe/src/octave-stable/libinterp/parse-tree/lex.ll"
2769{
2770 HANDLE_NUMBER ("{DECIMAL_DIGITS}/\\.[\\*/\\\\^\\']|{DECIMAL_NUMBER}", 10);
2771 }
2772 YY_BREAK
2773case 54:
2775#line 1277 "/home/jwe/src/octave-stable/libinterp/parse-tree/lex.ll"
2776{
2777 HANDLE_NUMBER ("{HEXADECIMAL_NUMBER}", 16);
2778 }
2779 YY_BREAK
2780
2781// Eat whitespace. Whitespace inside matrix constants is handled by
2782// the <MATRIX_START> start state code above.
2783
2784case 55:
2786#line 1286 "/home/jwe/src/octave-stable/libinterp/parse-tree/lex.ll"
2787{
2788 curr_lexer->m_filepos.increment_column (yyleng);
2789
2790 curr_lexer->mark_previous_token_trailing_space ();
2791 }
2792 YY_BREAK
2793
2794// Continuation lines. Allow arbitrary text after continuations.
2795
2796case 56:
2797/* rule 56 can match eol */
2799#line 1296 "/home/jwe/src/octave-stable/libinterp/parse-tree/lex.ll"
2800{
2801 curr_lexer->lexer_debug ("\\.\\.\\.{ANY_EXCEPT_NL}*{NL}");
2802
2803 curr_lexer->handle_continuation ();
2804 }
2805 YY_BREAK
2806
2807// Deprecated C preprocessor style continuation markers.
2808
2809case 57:
2810/* rule 57 can match eol */
2811#line 1307 "/home/jwe/src/octave-stable/libinterp/parse-tree/lex.ll"
2812case 58:
2813/* rule 58 can match eol */
2815#line 1307 "/home/jwe/src/octave-stable/libinterp/parse-tree/lex.ll"
2816{
2817 curr_lexer->lexer_debug ("\\\\{S}*{NL}|\\\\{S}*{CCHAR}{ANY_EXCEPT_NL}*{NL}");
2818
2819 /* FIXME: Remove support for '\\' line continuation in Octave 9 */
2820 static const char *msg = "using continuation marker \\ outside of double quoted strings was deprecated in version 7 and will be removed from a future version of Octave, use ... instead";
2821
2822 curr_lexer->warn_deprecated_syntax (msg);
2823
2824 curr_lexer->handle_continuation ();
2825 }
2826 YY_BREAK
2827
2828// End of file.
2829
2830case YY_STATE_EOF(INITIAL):
2837#line 1322 "/home/jwe/src/octave-stable/libinterp/parse-tree/lex.ll"
2838{
2839 return curr_lexer->handle_end_of_input ();
2840 }
2841 YY_BREAK
2842
2843// Identifiers.
2844
2845// Don't allow get and set to be recognized as keywords if they are
2846// followed by "(".
2847
2848case 59:
2850#line 1333 "/home/jwe/src/octave-stable/libinterp/parse-tree/lex.ll"
2851{
2852 HANDLE_IDENTIFIER ("(set|get){S}*\\(", true);
2853 }
2854 YY_BREAK
2855case 60:
2857#line 1337 "/home/jwe/src/octave-stable/libinterp/parse-tree/lex.ll"
2858{
2859 HANDLE_IDENTIFIER ("{IDENT}", false);
2860 }
2861 YY_BREAK
2862
2863// Superclass method identifiers.
2864
2865case 61:
2867#line 1345 "/home/jwe/src/octave-stable/libinterp/parse-tree/lex.ll"
2868{
2869 curr_lexer->lexer_debug ("{FQIDENT}{S}*@{S}*{FQIDENT}");
2870
2871 if (curr_lexer->previous_token_may_be_command ())
2872 {
2873 yyless (0);
2874 curr_lexer->push_start_state (COMMAND_START);
2875 }
2876 else
2877 {
2878 if (curr_lexer->m_at_beginning_of_statement)
2879 {
2880 std::string txt = yytext;
2881
2882 std::size_t at_or_dot_pos = txt.find_first_of ("@.");
2883
2884 if (at_or_dot_pos != std::string::npos)
2885 {
2886 std::size_t spc_pos = txt.find_first_of (" \t");
2887
2888 if (spc_pos != std::string::npos && spc_pos < at_or_dot_pos)
2889 {
2890 yyless (spc_pos);
2891 curr_lexer->m_filepos.increment_column (spc_pos);
2892
2893 return curr_lexer->handle_identifier ();
2894 }
2895 }
2896 }
2897
2898 curr_lexer->m_looking_for_object_index = true;
2899 curr_lexer->m_at_beginning_of_statement = false;
2900
2901 return curr_lexer->handle_superclass_identifier ();
2902 }
2903 }
2904 YY_BREAK
2905
2906// Metaclass query
2907
2908case 62:
2910#line 1386 "/home/jwe/src/octave-stable/libinterp/parse-tree/lex.ll"
2911{
2912 curr_lexer->lexer_debug ("\\?{S}*{FQIDENT}");
2913
2914 if (curr_lexer->previous_token_may_be_command ()
2915 && curr_lexer->space_follows_previous_token ())
2916 {
2917 yyless (0);
2918 curr_lexer->push_start_state (COMMAND_START);
2919 }
2920 else
2921 {
2922 curr_lexer->update_token_positions (yyleng);
2923
2924 int id_tok = curr_lexer->handle_meta_identifier ();
2925
2926 if (id_tok >= 0)
2927 {
2928 curr_lexer->m_looking_for_object_index = true;
2929
2930 return curr_lexer->count_token_internal (id_tok);
2931 }
2932 }
2933 }
2934 YY_BREAK
2935case 63:
2936#line 1411 "/home/jwe/src/octave-stable/libinterp/parse-tree/lex.ll"
2937case 64:
2939#line 1411 "/home/jwe/src/octave-stable/libinterp/parse-tree/lex.ll"
2940{
2941 curr_lexer->lexer_debug ("\\@|\\@{S}*{FQIDENT}");
2942
2943 if (curr_lexer->previous_token_may_be_command ()
2944 && curr_lexer->space_follows_previous_token ())
2945 {
2946 yyless (0);
2947 curr_lexer->push_start_state (COMMAND_START);
2948 }
2949 else
2950 {
2951 int tok_val = curr_lexer->previous_token_value ();
2952
2953 if (curr_lexer->whitespace_is_significant ()
2954 && curr_lexer->space_follows_previous_token ()
2955 && ! (tok_val == '[' || tok_val == '{'
2956 || curr_lexer->previous_token_is_binop ()))
2957 {
2958 yyless (0);
2959 curr_lexer->xunput (',');
2960 }
2961 else
2962 {
2963 curr_lexer->update_token_positions (yyleng);
2964
2965 curr_lexer->m_at_beginning_of_statement = false;
2966
2967 std::string ident = yytext;
2968
2969 if (ident == "@")
2970 {
2971 curr_lexer->m_looking_at_function_handle++;
2972 curr_lexer->m_looking_for_object_index = false;
2973
2974 return curr_lexer->count_token ('@');
2975 }
2976 else
2977 {
2978 ident = ident.substr (1);
2979 ident.erase (std::remove_if (ident.begin (), ident.end (),
2980 is_space_or_tab), ident.end ());
2981
2982 octave::token *tok;
2983
2984 if (octave::iskeyword (ident))
2985 tok = new octave::token (LEXICAL_ERROR,
2986 "function handles may not refer to keywords",
2987 curr_lexer->m_tok_beg,
2988 curr_lexer->m_tok_end);
2989 else
2990 {
2991 curr_lexer->m_looking_for_object_index = true;
2992
2993 tok = new octave::token (FCN_HANDLE, ident,
2994 curr_lexer->m_tok_beg,
2995 curr_lexer->m_tok_end);
2996 }
2997
2998 curr_lexer->push_token (tok);
2999
3000 return curr_lexer->count_token_internal (tok->token_value ());
3001 }
3002 }
3003 }
3004 }
3005 YY_BREAK
3006
3007// A new line character. New line characters inside matrix constants
3008// are handled by the <MATRIX_START> start state code above. If closest
3009// nesting is inside parentheses, don't return a row separator.
3010
3011case 65:
3012/* rule 65 can match eol */
3014#line 1483 "/home/jwe/src/octave-stable/libinterp/parse-tree/lex.ll"
3015{
3016 curr_lexer->lexer_debug ("{NL}");
3017
3018 if (curr_lexer->m_nesting_level.is_paren ())
3019 {
3020 curr_lexer->m_filepos.next_line ();
3021
3022 curr_lexer->m_at_beginning_of_statement = false;
3023 curr_lexer->warn_language_extension
3024 ("bare newline inside parentheses");
3025 }
3026 else if (curr_lexer->m_nesting_level.none ()
3027 || curr_lexer->m_nesting_level.is_anon_fcn_body ())
3028 {
3029 curr_lexer->update_token_positions (yyleng);
3030 curr_lexer->m_filepos.next_line ();
3031
3032 curr_lexer->m_at_beginning_of_statement = true;
3033
3034 return curr_lexer->count_token ('\n');
3035 }
3036 else if (curr_lexer->m_nesting_level.is_bracket_or_brace ())
3037 {
3038 curr_lexer->update_token_positions (yyleng);
3039 curr_lexer->m_filepos.next_line ();
3040
3041 // Use current file position for error token.
3042 octave::token *tok
3044 "unexpected internal lexer error",
3045 curr_lexer->m_filepos, curr_lexer->m_filepos);
3046
3047 curr_lexer->push_token (tok);
3048
3049 return curr_lexer->count_token_internal (LEXICAL_ERROR);
3050 }
3051 }
3052 YY_BREAK
3053
3054// Single quote can either be the beginning of a string or a transpose
3055// operator.
3056
3057case 66:
3059#line 1526 "/home/jwe/src/octave-stable/libinterp/parse-tree/lex.ll"
3060{
3061 curr_lexer->lexer_debug ("'");
3062
3063 if (curr_lexer->previous_token_may_be_command ()
3064 && curr_lexer->space_follows_previous_token ())
3065 {
3066 curr_lexer->m_filepos.increment_column ();
3067 curr_lexer->push_start_state (COMMAND_START);
3068 curr_lexer->begin_string (SQ_STRING_START);
3069 }
3070 else if (curr_lexer->m_at_beginning_of_statement)
3071 {
3072 curr_lexer->m_filepos.increment_column ();
3073 curr_lexer->begin_string (SQ_STRING_START);
3074 }
3075 else
3076 {
3077 int tok = curr_lexer->previous_token_value ();
3078
3079 if (curr_lexer->whitespace_is_significant ())
3080 {
3081 if (curr_lexer->space_follows_previous_token ())
3082 {
3083 if (tok == '[' || tok == '{'
3084 || curr_lexer->previous_token_is_binop ())
3085 {
3086 curr_lexer->m_filepos.increment_column ();
3087 curr_lexer->begin_string (SQ_STRING_START);
3088 }
3089 else
3090 {
3091 yyless (0);
3092 curr_lexer->xunput (',');
3093 }
3094 }
3095 else
3096 {
3097 if (tok == '[' || tok == '{'
3098 || curr_lexer->previous_token_is_binop ()
3099 || curr_lexer->previous_token_is_keyword ())
3100 {
3101 curr_lexer->m_filepos.increment_column ();
3102 curr_lexer->begin_string (SQ_STRING_START);
3103 }
3104 else
3105 {
3106 curr_lexer->m_filepos.increment_column ();
3107 return curr_lexer->count_token (HERMITIAN);
3108 }
3109 }
3110 }
3111 else
3112 {
3113 if (! tok || tok == '[' || tok == '{' || tok == '('
3114 || curr_lexer->previous_token_is_binop ()
3115 || curr_lexer->previous_token_is_keyword ())
3116 {
3117 curr_lexer->m_filepos.increment_column ();
3118 curr_lexer->begin_string (SQ_STRING_START);
3119 }
3120 else
3121 {
3122 curr_lexer->m_filepos.increment_column ();
3123 return curr_lexer->count_token (HERMITIAN);
3124 }
3125 }
3126 }
3127 }
3128 YY_BREAK
3129
3130// Double quotes always begin strings.
3131
3132case 67:
3134#line 1599 "/home/jwe/src/octave-stable/libinterp/parse-tree/lex.ll"
3135{
3136 curr_lexer->lexer_debug ("\\\"");
3137
3138 if (curr_lexer->previous_token_may_be_command ()
3139 && curr_lexer->space_follows_previous_token ())
3140 {
3141 curr_lexer->m_filepos.increment_column ();
3142 curr_lexer->push_start_state (COMMAND_START);
3143 curr_lexer->begin_string (DQ_STRING_START);
3144 }
3145 else
3146 {
3147 int tok = curr_lexer->previous_token_value ();
3148
3149 if (curr_lexer->whitespace_is_significant ())
3150 {
3151 if (curr_lexer->space_follows_previous_token ())
3152 {
3153 if (tok == '[' || tok == '{'
3154 || curr_lexer->previous_token_is_binop ())
3155 {
3156 curr_lexer->m_filepos.increment_column ();
3157 curr_lexer->begin_string (DQ_STRING_START);
3158 }
3159 else
3160 {
3161 yyless (0);
3162 curr_lexer->xunput (',');
3163 }
3164 }
3165 else
3166 {
3167 curr_lexer->m_filepos.increment_column ();
3168 curr_lexer->begin_string (DQ_STRING_START);
3169 }
3170 }
3171 else
3172 {
3173 curr_lexer->m_filepos.increment_column ();
3174 curr_lexer->begin_string (DQ_STRING_START);
3175 }
3176 }
3177 }
3178 YY_BREAK
3179
3180// Other operators.
3181
3182case 68:
3184#line 1647 "/home/jwe/src/octave-stable/libinterp/parse-tree/lex.ll"
3185{ CMD_OR_OP (":", ':', true); }
3186 YY_BREAK
3187case 69:
3189#line 1648 "/home/jwe/src/octave-stable/libinterp/parse-tree/lex.ll"
3190{ CMD_OR_DEPRECATED_OP (".+", "+", 7, '+'); }
3191 YY_BREAK
3192case 70:
3194#line 1649 "/home/jwe/src/octave-stable/libinterp/parse-tree/lex.ll"
3195{ CMD_OR_DEPRECATED_OP (".-", "-", 7, '-'); }
3196 YY_BREAK
3197case 71:
3199#line 1650 "/home/jwe/src/octave-stable/libinterp/parse-tree/lex.ll"
3200{ CMD_OR_OP (".*", EMUL, true); }
3201 YY_BREAK
3202case 72:
3204#line 1651 "/home/jwe/src/octave-stable/libinterp/parse-tree/lex.ll"
3205{ CMD_OR_OP ("./", EDIV, true); }
3206 YY_BREAK
3207case 73:
3209#line 1652 "/home/jwe/src/octave-stable/libinterp/parse-tree/lex.ll"
3210{ CMD_OR_OP (".\\", ELEFTDIV, true); }
3211 YY_BREAK
3212case 74:
3214#line 1653 "/home/jwe/src/octave-stable/libinterp/parse-tree/lex.ll"
3215{ CMD_OR_OP (".^", EPOW, true); }
3216 YY_BREAK
3217case 75:
3219#line 1654 "/home/jwe/src/octave-stable/libinterp/parse-tree/lex.ll"
3220{ CMD_OR_DEPRECATED_OP (".**", ".^", 7, EPOW); }
3221 YY_BREAK
3222case 76:
3224#line 1655 "/home/jwe/src/octave-stable/libinterp/parse-tree/lex.ll"
3225{ CMD_OR_OP ("<=", EXPR_LE, true); }
3226 YY_BREAK
3227case 77:
3229#line 1656 "/home/jwe/src/octave-stable/libinterp/parse-tree/lex.ll"
3230{ CMD_OR_OP ("==", EXPR_EQ, true); }
3231 YY_BREAK
3232case 78:
3234#line 1657 "/home/jwe/src/octave-stable/libinterp/parse-tree/lex.ll"
3235{ CMD_OR_OP ("!=", EXPR_NE, false); }
3236 YY_BREAK
3237case 79:
3239#line 1658 "/home/jwe/src/octave-stable/libinterp/parse-tree/lex.ll"
3240{ CMD_OR_OP ("~=", EXPR_NE, true); }
3241 YY_BREAK
3242case 80:
3244#line 1659 "/home/jwe/src/octave-stable/libinterp/parse-tree/lex.ll"
3245{ CMD_OR_OP (">=", EXPR_GE, true); }
3246 YY_BREAK
3247case 81:
3249#line 1660 "/home/jwe/src/octave-stable/libinterp/parse-tree/lex.ll"
3250{ CMD_OR_OP ("&", EXPR_AND, true); }
3251 YY_BREAK
3252case 82:
3254#line 1661 "/home/jwe/src/octave-stable/libinterp/parse-tree/lex.ll"
3255{ CMD_OR_OP ("|", EXPR_OR, true); }
3256 YY_BREAK
3257case 83:
3259#line 1662 "/home/jwe/src/octave-stable/libinterp/parse-tree/lex.ll"
3260{ CMD_OR_OP ("<", EXPR_LT, true); }
3261 YY_BREAK
3262case 84:
3264#line 1663 "/home/jwe/src/octave-stable/libinterp/parse-tree/lex.ll"
3265{ CMD_OR_OP (">", EXPR_GT, true); }
3266 YY_BREAK
3267case 85:
3269#line 1664 "/home/jwe/src/octave-stable/libinterp/parse-tree/lex.ll"
3270{ CMD_OR_OP ("*", '*', true); }
3271 YY_BREAK
3272case 86:
3274#line 1665 "/home/jwe/src/octave-stable/libinterp/parse-tree/lex.ll"
3275{ CMD_OR_OP ("/", '/', true); }
3276 YY_BREAK
3277
3278// In Matlab, '\' may also trigger command syntax.
3279
3280case 87:
3282#line 1671 "/home/jwe/src/octave-stable/libinterp/parse-tree/lex.ll"
3283{
3284 // FIXME: After backslash is no longer handled as a line
3285 // continuation marker outside of character strings, this
3286 // action may be replaced with
3287 //
3288 // CMD_OR_OP ("\\", LEFTDIV, true);
3289
3290 curr_lexer->lexer_debug ("\\");
3291
3292 return curr_lexer->handle_op (LEFTDIV);
3293 }
3294 YY_BREAK
3295case 88:
3297#line 1683 "/home/jwe/src/octave-stable/libinterp/parse-tree/lex.ll"
3298{ CMD_OR_OP ("^", POW, true); }
3299 YY_BREAK
3300case 89:
3302#line 1684 "/home/jwe/src/octave-stable/libinterp/parse-tree/lex.ll"
3303{ CMD_OR_DEPRECATED_OP ("**", "^", 7, POW); }
3304 YY_BREAK
3305case 90:
3307#line 1685 "/home/jwe/src/octave-stable/libinterp/parse-tree/lex.ll"
3308{ CMD_OR_OP ("&&", EXPR_AND_AND, true); }
3309 YY_BREAK
3310case 91:
3312#line 1686 "/home/jwe/src/octave-stable/libinterp/parse-tree/lex.ll"
3313{ CMD_OR_OP ("||", EXPR_OR_OR, true); }
3314 YY_BREAK
3315case 92:
3317#line 1688 "/home/jwe/src/octave-stable/libinterp/parse-tree/lex.ll"
3318{
3319 curr_lexer->lexer_debug (";");
3320
3321 bool at_beginning_of_statement
3322 = (! (curr_lexer->whitespace_is_significant ()
3323 || curr_lexer->m_looking_at_object_index.front ()));
3324
3325 return curr_lexer->handle_op (';', at_beginning_of_statement);
3326 }
3327 YY_BREAK
3328case 93:
3330#line 1698 "/home/jwe/src/octave-stable/libinterp/parse-tree/lex.ll"
3331{ CMD_OR_UNARY_OP ("+", '+', true); }
3332 YY_BREAK
3333case 94:
3335#line 1699 "/home/jwe/src/octave-stable/libinterp/parse-tree/lex.ll"
3336{ CMD_OR_UNARY_OP ("-", '-', true); }
3337 YY_BREAK
3338case 95:
3340#line 1701 "/home/jwe/src/octave-stable/libinterp/parse-tree/lex.ll"
3341{ CMD_OR_UNARY_OP ("~", EXPR_NOT, true); }
3342 YY_BREAK
3343case 96:
3345#line 1702 "/home/jwe/src/octave-stable/libinterp/parse-tree/lex.ll"
3346{ CMD_OR_UNARY_OP ("!", EXPR_NOT, false); }
3347 YY_BREAK
3348case 97:
3350#line 1704 "/home/jwe/src/octave-stable/libinterp/parse-tree/lex.ll"
3351{
3352 curr_lexer->lexer_debug (",");
3353
3354 bool at_beginning_of_statement
3355 = (! (curr_lexer->whitespace_is_significant ()
3356 || curr_lexer->m_looking_at_object_index.front ()));
3357
3358 return curr_lexer->handle_op (',', at_beginning_of_statement);
3359 }
3360 YY_BREAK
3361case 98:
3363#line 1714 "/home/jwe/src/octave-stable/libinterp/parse-tree/lex.ll"
3364{
3365 curr_lexer->lexer_debug (".'");
3366
3367 return curr_lexer->handle_op (TRANSPOSE);
3368 }
3369 YY_BREAK
3370case 99:
3372#line 1720 "/home/jwe/src/octave-stable/libinterp/parse-tree/lex.ll"
3373{ CMD_OR_UNARY_OP ("++", PLUS_PLUS, false); }
3374 YY_BREAK
3375case 100:
3377#line 1721 "/home/jwe/src/octave-stable/libinterp/parse-tree/lex.ll"
3378{ CMD_OR_UNARY_OP ("--", MINUS_MINUS, false); }
3379 YY_BREAK
3380case 101:
3382#line 1723 "/home/jwe/src/octave-stable/libinterp/parse-tree/lex.ll"
3383{
3384 curr_lexer->lexer_debug ("(");
3385
3386 bool unput_comma = false;
3387
3388 if (curr_lexer->whitespace_is_significant ()
3389 && curr_lexer->space_follows_previous_token ())
3390 {
3391 int tok = curr_lexer->previous_token_value ();
3392
3393 if (! (tok == '[' || tok == '{'
3394 || curr_lexer->previous_token_is_binop ()))
3395 unput_comma = true;
3396 }
3397
3398 if (unput_comma)
3399 {
3400 yyless (0);
3401 curr_lexer->xunput (',');
3402 }
3403 else
3404 {
3405 curr_lexer->update_token_positions (yyleng);
3406
3407 // If we are looking for an object index, then push TRUE for
3408 // m_looking_at_object_index. Otherwise, just push whatever state
3409 // is current (so that we can pop it off the stack when we find
3410 // the matching close paren).
3411
3412 curr_lexer->m_looking_at_object_index.push_front
3413 (curr_lexer->m_looking_for_object_index);
3414
3415 curr_lexer->m_looking_at_indirect_ref = false;
3416 curr_lexer->m_looking_for_object_index = false;
3417 curr_lexer->m_at_beginning_of_statement = false;
3418
3419 curr_lexer->m_nesting_level.paren ();
3420
3421 return curr_lexer->handle_token ('(');
3422 }
3423 }
3424 YY_BREAK
3425case 102:
3427#line 1765 "/home/jwe/src/octave-stable/libinterp/parse-tree/lex.ll"
3428{
3429 curr_lexer->lexer_debug (")");
3430
3431 curr_lexer->update_token_positions (yyleng);
3432
3433 curr_lexer->m_nesting_level.remove ();
3434
3435 curr_lexer->m_looking_at_object_index.pop_front ();
3436
3437 curr_lexer->m_looking_for_object_index = true;
3438 curr_lexer->m_at_beginning_of_statement = false;
3439
3440 if (curr_lexer->m_looking_at_anon_fcn_args)
3441 {
3442 curr_lexer->m_looking_at_anon_fcn_args = false;
3443 curr_lexer->m_nesting_level.anon_fcn_body ();
3444 }
3445
3446 return curr_lexer->count_token (')');
3447 }
3448 YY_BREAK
3449case 103:
3451#line 1786 "/home/jwe/src/octave-stable/libinterp/parse-tree/lex.ll"
3452{
3453 curr_lexer->lexer_debug (".");
3454
3455 if (curr_lexer->previous_token_may_be_command ()
3456 && curr_lexer->space_follows_previous_token ())
3457 {
3458 yyless (0);
3459 curr_lexer->push_start_state (COMMAND_START);
3460 }
3461 else
3462 {
3463 curr_lexer->update_token_positions (yyleng);
3464
3465 curr_lexer->m_looking_for_object_index = false;
3466 curr_lexer->m_at_beginning_of_statement = false;
3467
3468 return curr_lexer->handle_token ('.');
3469 }
3470 }
3471 YY_BREAK
3472
3473// = and op= operators.
3474
3475case 104:
3477#line 1810 "/home/jwe/src/octave-stable/libinterp/parse-tree/lex.ll"
3478{
3479 curr_lexer->lexer_debug ("=");
3480
3481 return curr_lexer->handle_op ('=');
3482 }
3483 YY_BREAK
3484case 105:
3486#line 1816 "/home/jwe/src/octave-stable/libinterp/parse-tree/lex.ll"
3487{ CMD_OR_OP ("+=", ADD_EQ, false); }
3488 YY_BREAK
3489case 106:
3491#line 1817 "/home/jwe/src/octave-stable/libinterp/parse-tree/lex.ll"
3492{ CMD_OR_OP ("-=", SUB_EQ, false); }
3493 YY_BREAK
3494case 107:
3496#line 1818 "/home/jwe/src/octave-stable/libinterp/parse-tree/lex.ll"
3497{ CMD_OR_OP ("*=", MUL_EQ, false); }
3498 YY_BREAK
3499case 108:
3501#line 1819 "/home/jwe/src/octave-stable/libinterp/parse-tree/lex.ll"
3502{ CMD_OR_OP ("/=", DIV_EQ, false); }
3503 YY_BREAK
3504case 109:
3506#line 1820 "/home/jwe/src/octave-stable/libinterp/parse-tree/lex.ll"
3507{ CMD_OR_OP ("\\=", LEFTDIV_EQ, false); }
3508 YY_BREAK
3509case 110:
3511#line 1821 "/home/jwe/src/octave-stable/libinterp/parse-tree/lex.ll"
3512{ CMD_OR_DEPRECATED_OP (".+=", "+=", 7, ADD_EQ); }
3513 YY_BREAK
3514case 111:
3516#line 1822 "/home/jwe/src/octave-stable/libinterp/parse-tree/lex.ll"
3517{ CMD_OR_DEPRECATED_OP (".-=", "-=", 7, SUB_EQ); }
3518 YY_BREAK
3519case 112:
3521#line 1823 "/home/jwe/src/octave-stable/libinterp/parse-tree/lex.ll"
3522{ CMD_OR_OP (".*=", EMUL_EQ, false); }
3523 YY_BREAK
3524case 113:
3526#line 1824 "/home/jwe/src/octave-stable/libinterp/parse-tree/lex.ll"
3527{ CMD_OR_OP ("./=", EDIV_EQ, false); }
3528 YY_BREAK
3529case 114:
3531#line 1825 "/home/jwe/src/octave-stable/libinterp/parse-tree/lex.ll"
3532{ CMD_OR_OP (".\\=", ELEFTDIV_EQ, false); }
3533 YY_BREAK
3534case 115:
3536#line 1826 "/home/jwe/src/octave-stable/libinterp/parse-tree/lex.ll"
3537{ CMD_OR_OP ("^=", POW_EQ, false); }
3538 YY_BREAK
3539case 116:
3541#line 1827 "/home/jwe/src/octave-stable/libinterp/parse-tree/lex.ll"
3542{ CMD_OR_DEPRECATED_OP ("**=", "^=", 7, POW_EQ); }
3543 YY_BREAK
3544case 117:
3546#line 1828 "/home/jwe/src/octave-stable/libinterp/parse-tree/lex.ll"
3547{ CMD_OR_OP (".^=", EPOW_EQ, false); }
3548 YY_BREAK
3549case 118:
3551#line 1829 "/home/jwe/src/octave-stable/libinterp/parse-tree/lex.ll"
3552{ CMD_OR_DEPRECATED_OP (".**=", ".^=", 7, EPOW_EQ); }
3553 YY_BREAK
3554case 119:
3556#line 1830 "/home/jwe/src/octave-stable/libinterp/parse-tree/lex.ll"
3557{ CMD_OR_OP ("&=", AND_EQ, false); }
3558 YY_BREAK
3559case 120:
3561#line 1831 "/home/jwe/src/octave-stable/libinterp/parse-tree/lex.ll"
3562{ CMD_OR_OP ("|=", OR_EQ, false); }
3563 YY_BREAK
3564
3565// In Matlab, '{' may also trigger command syntax.
3566
3567case 121:
3569#line 1837 "/home/jwe/src/octave-stable/libinterp/parse-tree/lex.ll"
3570{
3571 curr_lexer->lexer_debug ("{");
3572
3573 bool unput_comma = false;
3574
3575 if (curr_lexer->whitespace_is_significant ()
3576 && curr_lexer->space_follows_previous_token ())
3577 {
3578 int tok = curr_lexer->previous_token_value ();
3579
3580 if (! (tok == '[' || tok == '{'
3581 || curr_lexer->previous_token_is_binop ()))
3582 unput_comma = true;
3583 }
3584
3585 if (unput_comma)
3586 {
3587 yyless (0);
3588 curr_lexer->xunput (',');
3589 }
3590 else
3591 {
3592 curr_lexer->m_nesting_level.brace ();
3593
3594 curr_lexer->m_looking_at_object_index.push_front
3595 (curr_lexer->m_looking_for_object_index);
3596
3597 curr_lexer->m_filepos.increment_column (yyleng);
3598 curr_lexer->m_looking_for_object_index = false;
3599 curr_lexer->m_at_beginning_of_statement = false;
3600
3601 curr_lexer->m_braceflag++;
3602
3603 curr_lexer->push_start_state (MATRIX_START);
3604
3605 return curr_lexer->count_token ('{');
3606 }
3607 }
3608 YY_BREAK
3609case 122:
3611#line 1876 "/home/jwe/src/octave-stable/libinterp/parse-tree/lex.ll"
3612{
3613 curr_lexer->lexer_debug ("}");
3614
3615 curr_lexer->update_token_positions (yyleng);
3616
3617 curr_lexer->m_looking_at_object_index.pop_front ();
3618
3619 curr_lexer->m_looking_for_object_index = true;
3620 curr_lexer->m_at_beginning_of_statement = false;
3621
3622 curr_lexer->m_nesting_level.remove ();
3623
3624 return curr_lexer->handle_token ('}');
3625 }
3626 YY_BREAK
3627
3628// Unrecognized input. If the previous token may be a command and is
3629// followed by a space, parse the remainder of this statement as a
3630// command-style function call. Otherwise, unrecognized input is a
3631// lexical error.
3632
3633case 123:
3635#line 1898 "/home/jwe/src/octave-stable/libinterp/parse-tree/lex.ll"
3636{
3637 curr_lexer->lexer_debug (".");
3638
3639 curr_lexer->xunput (yytext[0]);
3640
3641 int c = curr_lexer->text_yyinput ();
3642
3643 if (c == 1)
3644 return -1;
3645 else if (c == EOF)
3646 return curr_lexer->handle_end_of_input ();
3647 else if (curr_lexer->previous_token_may_be_command ()
3648 && curr_lexer->space_follows_previous_token ())
3649 {
3650 yyless (0);
3651 curr_lexer->push_start_state (COMMAND_START);
3652 }
3653 else
3654 {
3655 std::ostringstream buf;
3656
3657 buf << "invalid character '"
3658 << octave::undo_string_escape (static_cast<char> (c))
3659 << "' (ASCII " << c << ")";
3660
3661 // Use current file position for error token.
3662 octave::token *tok
3663 = new octave::token (LEXICAL_ERROR, buf.str (),
3664 curr_lexer->m_filepos, curr_lexer->m_filepos);
3665
3666 curr_lexer->push_token (tok);
3667
3668 curr_lexer->m_filepos.increment_column ();
3669
3670 return curr_lexer->count_token_internal (LEXICAL_ERROR);
3671 }
3672 }
3673 YY_BREAK
3674
3675#if defined (HAVE_PRAGMA_GCC_DIAGNOSTIC)
3676 // Disable these warnings for flex code.
3677# pragma GCC diagnostic ignored "-Wold-style-cast"
3678# pragma GCC diagnostic ignored "-Wunused-parameter"
3679#endif
3680
3681case 124:
3683#line 1944 "/home/jwe/src/octave-stable/libinterp/parse-tree/lex.ll"
3684ECHO;
3685 YY_BREAK
3686#line 3687 "libinterp/parse-tree/lex.cc"
3687
3688 case YY_END_OF_BUFFER:
3689 {
3690 /* Amount of text matched not including the EOB char. */
3691 int yy_amount_of_matched_text = (int) (yy_cp - yyg->yytext_ptr) - 1;
3692
3693 /* Undo the effects of YY_DO_BEFORE_ACTION. */
3694 *yy_cp = yyg->yy_hold_char;
3696
3697 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
3698 {
3699 /* We're scanning a new file or input source. It's
3700 * possible that this happened because the user
3701 * just pointed yyin at a new source and called
3702 * yylex(). If so, then we have to assure
3703 * consistency between YY_CURRENT_BUFFER and our
3704 * globals. Here is the right place to do so, because
3705 * this is the first action (other than possibly a
3706 * back-up) that will match for the new input source.
3707 */
3708 yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
3709 YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
3710 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
3711 }
3712
3713 /* Note that here we test for yy_c_buf_p "<=" to the position
3714 * of the first EOB in the buffer, since yy_c_buf_p will
3715 * already have been incremented past the NUL character
3716 * (since all states make transitions on EOB to the
3717 * end-of-buffer state). Contrast this with the test
3718 * in input().
3719 */
3720 if ( yyg->yy_c_buf_p <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] )
3721 { /* This was really a NUL. */
3722 yy_state_type yy_next_state;
3723
3724 yyg->yy_c_buf_p = yyg->yytext_ptr + yy_amount_of_matched_text;
3725
3726 yy_current_state = yy_get_previous_state( yyscanner );
3727
3728 /* Okay, we're now positioned to make the NUL
3729 * transition. We couldn't have
3730 * yy_get_previous_state() go ahead and do it
3731 * for us because it doesn't know how to deal
3732 * with the possibility of jamming (and we don't
3733 * want to build jamming into it because then it
3734 * will run more slowly).
3735 */
3736
3737 yy_next_state = yy_try_NUL_trans( yy_current_state , yyscanner);
3738
3739 yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
3740
3741 if ( yy_next_state )
3742 {
3743 /* Consume the NUL. */
3744 yy_cp = ++yyg->yy_c_buf_p;
3745 yy_current_state = yy_next_state;
3746 goto yy_match;
3747 }
3748
3749 else
3750 {
3751 yy_cp = yyg->yy_c_buf_p;
3752 goto yy_find_action;
3753 }
3754 }
3755
3756 else switch ( yy_get_next_buffer( yyscanner ) )
3757 {
3759 {
3761
3762 if ( yywrap( yyscanner ) )
3763 {
3764 /* Note: because we've taken care in
3765 * yy_get_next_buffer() to have set up
3766 * yytext, we can now set up
3767 * yy_c_buf_p so that if some total
3768 * hoser (like flex itself) wants to
3769 * call the scanner after we return the
3770 * YY_NULL, it'll still work - another
3771 * YY_NULL will get returned.
3772 */
3773 yyg->yy_c_buf_p = yyg->yytext_ptr + YY_MORE_ADJ;
3774
3775 yy_act = YY_STATE_EOF(YY_START);
3776 goto do_action;
3777 }
3778
3779 else
3780 {
3781 if ( ! yyg->yy_did_buffer_switch_on_eof )
3783 }
3784 break;
3785 }
3786
3788 yyg->yy_c_buf_p =
3789 yyg->yytext_ptr + yy_amount_of_matched_text;
3790
3791 yy_current_state = yy_get_previous_state( yyscanner );
3792
3793 yy_cp = yyg->yy_c_buf_p;
3794 yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
3795 goto yy_match;
3796
3797 case EOB_ACT_LAST_MATCH:
3798 yyg->yy_c_buf_p =
3799 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars];
3800
3801 yy_current_state = yy_get_previous_state( yyscanner );
3802
3803 yy_cp = yyg->yy_c_buf_p;
3804 yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
3805 goto yy_find_action;
3806 }
3807 break;
3808 }
3809
3810 default:
3812 "fatal flex scanner internal error--no action found" );
3813 } /* end of action switch */
3814 } /* end of scanning one token */
3815 } /* end of user's declarations */
3816} /* end of yylex */
3817
3818/* yy_get_next_buffer - try to read in a new buffer
3819 *
3820 * Returns a code representing an action:
3821 * EOB_ACT_LAST_MATCH -
3822 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
3823 * EOB_ACT_END_OF_FILE - end of file
3824 */
3825static int yy_get_next_buffer (yyscan_t yyscanner)
3826{
3827 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
3828 char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
3829 char *source = yyg->yytext_ptr;
3830 int number_to_move, i;
3831 int ret_val;
3832
3833 if ( yyg->yy_c_buf_p > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] )
3835 "fatal flex scanner internal error--end of buffer missed" );
3836
3837 if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
3838 { /* Don't try to fill the buffer, so this is an EOF. */
3839 if ( yyg->yy_c_buf_p - yyg->yytext_ptr - YY_MORE_ADJ == 1 )
3840 {
3841 /* We matched a single character, the EOB, so
3842 * treat this as a final EOF.
3843 */
3844 return EOB_ACT_END_OF_FILE;
3845 }
3846
3847 else
3848 {
3849 /* We matched some text prior to the EOB, first
3850 * process it.
3851 */
3852 return EOB_ACT_LAST_MATCH;
3853 }
3854 }
3855
3856 /* Try to read more data. */
3857
3858 /* First move last chars to start of buffer. */
3859 number_to_move = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr - 1);
3860
3861 for ( i = 0; i < number_to_move; ++i )
3862 *(dest++) = *(source++);
3863
3864 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
3865 /* don't do the read, it's not guaranteed to return an EOF,
3866 * just force an EOF
3867 */
3868 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars = 0;
3869
3870 else
3871 {
3872 int num_to_read =
3873 YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
3874
3875 while ( num_to_read <= 0 )
3876 { /* Not enough room in the buffer - grow it. */
3877
3878 /* just a shorter name for the current buffer */
3880
3881 int yy_c_buf_p_offset =
3882 (int) (yyg->yy_c_buf_p - b->yy_ch_buf);
3883
3884 if ( b->yy_is_our_buffer )
3885 {
3886 int new_size = b->yy_buf_size * 2;
3887
3888 if ( new_size <= 0 )
3889 b->yy_buf_size += b->yy_buf_size / 8;
3890 else
3891 b->yy_buf_size *= 2;
3892
3893 b->yy_ch_buf = (char *)
3894 /* Include room in for 2 EOB chars. */
3895 yyrealloc( (void *) b->yy_ch_buf,
3896 (yy_size_t) (b->yy_buf_size + 2) , yyscanner );
3897 }
3898 else
3899 /* Can't grow it, we don't own it. */
3900 b->yy_ch_buf = NULL;
3901
3902 if ( ! b->yy_ch_buf )
3904 "fatal error - scanner input buffer overflow" );
3905
3906 yyg->yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
3907
3908 num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
3909 number_to_move - 1;
3910
3911 }
3912
3913 if ( num_to_read > YY_READ_BUF_SIZE )
3914 num_to_read = YY_READ_BUF_SIZE;
3915
3916 /* Read in more data. */
3917 YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
3918 yyg->yy_n_chars, num_to_read );
3919
3920 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
3921 }
3922
3923 if ( yyg->yy_n_chars == 0 )
3924 {
3925 if ( number_to_move == YY_MORE_ADJ )
3926 {
3927 ret_val = EOB_ACT_END_OF_FILE;
3928 yyrestart( yyin , yyscanner);
3929 }
3930
3931 else
3932 {
3933 ret_val = EOB_ACT_LAST_MATCH;
3934 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
3936 }
3937 }
3938
3939 else
3940 ret_val = EOB_ACT_CONTINUE_SCAN;
3941
3942 if ((yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
3943 /* Extend the array by 50%, plus the number we really need. */
3944 int new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1);
3945 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc(
3946 (void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf, (yy_size_t) new_size , yyscanner );
3947 if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
3948 YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
3949 /* "- 2" to take care of EOB's */
3950 YY_CURRENT_BUFFER_LVALUE->yy_buf_size = (int) (new_size - 2);
3951 }
3952
3953 yyg->yy_n_chars += number_to_move;
3956
3957 yyg->yytext_ptr = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
3958
3959 return ret_val;
3960}
3961
3962/* yy_get_previous_state - get the state just before the EOB char was reached */
3963
3965{
3966 yy_state_type yy_current_state;
3967 char *yy_cp;
3968 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
3969
3970 yy_current_state = yyg->yy_start;
3971 yy_current_state += YY_AT_BOL();
3972
3973 for ( yy_cp = yyg->yytext_ptr + YY_MORE_ADJ; yy_cp < yyg->yy_c_buf_p; ++yy_cp )
3974 {
3975 YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
3976 if ( yy_accept[yy_current_state] )
3977 {
3978 yyg->yy_last_accepting_state = yy_current_state;
3979 yyg->yy_last_accepting_cpos = yy_cp;
3980 }
3981 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
3982 {
3983 yy_current_state = (int) yy_def[yy_current_state];
3984 if ( yy_current_state >= 314 )
3985 yy_c = yy_meta[yy_c];
3986 }
3987 yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
3988 }
3989
3990 return yy_current_state;
3991}
3992
3993/* yy_try_NUL_trans - try to make a transition on the NUL character
3994 *
3995 * synopsis
3996 * next_state = yy_try_NUL_trans( current_state );
3997 */
3998 static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state , yyscan_t yyscanner)
3999{
4000 int yy_is_jam;
4001 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* This var may be unused depending upon options. */
4002 char *yy_cp = yyg->yy_c_buf_p;
4003
4004 YY_CHAR yy_c = 1;
4005 if ( yy_accept[yy_current_state] )
4006 {
4007 yyg->yy_last_accepting_state = yy_current_state;
4008 yyg->yy_last_accepting_cpos = yy_cp;
4009 }
4010 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
4011 {
4012 yy_current_state = (int) yy_def[yy_current_state];
4013 if ( yy_current_state >= 314 )
4014 yy_c = yy_meta[yy_c];
4015 }
4016 yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
4017 yy_is_jam = (yy_current_state == 313);
4018
4019 (void)yyg;
4020 return yy_is_jam ? 0 : yy_current_state;
4021}
4022
4023#ifndef YY_NO_UNPUT
4024
4025 static void yyunput (int c, char * yy_bp , yyscan_t yyscanner)
4026{
4027 char *yy_cp;
4028 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
4029
4030 yy_cp = yyg->yy_c_buf_p;
4031
4032 /* undo effects of setting up yytext */
4033 *yy_cp = yyg->yy_hold_char;
4034
4035 if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
4036 { /* need to shift things up to make room */
4037 /* +2 for EOB chars. */
4038 int number_to_move = yyg->yy_n_chars + 2;
4039 char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
4040 YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
4041 char *source =
4042 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
4043
4044 while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
4045 *--dest = *--source;
4046
4047 yy_cp += (int) (dest - source);
4048 yy_bp += (int) (dest - source);
4049 YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
4050 yyg->yy_n_chars = (int) YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
4051
4052 if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
4053 YY_FATAL_ERROR( "flex scanner push-back overflow" );
4054 }
4055
4056 *--yy_cp = (char) c;
4057
4058 yyg->yytext_ptr = yy_bp;
4059 yyg->yy_hold_char = *yy_cp;
4060 yyg->yy_c_buf_p = yy_cp;
4061}
4062
4063#endif
4064
4065#ifndef YY_NO_INPUT
4066#ifdef __cplusplus
4067 static int yyinput (yyscan_t yyscanner)
4068#else
4069 static int input (yyscan_t yyscanner)
4070#endif
4071
4072{
4073 int c;
4074 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
4075
4076 *yyg->yy_c_buf_p = yyg->yy_hold_char;
4077
4078 if ( *yyg->yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
4079 {
4080 /* yy_c_buf_p now points to the character we want to return.
4081 * If this occurs *before* the EOB characters, then it's a
4082 * valid NUL; if not, then we've hit the end of the buffer.
4083 */
4084 if ( yyg->yy_c_buf_p < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] )
4085 /* This was really a NUL. */
4086 *yyg->yy_c_buf_p = '\0';
4087
4088 else
4089 { /* need more input */
4090 int offset = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr);
4091 ++yyg->yy_c_buf_p;
4092
4093 switch ( yy_get_next_buffer( yyscanner ) )
4094 {
4095 case EOB_ACT_LAST_MATCH:
4096 /* This happens because yy_g_n_b()
4097 * sees that we've accumulated a
4098 * token and flags that we need to
4099 * try matching the token before
4100 * proceeding. But for input(),
4101 * there's no matching to consider.
4102 * So convert the EOB_ACT_LAST_MATCH
4103 * to EOB_ACT_END_OF_FILE.
4104 */
4105
4106 /* Reset buffer status. */
4107 yyrestart( yyin , yyscanner);
4108
4109 /*FALLTHROUGH*/
4110
4112 {
4113 if ( yywrap( yyscanner ) )
4114 return 0;
4115
4116 if ( ! yyg->yy_did_buffer_switch_on_eof )
4118#ifdef __cplusplus
4119 return yyinput(yyscanner);
4120#else
4121 return input(yyscanner);
4122#endif
4123 }
4124
4126 yyg->yy_c_buf_p = yyg->yytext_ptr + offset;
4127 break;
4128 }
4129 }
4130 }
4131
4132 c = *(unsigned char *) yyg->yy_c_buf_p; /* cast for 8-bit char's */
4133 *yyg->yy_c_buf_p = '\0'; /* preserve yytext */
4134 yyg->yy_hold_char = *++yyg->yy_c_buf_p;
4135
4136 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = (c == '\n');
4137
4138 return c;
4139}
4140#endif /* ifndef YY_NO_INPUT */
4141
4142/** Immediately switch to a different input stream.
4143 * @param input_file A readable stream.
4144 * @param yyscanner The scanner object.
4145 * @note This function does not reset the start condition to @c INITIAL .
4146 */
4147 void yyrestart (FILE * input_file , yyscan_t yyscanner)
4148{
4149 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
4150
4151 if ( ! YY_CURRENT_BUFFER ){
4152 yyensure_buffer_stack (yyscanner);
4154 yy_create_buffer( yyin, YY_BUF_SIZE , yyscanner);
4155 }
4156
4157 yy_init_buffer( YY_CURRENT_BUFFER, input_file , yyscanner);
4158 yy_load_buffer_state( yyscanner );
4159}
4160
4161/** Switch to a different input buffer.
4162 * @param new_buffer The new input buffer.
4163 * @param yyscanner The scanner object.
4164 */
4165 void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner)
4166{
4167 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
4168
4169 /* TODO. We should be able to replace this entire function body
4170 * with
4171 * yypop_buffer_state();
4172 * yypush_buffer_state(new_buffer);
4173 */
4174 yyensure_buffer_stack (yyscanner);
4175 if ( YY_CURRENT_BUFFER == new_buffer )
4176 return;
4177
4178 if ( YY_CURRENT_BUFFER )
4179 {
4180 /* Flush out information for old buffer. */
4181 *yyg->yy_c_buf_p = yyg->yy_hold_char;
4182 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p;
4183 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
4184 }
4185
4186 YY_CURRENT_BUFFER_LVALUE = new_buffer;
4187 yy_load_buffer_state( yyscanner );
4188
4189 /* We don't actually know whether we did this switch during
4190 * EOF (yywrap()) processing, but the only time this flag
4191 * is looked at is after yywrap() is called, so it's safe
4192 * to go ahead and always set it.
4193 */
4196
4197static void yy_load_buffer_state (yyscan_t yyscanner)
4198{
4199 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
4200 yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
4201 yyg->yytext_ptr = yyg->yy_c_buf_p = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
4202 yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
4203 yyg->yy_hold_char = *yyg->yy_c_buf_p;
4204}
4205
4206/** Allocate and initialize an input buffer state.
4207 * @param file A readable stream.
4208 * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
4209 * @param yyscanner The scanner object.
4210 * @return the allocated buffer state.
4211 */
4212 YY_BUFFER_STATE yy_create_buffer (FILE * file, int size , yyscan_t yyscanner)
4213{
4215
4216 b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) , yyscanner );
4217 if ( ! b )
4218 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
4219
4220 b->yy_buf_size = size;
4221
4222 /* yy_ch_buf has to be 2 characters longer than the size given because
4223 * we need to put in 2 end-of-buffer characters.
4224 */
4225 b->yy_ch_buf = (char *) yyalloc( (yy_size_t) (b->yy_buf_size + 2) , yyscanner );
4226 if ( ! b->yy_ch_buf )
4227 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
4228
4229 b->yy_is_our_buffer = 1;
4230
4231 yy_init_buffer( b, file , yyscanner);
4232
4233 return b;
4234}
4235
4236/** Destroy the buffer.
4237 * @param b a buffer created with yy_create_buffer()
4238 * @param yyscanner The scanner object.
4239 */
4240 void yy_delete_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner)
4241{
4242 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
4243
4244 if ( ! b )
4245 return;
4246
4247 if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
4249
4250 if ( b->yy_is_our_buffer )
4251 yyfree( (void *) b->yy_ch_buf , yyscanner );
4252
4253 yyfree( (void *) b , yyscanner );
4254}
4255
4256/* Initializes or reinitializes a buffer.
4257 * This function is sometimes called more than once on the same buffer,
4258 * such as during a yyrestart() or at EOF.
4259 */
4260 static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file , yyscan_t yyscanner)
4261
4262{
4263 int oerrno = errno;
4264 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
4265
4266 yy_flush_buffer( b , yyscanner);
4267
4268 b->yy_input_file = file;
4269 b->yy_fill_buffer = 1;
4270
4271 /* If b is the current buffer, then yy_init_buffer was _probably_
4272 * called from yyrestart() or through yy_get_next_buffer.
4273 * In that case, we don't want to reset the lineno or column.
4274 */
4275 if (b != YY_CURRENT_BUFFER){
4276 b->yy_bs_lineno = 1;
4277 b->yy_bs_column = 0;
4278 }
4279
4280 b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
4281
4282 errno = oerrno;
4283}
4284
4285/** Discard all buffered characters. On the next scan, YY_INPUT will be called.
4286 * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
4287 * @param yyscanner The scanner object.
4288 */
4289 void yy_flush_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner)
4290{
4291 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
4292 if ( ! b )
4293 return;
4294
4295 b->yy_n_chars = 0;
4296
4297 /* We always need two end-of-buffer characters. The first causes
4298 * a transition to the end-of-buffer state. The second causes
4299 * a jam in that state.
4300 */
4303
4304 b->yy_buf_pos = &b->yy_ch_buf[0];
4305
4306 b->yy_at_bol = 1;
4308
4309 if ( b == YY_CURRENT_BUFFER )
4310 yy_load_buffer_state( yyscanner );
4311}
4312
4313/** Pushes the new state onto the stack. The new state becomes
4314 * the current state. This function will allocate the stack
4315 * if necessary.
4316 * @param new_buffer The new state.
4317 * @param yyscanner The scanner object.
4318 */
4319void yypush_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner)
4320{
4321 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
4322 if (new_buffer == NULL)
4323 return;
4324
4325 yyensure_buffer_stack(yyscanner);
4326
4327 /* This block is copied from yy_switch_to_buffer. */
4328 if ( YY_CURRENT_BUFFER )
4329 {
4330 /* Flush out information for old buffer. */
4331 *yyg->yy_c_buf_p = yyg->yy_hold_char;
4332 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p;
4333 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
4334 }
4335
4336 /* Only push if top exists. Otherwise, replace top. */
4338 yyg->yy_buffer_stack_top++;
4339 YY_CURRENT_BUFFER_LVALUE = new_buffer;
4340
4341 /* copied from yy_switch_to_buffer. */
4342 yy_load_buffer_state( yyscanner );
4344}
4345
4346/** Removes and deletes the top of the stack, if present.
4347 * The next element becomes the new top.
4348 * @param yyscanner The scanner object.
4349 */
4350void yypop_buffer_state (yyscan_t yyscanner)
4351{
4352 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
4353 if (!YY_CURRENT_BUFFER)
4354 return;
4355
4358 if (yyg->yy_buffer_stack_top > 0)
4359 --yyg->yy_buffer_stack_top;
4360
4361 if (YY_CURRENT_BUFFER) {
4362 yy_load_buffer_state( yyscanner );
4364 }
4365}
4366
4367/* Allocates the stack if it does not exist.
4368 * Guarantees space for at least one push.
4369 */
4370static void yyensure_buffer_stack (yyscan_t yyscanner)
4371{
4372 yy_size_t num_to_alloc;
4373 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
4374
4375 if (!yyg->yy_buffer_stack) {
4376
4377 /* First allocation is just for 2 elements, since we don't know if this
4378 * scanner will even need a stack. We use 2 instead of 1 to avoid an
4379 * immediate realloc on the next call.
4380 */
4381 num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */
4382 yyg->yy_buffer_stack = (struct yy_buffer_state**)yyalloc
4383 (num_to_alloc * sizeof(struct yy_buffer_state*)
4384 , yyscanner);
4385 if ( ! yyg->yy_buffer_stack )
4386 YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
4387
4388 memset(yyg->yy_buffer_stack, 0, num_to_alloc * sizeof(struct yy_buffer_state*));
4389
4390 yyg->yy_buffer_stack_max = num_to_alloc;
4391 yyg->yy_buffer_stack_top = 0;
4392 return;
4393 }
4394
4395 if (yyg->yy_buffer_stack_top >= (yyg->yy_buffer_stack_max) - 1){
4396
4397 /* Increase the buffer to prepare for a possible push. */
4398 yy_size_t grow_size = 8 /* arbitrary grow size */;
4399
4400 num_to_alloc = yyg->yy_buffer_stack_max + grow_size;
4402 (yyg->yy_buffer_stack,
4403 num_to_alloc * sizeof(struct yy_buffer_state*)
4404 , yyscanner);
4405 if ( ! yyg->yy_buffer_stack )
4406 YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
4407
4408 /* zero only the new slots.*/
4409 memset(yyg->yy_buffer_stack + yyg->yy_buffer_stack_max, 0, grow_size * sizeof(struct yy_buffer_state*));
4410 yyg->yy_buffer_stack_max = num_to_alloc;
4411 }
4412}
4413
4414/** Setup the input buffer state to scan directly from a user-specified character buffer.
4415 * @param base the character buffer
4416 * @param size the size in bytes of the character buffer
4417 * @param yyscanner The scanner object.
4418 * @return the newly allocated buffer state object.
4419 */
4420YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size , yyscan_t yyscanner)
4421{
4423
4424 if ( size < 2 ||
4425 base[size-2] != YY_END_OF_BUFFER_CHAR ||
4426 base[size-1] != YY_END_OF_BUFFER_CHAR )
4427 /* They forgot to leave room for the EOB's. */
4428 return NULL;
4429
4430 b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) , yyscanner );
4431 if ( ! b )
4432 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
4433
4434 b->yy_buf_size = (int) (size - 2); /* "- 2" to take care of EOB's */
4435 b->yy_buf_pos = b->yy_ch_buf = base;
4436 b->yy_is_our_buffer = 0;
4437 b->yy_input_file = NULL;
4438 b->yy_n_chars = b->yy_buf_size;
4439 b->yy_is_interactive = 0;
4440 b->yy_at_bol = 1;
4441 b->yy_fill_buffer = 0;
4443
4444 yy_switch_to_buffer( b , yyscanner );
4445
4446 return b;
4447}
4448
4449/** Setup the input buffer state to scan a string. The next call to yylex() will
4450 * scan from a @e copy of @a str.
4451 * @param yystr a NUL-terminated string to scan
4452 * @param yyscanner The scanner object.
4453 * @return the newly allocated buffer state object.
4454 * @note If you want to scan bytes that may contain NUL values, then use
4455 * yy_scan_bytes() instead.
4456 */
4457YY_BUFFER_STATE yy_scan_string (const char * yystr , yyscan_t yyscanner)
4458{
4459
4460 return yy_scan_bytes( yystr, (int) strlen(yystr) , yyscanner);
4461}
4462
4463/** Setup the input buffer state to scan the given bytes. The next call to yylex() will
4464 * scan from a @e copy of @a bytes.
4465 * @param yybytes the byte buffer to scan
4466 * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
4467 * @param yyscanner The scanner object.
4468 * @return the newly allocated buffer state object.
4469 */
4470YY_BUFFER_STATE yy_scan_bytes (const char * yybytes, int _yybytes_len , yyscan_t yyscanner)
4471{
4473 char *buf;
4474 yy_size_t n;
4475 int i;
4476
4477 /* Get memory for full buffer, including space for trailing EOB's. */
4478 n = (yy_size_t) (_yybytes_len + 2);
4479 buf = (char *) yyalloc( n , yyscanner );
4480 if ( ! buf )
4481 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
4482
4483 for ( i = 0; i < _yybytes_len; ++i )
4484 buf[i] = yybytes[i];
4485
4486 buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
4487
4488 b = yy_scan_buffer( buf, n , yyscanner);
4489 if ( ! b )
4490 YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
4491
4492 /* It's okay to grow etc. this buffer, and we should throw it
4493 * away when we're done.
4494 */
4495 b->yy_is_our_buffer = 1;
4496
4497 return b;
4498}
4500#ifndef YY_EXIT_FAILURE
4501#define YY_EXIT_FAILURE 2
4502#endif
4503
4504static void yynoreturn yy_fatal_error (const char* msg , yyscan_t yyscanner)
4505{
4506 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
4507 (void)yyg;
4508 fprintf( stderr, "%s\n", msg );
4509 exit( YY_EXIT_FAILURE );
4510}
4511
4512/* Redefine yyless() so it works in section 3 code. */
4514#undef yyless
4515#define yyless(n) \
4516 do \
4517 { \
4518 /* Undo effects of setting up yytext. */ \
4519 int yyless_macro_arg = (n); \
4520 YY_LESS_LINENO(yyless_macro_arg);\
4521 yytext[yyleng] = yyg->yy_hold_char; \
4522 yyg->yy_c_buf_p = yytext + yyless_macro_arg; \
4523 yyg->yy_hold_char = *yyg->yy_c_buf_p; \
4524 *yyg->yy_c_buf_p = '\0'; \
4525 yyleng = yyless_macro_arg; \
4526 } \
4527 while ( 0 )
4528
4529/* Accessor methods (get/set functions) to struct members. */
4530
4531/** Get the user-defined data for this scanner.
4532 * @param yyscanner The scanner object.
4533 */
4535{
4536 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
4537 return yyextra;
4538}
4539
4540/** Get the current line number.
4541 * @param yyscanner The scanner object.
4542 */
4543int yyget_lineno (yyscan_t yyscanner)
4544{
4545 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
4546
4547 if (! YY_CURRENT_BUFFER)
4548 return 0;
4549
4550 return yylineno;
4551}
4552
4553/** Get the current column number.
4554 * @param yyscanner The scanner object.
4555 */
4556int yyget_column (yyscan_t yyscanner)
4557{
4558 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
4559
4560 if (! YY_CURRENT_BUFFER)
4561 return 0;
4562
4563 return yycolumn;
4564}
4565
4566/** Get the input stream.
4567 * @param yyscanner The scanner object.
4568 */
4569FILE *yyget_in (yyscan_t yyscanner)
4570{
4571 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
4572 return yyin;
4573}
4574
4575/** Get the output stream.
4576 * @param yyscanner The scanner object.
4577 */
4578FILE *yyget_out (yyscan_t yyscanner)
4579{
4580 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
4581 return yyout;
4582}
4583
4584/** Get the length of the current token.
4585 * @param yyscanner The scanner object.
4586 */
4587int yyget_leng (yyscan_t yyscanner)
4588{
4589 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
4590 return yyleng;
4591}
4592
4593/** Get the current token.
4594 * @param yyscanner The scanner object.
4596
4597char *yyget_text (yyscan_t yyscanner)
4598{
4599 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
4600 return yytext;
4601}
4602
4603/** Set the user-defined data. This data is never touched by the scanner.
4604 * @param user_defined The data to be associated with this scanner.
4605 * @param yyscanner The scanner object.
4606 */
4607void yyset_extra (YY_EXTRA_TYPE user_defined , yyscan_t yyscanner)
4608{
4609 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
4610 yyextra = user_defined ;
4611}
4612
4613/** Set the current line number.
4614 * @param _line_number line number
4615 * @param yyscanner The scanner object.
4616 */
4617void yyset_lineno (int _line_number , yyscan_t yyscanner)
4618{
4619 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
4620
4621 /* lineno is only valid if an input buffer exists. */
4622 if (! YY_CURRENT_BUFFER )
4623 YY_FATAL_ERROR( "yyset_lineno called with no buffer" );
4624
4625 yylineno = _line_number;
4626}
4627
4628/** Set the current column.
4629 * @param _column_no column number
4630 * @param yyscanner The scanner object.
4631 */
4632void yyset_column (int _column_no , yyscan_t yyscanner)
4633{
4634 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
4635
4636 /* column is only valid if an input buffer exists. */
4637 if (! YY_CURRENT_BUFFER )
4638 YY_FATAL_ERROR( "yyset_column called with no buffer" );
4639
4640 yycolumn = _column_no;
4641}
4642
4643/** Set the input stream. This does not discard the current
4644 * input buffer.
4645 * @param _in_str A readable stream.
4646 * @param yyscanner The scanner object.
4647 * @see yy_switch_to_buffer
4648 */
4649void yyset_in (FILE * _in_str , yyscan_t yyscanner)
4650{
4651 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
4652 yyin = _in_str ;
4654
4655void yyset_out (FILE * _out_str , yyscan_t yyscanner)
4656{
4657 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
4658 yyout = _out_str ;
4660
4661int yyget_debug (yyscan_t yyscanner)
4662{
4663 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
4664 return yy_flex_debug;
4666
4667void yyset_debug (int _bdebug , yyscan_t yyscanner)
4668{
4669 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
4670 yy_flex_debug = _bdebug ;
4671}
4672
4673/* Accessor methods for yylval and yylloc */
4674
4675YYSTYPE * yyget_lval (yyscan_t yyscanner)
4676{
4677 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
4678 return yylval;
4680
4681void yyset_lval (YYSTYPE * yylval_param , yyscan_t yyscanner)
4682{
4683 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
4684 yylval = yylval_param;
4685}
4686
4687/* User-visible API */
4688
4689/* yylex_init is special because it creates the scanner itself, so it is
4690 * the ONLY reentrant function that doesn't take the scanner as the last argument.
4691 * That's why we explicitly handle the declaration, instead of using our macros.
4692 */
4693int yylex_init(yyscan_t* ptr_yy_globals)
4694{
4695 if (ptr_yy_globals == NULL){
4696 errno = EINVAL;
4697 return 1;
4698 }
4699
4700 *ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), NULL );
4701
4702 if (*ptr_yy_globals == NULL){
4703 errno = ENOMEM;
4704 return 1;
4705 }
4706
4707 /* By setting to 0xAA, we expose bugs in yy_init_globals. Leave at 0x00 for releases. */
4708 memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
4709
4710 return yy_init_globals ( *ptr_yy_globals );
4711}
4712
4713/* yylex_init_extra has the same functionality as yylex_init, but follows the
4714 * convention of taking the scanner as the last argument. Note however, that
4715 * this is a *pointer* to a scanner, as it will be allocated by this call (and
4716 * is the reason, too, why this function also must handle its own declaration).
4717 * The user defined value in the first argument will be available to yyalloc in
4718 * the yyextra field.
4719 */
4720int yylex_init_extra( YY_EXTRA_TYPE yy_user_defined, yyscan_t* ptr_yy_globals )
4721{
4722 struct yyguts_t dummy_yyguts;
4723
4724 yyset_extra (yy_user_defined, &dummy_yyguts);
4725
4726 if (ptr_yy_globals == NULL){
4727 errno = EINVAL;
4728 return 1;
4729 }
4730
4731 *ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), &dummy_yyguts );
4732
4733 if (*ptr_yy_globals == NULL){
4734 errno = ENOMEM;
4735 return 1;
4736 }
4737
4738 /* By setting to 0xAA, we expose bugs in
4739 yy_init_globals. Leave at 0x00 for releases. */
4740 memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
4741
4742 yyset_extra (yy_user_defined, *ptr_yy_globals);
4743
4744 return yy_init_globals ( *ptr_yy_globals );
4746
4747static int yy_init_globals (yyscan_t yyscanner)
4748{
4749 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
4750 /* Initialization is the same as for the non-reentrant scanner.
4751 * This function is called from yylex_destroy(), so don't allocate here.
4752 */
4753
4754 yyg->yy_buffer_stack = NULL;
4755 yyg->yy_buffer_stack_top = 0;
4756 yyg->yy_buffer_stack_max = 0;
4757 yyg->yy_c_buf_p = NULL;
4758 yyg->yy_init = 0;
4759 yyg->yy_start = 0;
4760
4761 yyg->yy_start_stack_ptr = 0;
4762 yyg->yy_start_stack_depth = 0;
4763 yyg->yy_start_stack = NULL;
4764
4765/* Defined in main.c */
4766#ifdef YY_STDINIT
4767 yyin = stdin;
4768 yyout = stdout;
4769#else
4770 yyin = NULL;
4771 yyout = NULL;
4772#endif
4773
4774 /* For future reference: Set errno on error, since we are called by
4775 * yylex_init()
4776 */
4777 return 0;
4778}
4780/* yylex_destroy is for both reentrant and non-reentrant scanners. */
4781int yylex_destroy (yyscan_t yyscanner)
4782{
4783 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
4784
4785 /* Pop the buffer stack, destroying each element. */
4786 while(YY_CURRENT_BUFFER){
4787 yy_delete_buffer( YY_CURRENT_BUFFER , yyscanner );
4789 yypop_buffer_state(yyscanner);
4790 }
4791
4792 /* Destroy the stack itself. */
4793 yyfree(yyg->yy_buffer_stack , yyscanner);
4794 yyg->yy_buffer_stack = NULL;
4795
4796 /* Destroy the start condition stack. */
4797 yyfree( yyg->yy_start_stack , yyscanner );
4798 yyg->yy_start_stack = NULL;
4799
4800 /* Reset the globals. This is important in a non-reentrant scanner so the next time
4801 * yylex() is called, initialization will occur. */
4802 yy_init_globals( yyscanner);
4803
4804 /* Destroy the main struct (reentrant only). */
4805 yyfree ( yyscanner , yyscanner );
4806 yyscanner = NULL;
4807 return 0;
4808}
4809
4810/*
4811 * Internal utility routines.
4812 */
4813
4814#ifndef yytext_ptr
4815static void yy_flex_strncpy (char* s1, const char * s2, int n , yyscan_t yyscanner)
4816{
4817 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
4818 (void)yyg;
4819
4820 int i;
4821 for ( i = 0; i < n; ++i )
4822 s1[i] = s2[i];
4823}
4824#endif
4825
4826#ifdef YY_NEED_STRLEN
4827static int yy_flex_strlen (const char * s , yyscan_t yyscanner)
4828{
4829 int n;
4830 for ( n = 0; s[n]; ++n )
4831 ;
4832
4833 return n;
4834}
4835#endif
4836
4837#define YYTABLES_NAME "yytables"
4838
4839#line 1944 "/home/jwe/src/octave-stable/libinterp/parse-tree/lex.ll"
4840
4841
4842#if defined (HAVE_PRAGMA_GCC_DIAGNOSTIC)
4843 // Restore prevailing warning state for remainder of the file.
4844# pragma GCC diagnostic pop
4845#endif
4847void *
4849{
4850 return std::malloc (size);
4851}
4853void *
4854octave_realloc (void *ptr, yy_size_t size, yyscan_t)
4855{
4856 return std::realloc (ptr, size);
4857}
4859void
4860octave_free (void *ptr, yyscan_t)
4861{
4862 std::free (ptr);
4863}
4865static void
4866display_character (char c)
4867{
4868 if (isgraph (c))
4869 std::cerr << c;
4870 else
4871 switch (c)
4872 {
4873 case 0:
4874 std::cerr << "NUL";
4875 break;
4876
4877 case 1:
4878 std::cerr << "SOH";
4879 break;
4880
4881 case 2:
4882 std::cerr << "STX";
4883 break;
4884
4885 case 3:
4886 std::cerr << "ETX";
4887 break;
4888
4889 case 4:
4890 std::cerr << "EOT";
4891 break;
4892
4893 case 5:
4894 std::cerr << "ENQ";
4895 break;
4896
4897 case 6:
4898 std::cerr << "ACK";
4899 break;
4900
4901 case 7:
4902 std::cerr << "\\a";
4903 break;
4904
4905 case 8:
4906 std::cerr << "\\b";
4907 break;
4908
4909 case 9:
4910 std::cerr << "\\t";
4911 break;
4912
4913 case 10:
4914 std::cerr << "\\n";
4915 break;
4916
4917 case 11:
4918 std::cerr << "\\v";
4919 break;
4920
4921 case 12:
4922 std::cerr << "\\f";
4923 break;
4924
4925 case 13:
4926 std::cerr << "\\r";
4927 break;
4928
4929 case 14:
4930 std::cerr << "SO";
4931 break;
4932
4933 case 15:
4934 std::cerr << "SI";
4935 break;
4936
4937 case 16:
4938 std::cerr << "DLE";
4939 break;
4940
4941 case 17:
4942 std::cerr << "DC1";
4943 break;
4944
4945 case 18:
4946 std::cerr << "DC2";
4947 break;
4948
4949 case 19:
4950 std::cerr << "DC3";
4951 break;
4952
4953 case 20:
4954 std::cerr << "DC4";
4955 break;
4956
4957 case 21:
4958 std::cerr << "NAK";
4959 break;
4960
4961 case 22:
4962 std::cerr << "SYN";
4963 break;
4964
4965 case 23:
4966 std::cerr << "ETB";
4967 break;
4968
4969 case 24:
4970 std::cerr << "CAN";
4971 break;
4972
4973 case 25:
4974 std::cerr << "EM";
4975 break;
4976
4977 case 26:
4978 std::cerr << "SUB";
4979 break;
4980
4981 case 27:
4982 std::cerr << "ESC";
4983 break;
4984
4985 case 28:
4986 std::cerr << "FS";
4987 break;
4988
4989 case 29:
4990 std::cerr << "GS";
4991 break;
4992
4993 case 30:
4994 std::cerr << "RS";
4995 break;
4996
4997 case 31:
4998 std::cerr << "US";
4999 break;
5000
5001 case 32:
5002 std::cerr << "SPACE";
5003 break;
5004
5005 case 127:
5006 std::cerr << "DEL";
5007 break;
5008 }
5009}
5010
5011OCTAVE_NAMESPACE_BEGIN
5012
5013DEFUN (iskeyword, args, ,
5014 doc: /* -*- texinfo -*-
5015@deftypefn {} {} iskeyword ()
5016@deftypefnx {} {} iskeyword (@var{name})
5017Return true if @var{name} is an Octave keyword.
5018
5019If @var{name} is omitted, return a list of keywords.
5020@seealso{isvarname, exist}
5021@end deftypefn */)
5022{
5023 octave_value retval;
5024
5025 int nargin = args.length ();
5026
5027 if (nargin > 1)
5028 print_usage ();
5029
5030 if (nargin == 0)
5031 {
5032 // Neither set nor get are keywords. See the note in the
5033 // iskeyword function for additional details.
5034
5036
5037 int j = 0;
5038
5039 for (int i = 0; i < TOTAL_KEYWORDS; i++)
5040 {
5041 std::string kword = wordlist[i].name;
5042
5043 // FIXME: The following check is duplicated in iskeyword.
5044 if (! (kword == "set" || kword == "get" || kword == "arguments"
5045 || kword == "enumeration" || kword == "events"
5046 || kword == "methods" || kword == "properties"))
5047 lst[j++] = kword;
5048 }
5049
5050 lst.resize (j);
5051
5052 retval = Cell (lst.sort ());
5053 }
5054 else
5055 {
5056 std::string name = args(0).xstring_value ("iskeyword: NAME must be a string");
5057 retval = iskeyword (name);
5058 }
5059
5060 return retval;
5061}
5062
5063/*
5064
5065%!assert (iskeyword ("for"))
5066%!assert (iskeyword ("fort"), false)
5067%!assert (iskeyword ("fft"), false)
5068%!assert (iskeyword ("get"), false)
5069%!assert (iskeyword ("set"), false)
5070
5071%!error iskeyword ("A", "B")
5072%!error <NAME must be a string> iskeyword (1)
5073
5074*/
5076 void
5077 lexical_feedback::symbol_table_context::clear (void)
5078 {
5079 while (! m_frame_stack.empty ())
5080 m_frame_stack.pop_front ();
5081 }
5083 void
5084 lexical_feedback::symbol_table_context::pop (void)
5085 {
5086 if (empty ())
5088
5089 m_frame_stack.pop_front ();
5090 }
5093 lexical_feedback::symbol_table_context::curr_scope (void) const
5094 {
5095 if (empty ())
5096 return m_interpreter.get_current_scope ();
5097 else
5098 return m_frame_stack.front ();
5099 }
5102 lexical_feedback::symbol_table_context::parent_scope (void) const
5103 {
5104 std::size_t sz = size ();
5105
5106 return (sz > 1
5107 ? m_frame_stack[1]
5108 : (sz == 1 ? m_frame_stack[0] : symbol_scope ()));
5110
5111 lexical_feedback::~lexical_feedback (void)
5112 {
5113 m_tokens.clear ();
5114 }
5116 void
5117 lexical_feedback::init (void)
5118 {
5119 // The closest paren, brace, or bracket nesting is not an object
5120 // index.
5121 m_looking_at_object_index.push_front (false);
5122 }
5124 void
5125 lexical_feedback::reset (void)
5126 {
5127 m_end_of_input = false;
5128 m_allow_command_syntax = true;
5129 m_at_beginning_of_statement = true;
5130 m_looking_at_anon_fcn_args = false;
5131 m_looking_at_return_list = false;
5132 m_looking_at_parameter_list = false;
5133 m_looking_at_decl_list = false;
5134 m_looking_at_matrix_or_assign_lhs = false;
5135 m_looking_for_object_index = false;
5136 m_looking_at_indirect_ref = false;
5137 m_arguments_is_keyword = false;
5138 m_classdef_element_names_are_keywords = false;
5139 m_parsing_anon_fcn_body = false;
5140 m_parsing_class_method = false;
5141 m_parsing_classdef = false;
5142 m_parsing_classdef_decl = false;
5143 m_parsing_classdef_superclass = false;
5144 m_maybe_classdef_get_set_method = false;
5145 m_parsing_classdef_get_method = false;
5146 m_parsing_classdef_set_method = false;
5147 m_quote_is_transpose = false;
5148 m_force_script = false;
5149 m_reading_fcn_file = false;
5150 m_reading_script_file = false;
5151 m_reading_classdef_file = false;
5152 m_buffer_function_text = false;
5153 m_bracketflag = 0;
5154 m_braceflag = 0;
5155 m_looping = 0;
5156 m_defining_func = 0;
5157 m_looking_at_function_handle = 0;
5158 m_block_comment_nesting_level = 0;
5159 m_command_arg_paren_count = 0;
5160 m_token_count = 0;
5161 m_filepos = filepos (1, 1);
5162 m_tok_beg = filepos ();
5163 m_tok_end = filepos ();
5164 m_string_text = "";
5165 m_current_input_line = "";
5166 m_comment_text = "";
5167 m_help_text = "";
5168 m_function_text = "";
5169 m_fcn_file_name = "";
5170 m_fcn_file_full_name = "";
5171 m_dir_name = "";
5172 m_package_name = "";
5173 m_looking_at_object_index.clear ();
5174 m_looking_at_object_index.push_front (false);
5175
5176 while (! m_parsed_function_name.empty ())
5177 m_parsed_function_name.pop ();
5178
5179 m_symtab_context.clear ();
5180 m_nesting_level.reset ();
5181 m_tokens.clear ();
5182 }
5184 int
5185 lexical_feedback::previous_token_value (void) const
5186 {
5187 const token *tok = m_tokens.front ();
5188 return tok ? tok->token_value () : 0;
5189 }
5191 bool
5192 lexical_feedback::previous_token_value_is (int tok_val) const
5193 {
5194 const token *tok = m_tokens.front ();
5195 return tok ? tok->token_value_is (tok_val) : false;
5196 }
5198 void
5199 lexical_feedback::mark_previous_token_trailing_space (void)
5200 {
5201 token *tok = m_tokens.front ();
5202 if (tok && ! previous_token_value_is ('\n'))
5203 tok->mark_trailing_space ();
5204 }
5206 bool
5207 lexical_feedback::space_follows_previous_token (void) const
5208 {
5209 const token *tok = m_tokens.front ();
5210 return tok ? tok->space_follows_token () : false;
5211 }
5213 bool
5214 lexical_feedback::previous_token_is_binop (void) const
5215 {
5216 int tok = previous_token_value ();
5217
5218 return (tok == '+' || tok == '-' || tok == '@'
5219 || tok == ',' || tok == ';' || tok == '*' || tok == '/'
5220 || tok == ':' || tok == '=' || tok == ADD_EQ
5221 || tok == AND_EQ || tok == DIV_EQ || tok == EDIV
5222 || tok == EDIV_EQ || tok == ELEFTDIV || tok == ELEFTDIV_EQ
5223 || tok == EMUL || tok == EMUL_EQ
5224 || tok == EPOW || tok == EPOW_EQ || tok == EXPR_AND
5225 || tok == EXPR_AND_AND || tok == EXPR_EQ || tok == EXPR_GE
5226 || tok == EXPR_GT || tok == EXPR_LE || tok == EXPR_LT
5227 || tok == EXPR_NE || tok == EXPR_NOT || tok == EXPR_OR
5228 || tok == EXPR_OR_OR || tok == LEFTDIV || tok == LEFTDIV_EQ
5229 || tok == MUL_EQ || tok == OR_EQ || tok == POW
5230 || tok == POW_EQ || tok == SUB_EQ);
5231 }
5233 bool
5234 lexical_feedback::previous_token_is_keyword (void) const
5235 {
5236 const token *tok = m_tokens.front ();
5237 return tok ? tok->iskeyword () : false;
5238 }
5240 void
5241 lexical_feedback::mark_as_variable (const std::string& nm)
5242 {
5243 symbol_scope scope = m_symtab_context.curr_scope ();
5244
5245 if (scope)
5246 scope.mark_as_variable (nm);
5247 }
5249 void
5250 lexical_feedback::mark_as_variables (const std::list<std::string>& lst)
5251 {
5252 symbol_scope scope = m_symtab_context.curr_scope ();
5253
5254 if (scope)
5255 scope.mark_as_variables (lst);
5256 }
5258 bool
5259 lexical_feedback::previous_token_may_be_command (void) const
5260 {
5261 if (! m_allow_command_syntax)
5262 return false;
5263
5264 const token *tok = m_tokens.front ();
5265 return tok ? tok->may_be_command () : false;
5266 }
5268static bool
5269looks_like_copyright (const std::string& s)
5270{
5271 if (s.empty ())
5272 return false;
5273
5274 // Comment characters have been stripped but whitespace
5275 // (including newlines) remains.
5276
5277 std::size_t offset = s.find_first_not_of (" \t\n\r");
5278
5279 return (offset != std::string::npos
5280 && (s.substr (offset, 9) == "Copyright"
5281 || s.substr (offset, 6) == "Author"
5282 || s.substr (offset, 23) == "SPDX-License-Identifier"));
5283}
5285static bool
5286looks_like_shebang (const std::string& s)
5287{
5288 return ((! s.empty ()) && (s[0] == '!'));
5289}
5291 void
5292 base_lexer::input_buffer::fill (const std::string& input, bool eof_arg)
5293 {
5294 m_buffer = input;
5295 m_chars_left = m_buffer.length ();
5296 m_offset = 0;
5297 m_eof = eof_arg;
5298 }
5299
5300 // If BY_LINES is true, return chunks to the lexer line by line.
5301 int
5302 base_lexer::input_buffer::copy_chunk (char *buf, std::size_t max_size,
5303 bool by_lines)
5304 {
5305 static const char * const eol = "\n";
5306
5307 std::size_t len = 0;
5308 if (by_lines)
5309 {
5310 std::size_t newline_pos = m_buffer.find ('\n', m_offset);
5311 len = (newline_pos != std::string::npos
5312 ? newline_pos - m_offset + 1
5313 : (max_size > m_chars_left ? m_chars_left : max_size));
5314 }
5315 else
5316 len = max_size > m_chars_left ? m_chars_left : max_size;
5317
5318 assert (len > 0);
5319 memcpy (buf, m_buffer.c_str () + m_offset, len);
5320
5321 m_chars_left -= len;
5322 m_offset += len;
5323
5324 // Make sure the final input returned to the lexer ends with a new
5325 // line character.
5326
5327 if (m_chars_left == 0 && buf[len-1] != '\n')
5328 {
5329 if (len < max_size)
5330 {
5331 // There is enough room to plug the newline character in
5332 // the buffer.
5333 buf[len++] = '\n';
5334 }
5335 else
5336 {
5337 // There isn't enough room to plug the newline character
5338 // in BUF so arrange to have it returned on the next call
5339 // to base_lexer::read.
5340
5341 // At this point we've exhausted the original input
5342 // (m_chars_left is zero) so we can overwrite the initial
5343 // buffer with a single newline character to be returned on
5344 // the next call.
5345
5346 m_buffer = eol;
5347 m_chars_left = 1;
5348 m_offset = 0;
5349 }
5350 }
5351
5352 return len;
5354
5355 base_lexer::~base_lexer (void)
5356 {
5358 }
5360 void
5361 base_lexer::init (void)
5362 {
5364
5365 // Make base_lexer object available through yyextra in
5366 // flex-generated lexer.
5367 yyset_extra (this, m_scanner);
5368
5369 clear_start_state ();
5370 }
5371
5372 // Inside Flex-generated functions, yyg is the scanner cast to its real
5373 // type. Some flex macros that we use in base_lexer member functions
5374 // (for example, BEGIN) use yyg. If we could perform the actions of
5375 // these macros with functions instead, we could eliminate the
5376 // OCTAVE_YYG macro.
5377
5378#define OCTAVE_YYG \
5379 struct yyguts_t *yyg = static_cast<struct yyguts_t*> (m_scanner)
5381 void
5382 base_lexer::reset (void)
5383 {
5384 // Start off on the right foot.
5385 clear_start_state ();
5386
5387 m_symtab_context.clear ();
5388
5389 // Only ask for input from stdin if we are expecting interactive
5390 // input.
5391
5392 if (m_interpreter.interactive ()
5393 && ! (m_reading_fcn_file
5394 || m_reading_classdef_file
5395 || m_reading_script_file
5396 || input_from_eval_string ()))
5397 yyrestart (stdin, m_scanner);
5398
5399 lexical_feedback::reset ();
5400
5401 m_comment_buf.reset ();
5402 }
5404 void
5405 base_lexer::prep_for_file (void)
5406 {
5407 m_reading_script_file = true;
5408
5409 push_start_state (INPUT_FILE_START);
5410 }
5412 void
5413 base_lexer::begin_string (int state)
5414 {
5415 m_tok_beg = m_filepos;
5416
5417 push_start_state (state);
5418 }
5420 int
5421 base_lexer::handle_end_of_input (void)
5422 {
5423 lexer_debug ("<<EOF>>");
5424
5425 m_tok_beg = m_filepos;
5426 m_tok_end = m_filepos;
5427
5428 if (m_block_comment_nesting_level != 0)
5429 {
5430 warning ("block comment unterminated at end of input");
5431
5432 if ((m_reading_fcn_file || m_reading_script_file || m_reading_classdef_file)
5433 && ! m_fcn_file_name.empty ())
5434 warning ("near line %d of file '%s.m'",
5435 m_filepos.line (), m_fcn_file_name.c_str ());
5436 }
5437
5438 token *tok_val = new token (END_OF_INPUT, m_tok_beg, m_tok_end);
5439
5440 push_token (tok_val);
5441
5442 return count_token_internal (END_OF_INPUT);
5443 }
5445 char *
5446 base_lexer::flex_yytext (void)
5447 {
5448 return yyget_text (m_scanner);
5449 }
5451 int
5452 base_lexer::flex_yyleng (void)
5453 {
5454 return yyget_leng (m_scanner);
5455 }
5457 int
5458 base_lexer::text_yyinput (void)
5459 {
5460 int c = yyinput (m_scanner);
5461
5462 if (debug_flag ())
5463 {
5464 std::cerr << "I: ";
5466 std::cerr << std::endl;
5467 }
5468
5469 // Convert CRLF into just LF and single CR into LF.
5470
5471 if (c == '\r')
5472 {
5473 c = yyinput (m_scanner);
5474
5475 if (debug_flag ())
5476 {
5477 std::cerr << "I: ";
5479 std::cerr << std::endl;
5480 }
5481
5482 if (c != '\n')
5483 {
5484 xunput (c);
5485 c = '\n';
5486 }
5487 }
5488
5489 return c;
5490 }
5492 void
5493 base_lexer::xunput (char c, char *buf)
5494 {
5495 if (c != EOF)
5496 {
5497 if (debug_flag ())
5498 {
5499 std::cerr << "U: ";
5501 std::cerr << std::endl;
5502 }
5503
5504 yyunput (c, buf, m_scanner);
5505 }
5506 }
5508 void
5509 base_lexer::xunput (char c)
5510 {
5511 char *yytxt = flex_yytext ();
5512
5513 xunput (c, yytxt);
5514 }
5516 void
5517 base_lexer::update_token_positions (int tok_len)
5518 {
5519 m_tok_beg = m_filepos;
5520 m_tok_end = m_filepos;
5521
5522 if (tok_len > 1)
5523 m_tok_end.increment_column (tok_len - 1);
5524
5525 m_filepos.increment_column (tok_len);
5526 }
5528 bool
5529 base_lexer::looking_at_space (void)
5530 {
5531 int c = text_yyinput ();
5532 xunput (c);
5533 return is_space_or_tab (c);
5534 }
5536 bool
5537 base_lexer::inside_any_object_index (void)
5538 {
5539 bool retval = false;
5540
5541 for (const bool is_obj_idx : m_looking_at_object_index)
5542 {
5543 if (is_obj_idx)
5544 {
5545 retval = true;
5546 break;
5547 }
5548 }
5549
5550 return retval;
5551 }
5553 int
5554 base_lexer::make_keyword_token (const std::string& s)
5555 {
5556 // Token positions should have already been updated before this
5557 // function is called.
5558
5559 int slen = s.length ();
5560
5561 const octave_kw *kw = octave_kw_hash::in_word_set (s.c_str (), slen);
5562
5563 if (! kw)
5564 return 0;
5565
5566 bool previous_at_bos = m_at_beginning_of_statement;
5567
5568 // May be reset to true for some token types.
5569 m_at_beginning_of_statement = false;
5570
5571 token *tok_val = nullptr;
5572
5573 switch (kw->kw_id)
5574 {
5575 case break_kw:
5576 case catch_kw:
5577 case continue_kw:
5578 case else_kw:
5579 case otherwise_kw:
5580 case return_kw:
5582 m_at_beginning_of_statement = true;
5583 break;
5584
5585 case persistent_kw:
5586 case global_kw:
5587 m_looking_at_decl_list = true;
5588 break;
5589
5590 case case_kw:
5591 case elseif_kw:
5592 case until_kw:
5593 break;
5594
5595 case end_kw:
5596 if (inside_any_object_index ()
5597 || (m_defining_func
5598 && ! (m_looking_at_return_list
5599 || m_parsed_function_name.top ())))
5600 {
5601 m_at_beginning_of_statement = previous_at_bos;
5602 return 0;
5603 }
5604
5605 tok_val = new token (end_kw, token::simple_end, m_tok_beg, m_tok_end);
5606 m_at_beginning_of_statement = true;
5607 break;
5608
5609 case end_try_catch_kw:
5610 tok_val = new token (end_try_catch_kw, token::try_catch_end, m_tok_beg,
5611 m_tok_end);
5612 m_at_beginning_of_statement = true;
5613 break;
5614
5616 tok_val = new token (end_unwind_protect_kw,
5617 token::unwind_protect_end, m_tok_beg, m_tok_end);
5618 m_at_beginning_of_statement = true;
5619 break;
5620
5621 case endfor_kw:
5622 tok_val = new token (endfor_kw, token::for_end, m_tok_beg, m_tok_end);
5623 m_at_beginning_of_statement = true;
5624 break;
5625
5626 case endfunction_kw:
5627 tok_val = new token (endfunction_kw, token::function_end, m_tok_beg,
5628 m_tok_end);
5629 m_at_beginning_of_statement = true;
5630 break;
5631
5632 case endif_kw:
5633 tok_val = new token (endif_kw, token::if_end, m_tok_beg, m_tok_end);
5634 m_at_beginning_of_statement = true;
5635 break;
5636
5637 case endparfor_kw:
5638 tok_val = new token (endparfor_kw, token::parfor_end, m_tok_beg,
5639 m_tok_end);
5640 m_at_beginning_of_statement = true;
5641 break;
5642
5643 case endswitch_kw:
5644 tok_val = new token (endswitch_kw, token::switch_end, m_tok_beg,
5645 m_tok_end);
5646 m_at_beginning_of_statement = true;
5647 break;
5648
5649 case endwhile_kw:
5650 tok_val = new token (endwhile_kw, token::while_end, m_tok_beg,
5651 m_tok_end);
5652 m_at_beginning_of_statement = true;
5653 break;
5654
5655 case endarguments_kw:
5656#if defined (DISABLE_ARGUMENTS_VALIDATION_BLOCK)
5657 return 0;
5658#else
5659 tok_val = new token (endarguments_kw, token::arguments_end, m_tok_beg,
5660 m_tok_end);
5661 m_at_beginning_of_statement = true;
5662 break;
5663#endif
5664
5665 case endclassdef_kw:
5666 tok_val = new token (endclassdef_kw, token::classdef_end, m_tok_beg,
5667 m_tok_end);
5668 m_at_beginning_of_statement = true;
5669 break;
5670
5671 case endenumeration_kw:
5672 tok_val = new token (endenumeration_kw, token::enumeration_end,
5673 m_tok_beg, m_tok_end);
5674 m_at_beginning_of_statement = true;
5675 break;
5676
5677 case endevents_kw:
5678 tok_val = new token (endevents_kw, token::events_end, m_tok_beg,
5679 m_tok_end);
5680 m_at_beginning_of_statement = true;
5681 break;
5682
5683 case endmethods_kw:
5684 tok_val = new token (endmethods_kw, token::methods_end, m_tok_beg,
5685 m_tok_end);
5686 m_at_beginning_of_statement = true;
5687 break;
5688
5689 case endproperties_kw:
5690 tok_val = new token (endproperties_kw, token::properties_end, m_tok_beg,
5691 m_tok_end);
5692 m_at_beginning_of_statement = true;
5693 break;
5694
5695 case for_kw:
5696 case parfor_kw:
5697 case while_kw:
5698 m_looping++;
5699 break;
5700
5701 case do_kw:
5702 m_at_beginning_of_statement = true;
5703 m_looping++;
5704 break;
5705
5706 case try_kw:
5707 case unwind_protect_kw:
5708 m_at_beginning_of_statement = true;
5709 break;
5710
5711 case if_kw:
5712 case switch_kw:
5713 break;
5714
5715 case get_kw:
5716 case set_kw:
5717 // 'get' and 'set' are keywords in classdef method
5718 // declarations.
5719 if (! m_maybe_classdef_get_set_method)
5720 {
5721 m_at_beginning_of_statement = previous_at_bos;
5722 return 0;
5723 }
5724 break;
5725
5726 case enumeration_kw:
5727 case events_kw:
5728 case methods_kw:
5729 case properties_kw:
5730 // 'properties', 'methods' and 'events' are keywords for
5731 // classdef blocks.
5732 if (! m_classdef_element_names_are_keywords)
5733 {
5734 m_at_beginning_of_statement = previous_at_bos;
5735 return 0;
5736 }
5737 // fall through ...
5738
5739 case classdef_kw:
5740 // 'classdef' is always a keyword.
5741 if (! m_force_script && m_token_count == 0 && input_from_file ())
5742 {
5743 m_reading_classdef_file = true;
5744 m_reading_script_file = false;
5745 }
5746 break;
5747
5748 case function_kw:
5749 m_defining_func++;
5750 m_parsed_function_name.push (false);
5751
5752 if (! m_force_script && m_token_count == 0 && input_from_file ())
5753 {
5754 m_reading_fcn_file = true;
5755 m_reading_script_file = false;
5756 }
5757
5758 // FIXME: should we be asking directly whether input is coming
5759 // from an eval string instead of that it is not coming from a
5760 // file?
5761
5762 if (! (m_reading_fcn_file || m_reading_script_file
5763 || m_reading_classdef_file))
5764 {
5765 // Input must be coming from the terminal or stdin?
5766 m_buffer_function_text = true;
5767 m_function_text += (m_current_input_line + "\n");
5768
5769 // FIXME: do we need to save and restore the file position
5770 // or just reset the line number here? The goal is to
5771 // track line info for command-line functions relative
5772 // to the function keyword. Should we really be setting
5773 // the line and column info to (1, 1) here?
5774
5775 m_filepos = filepos (1, 1);
5776 update_token_positions (slen);
5777 }
5778 break;
5779
5780 case arguments_kw:
5781#if defined (DISABLE_ARGUMENTS_VALIDATION_BLOCK)
5782 return 0;
5783#else
5784 if (! m_arguments_is_keyword)
5785 return 0;
5786 break;
5787#endif
5788
5789 case spmd_kw:
5790 m_at_beginning_of_statement = true;
5791 break;
5792
5793 case endspmd_kw:
5794 tok_val = new token (endspmd_kw, token::spmd_end, m_tok_beg, m_tok_end);
5795 m_at_beginning_of_statement = true;
5796 break;
5797
5798 case magic_file_kw:
5799 {
5800 if ((m_reading_fcn_file || m_reading_script_file
5801 || m_reading_classdef_file)
5802 && ! m_fcn_file_full_name.empty ())
5803 tok_val = new token (magic_file_kw, m_fcn_file_full_name,
5804 m_tok_beg, m_tok_end);
5805 else
5806 tok_val = new token (magic_file_kw, "stdin", m_tok_beg, m_tok_end);
5807 }
5808 break;
5809
5810 case magic_line_kw:
5811 {
5812 int l = m_tok_beg.line ();
5813 octave_value ov_value (static_cast<double> (l));
5814 tok_val = new token (magic_line_kw, ov_value, "",
5815 m_tok_beg, m_tok_end);
5816 }
5817 break;
5818
5819 default:
5821 }
5822
5823 if (! tok_val)
5824 tok_val = new token (kw->tok, true, m_tok_beg, m_tok_end);
5825
5826 push_token (tok_val);
5827
5828 return kw->tok;
5829 }
5831 bool
5832 base_lexer::fq_identifier_contains_keyword (const std::string& s)
5833 {
5834 std::size_t p1 = 0;
5835 std::size_t p2;
5836
5837 std::string s_part;
5838
5839 do
5840 {
5841 p2 = s.find ('.', p1);
5842
5843 if (p2 != std::string::npos)
5844 {
5845 s_part = s.substr (p1, p2 - p1);
5846 p1 = p2 + 1;
5847 }
5848 else
5849 s_part = s.substr (p1);
5850
5851 if (iskeyword (s_part))
5852 return true;
5853 }
5854 while (p2 != std::string::npos);
5855
5856 return false;
5857 }
5859 bool
5860 base_lexer::whitespace_is_significant (void)
5861 {
5862 return (m_nesting_level.is_bracket ()
5863 || (m_nesting_level.is_brace ()
5864 && ! m_looking_at_object_index.front ()));
5865 }
5867static inline bool
5868looks_like_bin (const char *s, int len)
5869{
5870 return (len > 2 && s[0] == '0' && (s[1] == 'b' || s[1] == 'B'));
5871}
5873static inline bool
5874looks_like_hex (const char *s, int len)
5875{
5876 return (len > 2 && s[0] == '0' && (s[1] == 'x' || s[1] == 'X'));
5877}
5879static inline octave_value
5880make_integer_value (uintmax_t long_int_val, bool unsigned_val, int bytes)
5881{
5882 if (unsigned_val)
5883 {
5884 switch (bytes)
5885 {
5886 case 1:
5887 return octave_value (octave_uint8 (long_int_val));
5888
5889 case 2:
5890 return octave_value (octave_uint16 (long_int_val));
5891
5892 case 4:
5893 return octave_value (octave_uint32 (long_int_val));
5894
5895 case 8:
5896 return octave_value (octave_uint64 (long_int_val));
5897
5898 default:
5900 };
5901 }
5902 else
5903 {
5904 // FIXME: Conversion to signed values is supposed to follow
5905 // twos-complement rules. Do we need to be more carefule here?
5906
5907 switch (bytes)
5908 {
5909 case 1:
5910 return octave_value (octave_int8 (int8_t (long_int_val)));
5911
5912 case 2:
5913 return octave_value (octave_int16 (int16_t (long_int_val)));
5914
5915 case 4:
5916 return octave_value (octave_int32 (int32_t (long_int_val)));
5917
5918 case 8:
5919 return octave_value (octave_int64 (int64_t (long_int_val)));
5920
5921 default:
5923 };
5924 }
5925
5926 return octave_value ();
5927}
5929 template <>
5930 int
5931 base_lexer::handle_number<2> (void)
5932 {
5933 // Skip 0[bB] prefix.
5934 std::string yytxt (flex_yytext () + 2);
5935
5936 yytxt.erase (std::remove (yytxt.begin (), yytxt.end (), '_'),
5937 yytxt.end ());
5938
5939 std::size_t pos = yytxt.find_first_of ("su");
5940
5941 bool unsigned_val = true;
5942 int bytes = -1;
5943
5944 if (pos == std::string::npos)
5945 {
5946 std::size_t num_digits = yytxt.length ();
5947
5948 if (num_digits <= 8)
5949 bytes = 1;
5950 else if (num_digits <= 16)
5951 bytes = 2;
5952 else if (num_digits <= 32)
5953 bytes = 4;
5954 else if (num_digits <= 64)
5955 bytes = 8;
5956 }
5957 else
5958 {
5959 unsigned_val = (yytxt[pos] == 'u');
5960 std::string size_str = yytxt.substr (pos+1);
5961 yytxt = yytxt.substr (0, pos);
5962 std::size_t num_digits = yytxt.length ();
5963
5964 if (size_str == "8" && num_digits <= 8)
5965 bytes = 1;
5966 else if (size_str == "16" && num_digits <= 16)
5967 bytes = 2;
5968 else if (size_str == "32" && num_digits <= 32)
5969 bytes = 4;
5970 else if (size_str == "64" && num_digits <= 64)
5971 bytes = 8;
5972 }
5973
5974 if (bytes < 0)
5975 {
5976 token *tok
5977 = new token (LEXICAL_ERROR,
5978 "too many digits for binary constant",
5979 m_tok_beg, m_tok_end);
5980
5981 push_token (tok);
5982
5983 return count_token_internal (LEXICAL_ERROR);
5984 }
5985
5986 // FIXME: is there a better way? Can uintmax_t be anything other
5987 // than long or long long? Should we just be using uint64_t instead
5988 // of uintmax_t?
5989
5990 errno = 0;
5991 char *end;
5992 uintmax_t long_int_val;
5993 if (sizeof (uintmax_t) == sizeof (unsigned long long))
5994 long_int_val = strtoull (yytxt.c_str (), &end, 2);
5995 else if (sizeof (uintmax_t) == sizeof (unsigned long))
5996 long_int_val = strtoul (yytxt.c_str (), &end, 2);
5997 else
5999
6000 if (errno == ERANGE)
6002
6003 octave_value ov_value
6004 = make_integer_value (long_int_val, unsigned_val, bytes);
6005
6006 m_looking_for_object_index = false;
6007 m_at_beginning_of_statement = false;
6008
6009 update_token_positions (flex_yyleng ());
6010
6011 push_token (new token (NUMBER, ov_value, yytxt, m_tok_beg, m_tok_end));
6012
6013 return count_token_internal (NUMBER);
6014 }
6016 static uint64_t
6017 flintmax (void)
6018 {
6019 return (static_cast<uint64_t> (1) << std::numeric_limits<double>::digits);
6020 }
6022 template <>
6023 int
6024 base_lexer::handle_number<10> (void)
6025 {
6026 bool imag = false;
6027 bool digits_only = true;
6028
6029 char *yytxt = flex_yytext ();
6030 std::size_t yylng = flex_yyleng ();
6031
6032 OCTAVE_LOCAL_BUFFER (char, tmptxt, yylng + 1);
6033 char *rp = yytxt;
6034 char *p = &tmptxt[0];
6035
6036 char ch;
6037 while ((ch = *rp++))
6038 {
6039 switch (ch)
6040 {
6041 case '_':
6042 break;
6043
6044 case 'D':
6045 case 'd':
6046 *p++ = 'e';
6047 digits_only = false;
6048 break;
6049
6050 case 'I':
6051 case 'J':
6052 case 'i':
6053 case 'j':
6054 // Octave does not provide imaginary integers.
6055 digits_only = false;
6056 imag = true;
6057 break;
6058
6059 case '+':
6060 case '-':
6061 case '.':
6062 case 'E':
6063 case 'e':
6064 digits_only = false;
6065 *p++ = ch;
6066 break;
6067
6068 default:
6069 *p++ = ch;
6070 break;
6071 }
6072 }
6073
6074 *p = '\0';
6075
6076 double value = 0.0;
6077 int nread = 0;
6078
6079 nread = sscanf (tmptxt, "%lf", &value);
6080
6081 // If yytext doesn't contain a valid number, we are in deep doo doo.
6082
6083 assert (nread == 1);
6084
6085 octave_value ov_value;
6086
6087 // Use >= because > will not return true until value is greater than
6088 // flintmax + 2!
6089
6090 if (digits_only && value >= flintmax ())
6091 {
6092 // Try reading as an unsigned 64-bit integer. If there is a
6093 // range error, then create a double value. Otherwise, create a
6094 // special uint64 object that will be automatically converted to
6095 // double unless it appears as the argument to one of the int64
6096 // or uint64 functions.
6097
6098 errno = 0;
6099 char *end;
6100 uintmax_t long_int_val;
6101 if (sizeof (uintmax_t) == sizeof (unsigned long long))
6102 long_int_val = strtoull (tmptxt, &end, 10);
6103 else if (sizeof (uintmax_t) == sizeof (unsigned long))
6104 long_int_val = strtoul (tmptxt, &end, 10);
6105 else
6107
6108 if (errno != ERANGE)
6109 {
6110 // If possible, store the value as a signed integer.
6111
6112 octave_base_value *magic_int;
6113 if (long_int_val > std::numeric_limits<int64_t>::max ())
6114 magic_int = new octave_magic_uint (octave_uint64 (long_int_val));
6115 else
6116 magic_int = new octave_magic_int (octave_int64 (long_int_val));
6117
6118 ov_value = octave_value (magic_int);
6119 }
6120 }
6121
6122 m_looking_for_object_index = false;
6123 m_at_beginning_of_statement = false;
6124
6125 update_token_positions (yylng);
6126
6127 if (ov_value.is_undefined ())
6128 ov_value = (imag
6129 ? octave_value (Complex (0.0, value))
6130 : octave_value (value));
6131
6132 push_token (new token (NUMBER, ov_value, yytxt, m_tok_beg, m_tok_end));
6133
6134 return count_token_internal (NUMBER);
6135 }
6137 template <>
6138 int
6139 base_lexer::handle_number<16> (void)
6140 {
6141 // Skip 0[xX] prefix.
6142 std::string yytxt (flex_yytext () + 2);
6143
6144 yytxt.erase (std::remove (yytxt.begin (), yytxt.end (), '_'),
6145 yytxt.end ());
6146
6147 std::size_t pos = yytxt.find_first_of ("su");
6148
6149 bool unsigned_val = true;
6150 int bytes = -1;
6151
6152 if (pos == std::string::npos)
6153 {
6154 std::size_t num_digits = yytxt.length ();
6155
6156 if (num_digits <= 2)
6157 bytes = 1;
6158 else if (num_digits <= 4)
6159 bytes = 2;
6160 else if (num_digits <= 8)
6161 bytes = 4;
6162 else if (num_digits <= 16)
6163 bytes = 8;
6164 }
6165 else
6166 {
6167 unsigned_val = (yytxt[pos] == 'u');
6168 std::string size_str = yytxt.substr (pos+1);
6169 yytxt = yytxt.substr (0, pos);
6170 std::size_t num_digits = yytxt.length ();
6171
6172 if (size_str == "8" && num_digits <= 2)
6173 bytes = 1;
6174 else if (size_str == "16" && num_digits <= 4)
6175 bytes = 2;
6176 else if (size_str == "32" && num_digits <= 8)
6177 bytes = 4;
6178 else if (size_str == "64" && num_digits <= 16)
6179 bytes = 8;
6180 }
6181
6182 if (bytes < 0)
6183 {
6184 token *tok
6185 = new token (LEXICAL_ERROR,
6186 "too many digits for hexadecimal constant",
6187 m_tok_beg, m_tok_end);
6188
6189 push_token (tok);
6190
6191 return count_token_internal (LEXICAL_ERROR);
6192 }
6193
6194 // Assert here because if yytext doesn't contain a valid number, we
6195 // are in deep doo doo.
6196
6197 uintmax_t long_int_val;
6198 int status = sscanf (yytxt.c_str (), "%jx", &long_int_val);
6199 assert (status);
6200
6201 octave_value ov_value
6202 = make_integer_value (long_int_val, unsigned_val, bytes);
6203
6204 m_looking_for_object_index = false;
6205 m_at_beginning_of_statement = false;
6206
6207 update_token_positions (flex_yyleng ());
6208
6209 push_token (new token (NUMBER, ov_value, yytxt, m_tok_beg, m_tok_end));
6210
6211 return count_token_internal (NUMBER);
6212 }
6214 void
6215 base_lexer::handle_continuation (void)
6216 {
6217 char *yytxt = flex_yytext ();
6218 int yylng = flex_yyleng ();
6219
6220 int offset = 1;
6221 if (yytxt[0] == '\\')
6222 warn_language_extension_continuation ();
6223 else
6224 offset = 3;
6225
6226 bool have_space = false;
6227 while (offset < yylng)
6228 {
6229 char c = yytxt[offset];
6230 if (is_space_or_tab (c))
6231 {
6232 have_space = true;
6233 offset++;
6234 }
6235 else
6236 break;
6237 }
6238
6239 if (have_space)
6240 mark_previous_token_trailing_space ();
6241
6242 bool have_comment = false;
6243 while (offset < yylng)
6244 {
6245 char c = yytxt[offset];
6246 if (c == '#' || c == '%')
6247 {
6248 have_comment = true;
6249 offset++;
6250 }
6251 else
6252 break;
6253 }
6254
6255 if (have_comment)
6256 {
6257 m_comment_text = &yytxt[offset];
6258
6259 // finish_comment sets m_at_beginning_of_statement to true but
6260 // that's not be correct if we are handling a continued
6261 // statement. Preserve the current state.
6262
6263 bool saved_bos = m_at_beginning_of_statement;
6264
6265 finish_comment (comment_elt::end_of_line);
6266
6267 m_at_beginning_of_statement = saved_bos;
6268 }
6269
6270 m_filepos.next_line ();
6271 }
6273 void
6274 base_lexer::finish_comment (comment_elt::comment_type typ)
6275 {
6276 bool copyright = looks_like_copyright (m_comment_text);
6277
6278 if (m_nesting_level.none () && m_help_text.empty () && ! m_comment_text.empty ()
6279 && ! copyright && ! looks_like_shebang (m_comment_text))
6280 m_help_text = m_comment_text;
6281
6282 if (copyright)
6283 typ = comment_elt::copyright;
6284
6285 m_comment_buf.append (m_comment_text, typ);
6286
6287 m_comment_text = "";
6288
6289 m_at_beginning_of_statement = true;
6290 }
6292 int
6293 base_lexer::handle_close_bracket (int bracket_type)
6294 {
6295 m_looking_at_object_index.pop_front ();
6296
6297 m_looking_for_object_index = true;
6298 m_at_beginning_of_statement = false;
6299
6300 if (! m_nesting_level.none ())
6301 {
6302 m_nesting_level.remove ();
6303
6304 if (bracket_type == ']')
6305 m_bracketflag--;
6306 else if (bracket_type == '}')
6307 m_braceflag--;
6308 else
6310 }
6311
6312 pop_start_state ();
6313
6314 return count_token (bracket_type);
6315 }
6317 bool
6318 base_lexer::looks_like_command_arg (void)
6319 {
6320 if (! m_allow_command_syntax)
6321 return false;
6322
6323 bool space_before = space_follows_previous_token ();
6324 bool space_after = looking_at_space ();
6325
6326 return (space_before && ! space_after
6327 && previous_token_may_be_command ());
6328 }
6330 int
6331 base_lexer::handle_superclass_identifier (void)
6332 {
6333 update_token_positions (flex_yyleng ());
6334
6335 std::string txt = flex_yytext ();
6336
6337 txt.erase (std::remove_if (txt.begin (), txt.end (), is_space_or_tab),
6338 txt.end ());
6339
6340 std::size_t pos = txt.find ("@");
6341
6342 std::string meth = txt.substr (0, pos);
6343 std::string cls = txt.substr (pos + 1);
6344
6345 if (iskeyword (meth) || fq_identifier_contains_keyword (cls))
6346 {
6347 token *tok
6348 = new token (LEXICAL_ERROR,
6349 "method, class, and package names may not be keywords",
6350 m_tok_beg, m_tok_end);
6351
6352 push_token (tok);
6353
6354 return count_token_internal (LEXICAL_ERROR);
6355 }
6356
6357 push_token (new token (SUPERCLASSREF, meth, cls, m_tok_beg, m_tok_end));
6358
6359 m_filepos.increment_column (flex_yyleng ());
6360
6361 return count_token_internal (SUPERCLASSREF);
6362 }
6364 int
6365 base_lexer::handle_meta_identifier (void)
6366 {
6367 std::string txt = flex_yytext ();
6368
6369 txt.erase (std::remove_if (txt.begin (), txt.end (), is_space_or_tab),
6370 txt.end ());
6371
6372 // Eliminate leading '?'
6373 std::string cls = txt.substr (1);
6374
6375 // Token positions should have already been updated before this
6376 // function is called.
6377
6378 if (fq_identifier_contains_keyword (cls))
6379 {
6380 token *tok = new token (LEXICAL_ERROR,
6381 "class and package names may not be keywords",
6382 m_tok_beg, m_tok_end);
6383 push_token (tok);
6384
6385 return count_token_internal (LEXICAL_ERROR);
6386 }
6387
6388 push_token (new token (METAQUERY, cls, m_tok_beg, m_tok_end));
6389
6390 m_filepos.increment_column (flex_yyleng ());
6391
6392 return METAQUERY;
6393 }
6395 int
6396 base_lexer::handle_fq_identifier (void)
6397 {
6398 std::string txt = flex_yytext ();
6399
6400 txt.erase (std::remove_if (txt.begin (), txt.end (), is_space_or_tab),
6401 txt.end ());
6402
6403 // Token positions should have already been updated before this
6404 // function is called.
6405
6406 if (fq_identifier_contains_keyword (txt))
6407 {
6408 token *tok
6409 = new token (LEXICAL_ERROR,
6410 "function, method, class, and package names may not be keywords",
6411 m_tok_beg, m_tok_end);
6412
6413 push_token (tok);
6414
6415 return count_token_internal (LEXICAL_ERROR);
6416 }
6417
6418 push_token (new token (FQ_IDENT, txt, m_tok_beg, m_tok_end));
6419
6420 m_filepos.increment_column (flex_yyleng ());
6421
6422 return FQ_IDENT;
6423 }
6424
6425 // Figure out exactly what kind of token to return when we have seen
6426 // an identifier. Handles keywords. Return -1 if the identifier
6427 // should be ignored.
6429 int
6430 base_lexer::handle_identifier (void)
6431 {
6432 update_token_positions (flex_yyleng ());
6433
6434 std::string ident = flex_yytext ();
6435
6436 // If we are expecting a structure element, avoid recognizing
6437 // keywords and other special names and return STRUCT_ELT, which is
6438 // a string that is also a valid identifier.
6439
6440 if (m_looking_at_indirect_ref)
6441 {
6442 push_token (new token (STRUCT_ELT, ident, m_tok_beg, m_tok_end));
6443
6444 m_looking_for_object_index = true;
6445
6446 return STRUCT_ELT;
6447 }
6448
6449 // If ident is a keyword token, then make_keyword_token will set
6450 // m_at_beginning_of_statement. For example, if tok is an IF
6451 // token, then m_at_beginning_of_statement will be false.
6452
6453 int kw_token = make_keyword_token (ident);
6454
6455 // If we have a regular keyword, return it.
6456 // Keywords can be followed by identifiers.
6457
6458 if (kw_token)
6459 {
6460 m_looking_for_object_index = false;
6461
6462 // The call to make_keyword_token set m_at_beginning_of_statement.
6463
6464 return count_token_internal (kw_token);
6465 }
6466
6467 token *tok = new token (NAME, ident, m_tok_beg, m_tok_end);
6468
6469 // For compatibility with Matlab, the following symbols are
6470 // handled specially so that things like
6471 //
6472 // pi +1
6473 //
6474 // are parsed as an addition expression instead of as a command-style
6475 // function call with the argument "+1". Also for compatibility with
6476 // Matlab, if we are at the top level workspace, do not consider IDENT
6477 // as a possible command if it is already known to be a variable.
6478
6479 if (m_at_beginning_of_statement
6480 && ! (m_parsing_anon_fcn_body
6481 || ident == "e" || ident == "pi"
6482 || ident == "I" || ident == "i"
6483 || ident == "J" || ident == "j"
6484 || ident == "Inf" || ident == "inf"
6485 || ident == "NaN" || ident == "nan"))
6486 tok->mark_may_be_command ();
6487
6488 push_token (tok);
6489
6490 // The magic end index can't be indexed.
6491
6492 if (ident != "end")
6493 m_looking_for_object_index = true;
6494
6495 m_at_beginning_of_statement = false;
6496
6497 return count_token_internal (NAME);
6498 }
6500 void
6501 base_lexer::maybe_warn_separator_insert (char sep)
6502 {
6503 std::string nm = m_fcn_file_full_name;
6504
6505 if (nm.empty ())
6506 warning_with_id ("Octave:separator-insert",
6507 "potential auto-insertion of '%c' near line %d",
6508 sep, m_filepos.line ());
6509 else
6510 warning_with_id ("Octave:separator-insert",
6511 "potential auto-insertion of '%c' near line %d of file %s",
6512 sep, m_filepos.line (), nm.c_str ());
6513 }
6515 void
6516 base_lexer::warn_single_quote_string (void)
6517 {
6518 std::string nm = m_fcn_file_full_name;
6519
6520 if (nm.empty ())
6521 warning_with_id ("Octave:single-quote-string",
6522 "single quote delimited string near line %d",
6523 m_filepos.line ());
6524 else
6525 warning_with_id ("Octave:single-quote-string",
6526 "single quote delimited string near line %d of file %s",
6527 m_filepos.line (), nm.c_str ());
6528 }
6530 void
6531 base_lexer::warn_language_extension (const std::string& msg)
6532 {
6533 std::string nm = m_fcn_file_full_name;
6534
6535 if (nm.empty ())
6536 warning_with_id ("Octave:language-extension",
6537 "Octave language extension used: %s",
6538 msg.c_str ());
6539 else
6540 warning_with_id ("Octave:language-extension",
6541 "Octave language extension used: %s near line %d offile %s",
6542 msg.c_str (), m_filepos.line (), nm.c_str ());
6543 }
6545 void
6546 base_lexer::maybe_warn_language_extension_comment (char c)
6547 {
6548 if (c == '#')
6549 warn_language_extension ("# used as comment character");
6550 }
6552 void
6553 base_lexer::warn_language_extension_continuation (void)
6554 {
6555 warn_language_extension ("\\ used as line continuation marker");
6556 }
6558 void
6559 base_lexer::warn_language_extension_operator (const std::string& op)
6560 {
6561 std::string t = op;
6562 int n = t.length ();
6563 if (t[n-1] == '\n')
6564 t.resize (n-1);
6565 warn_language_extension (t + " used as operator");
6566 }
6568 void
6569 base_lexer::warn_deprecated_syntax (const std::string& msg)
6570 {
6571 if (m_fcn_file_full_name.empty ())
6572 warning_with_id ("Octave:deprecated-syntax", "%s", msg.c_str ());
6573 else
6574 warning_with_id ("Octave:deprecated-syntax",
6575 "%s; near line %d of file '%s'", msg.c_str (),
6576 m_filepos.line (), m_fcn_file_full_name.c_str ());
6577 }
6579 void
6580 base_lexer::warn_deprecated_operator (const std::string& deprecated_op,
6581 const std::string& recommended_op,
6582 const std::string& version)
6583 {
6584 std::string msg = "the '" + deprecated_op + "' operator was deprecated in version " + version + " and will not be allowed in a future version of Octave; please use '" + recommended_op + "' instead";
6585
6586 warn_deprecated_syntax (msg);
6587 }
6589 void
6590 base_lexer::push_token (token *tok)
6591 {
6592 YYSTYPE *lval = yyget_lval (m_scanner);
6593 lval->tok_val = tok;
6594 m_tokens.push (tok);
6595 }
6597 token *
6598 base_lexer::current_token (void)
6599 {
6600 YYSTYPE *lval = yyget_lval (m_scanner);
6601 return lval->tok_val;
6602 }
6604 std::size_t
6605 base_lexer::pending_token_count (void) const
6606 {
6607 return m_tokens.size ();
6608 }
6610 void
6611 base_lexer::display_token (int tok)
6612 {
6613 switch (tok)
6614 {
6615 case '=': std::cerr << "'='\n"; break;
6616 case ':': std::cerr << "':'\n"; break;
6617 case '-': std::cerr << "'-'\n"; break;
6618 case '+': std::cerr << "'+'\n"; break;
6619 case '*': std::cerr << "'*'\n"; break;
6620 case '/': std::cerr << "'/'\n"; break;
6621 case ADD_EQ: std::cerr << "ADD_EQ\n"; break;
6622 case SUB_EQ: std::cerr << "SUB_EQ\n"; break;
6623 case MUL_EQ: std::cerr << "MUL_EQ\n"; break;
6624 case DIV_EQ: std::cerr << "DIV_EQ\n"; break;
6625 case LEFTDIV_EQ: std::cerr << "LEFTDIV_EQ\n"; break;
6626 case POW_EQ: std::cerr << "POW_EQ\n"; break;
6627 case EMUL_EQ: std::cerr << "EMUL_EQ\n"; break;
6628 case EDIV_EQ: std::cerr << "EDIV_EQ\n"; break;
6629 case ELEFTDIV_EQ: std::cerr << "ELEFTDIV_EQ\n"; break;
6630 case EPOW_EQ: std::cerr << "EPOW_EQ\n"; break;
6631 case AND_EQ: std::cerr << "AND_EQ\n"; break;
6632 case OR_EQ: std::cerr << "OR_EQ\n"; break;
6633 case EXPR_AND_AND: std::cerr << "EXPR_AND_AND\n"; break;
6634 case EXPR_OR_OR: std::cerr << "EXPR_OR_OR\n"; break;
6635 case EXPR_AND: std::cerr << "EXPR_AND\n"; break;
6636 case EXPR_OR: std::cerr << "EXPR_OR\n"; break;
6637 case EXPR_NOT: std::cerr << "EXPR_NOT\n"; break;
6638 case EXPR_LT: std::cerr << "EXPR_LT\n"; break;
6639 case EXPR_LE: std::cerr << "EXPR_LE\n"; break;
6640 case EXPR_EQ: std::cerr << "EXPR_EQ\n"; break;
6641 case EXPR_NE: std::cerr << "EXPR_NE\n"; break;
6642 case EXPR_GE: std::cerr << "EXPR_GE\n"; break;
6643 case EXPR_GT: std::cerr << "EXPR_GT\n"; break;
6644 case LEFTDIV: std::cerr << "LEFTDIV\n"; break;
6645 case EMUL: std::cerr << "EMUL\n"; break;
6646 case EDIV: std::cerr << "EDIV\n"; break;
6647 case ELEFTDIV: std::cerr << "ELEFTDIV\n"; break;
6648 case HERMITIAN: std::cerr << "HERMITIAN\n"; break;
6649 case TRANSPOSE: std::cerr << "TRANSPOSE\n"; break;
6650 case PLUS_PLUS: std::cerr << "PLUS_PLUS\n"; break;
6651 case MINUS_MINUS: std::cerr << "MINUS_MINUS\n"; break;
6652 case POW: std::cerr << "POW\n"; break;
6653 case EPOW: std::cerr << "EPOW\n"; break;
6654
6655 case NUMBER:
6656 {
6657 token *tok_val = current_token ();
6658 std::cerr << "NUMBER [";
6659 octave_value num = tok_val->number ();
6660 num.print_raw (std::cerr);
6661 std::cerr << "]\n";
6662 }
6663 break;
6664
6665 case STRUCT_ELT:
6666 {
6667 token *tok_val = current_token ();
6668 std::cerr << "STRUCT_ELT [" << tok_val->text () << "]\n";
6669 }
6670 break;
6671
6672 case NAME:
6673 {
6674 token *tok_val = current_token ();
6675 std::cerr << "NAME [" << tok_val->text () << "]\n";
6676 }
6677 break;
6678
6679 case END: std::cerr << "END\n"; break;
6680
6681 case DQ_STRING:
6682 case SQ_STRING:
6683 {
6684 token *tok_val = current_token ();
6685
6686 std::cerr << (tok == DQ_STRING ? "DQ_STRING" : "SQ_STRING")
6687 << " [" << tok_val->text () << "]\n";
6688 }
6689 break;
6690
6691 case FOR: std::cerr << "FOR\n"; break;
6692 case WHILE: std::cerr << "WHILE\n"; break;
6693 case DO: std::cerr << "DO\n"; break;
6694 case UNTIL: std::cerr << "UNTIL\n"; break;
6695 case IF: std::cerr << "IF\n"; break;
6696 case ELSEIF: std::cerr << "ELSEIF\n"; break;
6697 case ELSE: std::cerr << "ELSE\n"; break;
6698 case SWITCH: std::cerr << "SWITCH\n"; break;
6699 case CASE: std::cerr << "CASE\n"; break;
6700 case OTHERWISE: std::cerr << "OTHERWISE\n"; break;
6701 case BREAK: std::cerr << "BREAK\n"; break;
6702 case CONTINUE: std::cerr << "CONTINUE\n"; break;
6703 case FUNC_RET: std::cerr << "FUNC_RET\n"; break;
6704 case UNWIND: std::cerr << "UNWIND\n"; break;
6705 case CLEANUP: std::cerr << "CLEANUP\n"; break;
6706 case TRY: std::cerr << "TRY\n"; break;
6707 case CATCH: std::cerr << "CATCH\n"; break;
6708 case GLOBAL: std::cerr << "GLOBAL\n"; break;
6709 case PERSISTENT: std::cerr << "PERSISTENT\n"; break;
6710 case FCN_HANDLE: std::cerr << "FCN_HANDLE\n"; break;
6711 case END_OF_INPUT: std::cerr << "END_OF_INPUT\n\n"; break;
6712 case LEXICAL_ERROR: std::cerr << "LEXICAL_ERROR\n\n"; break;
6713 case FCN: std::cerr << "FCN\n"; break;
6714 case INPUT_FILE: std::cerr << "INPUT_FILE\n"; break;
6715 case SUPERCLASSREF: std::cerr << "SUPERCLASSREF\n"; break;
6716 case METAQUERY: std::cerr << "METAQUERY\n"; break;
6717 case GET: std::cerr << "GET\n"; break;
6718 case SET: std::cerr << "SET\n"; break;
6719 case PROPERTIES: std::cerr << "PROPERTIES\n"; break;
6720 case METHODS: std::cerr << "METHODS\n"; break;
6721 case EVENTS: std::cerr << "EVENTS\n"; break;
6722 case CLASSDEF: std::cerr << "CLASSDEF\n"; break;
6723 case '\n': std::cerr << "\\n\n"; break;
6724 case '\r': std::cerr << "\\r\n"; break;
6725 case '\t': std::cerr << "TAB\n"; break;
6726 default:
6727 {
6728 if (tok < 256 && tok > 31)
6729 std::cerr << static_cast<char> (tok) << "\n";
6730 else
6731 std::cerr << "UNKNOWN(" << tok << ")\n";
6732 }
6733 break;
6734 }
6735 }
6737 void
6738 base_lexer::fatal_error (const char *msg)
6739 {
6740 error ("fatal lexer error: %s", msg);
6741 }
6743 bool
6744 base_lexer::debug_flag (void) const
6745 {
6746 settings& stgs = m_interpreter.get_settings ();
6747 return stgs.lexer_debug_flag ();
6748 }
6750 bool
6751 base_lexer::display_tokens (void) const
6752 {
6753 settings& stgs = m_interpreter.get_settings ();
6754 return stgs.display_tokens ();
6755 }
6757 void
6758 base_lexer::increment_token_count (void)
6759 {
6760 settings& stgs = m_interpreter.get_settings ();
6761 stgs.increment_token_count ();
6762
6763 m_token_count++;
6764 }
6766 void
6767 base_lexer::lexer_debug (const char *pattern)
6768 {
6769 if (debug_flag ())
6770 {
6771 std::cerr << std::endl;
6772
6773 display_start_state ();
6774
6775 std::cerr << "P: " << pattern << std::endl;
6776 std::cerr << "T: " << flex_yytext () << std::endl;
6777 }
6778 }
6780 bool
6781 base_lexer::input_from_tmp_history_file (void)
6782 {
6783 history_system& history_sys = m_interpreter.get_history_system ();
6784
6785 return history_sys.input_from_tmp_file ();
6786 }
6788 void
6789 base_lexer::push_start_state (int state)
6790 {
6791 OCTAVE_YYG;
6792
6793 start_state_stack.push (state);
6794
6795 BEGIN (start_state ());
6796 }
6798 void
6799 base_lexer::pop_start_state (void)
6800 {
6801 OCTAVE_YYG;
6802
6803 start_state_stack.pop ();
6804
6805 BEGIN (start_state ());
6806 }
6808 void
6809 base_lexer::clear_start_state (void)
6810 {
6811 while (! start_state_stack.empty ())
6812 start_state_stack.pop ();
6813
6814 push_start_state (INITIAL);
6815 }
6817 void
6818 base_lexer::display_start_state (void) const
6819 {
6820 std::cerr << "S: ";
6821
6822 switch (start_state ())
6823 {
6824 case INITIAL:
6825 std::cerr << "INITIAL" << std::endl;
6826 break;
6827
6828 case COMMAND_START:
6829 std::cerr << "COMMAND_START" << std::endl;
6830 break;
6831
6832 case MATRIX_START:
6833 std::cerr << "MATRIX_START" << std::endl;
6834 break;
6835
6836 case INPUT_FILE_START:
6837 std::cerr << "INPUT_FILE_START" << std::endl;
6838 break;
6839
6841 std::cerr << "BLOCK_COMMENT_START" << std::endl;
6842 break;
6843
6844 case LINE_COMMENT_START:
6845 std::cerr << "LINE_COMMENT_START" << std::endl;
6846 break;
6847
6848 case DQ_STRING_START:
6849 std::cerr << "DQ_STRING_START" << std::endl;
6850 break;
6851
6852 case SQ_STRING_START:
6853 std::cerr << "SQ_STRING_START" << std::endl;
6854 break;
6855
6856 case FQ_IDENT_START:
6857 std::cerr << "FQ_IDENT_START" << std::endl;
6858 break;
6859
6860 default:
6861 std::cerr << "UNKNOWN START STATE!" << std::endl;
6862 break;
6863 }
6864 }
6866 bool
6867 base_lexer::maybe_unput_comma_before_unary_op (int tok)
6868 {
6869 int prev_tok = previous_token_value ();
6870
6871 bool unput_comma = false;
6872
6873 if (whitespace_is_significant () && space_follows_previous_token ())
6874 {
6875 int c = text_yyinput ();
6876 xunput (c);
6877
6878 bool space_after = is_space_or_tab (c);
6879
6880 if (! (prev_tok == '[' || prev_tok == '{'
6881 || previous_token_is_binop ()
6882 || ((tok == '+' || tok == '-') && space_after)))
6883 unput_comma = true;
6884 }
6885
6886 return unput_comma;
6887 }
6889 int
6890 base_lexer::handle_op (int tok, bool bos, bool compat)
6891 {
6892 if (! compat)
6893 warn_language_extension_operator (flex_yytext ());
6894
6895 update_token_positions (flex_yyleng ());
6896
6897 push_token (new token (tok, m_tok_beg, m_tok_end));
6898
6899 m_looking_for_object_index = false;
6900 m_at_beginning_of_statement = bos;
6901
6902 switch (tok)
6903 {
6904 case EXPR_LT:
6905 if (m_parsing_classdef_decl)
6906 {
6907 m_parsing_classdef_superclass = true;
6908 push_start_state (FQ_IDENT_START);
6909 }
6910 break;
6911
6912 case EXPR_AND:
6913 if (m_parsing_classdef_superclass)
6914 push_start_state (FQ_IDENT_START);
6915 break;
6916
6917 default:
6918 break;
6919 }
6920
6921 return count_token_internal (tok);
6922 }
6923
6924 // When a command argument boundary is detected, push out the current
6925 // argument being built. This one seems like a good candidate for a
6926 // function call.
6928 int
6929 base_lexer::finish_command_arg (void)
6930 {
6931 int tok = SQ_STRING;
6932
6933 token *tok_val = new token (tok, m_string_text, m_tok_beg, m_tok_end);
6934
6935 m_string_text = "";
6936 m_command_arg_paren_count = 0;
6937
6938 return handle_token (tok, tok_val);
6939 }
6941 int
6942 base_lexer::handle_token (int tok, token *tok_val)
6943 {
6944 if (! tok_val)
6945 tok_val = new token (tok, m_tok_beg, m_tok_end);
6946
6947 push_token (tok_val);
6948
6949 return count_token_internal (tok);
6950 }
6952 int
6953 base_lexer::count_token (int tok)
6954 {
6955 token *tok_val = new token (tok, m_tok_beg, m_tok_end);
6956
6957 push_token (tok_val);
6958
6959 return count_token_internal (tok);
6960 }
6962 int
6963 base_lexer::count_token_internal (int tok)
6964 {
6965 if (tok != '\n')
6966 increment_token_count ();
6967
6968 return show_token (tok);
6969 }
6971 int
6972 base_lexer::show_token (int tok)
6973 {
6974
6975 if (display_tokens ())
6976 display_token (tok);
6977
6978 if (debug_flag ())
6979 {
6980 std::cerr << "R: ";
6981 display_token (tok);
6982 std::cerr << std::endl;
6983 }
6984
6985 return tok;
6986 }
6988 int
6989 lexer::fill_flex_buffer (char *buf, unsigned max_size)
6990 {
6991 int status = 0;
6992
6993 if (m_input_buf.empty ())
6994 {
6995 input_system& input_sys = m_interpreter.get_input_system ();
6996
6997 std::string ps
6998 = m_initial_input ? input_sys.PS1 () : input_sys.PS2 ();
6999
7000 std::string prompt = command_editor::decode_prompt_string (ps);
7001
7002 bool eof = false;
7003 m_current_input_line = m_reader.get_input (prompt, eof);
7004
7005 m_input_buf.fill (m_current_input_line, eof);
7006
7007 // Attempt to capture text for functions defined on the
7008 // command line.
7009 //
7010 // FIXME: the handling of newline here seems a bit clumsy.
7011 //
7012 // See also comments in push_lexer::append_input.
7013
7014 if (m_buffer_function_text)
7015 {
7016 if (! m_current_input_line.empty ())
7017 {
7018 m_function_text += m_current_input_line;
7019 if (m_current_input_line.back () != '\n')
7020 m_function_text += '\n';
7021 }
7022 }
7023 }
7024
7025 if (! m_input_buf.empty ())
7026 status = m_input_buf.copy_chunk (buf, max_size);
7027 else
7028 status = YY_NULL;
7029
7030 m_initial_input = false;
7031
7032 return status;
7033 }
7035 void
7036 push_lexer::append_input (const std::string& input, bool eof)
7037 {
7038 // FIXME: input may contain more than one line, so how can we
7039 // properly start buffering input for command-line functions?
7040 //
7041 // Currently, base_lexer::make_keyword_token starts buffering text
7042 // for command-line functions by setting the initial value of
7043 // m_function_text to m_current_input_line when function_kw is
7044 // recognized. To make that work, we need to do something like
7045 // maintain a queue of input strings and pass them to the flex
7046 // buffer one line at a time, while also setting
7047 // m_current_input_line. Some care will be needed if a single line
7048 // of input arrives in multiple calls to append_input.
7049 //
7050 // OR, should we require that the input string to append_input
7051 // IS a single line of input? That seems to be what we are doing
7052 // here by setting m_current_input_line to input.
7053
7054 m_input_buf.fill (input, eof);
7055 m_current_input_line = input;
7056 }
7058 int
7059 push_lexer::fill_flex_buffer (char *buf, unsigned max_size)
7060 {
7061 int status = 0;
7062
7063 if (m_input_buf.empty () && ! m_input_buf.at_eof ())
7064 {
7065 // If the input buffer is empty or we are at the end of the
7066 // buffer, insert ASCII 1 as a marker for subsequent rules.
7067 // Don't insert a newline character in this case. Instead of
7068 // calling input_buffer::fill followed immediately by
7069 // input_buffer::copy_chunk, simply insert the marker directly
7070 // in BUF.
7071
7072 assert (max_size > 0);
7073
7074 buf[0] = static_cast<char> (1);
7075 status = 1;
7076 }
7077 else
7078 {
7079 // Note that the copy_chunk function may append a newline
7080 // character to the input.
7081
7082 if (! m_input_buf.empty ())
7083 status = m_input_buf.copy_chunk (buf, max_size, true);
7084 else
7085 status = YY_NULL;
7086 }
7087
7088 return status;
7089 }
7090
7091OCTAVE_NAMESPACE_END
7092
charNDArray max(char d, const charNDArray &m)
Definition: chNDArray.cc:230
Definition: Cell.h:43
octave_value input_from_tmp_file(const octave_value_list &args, int nargout)
Definition: oct-hist.cc:298
octave_value PS2(const octave_value_list &args, int nargout)
octave_value PS1(const octave_value_list &args, int nargout)
void mark_as_variable(const std::string &nm)
Definition: symscope.h:659
void mark_as_variables(const std::list< std::string > &lst)
Definition: symscope.h:665
bool token_value_is(int tv) const
Definition: token.h:107
void mark_trailing_space(void)
Definition: token.h:103
octave_value number(void) const
Definition: token.cc:103
bool space_follows_token(void) const
Definition: token.h:104
std::string text(void) const
Definition: token.cc:96
bool iskeyword(void) const
Definition: token.h:119
void mark_may_be_command(void)
Definition: token.h:100
bool may_be_command(void) const
Definition: token.h:101
int token_value(void) const
Definition: token.h:106
static const struct octave_kw * in_word_set(const char *str, size_t len)
Definition: oct-gperf.h:294
void print_raw(std::ostream &os, bool pr_as_read_syntax=false) const
Definition: ov.h:1428
bool is_undefined(void) const
Definition: ov.h:640
OCTINTERP_API octave_idx_type length(void) const
octave_value lexer_debug_flag(const octave_value_list &args, int nargout)
Definition: settings.cc:51
octave_value display_tokens(const octave_value_list &args, int nargout)
Definition: settings.cc:44
void increment_token_count(void)
Definition: settings.h:70
string_vector & sort(bool make_uniq=false)
Definition: str-vec.cc:77
void resize(octave_idx_type n, const std::string &rfv="")
Definition: str-vec.h:95
ColumnVector imag(const ComplexColumnVector &a)
Definition: dColVector.cc:143
OCTINTERP_API void print_usage(void)
Definition: defun-int.h:72
#define DEFUN(name, args_name, nargout_name, doc)
Macro to define a builtin function.
Definition: defun.h:56
void warning(const char *fmt,...)
Definition: error.cc:1055
void warning_with_id(const char *id, const char *fmt,...)
Definition: error.cc:1070
void error(const char *fmt,...)
Definition: error.cc:980
#define panic_impossible()
Definition: error.h:411
QString name
#define INPUT_FILE_START
Definition: lex.cc:1401
#define yy_load_buffer_state
Definition: lex.cc:111
#define YY_NEW_FILE
Definition: lex.cc:416
#define yyset_extra
Definition: lex.cc:189
#define CMD_OR_DEPRECATED_OP(PATTERN, REPLACEMENT, VERSION, TOK)
Definition: lex.cc:1204
#define yytext
Definition: lex.cc:397
#define yyget_lval
Definition: lex.cc:261
#define yyget_column
Definition: lex.cc:243
unsigned char flex_uint8_t
Definition: lex.cc:325
#define yyset_lineno
Definition: lex.cc:237
#define yyset_lval
Definition: lex.cc:267
void * yyscan_t
Definition: lex.cc:388
#define OCTAVE_YYG
Definition: lex.cc:5376
#define yylex_init
Definition: lex.cc:153
static bool looks_like_bin(const char *s, int len)
Definition: lex.cc:5866
static int yy_init_globals(yyscan_t yyscanner)
Definition: lex.cc:4745
OCTAVE_NAMESPACE_BEGIN bool iskeyword(const std::string &s)
Definition: lex.cc:1359
#define yyrestart
Definition: lex.cc:147
static const YY_CHAR yy_meta[61]
Definition: lex.cc:693
#define yyset_debug
Definition: lex.cc:177
#define YY_EXTRA_TYPE
Definition: lex.cc:1170
static int yy_get_next_buffer(yyscan_t yyscanner)
Definition: lex.cc:3823
#define YYSTYPE
Definition: lex.cc:1158
short int flex_int16_t
Definition: lex.cc:323
#define yy_flex_debug
Definition: lex.cc:400
#define yyget_out
Definition: lex.cc:207
static octave_value make_integer_value(uintmax_t long_int_val, bool unsigned_val, int bytes)
Definition: lex.cc:5878
unsigned int flex_uint32_t
Definition: lex.cc:327
static yy_state_type yy_try_NUL_trans(yy_state_type current_state, yyscan_t yyscanner)
Definition: lex.cc:3996
void * octave_alloc(yy_size_t, yyscan_t yyscanner)
Definition: lex.cc:4846
#define yy_scan_bytes
Definition: lex.cc:93
#define YY_BREAK
Definition: lex.cc:1634
#define yylex_init_extra
Definition: lex.cc:159
#define yynoreturn
Definition: lex.cc:374
#define yyget_debug
Definition: lex.cc:171
static void display_character(char c)
Definition: lex.cc:4864
#define yypush_buffer_state
Definition: lex.cc:123
struct yy_buffer_state * YY_BUFFER_STATE
Definition: lex.cc:438
static bool is_space_or_tab_or_eol(char c)
Definition: lex.cc:1352
#define yyfree
Definition: lex.cc:285
#define yyout
Definition: lex.cc:394
#define YY_BUFFER_NEW
Definition: lex.cc:516
#define CMD_OR_UNARY_OP(PATTERN, TOK, COMPAT)
Definition: lex.cc:1224
#define yyget_lineno
Definition: lex.cc:231
#define yylex
Definition: lex.cc:141
#define YY_RESTORE_YY_MORE_OFFSET
Definition: lex.cc:1085
static int input(yyscan_t yyscanner)
Definition: lex.cc:4067
#define yywrap
Definition: lex.cc:255
#define HANDLE_EOB_OR_EOF(STATUS)
Definition: lex.cc:1252
#define yyget_text
Definition: lex.cc:225
#define YY_BUFFER_NORMAL
Definition: lex.cc:517
static bool looks_like_shebang(const std::string &s)
Definition: lex.cc:5284
#define yyensure_buffer_stack
Definition: lex.cc:135
#define COMMAND_START
Definition: lex.cc:1399
#define yy_scan_buffer
Definition: lex.cc:81
#define YY_MORE_ADJ
Definition: lex.cc:1084
#define YY_RULE_SETUP
Definition: lex.cc:1637
void octave_free(void *, yyscan_t yyscanner)
Definition: lex.cc:4858
#define yy_scan_string
Definition: lex.cc:87
#define yyextra
Definition: lex.cc:395
#define HANDLE_NUMBER(PATTERN, BASE)
Definition: lex.cc:1278
#define YY_AT_BOL()
Definition: lex.cc:587
#define yylval
Definition: lex.cc:1460
signed char flex_int8_t
Definition: lex.cc:322
#define yyget_leng
Definition: lex.cc:219
#define EOB_ACT_END_OF_FILE
Definition: lex.cc:447
#define yyalloc
Definition: lex.cc:273
static void yyunput(int c, char *buf_ptr, yyscan_t yyscanner)
Definition: lex.cc:4023
#define yypop_buffer_state
Definition: lex.cc:129
#define YY_CURRENT_BUFFER_LVALUE
Definition: lex.cc:545
int flex_int32_t
Definition: lex.cc:324
#define yylex_destroy
Definition: lex.cc:165
static const flex_int16_t yy_def[358]
Definition: lex.cc:746
#define curr_lexer
Definition: lex.cc:1171
static const flex_int16_t yy_nxt[1288]
Definition: lex.cc:789
#define YY_NULL
Definition: lex.cc:378
#define YY_START
Definition: lex.cc:411
#define yyset_column
Definition: lex.cc:249
#define HANDLE_IDENTIFIER(pattern, get_set)
Definition: lex.cc:1307
static bool looks_like_hex(const char *s, int len)
Definition: lex.cc:5872
static uint64_t flintmax(void)
Definition: lex.cc:6015
#define yy_switch_to_buffer
Definition: lex.cc:117
static void yy_fatal_error(const char *msg, yyscan_t yyscanner)
Definition: lex.cc:4502
int yy_state_type
Definition: lex.cc:595
static bool is_space_or_tab(char c)
Definition: lex.cc:1346
#define YY_CURRENT_BUFFER
Definition: lex.cc:539
#define yy_init_buffer
Definition: lex.cc:99
#define INITIAL
Definition: lex.cc:1398
#define MATRIX_START
Definition: lex.cc:1400
#define yyget_extra
Definition: lex.cc:183
#define DQ_STRING_START
Definition: lex.cc:1404
#define yyin
Definition: lex.cc:393
#define LINE_COMMENT_START
Definition: lex.cc:1403
#define YY_READ_BUF_SIZE
Definition: lex.cc:1544
static const flex_int16_t yy_chk[1288]
Definition: lex.cc:934
#define YY_INPUT(buf, result, max_size)
Definition: lex.cc:1178
#define ECHO
Definition: lex.cc:1553
#define yy_flush_buffer
Definition: lex.cc:105
#define yyrealloc
Definition: lex.cc:279
#define YY_END_OF_BUFFER
Definition: lex.cc:614
#define YY_STATE_EOF(state)
Definition: lex.cc:414
#define BEGIN
Definition: lex.cc:406
#define YY_END_OF_BUFFER_CHAR
Definition: lex.cc:417
#define YY_FATAL_ERROR(msg)
Definition: lex.cc:1186
unsigned short int flex_uint16_t
Definition: lex.cc:326
#define yy_create_buffer
Definition: lex.cc:69
flex_uint8_t YY_CHAR
Definition: lex.cc:593
#define YY_DO_BEFORE_ACTION
Definition: lex.cc:607
static bool looks_like_copyright(const std::string &s)
Definition: lex.cc:5267
#define yy_delete_buffer
Definition: lex.cc:75
#define EOB_ACT_LAST_MATCH
Definition: lex.cc:448
#define yyget_in
Definition: lex.cc:195
size_t yy_size_t
Definition: lex.cc:443
#define YY_BUFFER_EOF_PENDING
Definition: lex.cc:528
#define yylineno
Definition: lex.cc:398
static const flex_int16_t yy_base[358]
Definition: lex.cc:703
static const YY_CHAR yy_ec[256]
Definition: lex.cc:661
#define yycolumn
Definition: lex.cc:399
#define yyset_out
Definition: lex.cc:213
#define EOB_ACT_CONTINUE_SCAN
Definition: lex.cc:446
#define HANDLE_STRING_CONTINUATION
Definition: lex.cc:1269
#define YY_DECL
Definition: lex.cc:1621
#define yyless(n)
Definition: lex.cc:4513
#define YY_BUF_SIZE
Definition: lex.cc:428
#define CMD_OR_OP(PATTERN, TOK, COMPAT)
Definition: lex.cc:1189
#define YY_EXIT_FAILURE
Definition: lex.cc:4499
void * octave_realloc(void *, yy_size_t, yyscan_t yyscanner)
Definition: lex.cc:4852
static yy_state_type yy_get_previous_state(yyscan_t yyscanner)
Definition: lex.cc:3962
#define isatty
Definition: lex.cc:1162
#define YY_SC_TO_UI(c)
Definition: lex.cc:383
#define SQ_STRING_START
Definition: lex.cc:1405
static const flex_int16_t yy_accept[314]
Definition: lex.cc:622
#define yyleng
Definition: lex.cc:396
#define BLOCK_COMMENT_START
Definition: lex.cc:1402
#define yyset_in
Definition: lex.cc:201
#define FQ_IDENT_START
Definition: lex.cc:1406
static uint32_t state[624]
Definition: randmtzig.cc:192
bool iskeyword(const std::string &s)
std::complex< double > Complex
Definition: oct-cmplx.h:33
@ endspmd_kw
Definition: oct-gperf.h:88
@ endif_kw
Definition: oct-gperf.h:84
@ global_kw
Definition: oct-gperf.h:96
@ return_kw
Definition: oct-gperf.h:105
@ classdef_kw
Definition: oct-gperf.h:70
@ endswitch_kw
Definition: oct-gperf.h:89
@ methods_kw
Definition: oct-gperf.h:100
@ try_kw
Definition: oct-gperf.h:109
@ magic_file_kw
Definition: oct-gperf.h:98
@ end_try_catch_kw
Definition: oct-gperf.h:76
@ endenumeration_kw
Definition: oct-gperf.h:80
@ function_kw
Definition: oct-gperf.h:94
@ endfunction_kw
Definition: oct-gperf.h:83
@ endevents_kw
Definition: oct-gperf.h:81
@ else_kw
Definition: oct-gperf.h:73
@ do_kw
Definition: oct-gperf.h:72
@ while_kw
Definition: oct-gperf.h:113
@ arguments_kw
Definition: oct-gperf.h:66
@ unwind_protect_kw
Definition: oct-gperf.h:111
@ case_kw
Definition: oct-gperf.h:68
@ continue_kw
Definition: oct-gperf.h:71
@ properties_kw
Definition: oct-gperf.h:104
@ set_kw
Definition: oct-gperf.h:106
@ endparfor_kw
Definition: oct-gperf.h:86
@ endmethods_kw
Definition: oct-gperf.h:85
@ magic_line_kw
Definition: oct-gperf.h:99
@ spmd_kw
Definition: oct-gperf.h:107
@ persistent_kw
Definition: oct-gperf.h:103
@ otherwise_kw
Definition: oct-gperf.h:101
@ end_unwind_protect_kw
Definition: oct-gperf.h:77
@ until_kw
Definition: oct-gperf.h:110
@ endarguments_kw
Definition: oct-gperf.h:78
@ endwhile_kw
Definition: oct-gperf.h:90
@ get_kw
Definition: oct-gperf.h:95
@ elseif_kw
Definition: oct-gperf.h:74
@ catch_kw
Definition: oct-gperf.h:69
@ endproperties_kw
Definition: oct-gperf.h:87
@ end_kw
Definition: oct-gperf.h:75
@ endfor_kw
Definition: oct-gperf.h:82
@ endclassdef_kw
Definition: oct-gperf.h:79
@ unwind_protect_cleanup_kw
Definition: oct-gperf.h:112
@ if_kw
Definition: oct-gperf.h:97
@ events_kw
Definition: oct-gperf.h:92
@ switch_kw
Definition: oct-gperf.h:108
@ break_kw
Definition: oct-gperf.h:67
@ parfor_kw
Definition: oct-gperf.h:102
@ for_kw
Definition: oct-gperf.h:93
@ enumeration_kw
Definition: oct-gperf.h:91
#define TOTAL_KEYWORDS
Definition: oct-gperf.h:119
static const struct octave_kw wordlist[]
Definition: oct-gperf.h:183
#define OCTAVE_LOCAL_BUFFER(T, buf, size)
Definition: oct-locbuf.h:44
#define scanner
Definition: oct-parse.cc:147
@ LEFTDIV
Definition: oct-parse.h:88
@ EDIV
Definition: oct-parse.h:90
@ PROPERTIES
Definition: oct-parse.h:127
@ FCN_HANDLE
Definition: oct-parse.h:125
@ FUNC_RET
Definition: oct-parse.h:118
@ PLUS_PLUS
Definition: oct-parse.h:94
@ END_OF_INPUT
Definition: oct-parse.h:139
@ DIV_EQ
Definition: oct-parse.h:68
@ GET
Definition: oct-parse.h:134
@ NUMBER
Definition: oct-parse.h:98
@ SUPERCLASSREF
Definition: oct-parse.h:132
@ ELEFTDIV
Definition: oct-parse.h:91
@ EXPR_LT
Definition: oct-parse.h:82
@ DQ_STRING
Definition: oct-parse.h:102
@ IF
Definition: oct-parse.h:110
@ MINUS_MINUS
Definition: oct-parse.h:95
@ POW
Definition: oct-parse.h:96
@ WHILE
Definition: oct-parse.h:106
@ TRANSPOSE
Definition: oct-parse.h:93
@ OR_EQ
Definition: oct-parse.h:76
@ EXPR_AND_AND
Definition: oct-parse.h:77
@ EXPR_NE
Definition: oct-parse.h:85
@ EXPR_OR_OR
Definition: oct-parse.h:78
@ CONTINUE
Definition: oct-parse.h:117
@ EPOW_EQ
Definition: oct-parse.h:74
@ EVENTS
Definition: oct-parse.h:129
@ SWITCH
Definition: oct-parse.h:113
@ TRY
Definition: oct-parse.h:121
@ EPOW
Definition: oct-parse.h:97
@ SQ_STRING
Definition: oct-parse.h:103
@ MUL_EQ
Definition: oct-parse.h:67
@ AND_EQ
Definition: oct-parse.h:75
@ NAME
Definition: oct-parse.h:100
@ EMUL_EQ
Definition: oct-parse.h:71
@ INPUT_FILE
Definition: oct-parse.h:140
@ ELSEIF
Definition: oct-parse.h:111
@ POW_EQ
Definition: oct-parse.h:70
@ CATCH
Definition: oct-parse.h:122
@ ADD_EQ
Definition: oct-parse.h:65
@ ELSE
Definition: oct-parse.h:112
@ BREAK
Definition: oct-parse.h:116
@ SUB_EQ
Definition: oct-parse.h:66
@ CASE
Definition: oct-parse.h:114
@ PERSISTENT
Definition: oct-parse.h:124
@ UNTIL
Definition: oct-parse.h:108
@ FOR
Definition: oct-parse.h:104
@ EXPR_NOT
Definition: oct-parse.h:81
@ EXPR_LE
Definition: oct-parse.h:83
@ SET
Definition: oct-parse.h:135
@ DO
Definition: oct-parse.h:107
@ STRUCT_ELT
Definition: oct-parse.h:99
@ EXPR_GE
Definition: oct-parse.h:86
@ LEXICAL_ERROR
Definition: oct-parse.h:138
@ METHODS
Definition: oct-parse.h:128
@ FCN
Definition: oct-parse.h:136
@ OTHERWISE
Definition: oct-parse.h:115
@ EXPR_OR
Definition: oct-parse.h:80
@ CLEANUP
Definition: oct-parse.h:120
@ FQ_IDENT
Definition: oct-parse.h:133
@ METAQUERY
Definition: oct-parse.h:131
@ EMUL
Definition: oct-parse.h:89
@ LEFTDIV_EQ
Definition: oct-parse.h:69
@ CLASSDEF
Definition: oct-parse.h:126
@ HERMITIAN
Definition: oct-parse.h:92
@ EDIV_EQ
Definition: oct-parse.h:72
@ ELEFTDIV_EQ
Definition: oct-parse.h:73
@ EXPR_GT
Definition: oct-parse.h:87
@ UNWIND
Definition: oct-parse.h:119
@ EXPR_EQ
Definition: oct-parse.h:84
@ GLOBAL
Definition: oct-parse.h:123
@ EXPR_AND
Definition: oct-parse.h:79
T::size_type strlen(const typename T::value_type *str)
Definition: oct-string.cc:85
unsigned char flex_uint8_t
void * yyscan_t
short int flex_int16_t
int yy_state_type
flex_uint8_t YY_CHAR
size_t yy_size_t
void * malloc(unsigned)
#define m_scanner
void free(void *)
@ END
return octave_value(v1.char_array_value() . concat(v2.char_array_value(), ra_idx),((a1.is_sq_string()||a2.is_sq_string()) ? '\'' :'"'))
static int num_digits(T x)
Definition: pr-output.cc:164
octave_kw_id kw_id
Definition: oct-gperf.h:117
const char * name
Definition: oct-gperf.h:117
int yy_bs_column
The column count.
int yy_bs_lineno
The line count.
flex_int32_t yy_verify
flex_int32_t yy_nxt
FILE * yyin_r
Definition: lex.cc:1428
int yy_did_buffer_switch_on_eof
Definition: lex.cc:1438
int yy_start_stack_depth
Definition: lex.cc:1440
FILE * yyout_r
Definition: lex.cc:1428
size_t yy_buffer_stack_max
capacity of stack.
Definition: lex.cc:1430
char * yy_last_accepting_cpos
Definition: lex.cc:1443
int yy_flex_debug_r
Definition: lex.cc:1446
int yy_more_flag
Definition: lex.cc:1449
int yy_more_len
Definition: lex.cc:1450
yy_state_type yy_last_accepting_state
Definition: lex.cc:1442
int yy_start
Definition: lex.cc:1437
int yy_n_chars
Definition: lex.cc:1433
int yylineno_r
Definition: lex.cc:1445
char * yy_c_buf_p
Definition: lex.cc:1435
int yyleng_r
Definition: lex.cc:1434
int yy_init
Definition: lex.cc:1436
YY_BUFFER_STATE * yy_buffer_stack
Stack as an array.
Definition: lex.cc:1431
octave::base_lexer * yyextra_r
Definition: lex.cc:1425
int yy_start_stack_ptr
Definition: lex.cc:1439
char yy_hold_char
Definition: lex.cc:1432
char * yytext_r
Definition: lex.cc:1448
OCTAVE_STYPE * yylval_r
Definition: lex.cc:1452
int * yy_start_stack
Definition: lex.cc:1441
size_t yy_buffer_stack_top
index of top of stack.
Definition: lex.cc:1429
const char * undo_string_escape(char c)
Definition: utils.cc:982
F77_RET_T len
Definition: xerbla.cc:61