~ubuntu-branches/debian/sid/octave3.0/sid

« back to all changes in this revision

Viewing changes to src/lex.cc

  • Committer: Bazaar Package Importer
  • Author(s): Rafael Laboissiere
  • Date: 2007-12-23 16:04:15 UTC
  • Revision ID: james.westby@ubuntu.com-20071223160415-n4gk468dihy22e9v
Tags: upstream-3.0.0
ImportĀ upstreamĀ versionĀ 3.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
#line 3 "<stdout>"
 
3
 
 
4
#define  YY_INT_ALIGNED short int
 
5
 
 
6
/* A lexical scanner generated by flex */
 
7
 
 
8
#define FLEX_SCANNER
 
9
#define YY_FLEX_MAJOR_VERSION 2
 
10
#define YY_FLEX_MINOR_VERSION 5
 
11
#define YY_FLEX_SUBMINOR_VERSION 33
 
12
#if YY_FLEX_SUBMINOR_VERSION > 0
 
13
#define FLEX_BETA
 
14
#endif
 
15
 
 
16
/* First, we deal with  platform-specific or compiler-specific issues. */
 
17
 
 
18
/* begin standard C headers. */
 
19
#include <stdio.h>
 
20
#include <string.h>
 
21
#include <errno.h>
 
22
#include <stdlib.h>
 
23
 
 
24
/* end standard C headers. */
 
25
 
 
26
/* flex integer type definitions */
 
27
 
 
28
#ifndef FLEXINT_H
 
29
#define FLEXINT_H
 
30
 
 
31
/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
 
32
 
 
33
#if __STDC_VERSION__ >= 199901L
 
34
 
 
35
/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
 
36
 * if you want the limit (max/min) macros for int types. 
 
37
 */
 
38
#ifndef __STDC_LIMIT_MACROS
 
39
#define __STDC_LIMIT_MACROS 1
 
40
#endif
 
41
 
 
42
#include <inttypes.h>
 
43
typedef int8_t flex_int8_t;
 
44
typedef uint8_t flex_uint8_t;
 
45
typedef int16_t flex_int16_t;
 
46
typedef uint16_t flex_uint16_t;
 
47
typedef int32_t flex_int32_t;
 
48
typedef uint32_t flex_uint32_t;
 
49
#else
 
50
typedef signed char flex_int8_t;
 
51
typedef short int flex_int16_t;
 
52
typedef int flex_int32_t;
 
53
typedef unsigned char flex_uint8_t; 
 
54
typedef unsigned short int flex_uint16_t;
 
55
typedef unsigned int flex_uint32_t;
 
56
#endif /* ! C99 */
 
57
 
 
58
/* Limits of integral types. */
 
59
#ifndef INT8_MIN
 
60
#define INT8_MIN               (-128)
 
61
#endif
 
62
#ifndef INT16_MIN
 
63
#define INT16_MIN              (-32767-1)
 
64
#endif
 
65
#ifndef INT32_MIN
 
66
#define INT32_MIN              (-2147483647-1)
 
67
#endif
 
68
#ifndef INT8_MAX
 
69
#define INT8_MAX               (127)
 
70
#endif
 
71
#ifndef INT16_MAX
 
72
#define INT16_MAX              (32767)
 
73
#endif
 
74
#ifndef INT32_MAX
 
75
#define INT32_MAX              (2147483647)
 
76
#endif
 
77
#ifndef UINT8_MAX
 
78
#define UINT8_MAX              (255U)
 
79
#endif
 
80
#ifndef UINT16_MAX
 
81
#define UINT16_MAX             (65535U)
 
82
#endif
 
83
#ifndef UINT32_MAX
 
84
#define UINT32_MAX             (4294967295U)
 
85
#endif
 
86
 
 
87
#endif /* ! FLEXINT_H */
 
88
 
 
89
#ifdef __cplusplus
 
90
 
 
91
/* The "const" storage-class-modifier is valid. */
 
92
#define YY_USE_CONST
 
93
 
 
94
#else   /* ! __cplusplus */
 
95
 
 
96
#if __STDC__
 
97
 
 
98
#define YY_USE_CONST
 
99
 
 
100
#endif  /* __STDC__ */
 
101
#endif  /* ! __cplusplus */
 
102
 
 
103
#ifdef YY_USE_CONST
 
104
#define yyconst const
 
105
#else
 
106
#define yyconst
 
107
#endif
 
108
 
 
109
/* Returned upon end-of-file. */
 
110
#define YY_NULL 0
 
111
 
 
112
/* Promotes a possibly negative, possibly signed char to an unsigned
 
113
 * integer for use as an array index.  If the signed char is negative,
 
114
 * we want to instead treat it as an 8-bit unsigned char, hence the
 
115
 * double cast.
 
116
 */
 
117
#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
 
118
 
 
119
/* Enter a start condition.  This macro really ought to take a parameter,
 
120
 * but we do it the disgusting crufty way forced on us by the ()-less
 
121
 * definition of BEGIN.
 
122
 */
 
123
#define BEGIN (yy_start) = 1 + 2 *
 
124
 
 
125
/* Translate the current start state into a value that can be later handed
 
126
 * to BEGIN to return to the state.  The YYSTATE alias is for lex
 
127
 * compatibility.
 
128
 */
 
129
#define YY_START (((yy_start) - 1) / 2)
 
130
#define YYSTATE YY_START
 
131
 
 
132
/* Action number for EOF rule of a given start state. */
 
133
#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
 
134
 
 
135
/* Special action meaning "start processing a new file". */
 
136
#define YY_NEW_FILE octave_restart(octave_in  )
 
137
 
 
138
#define YY_END_OF_BUFFER_CHAR 0
 
139
 
 
140
/* Size of default input buffer. */
 
141
#ifndef YY_BUF_SIZE
 
142
#define YY_BUF_SIZE 16384
 
143
#endif
 
144
 
 
145
/* The state buf must be large enough to hold one state per character in the main buffer.
 
146
 */
 
147
#define YY_STATE_BUF_SIZE   ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
 
148
 
 
149
#ifndef YY_TYPEDEF_YY_BUFFER_STATE
 
150
#define YY_TYPEDEF_YY_BUFFER_STATE
 
151
typedef struct yy_buffer_state *YY_BUFFER_STATE;
 
152
#endif
 
153
 
 
154
extern int octave_leng;
 
155
 
 
156
extern FILE *octave_in, *octave_out;
 
157
 
 
158
#define EOB_ACT_CONTINUE_SCAN 0
 
159
#define EOB_ACT_END_OF_FILE 1
 
160
#define EOB_ACT_LAST_MATCH 2
 
161
 
 
162
    #define YY_LESS_LINENO(n)
 
163
    
 
164
/* Return all but the first "n" matched characters back to the input stream. */
 
165
#define yyless(n) \
 
166
        do \
 
167
                { \
 
168
                /* Undo effects of setting up octave_text. */ \
 
169
        int yyless_macro_arg = (n); \
 
170
        YY_LESS_LINENO(yyless_macro_arg);\
 
171
                *yy_cp = (yy_hold_char); \
 
172
                YY_RESTORE_YY_MORE_OFFSET \
 
173
                (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
 
174
                YY_DO_BEFORE_ACTION; /* set up octave_text again */ \
 
175
                } \
 
176
        while ( 0 )
 
177
 
 
178
#define unput(c) yyunput( c, (yytext_ptr)  )
 
179
 
 
180
/* The following is because we cannot portably get our hands on size_t
 
181
 * (without autoconf's help, which isn't available because we want
 
182
 * flex-generated scanners to compile on their own).
 
183
 */
 
184
 
 
185
#ifndef YY_TYPEDEF_YY_SIZE_T
 
186
#define YY_TYPEDEF_YY_SIZE_T
 
187
typedef unsigned int yy_size_t;
 
188
#endif
 
189
 
 
190
#ifndef YY_STRUCT_YY_BUFFER_STATE
 
191
#define YY_STRUCT_YY_BUFFER_STATE
 
192
struct yy_buffer_state
 
193
        {
 
194
        FILE *yy_input_file;
 
195
 
 
196
        char *yy_ch_buf;                /* input buffer */
 
197
        char *yy_buf_pos;               /* current position in input buffer */
 
198
 
 
199
        /* Size of input buffer in bytes, not including room for EOB
 
200
         * characters.
 
201
         */
 
202
        yy_size_t yy_buf_size;
 
203
 
 
204
        /* Number of characters read into yy_ch_buf, not including EOB
 
205
         * characters.
 
206
         */
 
207
        int yy_n_chars;
 
208
 
 
209
        /* Whether we "own" the buffer - i.e., we know we created it,
 
210
         * and can realloc() it to grow it, and should free() it to
 
211
         * delete it.
 
212
         */
 
213
        int yy_is_our_buffer;
 
214
 
 
215
        /* Whether this is an "interactive" input source; if so, and
 
216
         * if we're using stdio for input, then we want to use getc()
 
217
         * instead of fread(), to make sure we stop fetching input after
 
218
         * each newline.
 
219
         */
 
220
        int yy_is_interactive;
 
221
 
 
222
        /* Whether we're considered to be at the beginning of a line.
 
223
         * If so, '^' rules will be active on the next match, otherwise
 
224
         * not.
 
225
         */
 
226
        int yy_at_bol;
 
227
 
 
228
    int yy_bs_lineno; /**< The line count. */
 
229
    int yy_bs_column; /**< The column count. */
 
230
    
 
231
        /* Whether to try to fill the input buffer when we reach the
 
232
         * end of it.
 
233
         */
 
234
        int yy_fill_buffer;
 
235
 
 
236
        int yy_buffer_status;
 
237
 
 
238
#define YY_BUFFER_NEW 0
 
239
#define YY_BUFFER_NORMAL 1
 
240
        /* When an EOF's been seen but there's still some text to process
 
241
         * then we mark the buffer as YY_EOF_PENDING, to indicate that we
 
242
         * shouldn't try reading from the input source any more.  We might
 
243
         * still have a bunch of tokens to match, though, because of
 
244
         * possible backing-up.
 
245
         *
 
246
         * When we actually see the EOF, we change the status to "new"
 
247
         * (via octave_restart()), so that the user can continue scanning by
 
248
         * just pointing octave_in at a new input file.
 
249
         */
 
250
#define YY_BUFFER_EOF_PENDING 2
 
251
 
 
252
        };
 
253
#endif /* !YY_STRUCT_YY_BUFFER_STATE */
 
254
 
 
255
/* Stack of input buffers. */
 
256
static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */
 
257
static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */
 
258
static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */
 
259
 
 
260
/* We provide macros for accessing buffer states in case in the
 
261
 * future we want to put the buffer states in a more general
 
262
 * "scanner state".
 
263
 *
 
264
 * Returns the top of the stack, or NULL.
 
265
 */
 
266
#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
 
267
                          ? (yy_buffer_stack)[(yy_buffer_stack_top)] \
 
268
                          : NULL)
 
269
 
 
270
/* Same as previous macro, but useful when we know that the buffer stack is not
 
271
 * NULL or when we need an lvalue. For internal use only.
 
272
 */
 
273
#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
 
274
 
 
275
/* yy_hold_char holds the character lost when octave_text is formed. */
 
276
static char yy_hold_char;
 
277
static int yy_n_chars;          /* number of characters read into yy_ch_buf */
 
278
int octave_leng;
 
279
 
 
280
/* Points to current character in buffer. */
 
281
static char *yy_c_buf_p = (char *) 0;
 
282
static int yy_init = 0;         /* whether we need to initialize */
 
283
static int yy_start = 0;        /* start state number */
 
284
 
 
285
/* Flag which is used to allow octave_wrap()'s to do buffer switches
 
286
 * instead of setting up a fresh octave_in.  A bit of a hack ...
 
287
 */
 
288
static int yy_did_buffer_switch_on_eof;
 
289
 
 
290
void octave_restart (FILE *input_file  );
 
291
void octave__switch_to_buffer (YY_BUFFER_STATE new_buffer  );
 
292
YY_BUFFER_STATE octave__create_buffer (FILE *file,int size  );
 
293
void octave__delete_buffer (YY_BUFFER_STATE b  );
 
294
void octave__flush_buffer (YY_BUFFER_STATE b  );
 
295
void octave_push_buffer_state (YY_BUFFER_STATE new_buffer  );
 
296
void octave_pop_buffer_state (void );
 
297
 
 
298
static void octave_ensure_buffer_stack (void );
 
299
static void octave__load_buffer_state (void );
 
300
static void octave__init_buffer (YY_BUFFER_STATE b,FILE *file  );
 
301
 
 
302
#define YY_FLUSH_BUFFER octave__flush_buffer(YY_CURRENT_BUFFER )
 
303
 
 
304
YY_BUFFER_STATE octave__scan_buffer (char *base,yy_size_t size  );
 
305
YY_BUFFER_STATE octave__scan_string (yyconst char *yy_str  );
 
306
YY_BUFFER_STATE octave__scan_bytes (yyconst char *bytes,int len  );
 
307
 
 
308
void *octave_alloc (yy_size_t  );
 
309
void *octave_realloc (void *,yy_size_t  );
 
310
void octave_free (void *  );
 
311
 
 
312
#define yy_new_buffer octave__create_buffer
 
313
 
 
314
#define yy_set_interactive(is_interactive) \
 
315
        { \
 
316
        if ( ! YY_CURRENT_BUFFER ){ \
 
317
        octave_ensure_buffer_stack (); \
 
318
                YY_CURRENT_BUFFER_LVALUE =    \
 
319
            octave__create_buffer(octave_in,YY_BUF_SIZE ); \
 
320
        } \
 
321
        YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
 
322
        }
 
323
 
 
324
#define yy_set_bol(at_bol) \
 
325
        { \
 
326
        if ( ! YY_CURRENT_BUFFER ){\
 
327
        octave_ensure_buffer_stack (); \
 
328
                YY_CURRENT_BUFFER_LVALUE =    \
 
329
            octave__create_buffer(octave_in,YY_BUF_SIZE ); \
 
330
        } \
 
331
        YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
 
332
        }
 
333
 
 
334
#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
 
335
 
 
336
/* Begin user sect3 */
 
337
 
 
338
typedef unsigned char YY_CHAR;
 
339
 
 
340
FILE *octave_in = (FILE *) 0, *octave_out = (FILE *) 0;
 
341
 
 
342
typedef int yy_state_type;
 
343
 
 
344
extern int octave_lineno;
 
345
 
 
346
int octave_lineno = 1;
 
347
 
 
348
extern char *octave_text;
 
349
#define yytext_ptr octave_text
 
350
 
 
351
static yy_state_type yy_get_previous_state (void );
 
352
static yy_state_type yy_try_NUL_trans (yy_state_type current_state  );
 
353
static int yy_get_next_buffer (void );
 
354
static void yy_fatal_error (yyconst char msg[]  );
 
355
 
 
356
/* Done after the current pattern has been matched and before the
 
357
 * corresponding action - sets up octave_text.
 
358
 */
 
359
#define YY_DO_BEFORE_ACTION \
 
360
        (yytext_ptr) = yy_bp; \
 
361
        octave_leng = (size_t) (yy_cp - yy_bp); \
 
362
        (yy_hold_char) = *yy_cp; \
 
363
        *yy_cp = '\0'; \
 
364
        (yy_c_buf_p) = yy_cp;
 
365
 
 
366
#define YY_NUM_RULES 85
 
367
#define YY_END_OF_BUFFER 86
 
368
/* This struct is not used in this scanner,
 
369
   but its presence is necessary. */
 
370
struct yy_trans_info
 
371
        {
 
372
        flex_int32_t yy_verify;
 
373
        flex_int32_t yy_nxt;
 
374
        };
 
375
static yyconst flex_int16_t yy_accept[433] =
 
376
    {   0,
 
377
       19,   19,   19,   19,   19,   19,    0,    0,    0,    0,
 
378
       86,   84,   19,   24,   24,   62,   26,   27,   22,   44,
 
379
       25,   63,   64,   50,   48,   54,   49,   65,   51,   18,
 
380
       18,   28,   53,   46,   57,   47,   23,   14,   52,   15,
 
381
       55,   82,   45,   83,   62,    6,    3,    3,    6,    5,
 
382
        6,    6,    5,    6,    6,    6,    6,    4,    6,    6,
 
383
        6,    6,    6,    6,    4,    6,    6,    6,    6,    6,
 
384
        6,    6,    6,    6,    6,    6,    6,   10,   13,   13,
 
385
       27,    9,   11,    7,    8,    1,   85,    2,   19,   24,
 
386
       42,   22,   22,   58,   78,   56,   68,   37,   66,   38,
 
387
 
 
388
       67,   36,   31,   29,   30,    0,   32,   18,   33,   34,
 
389
       69,   18,   18,    0,   16,    0,   60,   39,   40,   43,
 
390
       61,   14,    0,   20,   20,    0,   70,   76,   82,   79,
 
391
       59,   41,    6,    6,    3,    6,    6,    6,    6,    6,
 
392
        6,    6,    6,    6,    6,    6,    6,    6,    6,    6,
 
393
        6,    6,    6,    6,    6,    6,    6,    6,    6,    6,
 
394
        6,    6,    6,    6,    6,    6,    6,    6,    6,    6,
 
395
        6,    6,    6,    6,    6,   10,   13,   13,    0,    9,
 
396
       11,    7,    8,   13,   13,    0,   13,    0,   12,   12,
 
397
        9,   11,   11,    0,    7,    8,   35,   73,   71,   72,
 
398
 
 
399
        0,   74,    0,   75,   77,   17,   18,    0,   18,   18,
 
400
       80,   81,    0,   21,   21,    6,    6,    6,    6,    6,
 
401
        6,    6,    6,    6,    6,    6,    6,    6,    6,    6,
 
402
        6,    6,    6,   13,   13,    0,   13,   13,   12,   12,
 
403
        0,   12,   12,   12,    0,   11,    7,    8,   11,    0,
 
404
       11,   11,    0,   18,   21,    6,    6,   13,   13,   13,
 
405
        0,   11,    7,    8,   12,    0,   12,   12,   12,   12,
 
406
        0,   12,   12,   11,   11,   11,    0,    7,    8,   11,
 
407
       11,   11,    0,   13,   13,   11,   11,   11,    0,    7,
 
408
        8,   12,   12,   12,    0,   11,    7,    8,   12,   12,
 
409
 
 
410
       12,    0,   11,    7,    8,   11,   11,    0,   11,   11,
 
411
       11,    0,    0,   11,   11,   11,   11,   11,   11,    0,
 
412
       11,   11,   11,    0,    0,   11,   11,   12,   12,   11,
 
413
       11,   11,    0,    7,    8,   12,   12,   11,   11,   11,
 
414
        0,    7,    8,   11,    0,   11,   11,   11,   11,    0,
 
415
       11,   11,   11,   11,   11,    0,   11,    7,    8,   11,
 
416
       11,   11,   11,   11,   11,    0,   11,    7,    8,   11,
 
417
       11,   11,    0,   11,   11,   11,    0,   11,   11,   11,
 
418
        0,   11,    7,    8,   11,   11,   11,    0,   11,    7,
 
419
        8,   11,   11,   11,   11,   11,    0,    7,    8,   11,
 
420
 
 
421
       11,   11,   11,   11,    0,    7,    8,   11,   11,   11,
 
422
       11,   11,   11,   11,   11,   11,    0,    7,    8,   11,
 
423
       11,   11,   11,   11,    0,    7,    8,   11,   11,   11,
 
424
       11,    0
 
425
    } ;
 
426
 
 
427
static yyconst flex_int32_t yy_ec[256] =
 
428
    {   0,
 
429
        1,    1,    1,    1,    1,    1,    1,    1,    2,    3,
 
430
        1,    1,    4,    1,    1,    1,    1,    1,    1,    1,
 
431
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
 
432
        1,    2,    5,    6,    7,    8,    7,    9,   10,   11,
 
433
       12,   13,   14,   15,   16,   17,   18,   19,   20,   20,
 
434
       20,   20,   20,   20,   20,   20,   20,   21,   22,   23,
 
435
       24,   25,    1,   26,   27,   27,   27,   28,   28,   27,
 
436
        8,    8,   29,   29,    8,    8,    8,    8,    8,    8,
 
437
        8,    8,    8,    8,    8,    8,    8,   30,    8,    8,
 
438
       31,   32,   33,   34,    8,    1,   27,   27,   27,   28,
 
439
 
 
440
       28,   27,    8,    8,   29,   29,    8,    8,    8,    8,
 
441
        8,    8,    8,    8,    8,    8,    8,    8,    8,   30,
 
442
        8,    8,   35,   36,   37,   38,    1,    1,    1,    1,
 
443
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
 
444
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
 
445
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
 
446
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
 
447
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
 
448
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
 
449
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
 
450
 
 
451
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
 
452
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
 
453
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
 
454
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
 
455
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
 
456
        1,    1,    1,    1,    1
 
457
    } ;
 
458
 
 
459
static yyconst flex_int32_t yy_meta[39] =
 
460
    {   0,
 
461
        1,    2,    3,    3,    1,    1,    1,    2,    1,    1,
 
462
        1,    1,    1,    1,    3,    1,    1,    1,    2,    2,
 
463
        1,    3,    1,    1,    1,    1,    2,    2,    2,    2,
 
464
        1,    1,    1,    1,    1,    1,    1,    1
 
465
    } ;
 
466
 
 
467
static yyconst flex_int16_t yy_base[448] =
 
468
    {   0,
 
469
        0,    0,   38,    0,   75,    0,  816,  815,  814,  813,
 
470
      815, 1982,  812, 1982,  810,  788, 1982, 1982,  809,   71,
 
471
     1982, 1982, 1982,   68,   69, 1982,   70,  103,  786,  121,
 
472
       81, 1982, 1982,   61,  784,   63, 1982,  805,  100, 1982,
 
473
      782,  803,   75, 1982,  780,  801, 1982,  799,   94, 1982,
 
474
      150,  123, 1982,  799,  798,  129,  112, 1982,  132,  179,
 
475
      103,  212,  769,  796, 1982,  131,  104,  137,  795,  794,
 
476
      161,  793,  142,  791,  158,  790,  143,  241,  277,  780,
 
477
      126,  776,  169,  775,  770, 1982, 1982, 1982,  769, 1982,
 
478
     1982,  761,  760, 1982, 1982,  733, 1982, 1982, 1982, 1982,
 
479
 
 
480
     1982, 1982,  133,  732,  723,  725,  717,  155,  712,  711,
 
481
     1982,  305,  187,  189, 1982,  198,  703, 1982, 1982, 1982,
 
482
      702,  719,  184, 1982,  717,  197, 1982, 1982,  709, 1982,
 
483
     1982, 1982,  704,  703, 1982,  698,  697,    0,  673,  637,
 
484
      188,  601,  565,  529,  497,  495,  470,  222,  225,  226,
 
485
      217,  228,  257,  231,  234,  451,  330,  401,  251,  423,
 
486
      270,  236,  417,  410,  407,  237,  402,  289,  298,  397,
 
487
      393,  379,  361,  359,  355,    0,    0,  341,  217,  340,
 
488
      301,  336,  327,    0,  316,  219,    0,  265,  363,  399,
 
489
      315,  324,  349,  279,  307,  273,  242, 1982, 1982, 1982,
 
490
 
 
491
      369, 1982,  316, 1982, 1982, 1982,  326,  268,  287,  355,
 
492
     1982, 1982,  291, 1982,  308,  249,  262,  260,  255,  384,
 
493
      252,  378,  245,  235,  208,  388,  339,  391,  435,  200,
 
494
      157,  411,  375,    0,    0,  318,    0,  463,    0,  140,
 
495
      365,  499,    0,  535,  386,  420,  426,  436,  439,  413,
 
496
      445,  454,  415,  431, 1982,  457,  469,  571,    0,  607,
 
497
      441,  471,  477,  480,    0,  465,    0,  643,    0,    0,
 
498
      483,    0,  679,  488,  715,  751,  490,  505,  508,  511,
 
499
      520,  526,  501,    0,    0,  541,  787,  823,  513,  547,
 
500
      550,  859,    0,  895,  516,  556,  562,  567,  931,    0,
 
501
 
 
502
      967,  522,  577,  583,  586,    0,  112,  531, 1003,    0,
 
503
     1039,  537,  543,    0, 1075,  592,  598,    0,   88,  552,
 
504
     1111,    0, 1147,  558,  573,    0, 1183,    0,    0,  613,
 
505
        0, 1219,  579,  619,  622,    0,    0,  628,    0, 1255,
 
506
      588,  634,  639,    0,  594,    0, 1291,    0,    0,  603,
 
507
        0, 1327, 1363,    0, 1399,  609,  649,  655,  658,    0,
 
508
        0,    0, 1435,    0, 1471,  615,  664,  670,  675, 1507,
 
509
        0, 1543,  624, 1579,    0, 1615,  630, 1651,    0, 1687,
 
510
      645,  685,  691,  694, 1723,    0, 1759,  651,  700,  706,
 
511
      711,    0,    0,  721,    0, 1795,  660,  727,  730,    0,
 
512
 
 
513
        0,  736,    0, 1831,  666,  742,  747,    0,    0,    0,
 
514
        0,    0,    0,  757,    0, 1867,  681,  763,  766,    0,
 
515
        0,  772,    0, 1903,  687,  778,  783,    0,    0,    0,
 
516
        0, 1982, 1940, 1943,   87, 1946, 1948, 1951, 1954, 1957,
 
517
     1960, 1963, 1966, 1969, 1972, 1975, 1978
 
518
    } ;
 
519
 
 
520
static yyconst flex_int16_t yy_def[448] =
 
521
    {   0,
 
522
      432,    1,  432,    3,    1,    5,  433,  433,  434,  434,
 
523
      432,  432,  432,  432,  432,  432,  432,  432,  435,  432,
 
524
      432,  432,  432,  432,  432,  432,  432,  432,  432,  432,
 
525
      432,  432,  432,  432,  432,  432,  432,  432,  432,  432,
 
526
      432,  432,  432,  432,  432,  436,  432,  432,  436,  432,
 
527
      436,  436,  432,  436,  436,  436,  436,  432,  436,  436,
 
528
      436,  436,   62,  436,  432,  436,  436,  436,  436,  436,
 
529
      436,  436,  436,  436,  436,  436,  436,  432,  432,   79,
 
530
      437,  432,  432,  432,  432,  432,  432,  432,  432,  432,
 
531
      432,  432,  435,  432,  432,  432,  432,  432,  432,  432,
 
532
 
 
533
      432,  432,  432,  432,  432,  432,  432,  432,  432,  432,
 
534
      432,  432,  432,  432,  432,  432,  432,  432,  432,  432,
 
535
      432,  432,  432,  432,  432,  438,  432,  432,  432,  432,
 
536
      432,  432,  436,  432,  432,  436,  432,   51,  436,  436,
 
537
      436,  436,  436,  436,  436,  436,  436,  436,  436,  436,
 
538
      436,  436,  436,  436,  436,  436,   62,   62,  436,  436,
 
539
      436,  436,  436,  436,  436,  436,  432,  432,  439,  436,
 
540
      436,  432,  436,  436,  436,   78,   79,   79,  437,  432,
 
541
      432,  432,  432,   79,   79,  440,   79,  437,  432,  437,
 
542
      432,  432,  432,  441,  432,  432,  432,  432,  432,  432,
 
543
 
 
544
      432,  432,  432,  432,  432,  432,  432,  432,  432,  432,
 
545
      432,  432,  438,  432,  438,  436,  436,  436,  436,  436,
 
546
      436,  436,  436,  436,  436,   62,  436,  436,  436,  436,
 
547
      436,  439,  438,   79,   79,  440,   79,  440,  189,  189,
 
548
      442,  437,  189,  437,  443,  437,  437,  437,  432,  441,
 
549
      432,  441,  432,  432,  432,  436,  436,  440,   79,  440,
 
550
      440,  440,  440,  440,  189,  442,  189,  442,  189,  189,
 
551
      443,  189,  443,  437,  432,  437,  444,  437,  437,  441,
 
552
      432,  441,  441,   79,   79,  440,  432,  440,  445,  440,
 
553
      440,  442,  189,  442,  442,  442,  442,  442,  443,  189,
 
554
 
 
555
      443,  443,  443,  443,  443,  275,  275,  446,  437,  275,
 
556
      437,  447,  444,  275,  444,  432,  432,  287,  287,  445,
 
557
      440,  287,  440,  445,  445,  287,  445,  189,  189,  442,
 
558
      275,  442,  446,  442,  442,  189,  189,  443,  275,  443,
 
559
      447,  443,  443,  275,  446,  275,  446,  275,  275,  447,
 
560
      275,  447,  444,  275,  444,  447,  444,  444,  444,  287,
 
561
      287,  287,  445,  287,  445,  445,  445,  445,  445,  442,
 
562
      275,  442,  446,  443,  275,  443,  447,  446,  275,  446,
 
563
      446,  446,  446,  446,  447,  275,  447,  447,  447,  447,
 
564
      447,  275,  275,  444,  275,  444,  444,  444,  444,  287,
 
565
 
 
566
      287,  445,  287,  445,  445,  445,  445,  275,  275,  275,
 
567
      275,  275,  275,  446,  275,  446,  446,  446,  446,  275,
 
568
      275,  447,  275,  447,  447,  447,  447,  275,  287,  275,
 
569
      275,    0,  432,  432,  432,  432,  432,  432,  432,  432,
 
570
      432,  432,  432,  432,  432,  432,  432
 
571
    } ;
 
572
 
 
573
static yyconst flex_int16_t yy_nxt[2021] =
 
574
    {   0,
 
575
       12,   13,   14,   15,   16,   17,   18,   19,   20,   21,
 
576
       22,   23,   24,   25,   26,   27,   28,   29,   30,   31,
 
577
       32,   33,   34,   35,   36,   37,   19,   19,   19,   19,
 
578
       38,   39,   40,   41,   42,   43,   44,   45,   46,   13,
 
579
       47,   48,   49,   50,   18,   51,   52,   53,   54,   55,
 
580
       56,   57,   58,   59,   60,   61,   62,   63,   64,   65,
 
581
       66,   67,   68,   69,   51,   51,   51,   51,   70,   71,
 
582
       72,   73,   74,   75,   76,   77,   78,   79,   80,   94,
 
583
       96,   81,   98,  117,  118,  100,  120,  121,   93,   82,
 
584
      360,   97,   99,  101,   95,  134,   83,  112,  130,  113,
 
585
 
 
586
      113,  123,  124,  125,  134,  134,  126,   84,  114,  115,
 
587
      131,   85,  102,  134,  344,  103,  104,  136,  105,  106,
 
588
      107,  108,  108,  127,  134,  143,  156,  164,  189,  190,
 
589
      134,  139,  134,  134,  109,  144,  110,  112,  134,  113,
 
590
      113,  141,  265,  134,  134,  197,  140,  145,  114,  115,
 
591
      116,  137,  142,  162,  163,  146,  198,  138,  134,  134,
 
592
      165,  166,  168,  124,  125,  171,  175,  169,  138,  138,
 
593
      192,  192,  193,  108,  108,  194,  138,  138,  138,  138,
 
594
      134,  173,  203,  115,  170,  123,  124,  125,  147,  134,
 
595
      126,  148,  149,  174,  150,  151,  152,  153,  153,  214,
 
596
 
 
597
      215,  134,  208,  112,  208,  113,  113,  209,  209,  134,
 
598
      154,  171,  155,  134,  114,  115,  210,  210,  134,  189,
 
599
      190,  237,  238,  134,  210,  210,  134,  134,  157,  134,
 
600
      158,  158,  134,  220,  216,  134,  134,  134,  134,  159,
 
601
      160,  161,  176,  177,  178,  217,  134,  179,  218,  219,
 
602
      134,  221,  134,  134,  223,  180,  134,  224,  134,  230,
 
603
      231,  134,  181,  134,  227,  205,  227,  189,  190,  228,
 
604
      228,  134,  224,  182,  196,  153,  153,  183,  184,  184,
 
605
      185,  251,  252,  186,  222,  160,  209,  209,  229,  229,
 
606
      168,  124,  125,  214,  215,  126,  229,  229,  181,  233,
 
607
 
 
608
      214,  215,  192,  192,  193,  209,  209,  194,  195,  182,
 
609
      255,  215,  213,  183,  206,  115,  191,  206,  235,  213,
 
610
      237,  238,  206,  207,  207,  192,  192,  193,  196,  253,
 
611
      194,  253,  114,  115,  254,  254,  206,  195,  206,  225,
 
612
      134,  191,  225,  234,  207,  207,  133,  225,  226,  226,
 
613
      192,  249,  193,  114,  115,  194,  134,  228,  228,  133,
 
614
      134,  225,  134,  225,  239,  239,  240,  267,  268,  241,
 
615
      123,  124,  125,  210,  210,  126,  233,  214,  215,  134,
 
616
      172,  210,  210,  115,  181,  168,  124,  125,  272,  273,
 
617
      169,  256,  134,  256,  134,  182,  257,  257,  134,  183,
 
618
 
 
619
      242,  243,  244,  167,  133,  245,  226,  226,  134,  228,
 
620
      228,  134,  233,  214,  215,  251,  252,  133,  134,  160,
 
621
      246,  274,  275,  276,  134,  213,  277,  278,  189,  190,
 
622
      133,  247,  213,  254,  254,  248,  134,  279,  189,  190,
 
623
      192,  192,  193,  237,  238,  194,  192,  192,  193,  254,
 
624
      254,  194,  134,  229,  229,  280,  281,  282,  134,  115,
 
625
      283,  229,  229,  160,  258,  259,  260,  267,  268,  261,
 
626
      134,  134,  286,  287,  288,  257,  257,  289,  290,  237,
 
627
      238,  291,  237,  238,  262,  272,  273,  257,  257,  274,
 
628
      275,  276,  314,  315,  277,  263,  134,  160,  134,  264,
 
629
 
 
630
      242,  269,  244,  251,  252,  245,  278,  189,  190,  279,
 
631
      189,  190,  280,  316,  282,  326,  327,  283,  267,  268,
 
632
      246,  192,  192,  193,  272,  273,  194,  280,  317,  282,
 
633
      134,  247,  283,  346,  347,  248,  242,  270,  244,  351,
 
634
      352,  245,  286,  287,  288,  314,  315,  289,  290,  237,
 
635
      238,  291,  237,  238,  326,  327,  246,  330,  331,  332,
 
636
      326,  327,  333,  334,  267,  268,  134,  247,  335,  267,
 
637
      268,  248,  258,  284,  260,  326,  327,  261,  338,  339,
 
638
      340,  346,  347,  341,  342,  272,  273,  343,  272,  273,
 
639
      351,  352,  262,  192,  192,  193,  346,  347,  194,  192,
 
640
 
 
641
      192,  193,  134,  263,  194,  351,  352,  264,  258,  285,
 
642
      260,  351,  352,  261,  330,  331,  332,  326,  327,  333,
 
643
      334,  267,  268,  335,  267,  268,  346,  347,  262,  338,
 
644
      339,  340,  351,  352,  341,  342,  272,  273,  134,  263,
 
645
      343,  272,  273,  264,  292,  293,  294,  346,  347,  295,
 
646
      394,  395,  396,  351,  352,  397,  398,  314,  315,  399,
 
647
      314,  315,  314,  315,  296,  402,  403,  404,  326,  327,
 
648
      405,  406,  326,  327,  134,  297,  407,  326,  327,  298,
 
649
      299,  300,  301,  346,  347,  302,  414,  415,  416,  351,
 
650
      352,  417,  418,  346,  347,  419,  346,  347,  137,  134,
 
651
 
 
652
      303,  422,  423,  424,  134,  134,  425,  426,  351,  352,
 
653
      129,  304,  427,  351,  352,  305,  306,  306,  307,  124,
 
654
      122,  308,  394,  395,  396,  212,  211,  397,  398,  314,
 
655
      315,  399,  314,  315,  205,  204,  181,  402,  403,  404,
 
656
      202,  201,  405,  406,  326,  327,  200,  182,  407,  326,
 
657
      327,  183,  309,  310,  311,  199,  128,  312,  414,  415,
 
658
      416,   92,   92,  417,  418,  346,  347,  419,  346,  347,
 
659
       89,  196,  246,  422,  423,  424,  195,  191,  425,  426,
 
660
      351,  352,  187,  247,  427,  351,  352,  248,  318,  318,
 
661
      319,  134,  172,  320,  134,  167,  134,  134,  133,  134,
 
662
 
 
663
      134,  135,  134,  132,  129,  128,  122,  119,  181,  111,
 
664
       92,   91,   90,   89,  432,   87,   87,   87,   87,  182,
 
665
      432,  432,  432,  183,  321,  322,  323,  432,  432,  324,
 
666
      432,  432,  432,  432,  432,  432,  432,  432,  432,  432,
 
667
      432,  432,  432,  432,  262,  432,  432,  432,  432,  432,
 
668
      432,  432,  432,  432,  432,  263,  432,  432,  432,  264,
 
669
      292,  328,  294,  432,  432,  295,  432,  432,  432,  432,
 
670
      432,  432,  432,  432,  432,  432,  432,  432,  432,  432,
 
671
      296,  432,  432,  432,  432,  432,  432,  432,  432,  432,
 
672
      432,  297,  432,  432,  432,  298,  292,  329,  294,  432,
 
673
 
 
674
      432,  295,  432,  432,  432,  432,  432,  432,  432,  432,
 
675
      432,  432,  432,  432,  432,  432,  296,  432,  432,  432,
 
676
      432,  432,  432,  432,  432,  432,  432,  297,  432,  432,
 
677
      432,  298,  299,  336,  301,  432,  432,  302,  432,  432,
 
678
      432,  432,  432,  432,  432,  432,  432,  432,  432,  432,
 
679
      432,  432,  303,  432,  432,  432,  432,  432,  432,  432,
 
680
      432,  432,  432,  304,  432,  432,  432,  305,  299,  337,
 
681
      301,  432,  432,  302,  432,  432,  432,  432,  432,  432,
 
682
      432,  432,  432,  432,  432,  432,  432,  432,  303,  432,
 
683
      432,  432,  432,  432,  432,  432,  432,  432,  432,  304,
 
684
 
 
685
      432,  432,  432,  305,  309,  348,  311,  432,  432,  312,
 
686
      432,  432,  432,  432,  432,  432,  432,  432,  432,  432,
 
687
      432,  432,  432,  432,  246,  432,  432,  432,  432,  432,
 
688
      432,  432,  432,  432,  432,  247,  432,  432,  432,  248,
 
689
      309,  349,  311,  432,  432,  312,  432,  432,  432,  432,
 
690
      432,  432,  432,  432,  432,  432,  432,  432,  432,  432,
 
691
      246,  432,  432,  432,  432,  432,  432,  432,  432,  432,
 
692
      432,  247,  432,  432,  432,  248,  353,  354,  355,  432,
 
693
      432,  356,  432,  432,  432,  432,  432,  432,  432,  432,
 
694
      432,  432,  432,  432,  432,  432,  357,  432,  432,  432,
 
695
 
 
696
      432,  432,  432,  432,  432,  432,  432,  358,  432,  432,
 
697
      432,  359,  321,  361,  323,  432,  432,  324,  432,  432,
 
698
      432,  432,  432,  432,  432,  432,  432,  432,  432,  432,
 
699
      432,  432,  262,  432,  432,  432,  432,  432,  432,  432,
 
700
      432,  432,  432,  263,  432,  432,  432,  264,  321,  362,
 
701
      323,  432,  432,  324,  432,  432,  432,  432,  432,  432,
 
702
      432,  432,  432,  432,  432,  432,  432,  432,  262,  432,
 
703
      432,  432,  432,  432,  432,  432,  432,  432,  432,  263,
 
704
      432,  432,  432,  264,  363,  364,  365,  432,  432,  366,
 
705
      432,  432,  432,  432,  432,  432,  432,  432,  432,  432,
 
706
 
 
707
      432,  432,  432,  432,  367,  432,  432,  432,  432,  432,
 
708
      432,  432,  432,  432,  432,  368,  432,  432,  432,  369,
 
709
      370,  371,  372,  432,  432,  373,  432,  432,  432,  432,
 
710
      432,  432,  432,  432,  432,  432,  432,  432,  432,  432,
 
711
      296,  432,  432,  432,  432,  432,  432,  432,  432,  432,
 
712
      432,  297,  432,  432,  432,  298,  374,  375,  376,  432,
 
713
      432,  377,  432,  432,  432,  432,  432,  432,  432,  432,
 
714
      432,  432,  432,  432,  432,  432,  303,  432,  432,  432,
 
715
      432,  432,  432,  432,  432,  432,  432,  304,  432,  432,
 
716
      432,  305,  378,  379,  380,  432,  432,  381,  432,  432,
 
717
 
 
718
      432,  432,  432,  432,  432,  432,  432,  432,  432,  432,
 
719
      432,  432,  382,  432,  432,  432,  432,  432,  432,  432,
 
720
      432,  432,  432,  383,  432,  432,  432,  384,  385,  386,
 
721
      387,  432,  432,  388,  432,  432,  432,  432,  432,  432,
 
722
      432,  432,  432,  432,  432,  432,  432,  432,  389,  432,
 
723
      432,  432,  432,  432,  432,  432,  432,  432,  432,  390,
 
724
      432,  432,  432,  391,  353,  392,  355,  432,  432,  356,
 
725
      432,  432,  432,  432,  432,  432,  432,  432,  432,  432,
 
726
      432,  432,  432,  432,  357,  432,  432,  432,  432,  432,
 
727
      432,  432,  432,  432,  432,  358,  432,  432,  432,  359,
 
728
 
 
729
      353,  393,  355,  432,  432,  356,  432,  432,  432,  432,
 
730
      432,  432,  432,  432,  432,  432,  432,  432,  432,  432,
 
731
      357,  432,  432,  432,  432,  432,  432,  432,  432,  432,
 
732
      432,  358,  432,  432,  432,  359,  363,  400,  365,  432,
 
733
      432,  366,  432,  432,  432,  432,  432,  432,  432,  432,
 
734
      432,  432,  432,  432,  432,  432,  367,  432,  432,  432,
 
735
      432,  432,  432,  432,  432,  432,  432,  368,  432,  432,
 
736
      432,  369,  363,  401,  365,  432,  432,  366,  432,  432,
 
737
      432,  432,  432,  432,  432,  432,  432,  432,  432,  432,
 
738
      432,  432,  367,  432,  432,  432,  432,  432,  432,  432,
 
739
 
 
740
      432,  432,  432,  368,  432,  432,  432,  369,  370,  408,
 
741
      372,  432,  432,  373,  432,  432,  432,  432,  432,  432,
 
742
      432,  432,  432,  432,  432,  432,  432,  432,  296,  432,
 
743
      432,  432,  432,  432,  432,  432,  432,  432,  432,  297,
 
744
      432,  432,  432,  298,  370,  409,  372,  432,  432,  373,
 
745
      432,  432,  432,  432,  432,  432,  432,  432,  432,  432,
 
746
      432,  432,  432,  432,  296,  432,  432,  432,  432,  432,
 
747
      432,  432,  432,  432,  432,  297,  432,  432,  432,  298,
 
748
      374,  410,  376,  432,  432,  377,  432,  432,  432,  432,
 
749
      432,  432,  432,  432,  432,  432,  432,  432,  432,  432,
 
750
 
 
751
      303,  432,  432,  432,  432,  432,  432,  432,  432,  432,
 
752
      432,  304,  432,  432,  432,  305,  374,  411,  376,  432,
 
753
      432,  377,  432,  432,  432,  432,  432,  432,  432,  432,
 
754
      432,  432,  432,  432,  432,  432,  303,  432,  432,  432,
 
755
      432,  432,  432,  432,  432,  432,  432,  304,  432,  432,
 
756
      432,  305,  378,  412,  380,  432,  432,  381,  432,  432,
 
757
      432,  432,  432,  432,  432,  432,  432,  432,  432,  432,
 
758
      432,  432,  382,  432,  432,  432,  432,  432,  432,  432,
 
759
      432,  432,  432,  383,  432,  432,  432,  384,  378,  413,
 
760
      380,  432,  432,  381,  432,  432,  432,  432,  432,  432,
 
761
 
 
762
      432,  432,  432,  432,  432,  432,  432,  432,  382,  432,
 
763
      432,  432,  432,  432,  432,  432,  432,  432,  432,  383,
 
764
      432,  432,  432,  384,  385,  420,  387,  432,  432,  388,
 
765
      432,  432,  432,  432,  432,  432,  432,  432,  432,  432,
 
766
      432,  432,  432,  432,  389,  432,  432,  432,  432,  432,
 
767
      432,  432,  432,  432,  432,  390,  432,  432,  432,  391,
 
768
      385,  421,  387,  432,  432,  388,  432,  432,  432,  432,
 
769
      432,  432,  432,  432,  432,  432,  432,  432,  432,  432,
 
770
      389,  432,  432,  432,  432,  432,  432,  432,  432,  432,
 
771
      432,  390,  432,  432,  432,  391,  353,  428,  355,  432,
 
772
 
 
773
      432,  356,  432,  432,  432,  432,  432,  432,  432,  432,
 
774
      432,  432,  432,  432,  432,  432,  357,  432,  432,  432,
 
775
      432,  432,  432,  432,  432,  432,  432,  358,  432,  432,
 
776
      432,  359,  363,  429,  365,  432,  432,  366,  432,  432,
 
777
      432,  432,  432,  432,  432,  432,  432,  432,  432,  432,
 
778
      432,  432,  367,  432,  432,  432,  432,  432,  432,  432,
 
779
      432,  432,  432,  368,  432,  432,  432,  369,  378,  430,
 
780
      380,  432,  432,  381,  432,  432,  432,  432,  432,  432,
 
781
      432,  432,  432,  432,  432,  432,  432,  432,  382,  432,
 
782
      432,  432,  432,  432,  432,  432,  432,  432,  432,  383,
 
783
 
 
784
      432,  432,  432,  384,  385,  431,  387,  432,  432,  388,
 
785
      432,  432,  432,  432,  432,  432,  432,  432,  432,  432,
 
786
      432,  432,  432,  432,  389,  432,  432,  432,  432,  432,
 
787
      432,  432,  432,  432,  432,  390,  432,  432,  432,  391,
 
788
       86,   86,   86,   88,   88,   88,  133,  133,  188,  188,
 
789
      188,  213,  213,  213,  232,  232,  232,  236,  236,  236,
 
790
      250,  250,  250,  266,  266,  266,  271,  271,  271,  313,
 
791
      313,  313,  325,  325,  325,  345,  345,  345,  350,  350,
 
792
      350,   11,  432,  432,  432,  432,  432,  432,  432,  432,
 
793
      432,  432,  432,  432,  432,  432,  432,  432,  432,  432,
 
794
 
 
795
      432,  432,  432,  432,  432,  432,  432,  432,  432,  432,
 
796
      432,  432,  432,  432,  432,  432,  432,  432,  432,  432
 
797
    } ;
 
798
 
 
799
static yyconst flex_int16_t yy_chk[2021] =
 
800
    {   0,
 
801
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
 
802
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
 
803
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
 
804
        1,    1,    1,    1,    1,    1,    1,    1,    3,    3,
 
805
        3,    3,    3,    3,    3,    3,    3,    3,    3,    3,
 
806
        3,    3,    3,    3,    3,    3,    3,    3,    3,    3,
 
807
        3,    3,    3,    3,    3,    3,    3,    3,    3,    3,
 
808
        3,    3,    3,    3,    3,    3,    5,    5,    5,   20,
 
809
       24,    5,   25,   34,   34,   27,   36,   36,  435,    5,
 
810
      319,   24,   25,   27,   20,   49,    5,   31,   43,   31,
 
811
 
 
812
       31,   39,   39,   39,   61,   67,   39,    5,   31,   31,
 
813
       43,    5,   28,   57,  307,   28,   28,   49,   28,   28,
 
814
       28,   28,   28,   39,   52,   57,   61,   67,   81,   81,
 
815
       56,   52,   66,   59,   28,   57,   28,   30,   68,   30,
 
816
       30,   56,  240,   73,   77,  103,   52,   59,   30,   30,
 
817
       30,   51,   56,   66,   66,   59,  103,   51,  231,   75,
 
818
       68,   68,   71,   71,   71,   73,   77,   71,   51,   51,
 
819
       83,   83,   83,  108,  108,   83,   51,   51,   51,   51,
 
820
       60,   75,  108,  108,   71,  123,  123,  123,   60,  141,
 
821
      123,   60,   60,   75,   60,   60,   60,   60,   60,  126,
 
822
 
 
823
      126,  230,  114,  113,  114,  113,  113,  114,  114,  225,
 
824
       60,  141,   60,   62,  113,  113,  116,  116,  151,  179,
 
825
      179,  186,  186,  148,  116,  116,  149,  150,   62,  152,
 
826
       62,   62,  154,  151,  148,  155,  224,  162,  166,   62,
 
827
       62,   62,   78,   78,   78,  148,  223,   78,  149,  150,
 
828
      216,  152,  159,  221,  154,   78,  219,  155,  153,  162,
 
829
      166,  218,   78,  217,  159,  197,  159,  188,  188,  159,
 
830
      159,  161,  216,   78,  196,  153,  153,   78,   79,   79,
 
831
       79,  194,  194,   79,  153,  153,  208,  208,  161,  161,
 
832
      168,  168,  168,  213,  213,  168,  161,  161,   79,  169,
 
833
 
 
834
      169,  169,  181,  181,  181,  209,  209,  181,  195,   79,
 
835
      215,  215,  169,   79,  112,  209,  191,  112,  185,  169,
 
836
      236,  236,  112,  112,  112,  192,  192,  192,  183,  203,
 
837
      192,  203,  112,  112,  203,  203,  112,  182,  112,  157,
 
838
      227,  180,  157,  178,  207,  207,  157,  157,  157,  157,
 
839
      193,  193,  193,  207,  207,  193,  175,  227,  227,  157,
 
840
      174,  157,  173,  157,  189,  189,  189,  241,  241,  189,
 
841
      201,  201,  201,  210,  210,  201,  233,  233,  233,  222,
 
842
      172,  210,  210,  210,  189,  220,  220,  220,  245,  245,
 
843
      220,  222,  228,  222,  171,  189,  222,  222,  170,  189,
 
844
 
 
845
      190,  190,  190,  167,  226,  190,  226,  226,  165,  228,
 
846
      228,  164,  232,  232,  232,  250,  250,  226,  163,  228,
 
847
      190,  246,  246,  246,  160,  232,  246,  247,  247,  247,
 
848
      158,  190,  232,  253,  253,  190,  229,  248,  248,  248,
 
849
      249,  249,  249,  261,  261,  249,  251,  251,  251,  254,
 
850
      254,  251,  156,  229,  229,  252,  252,  252,  256,  254,
 
851
      252,  229,  229,  229,  238,  238,  238,  266,  266,  238,
 
852
      257,  147,  262,  262,  262,  256,  256,  262,  263,  263,
 
853
      263,  264,  264,  264,  238,  271,  271,  257,  257,  274,
 
854
      274,  274,  277,  277,  274,  238,  146,  257,  145,  238,
 
855
 
 
856
      242,  242,  242,  283,  283,  242,  278,  278,  278,  279,
 
857
      279,  279,  280,  280,  280,  289,  289,  280,  295,  295,
 
858
      242,  281,  281,  281,  302,  302,  281,  282,  282,  282,
 
859
      144,  242,  282,  308,  308,  242,  244,  244,  244,  312,
 
860
      312,  244,  286,  286,  286,  313,  313,  286,  290,  290,
 
861
      290,  291,  291,  291,  320,  320,  244,  296,  296,  296,
 
862
      324,  324,  296,  297,  297,  297,  143,  244,  298,  298,
 
863
      298,  244,  258,  258,  258,  325,  325,  258,  303,  303,
 
864
      303,  333,  333,  303,  304,  304,  304,  305,  305,  305,
 
865
      341,  341,  258,  316,  316,  316,  345,  345,  316,  317,
 
866
 
 
867
      317,  317,  142,  258,  317,  350,  350,  258,  260,  260,
 
868
      260,  356,  356,  260,  330,  330,  330,  366,  366,  330,
 
869
      334,  334,  334,  335,  335,  335,  373,  373,  260,  338,
 
870
      338,  338,  377,  377,  338,  342,  342,  342,  140,  260,
 
871
      343,  343,  343,  260,  268,  268,  268,  381,  381,  268,
 
872
      357,  357,  357,  388,  388,  357,  358,  358,  358,  359,
 
873
      359,  359,  397,  397,  268,  367,  367,  367,  405,  405,
 
874
      367,  368,  368,  368,  139,  268,  369,  369,  369,  268,
 
875
      273,  273,  273,  417,  417,  273,  382,  382,  382,  425,
 
876
      425,  382,  383,  383,  383,  384,  384,  384,  137,  136,
 
877
 
 
878
      273,  389,  389,  389,  134,  133,  389,  390,  390,  390,
 
879
      129,  273,  391,  391,  391,  273,  275,  275,  275,  125,
 
880
      122,  275,  394,  394,  394,  121,  117,  394,  398,  398,
 
881
      398,  399,  399,  399,  110,  109,  275,  402,  402,  402,
 
882
      107,  106,  402,  406,  406,  406,  105,  275,  407,  407,
 
883
      407,  275,  276,  276,  276,  104,   96,  276,  414,  414,
 
884
      414,   93,   92,  414,  418,  418,  418,  419,  419,  419,
 
885
       89,   85,  276,  422,  422,  422,   84,   82,  422,  426,
 
886
      426,  426,   80,  276,  427,  427,  427,  276,  287,  287,
 
887
      287,   76,   74,  287,   72,   70,   69,   64,   63,   55,
 
888
 
 
889
       54,   48,   46,   45,   42,   41,   38,   35,  287,   29,
 
890
       19,   16,   15,   13,   11,   10,    9,    8,    7,  287,
 
891
        0,    0,    0,  287,  288,  288,  288,    0,    0,  288,
 
892
        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
 
893
        0,    0,    0,    0,  288,    0,    0,    0,    0,    0,
 
894
        0,    0,    0,    0,    0,  288,    0,    0,    0,  288,
 
895
      292,  292,  292,    0,    0,  292,    0,    0,    0,    0,
 
896
        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
 
897
      292,    0,    0,    0,    0,    0,    0,    0,    0,    0,
 
898
        0,  292,    0,    0,    0,  292,  294,  294,  294,    0,
 
899
 
 
900
        0,  294,    0,    0,    0,    0,    0,    0,    0,    0,
 
901
        0,    0,    0,    0,    0,    0,  294,    0,    0,    0,
 
902
        0,    0,    0,    0,    0,    0,    0,  294,    0,    0,
 
903
        0,  294,  299,  299,  299,    0,    0,  299,    0,    0,
 
904
        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
 
905
        0,    0,  299,    0,    0,    0,    0,    0,    0,    0,
 
906
        0,    0,    0,  299,    0,    0,    0,  299,  301,  301,
 
907
      301,    0,    0,  301,    0,    0,    0,    0,    0,    0,
 
908
        0,    0,    0,    0,    0,    0,    0,    0,  301,    0,
 
909
        0,    0,    0,    0,    0,    0,    0,    0,    0,  301,
 
910
 
 
911
        0,    0,    0,  301,  309,  309,  309,    0,    0,  309,
 
912
        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
 
913
        0,    0,    0,    0,  309,    0,    0,    0,    0,    0,
 
914
        0,    0,    0,    0,    0,  309,    0,    0,    0,  309,
 
915
      311,  311,  311,    0,    0,  311,    0,    0,    0,    0,
 
916
        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
 
917
      311,    0,    0,    0,    0,    0,    0,    0,    0,    0,
 
918
        0,  311,    0,    0,    0,  311,  315,  315,  315,    0,
 
919
        0,  315,    0,    0,    0,    0,    0,    0,    0,    0,
 
920
        0,    0,    0,    0,    0,    0,  315,    0,    0,    0,
 
921
 
 
922
        0,    0,    0,    0,    0,    0,    0,  315,    0,    0,
 
923
        0,  315,  321,  321,  321,    0,    0,  321,    0,    0,
 
924
        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
 
925
        0,    0,  321,    0,    0,    0,    0,    0,    0,    0,
 
926
        0,    0,    0,  321,    0,    0,    0,  321,  323,  323,
 
927
      323,    0,    0,  323,    0,    0,    0,    0,    0,    0,
 
928
        0,    0,    0,    0,    0,    0,    0,    0,  323,    0,
 
929
        0,    0,    0,    0,    0,    0,    0,    0,    0,  323,
 
930
        0,    0,    0,  323,  327,  327,  327,    0,    0,  327,
 
931
        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
 
932
 
 
933
        0,    0,    0,    0,  327,    0,    0,    0,    0,    0,
 
934
        0,    0,    0,    0,    0,  327,    0,    0,    0,  327,
 
935
      332,  332,  332,    0,    0,  332,    0,    0,    0,    0,
 
936
        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
 
937
      332,    0,    0,    0,    0,    0,    0,    0,    0,    0,
 
938
        0,  332,    0,    0,    0,  332,  340,  340,  340,    0,
 
939
        0,  340,    0,    0,    0,    0,    0,    0,    0,    0,
 
940
        0,    0,    0,    0,    0,    0,  340,    0,    0,    0,
 
941
        0,    0,    0,    0,    0,    0,    0,  340,    0,    0,
 
942
        0,  340,  347,  347,  347,    0,    0,  347,    0,    0,
 
943
 
 
944
        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
 
945
        0,    0,  347,    0,    0,    0,    0,    0,    0,    0,
 
946
        0,    0,    0,  347,    0,    0,    0,  347,  352,  352,
 
947
      352,    0,    0,  352,    0,    0,    0,    0,    0,    0,
 
948
        0,    0,    0,    0,    0,    0,    0,    0,  352,    0,
 
949
        0,    0,    0,    0,    0,    0,    0,    0,    0,  352,
 
950
        0,    0,    0,  352,  353,  353,  353,    0,    0,  353,
 
951
        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
 
952
        0,    0,    0,    0,  353,    0,    0,    0,    0,    0,
 
953
        0,    0,    0,    0,    0,  353,    0,    0,    0,  353,
 
954
 
 
955
      355,  355,  355,    0,    0,  355,    0,    0,    0,    0,
 
956
        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
 
957
      355,    0,    0,    0,    0,    0,    0,    0,    0,    0,
 
958
        0,  355,    0,    0,    0,  355,  363,  363,  363,    0,
 
959
        0,  363,    0,    0,    0,    0,    0,    0,    0,    0,
 
960
        0,    0,    0,    0,    0,    0,  363,    0,    0,    0,
 
961
        0,    0,    0,    0,    0,    0,    0,  363,    0,    0,
 
962
        0,  363,  365,  365,  365,    0,    0,  365,    0,    0,
 
963
        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
 
964
        0,    0,  365,    0,    0,    0,    0,    0,    0,    0,
 
965
 
 
966
        0,    0,    0,  365,    0,    0,    0,  365,  370,  370,
 
967
      370,    0,    0,  370,    0,    0,    0,    0,    0,    0,
 
968
        0,    0,    0,    0,    0,    0,    0,    0,  370,    0,
 
969
        0,    0,    0,    0,    0,    0,    0,    0,    0,  370,
 
970
        0,    0,    0,  370,  372,  372,  372,    0,    0,  372,
 
971
        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
 
972
        0,    0,    0,    0,  372,    0,    0,    0,    0,    0,
 
973
        0,    0,    0,    0,    0,  372,    0,    0,    0,  372,
 
974
      374,  374,  374,    0,    0,  374,    0,    0,    0,    0,
 
975
        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
 
976
 
 
977
      374,    0,    0,    0,    0,    0,    0,    0,    0,    0,
 
978
        0,  374,    0,    0,    0,  374,  376,  376,  376,    0,
 
979
        0,  376,    0,    0,    0,    0,    0,    0,    0,    0,
 
980
        0,    0,    0,    0,    0,    0,  376,    0,    0,    0,
 
981
        0,    0,    0,    0,    0,    0,    0,  376,    0,    0,
 
982
        0,  376,  378,  378,  378,    0,    0,  378,    0,    0,
 
983
        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
 
984
        0,    0,  378,    0,    0,    0,    0,    0,    0,    0,
 
985
        0,    0,    0,  378,    0,    0,    0,  378,  380,  380,
 
986
      380,    0,    0,  380,    0,    0,    0,    0,    0,    0,
 
987
 
 
988
        0,    0,    0,    0,    0,    0,    0,    0,  380,    0,
 
989
        0,    0,    0,    0,    0,    0,    0,    0,    0,  380,
 
990
        0,    0,    0,  380,  385,  385,  385,    0,    0,  385,
 
991
        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
 
992
        0,    0,    0,    0,  385,    0,    0,    0,    0,    0,
 
993
        0,    0,    0,    0,    0,  385,    0,    0,    0,  385,
 
994
      387,  387,  387,    0,    0,  387,    0,    0,    0,    0,
 
995
        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
 
996
      387,    0,    0,    0,    0,    0,    0,    0,    0,    0,
 
997
        0,  387,    0,    0,    0,  387,  396,  396,  396,    0,
 
998
 
 
999
        0,  396,    0,    0,    0,    0,    0,    0,    0,    0,
 
1000
        0,    0,    0,    0,    0,    0,  396,    0,    0,    0,
 
1001
        0,    0,    0,    0,    0,    0,    0,  396,    0,    0,
 
1002
        0,  396,  404,  404,  404,    0,    0,  404,    0,    0,
 
1003
        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
 
1004
        0,    0,  404,    0,    0,    0,    0,    0,    0,    0,
 
1005
        0,    0,    0,  404,    0,    0,    0,  404,  416,  416,
 
1006
      416,    0,    0,  416,    0,    0,    0,    0,    0,    0,
 
1007
        0,    0,    0,    0,    0,    0,    0,    0,  416,    0,
 
1008
        0,    0,    0,    0,    0,    0,    0,    0,    0,  416,
 
1009
 
 
1010
        0,    0,    0,  416,  424,  424,  424,    0,    0,  424,
 
1011
        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
 
1012
        0,    0,    0,    0,  424,    0,    0,    0,    0,    0,
 
1013
        0,    0,    0,    0,    0,  424,    0,    0,    0,  424,
 
1014
      433,  433,  433,  434,  434,  434,  436,  436,  437,  437,
 
1015
      437,  438,  438,  438,  439,  439,  439,  440,  440,  440,
 
1016
      441,  441,  441,  442,  442,  442,  443,  443,  443,  444,
 
1017
      444,  444,  445,  445,  445,  446,  446,  446,  447,  447,
 
1018
      447,  432,  432,  432,  432,  432,  432,  432,  432,  432,
 
1019
      432,  432,  432,  432,  432,  432,  432,  432,  432,  432,
 
1020
 
 
1021
      432,  432,  432,  432,  432,  432,  432,  432,  432,  432,
 
1022
      432,  432,  432,  432,  432,  432,  432,  432,  432,  432
 
1023
    } ;
 
1024
 
 
1025
static yy_state_type yy_last_accepting_state;
 
1026
static char *yy_last_accepting_cpos;
 
1027
 
 
1028
extern int octave__flex_debug;
 
1029
int octave__flex_debug = 0;
 
1030
 
 
1031
/* The intent behind this definition is that it'll catch
 
1032
 * any uses of REJECT which flex missed.
 
1033
 */
 
1034
#define REJECT reject_used_but_not_detected
 
1035
#define yymore() yymore_used_but_not_detected
 
1036
#define YY_MORE_ADJ 0
 
1037
#define YY_RESTORE_YY_MORE_OFFSET
 
1038
char *octave_text;
 
1039
#line 1 "lex.l"
 
1040
/*
 
1041
 
 
1042
Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
 
1043
              2002, 2003, 2004, 2005, 2006, 2007 John W. Eaton
 
1044
 
 
1045
This file is part of Octave.
 
1046
 
 
1047
Octave is free software; you can redistribute it and/or modify it
 
1048
under the terms of the GNU General Public License as published by the
 
1049
Free Software Foundation; either version 3 of the License, or (at your
 
1050
option) any later version.
 
1051
 
 
1052
Octave is distributed in the hope that it will be useful, but WITHOUT
 
1053
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 
1054
FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 
1055
for more details.
 
1056
 
 
1057
You should have received a copy of the GNU General Public License
 
1058
along with Octave; see the file COPYING.  If not, see
 
1059
<http://www.gnu.org/licenses/>.
 
1060
 
 
1061
*/
 
1062
 
 
1063
 
 
1064
 
 
1065
 
 
1066
#line 33 "lex.l"
 
1067
#ifdef HAVE_CONFIG_H
 
1068
#include <config.h>
 
1069
#endif
 
1070
 
 
1071
#include <cctype>
 
1072
#include <cstring>
 
1073
 
 
1074
#include <sstream>
 
1075
#include <string>
 
1076
#include <stack>
 
1077
 
 
1078
#ifdef HAVE_UNISTD_H
 
1079
#ifdef HAVE_SYS_TYPES_H
 
1080
#include <sys/types.h>
 
1081
#endif
 
1082
#include <unistd.h>
 
1083
#endif
 
1084
 
 
1085
#include "cmd-edit.h"
 
1086
#include "quit.h"
 
1087
#include "lo-mappers.h"
 
1088
 
 
1089
// These would be alphabetical, but y.tab.h must be included before
 
1090
// oct-gperf.h and y.tab.h must be included after token.h and the tree
 
1091
// class declarations.  We can't include y.tab.h in oct-gperf.h
 
1092
// because it may not be protected to allow it to be included multiple
 
1093
// times.
 
1094
 
 
1095
#include "Cell.h"
 
1096
#include "comment-list.h"
 
1097
#include "defun.h"
 
1098
#include "error.h"
 
1099
#include "gripes.h"
 
1100
#include "input.h"
 
1101
#include "lex.h"
 
1102
#include "ov.h"
 
1103
#include "parse.h"
 
1104
#include "pt-all.h"
 
1105
#include "symtab.h"
 
1106
#include "token.h"
 
1107
#include "toplev.h"
 
1108
#include "utils.h"
 
1109
#include "variables.h"
 
1110
#include <y.tab.h>
 
1111
#include <oct-gperf.h>
 
1112
 
 
1113
#if ! (defined (FLEX_SCANNER) \
 
1114
       && defined (YY_FLEX_MAJOR_VERSION) && YY_FLEX_MAJOR_VERSION >= 2 \
 
1115
       && defined (YY_FLEX_MINOR_VERSION) && YY_FLEX_MINOR_VERSION >= 5)
 
1116
#error lex.l requires flex version 2.5.4 or later
 
1117
#endif
 
1118
 
 
1119
#define yylval octave_lval
 
1120
 
 
1121
// Arrange to get input via readline.
 
1122
 
 
1123
#ifdef YY_INPUT
 
1124
#undef YY_INPUT
 
1125
#endif
 
1126
#define YY_INPUT(buf, result, max_size) \
 
1127
  if ((result = octave_read (buf, max_size)) < 0) \
 
1128
    YY_FATAL_ERROR ("octave_read () in flex scanner failed");
 
1129
 
 
1130
// Try to avoid crashing out completely on fatal scanner errors.
 
1131
// The call to yy_fatal_error should never happen, but it avoids a
 
1132
// `static function defined but not used' warning from gcc.
 
1133
 
 
1134
#ifdef YY_FATAL_ERROR
 
1135
#undef YY_FATAL_ERROR
 
1136
#endif
 
1137
#define YY_FATAL_ERROR(msg) \
 
1138
  do \
 
1139
    { \
 
1140
      error (msg); \
 
1141
      OCTAVE_QUIT; \
 
1142
      yy_fatal_error (msg); \
 
1143
    } \
 
1144
  while (0)
 
1145
 
 
1146
#define COUNT_TOK_AND_RETURN(tok) \
 
1147
  do \
 
1148
    { \
 
1149
      Vtoken_count++; \
 
1150
      return tok; \
 
1151
    } \
 
1152
  while (0)
 
1153
 
 
1154
#define TOK_RETURN(tok) \
 
1155
  do \
 
1156
    { \
 
1157
      current_input_column += octave_leng; \
 
1158
      lexer_flags.quote_is_transpose = false; \
 
1159
      lexer_flags.convert_spaces_to_comma = true; \
 
1160
      COUNT_TOK_AND_RETURN (tok); \
 
1161
    } \
 
1162
  while (0)
 
1163
 
 
1164
#define TOK_PUSH_AND_RETURN(name, tok) \
 
1165
  do \
 
1166
    { \
 
1167
      yylval.tok_val = new token (name, input_line_number, \
 
1168
                                  current_input_column); \
 
1169
      token_stack.push (yylval.tok_val); \
 
1170
      TOK_RETURN (tok); \
 
1171
    } \
 
1172
  while (0)
 
1173
 
 
1174
#define BIN_OP_RETURN(tok, convert) \
 
1175
  do \
 
1176
    { \
 
1177
      yylval.tok_val = new token (input_line_number, current_input_column); \
 
1178
      token_stack.push (yylval.tok_val); \
 
1179
      current_input_column += octave_leng; \
 
1180
      lexer_flags.quote_is_transpose = false; \
 
1181
      lexer_flags.convert_spaces_to_comma = convert; \
 
1182
      COUNT_TOK_AND_RETURN (tok); \
 
1183
    } \
 
1184
  while (0)
 
1185
 
 
1186
#define XBIN_OP_RETURN(tok, convert) \
 
1187
  do \
 
1188
    { \
 
1189
        gripe_matlab_incompatible_operator (octave_text); \
 
1190
        BIN_OP_RETURN (tok, convert); \
 
1191
    } \
 
1192
  while (0)
 
1193
 
 
1194
// TRUE means that we have encountered EOF on the input stream.
 
1195
bool parser_end_of_input = false;
 
1196
 
 
1197
// Flags that need to be shared between the lexer and parser.
 
1198
lexical_feedback lexer_flags;
 
1199
 
 
1200
// Stack to hold tokens so that we can delete them when the parser is
 
1201
// reset and avoid growing forever just because we are stashing some
 
1202
// information.  This has to appear before lex.h is included, because
 
1203
// one of the macros defined there uses token_stack.
 
1204
//
 
1205
// FIXME -- this should really be static, but that causes
 
1206
// problems on some systems.
 
1207
std::stack <token*> token_stack;
 
1208
 
 
1209
// Did eat_whitespace() eat a space or tab, or a newline, or both?
 
1210
 
 
1211
typedef int yum_yum;
 
1212
 
 
1213
const yum_yum ATE_NOTHING = 0;
 
1214
const yum_yum ATE_SPACE_OR_TAB = 1;
 
1215
const yum_yum ATE_NEWLINE = 2;
 
1216
 
 
1217
// Is the closest nesting level a square bracket, squiggly brace or a paren?
 
1218
 
 
1219
class bracket_brace_paren_nesting_level
 
1220
{
 
1221
public:
 
1222
 
 
1223
  bracket_brace_paren_nesting_level (void) : context () { }
 
1224
 
 
1225
  ~bracket_brace_paren_nesting_level (void) { }
 
1226
 
 
1227
  void bracket (void) { context.push (BRACKET); }
 
1228
  bool is_bracket (void)
 
1229
    { return ! context.empty () && context.top () == BRACKET; }
 
1230
 
 
1231
  void brace (void) {  context.push (BRACE); }
 
1232
  bool is_brace (void)
 
1233
    { return ! context.empty () && context.top () == BRACE; }
 
1234
 
 
1235
  void paren (void) {  context.push (PAREN); }
 
1236
  bool is_paren (void)
 
1237
    { return ! context.empty () && context.top () == PAREN; }
 
1238
 
 
1239
  bool is_bracket_or_brace (void)
 
1240
    { return (! context.empty ()
 
1241
              && (context.top () == BRACKET || context.top () == BRACE)); }
 
1242
 
 
1243
  bool none (void) { return context.empty (); }
 
1244
 
 
1245
  void remove (void) { if (! context.empty ()) context.pop (); }
 
1246
 
 
1247
  void clear (void) { while (! context.empty ()) context.pop (); }
 
1248
 
 
1249
private:
 
1250
 
 
1251
  std::stack<int> context;
 
1252
 
 
1253
  static const int BRACKET;
 
1254
  static const int BRACE;
 
1255
  static const int PAREN;
 
1256
 
 
1257
  bracket_brace_paren_nesting_level (const bracket_brace_paren_nesting_level&);
 
1258
 
 
1259
  bracket_brace_paren_nesting_level&
 
1260
  operator = (const bracket_brace_paren_nesting_level&);
 
1261
};
 
1262
 
 
1263
const int bracket_brace_paren_nesting_level::BRACKET = 1;
 
1264
const int bracket_brace_paren_nesting_level::BRACE = 2;
 
1265
const int bracket_brace_paren_nesting_level::PAREN = 3;
 
1266
 
 
1267
static bracket_brace_paren_nesting_level nesting_level;
 
1268
 
 
1269
static unsigned int Vtoken_count = 0;
 
1270
 
 
1271
// Forward declarations for functions defined at the bottom of this
 
1272
// file.
 
1273
 
 
1274
static void fixup_column_count (char *s);
 
1275
static void do_comma_insert_check (void);
 
1276
static int is_keyword_token (const std::string& s);
 
1277
static void prep_for_function (void);
 
1278
static void prep_for_nested_function (void);
 
1279
static symbol_record *lookup_identifier (const std::string& s);
 
1280
static std::string grab_help_text (void);
 
1281
static bool match_any (char c, const char *s);
 
1282
static bool next_token_is_sep_op (void);
 
1283
static bool next_token_is_bin_op (bool spc_prev);
 
1284
static bool next_token_is_postfix_unary_op (bool spc_prev);
 
1285
static std::string strip_trailing_whitespace (char *s);
 
1286
static void handle_number (void);
 
1287
static int handle_string (char delim, int text_style = 0);
 
1288
static int handle_close_bracket (bool spc_gobbled, int bracket_type);
 
1289
static int handle_identifier (void);
 
1290
static bool have_continuation (bool trailing_comments_ok = true);
 
1291
static bool have_ellipsis_continuation (bool trailing_comments_ok = true);
 
1292
static void scan_for_comments (const char *);
 
1293
static yum_yum eat_whitespace (void);
 
1294
static yum_yum eat_continuation (void);
 
1295
static void maybe_warn_separator_insert (char sep);
 
1296
static void gripe_single_quote_string (void);
 
1297
static void gripe_matlab_incompatible (const std::string& msg);
 
1298
static void maybe_gripe_matlab_incompatible_comment (char c);
 
1299
static void gripe_matlab_incompatible_continuation (void);
 
1300
static void gripe_matlab_incompatible_operator (const std::string& op);
 
1301
 
 
1302
#line 1303 "<stdout>"
 
1303
 
 
1304
#define INITIAL 0
 
1305
#define COMMAND_START 1
 
1306
#define MATRIX_START 2
 
1307
#define NESTED_FUNCTION_END 3
 
1308
#define NESTED_FUNCTION_BEGIN 4
 
1309
 
 
1310
#ifndef YY_NO_UNISTD_H
 
1311
/* Special case for "unistd.h", since it is non-ANSI. We include it way
 
1312
 * down here because we want the user's section 1 to have been scanned first.
 
1313
 * The user has a chance to override it with an option.
 
1314
 */
 
1315
#include <unistd.h>
 
1316
#endif
 
1317
 
 
1318
#ifndef YY_EXTRA_TYPE
 
1319
#define YY_EXTRA_TYPE void *
 
1320
#endif
 
1321
 
 
1322
static int yy_init_globals (void );
 
1323
 
 
1324
/* Macros after this point can all be overridden by user definitions in
 
1325
 * section 1.
 
1326
 */
 
1327
 
 
1328
#ifndef YY_SKIP_YYWRAP
 
1329
#ifdef __cplusplus
 
1330
extern "C" int octave_wrap (void );
 
1331
#else
 
1332
extern int octave_wrap (void );
 
1333
#endif
 
1334
#endif
 
1335
 
 
1336
    static void yyunput (int c,char *buf_ptr  );
 
1337
    
 
1338
#ifndef yytext_ptr
 
1339
static void yy_flex_strncpy (char *,yyconst char *,int );
 
1340
#endif
 
1341
 
 
1342
#ifdef YY_NEED_STRLEN
 
1343
static int yy_flex_strlen (yyconst char * );
 
1344
#endif
 
1345
 
 
1346
#ifndef YY_NO_INPUT
 
1347
 
 
1348
#ifdef __cplusplus
 
1349
static int yyinput (void );
 
1350
#else
 
1351
static int input (void );
 
1352
#endif
 
1353
 
 
1354
#endif
 
1355
 
 
1356
/* Amount of stuff to slurp up with each read. */
 
1357
#ifndef YY_READ_BUF_SIZE
 
1358
#define YY_READ_BUF_SIZE 8192
 
1359
#endif
 
1360
 
 
1361
/* Copy whatever the last rule matched to the standard output. */
 
1362
#ifndef ECHO
 
1363
/* This used to be an fputs(), but since the string might contain NUL's,
 
1364
 * we now use fwrite().
 
1365
 */
 
1366
#define ECHO (void) fwrite( octave_text, octave_leng, 1, octave_out )
 
1367
#endif
 
1368
 
 
1369
/* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
 
1370
 * is returned in "result".
 
1371
 */
 
1372
#ifndef YY_INPUT
 
1373
#define YY_INPUT(buf,result,max_size) \
 
1374
        if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
 
1375
                { \
 
1376
                int c = '*'; \
 
1377
                size_t n; \
 
1378
                for ( n = 0; n < max_size && \
 
1379
                             (c = getc( octave_in )) != EOF && c != '\n'; ++n ) \
 
1380
                        buf[n] = (char) c; \
 
1381
                if ( c == '\n' ) \
 
1382
                        buf[n++] = (char) c; \
 
1383
                if ( c == EOF && ferror( octave_in ) ) \
 
1384
                        YY_FATAL_ERROR( "input in flex scanner failed" ); \
 
1385
                result = n; \
 
1386
                } \
 
1387
        else \
 
1388
                { \
 
1389
                errno=0; \
 
1390
                while ( (result = fread(buf, 1, max_size, octave_in))==0 && ferror(octave_in)) \
 
1391
                        { \
 
1392
                        if( errno != EINTR) \
 
1393
                                { \
 
1394
                                YY_FATAL_ERROR( "input in flex scanner failed" ); \
 
1395
                                break; \
 
1396
                                } \
 
1397
                        errno=0; \
 
1398
                        clearerr(octave_in); \
 
1399
                        } \
 
1400
                }\
 
1401
\
 
1402
 
 
1403
#endif
 
1404
 
 
1405
/* No semi-colon after return; correct usage is to write "yyterminate();" -
 
1406
 * we don't want an extra ';' after the "return" because that will cause
 
1407
 * some compilers to complain about unreachable statements.
 
1408
 */
 
1409
#ifndef yyterminate
 
1410
#define yyterminate() return YY_NULL
 
1411
#endif
 
1412
 
 
1413
/* Number of entries by which start-condition stack grows. */
 
1414
#ifndef YY_START_STACK_INCR
 
1415
#define YY_START_STACK_INCR 25
 
1416
#endif
 
1417
 
 
1418
/* Report a fatal error. */
 
1419
#ifndef YY_FATAL_ERROR
 
1420
#define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
 
1421
#endif
 
1422
 
 
1423
/* end tables serialization structures and prototypes */
 
1424
 
 
1425
/* Default declaration of generated scanner - a define so the user can
 
1426
 * easily add parameters.
 
1427
 */
 
1428
#ifndef YY_DECL
 
1429
#define YY_DECL_IS_OURS 1
 
1430
 
 
1431
extern int octave_lex (void);
 
1432
 
 
1433
#define YY_DECL int octave_lex (void)
 
1434
#endif /* !YY_DECL */
 
1435
 
 
1436
/* Code executed at the beginning of each rule, after octave_text and octave_leng
 
1437
 * have been set up.
 
1438
 */
 
1439
#ifndef YY_USER_ACTION
 
1440
#define YY_USER_ACTION
 
1441
#endif
 
1442
 
 
1443
/* Code executed at the end of each rule. */
 
1444
#ifndef YY_BREAK
 
1445
#define YY_BREAK break;
 
1446
#endif
 
1447
 
 
1448
#define YY_RULE_SETUP \
 
1449
        YY_USER_ACTION
 
1450
 
 
1451
/** The main scanner function which does all the work.
 
1452
 */
 
1453
YY_DECL
 
1454
{
 
1455
        register yy_state_type yy_current_state;
 
1456
        register char *yy_cp, *yy_bp;
 
1457
        register int yy_act;
 
1458
    
 
1459
#line 287 "lex.l"
 
1460
 
 
1461
 
 
1462
#line 1463 "<stdout>"
 
1463
 
 
1464
        if ( !(yy_init) )
 
1465
                {
 
1466
                (yy_init) = 1;
 
1467
 
 
1468
#ifdef YY_USER_INIT
 
1469
                YY_USER_INIT;
 
1470
#endif
 
1471
 
 
1472
                if ( ! (yy_start) )
 
1473
                        (yy_start) = 1; /* first start state */
 
1474
 
 
1475
                if ( ! octave_in )
 
1476
                        octave_in = stdin;
 
1477
 
 
1478
                if ( ! octave_out )
 
1479
                        octave_out = stdout;
 
1480
 
 
1481
                if ( ! YY_CURRENT_BUFFER ) {
 
1482
                        octave_ensure_buffer_stack ();
 
1483
                        YY_CURRENT_BUFFER_LVALUE =
 
1484
                                octave__create_buffer(octave_in,YY_BUF_SIZE );
 
1485
                }
 
1486
 
 
1487
                octave__load_buffer_state( );
 
1488
                }
 
1489
 
 
1490
        while ( 1 )             /* loops until end-of-file is reached */
 
1491
                {
 
1492
                yy_cp = (yy_c_buf_p);
 
1493
 
 
1494
                /* Support of octave_text. */
 
1495
                *yy_cp = (yy_hold_char);
 
1496
 
 
1497
                /* yy_bp points to the position in yy_ch_buf of the start of
 
1498
                 * the current run.
 
1499
                 */
 
1500
                yy_bp = yy_cp;
 
1501
 
 
1502
                yy_current_state = (yy_start);
 
1503
yy_match:
 
1504
                do
 
1505
                        {
 
1506
                        register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
 
1507
                        if ( yy_accept[yy_current_state] )
 
1508
                                {
 
1509
                                (yy_last_accepting_state) = yy_current_state;
 
1510
                                (yy_last_accepting_cpos) = yy_cp;
 
1511
                                }
 
1512
                        while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
 
1513
                                {
 
1514
                                yy_current_state = (int) yy_def[yy_current_state];
 
1515
                                if ( yy_current_state >= 433 )
 
1516
                                        yy_c = yy_meta[(unsigned int) yy_c];
 
1517
                                }
 
1518
                        yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
 
1519
                        ++yy_cp;
 
1520
                        }
 
1521
                while ( yy_base[yy_current_state] != 1982 );
 
1522
 
 
1523
yy_find_action:
 
1524
                yy_act = yy_accept[yy_current_state];
 
1525
                if ( yy_act == 0 )
 
1526
                        { /* have to back up */
 
1527
                        yy_cp = (yy_last_accepting_cpos);
 
1528
                        yy_current_state = (yy_last_accepting_state);
 
1529
                        yy_act = yy_accept[yy_current_state];
 
1530
                        }
 
1531
 
 
1532
                YY_DO_BEFORE_ACTION;
 
1533
 
 
1534
do_action:      /* This label is used only to access EOF actions. */
 
1535
 
 
1536
                switch ( yy_act )
 
1537
        { /* beginning of action switch */
 
1538
                        case 0: /* must back up */
 
1539
                        /* undo the effects of YY_DO_BEFORE_ACTION */
 
1540
                        *yy_cp = (yy_hold_char);
 
1541
                        yy_cp = (yy_last_accepting_cpos);
 
1542
                        yy_current_state = (yy_last_accepting_state);
 
1543
                        goto yy_find_action;
 
1544
 
 
1545
case 1:
 
1546
YY_RULE_SETUP
 
1547
#line 289 "lex.l"
 
1548
{
 
1549
    BEGIN (NESTED_FUNCTION_BEGIN);
 
1550
    yyunput (octave_text[0], octave_text);
 
1551
    COUNT_TOK_AND_RETURN (';');
 
1552
  }
 
1553
        YY_BREAK
 
1554
case 2:
 
1555
YY_RULE_SETUP
 
1556
#line 295 "lex.l"
 
1557
{
 
1558
    BEGIN (INITIAL);
 
1559
    yyunput (octave_text[0], octave_text);
 
1560
    prep_for_nested_function ();
 
1561
    COUNT_TOK_AND_RETURN (FCN);
 
1562
  }
 
1563
        YY_BREAK
 
1564
 
 
1565
// Help and other command-style functions are a pain in the ass.  This
 
1566
// stuff needs to be simplified.  May require some changes in the
 
1567
// parser too.
 
1568
 
 
1569
case 3:
 
1570
/* rule 3 can match eol */
 
1571
YY_RULE_SETUP
 
1572
#line 308 "lex.l"
 
1573
{
 
1574
    BEGIN (INITIAL);
 
1575
    current_input_column = 1;
 
1576
    lexer_flags.quote_is_transpose = false;
 
1577
    lexer_flags.convert_spaces_to_comma = true;
 
1578
    lexer_flags.doing_rawcommand = false;
 
1579
    COUNT_TOK_AND_RETURN ('\n');
 
1580
  }
 
1581
        YY_BREAK
 
1582
case 4:
 
1583
YY_RULE_SETUP
 
1584
#line 317 "lex.l"
 
1585
{
 
1586
    if (lexer_flags.doing_rawcommand)
 
1587
      TOK_PUSH_AND_RETURN (octave_text, SQ_STRING);
 
1588
 
 
1589
    BEGIN (INITIAL);
 
1590
 
 
1591
    if (strcmp (octave_text, ",") == 0)
 
1592
      TOK_RETURN (',');
 
1593
    else
 
1594
      TOK_RETURN (';');
 
1595
  }
 
1596
        YY_BREAK
 
1597
case 5:
 
1598
YY_RULE_SETUP
 
1599
#line 329 "lex.l"
 
1600
{
 
1601
    current_input_column++;
 
1602
    COUNT_TOK_AND_RETURN (handle_string (octave_text[0], true));
 
1603
  }
 
1604
        YY_BREAK
 
1605
case 6:
 
1606
YY_RULE_SETUP
 
1607
#line 334 "lex.l"
 
1608
{
 
1609
    std::string tok = strip_trailing_whitespace (octave_text);
 
1610
    TOK_PUSH_AND_RETURN (tok, SQ_STRING);
 
1611
  }
 
1612
        YY_BREAK
 
1613
 
 
1614
// For this and the next two rules, we're looking at ']', and we
 
1615
// need to know if the next token is `=' or `=='.
 
1616
//
 
1617
// It would have been so much easier if the delimiters were simply
 
1618
// different for the expression on the left hand side of the equals
 
1619
// operator.
 
1620
//
 
1621
// It's also a pain in the ass to decide whether to insert a comma
 
1622
// after seeing a ']' character...
 
1623
 
 
1624
case 7:
 
1625
/* rule 7 can match eol */
 
1626
YY_RULE_SETUP
 
1627
#line 351 "lex.l"
 
1628
{
 
1629
    scan_for_comments (octave_text);
 
1630
    fixup_column_count (octave_text);
 
1631
    int c = octave_text[octave_leng-1];
 
1632
    int cont_is_spc = eat_continuation ();
 
1633
    bool spc_gobbled = (cont_is_spc || c == ' ' || c == '\t');
 
1634
    int tok_to_return = handle_close_bracket (spc_gobbled, ']');
 
1635
    if (spc_gobbled)
 
1636
      yyunput (' ', octave_text);
 
1637
    COUNT_TOK_AND_RETURN (tok_to_return);
 
1638
  }
 
1639
        YY_BREAK
 
1640
case 8:
 
1641
/* rule 8 can match eol */
 
1642
YY_RULE_SETUP
 
1643
#line 363 "lex.l"
 
1644
{
 
1645
    scan_for_comments (octave_text);
 
1646
    fixup_column_count (octave_text);
 
1647
    int c = octave_text[octave_leng-1];
 
1648
    int cont_is_spc = eat_continuation ();
 
1649
    bool spc_gobbled = (cont_is_spc || c == ' ' || c == '\t');
 
1650
    int tok_to_return = handle_close_bracket (spc_gobbled, '}');
 
1651
    if (spc_gobbled)
 
1652
      yyunput (' ', octave_text);
 
1653
    COUNT_TOK_AND_RETURN (tok_to_return);
 
1654
  }
 
1655
        YY_BREAK
 
1656
 
 
1657
// Commas are element separators in matrix constants.  If we don't
 
1658
// check for continuations here we can end up inserting too many
 
1659
// commas.
 
1660
 
 
1661
case 9:
 
1662
YY_RULE_SETUP
 
1663
#line 381 "lex.l"
 
1664
{
 
1665
    current_input_column += octave_leng;
 
1666
 
 
1667
    int tmp = eat_continuation ();
 
1668
 
 
1669
    lexer_flags.quote_is_transpose = false;
 
1670
    lexer_flags.convert_spaces_to_comma = true;
 
1671
 
 
1672
    if ((tmp & ATE_NEWLINE) == ATE_NEWLINE)
 
1673
      {
 
1674
        maybe_warn_separator_insert (';');
 
1675
 
 
1676
        yyunput (';', octave_text);
 
1677
      }
 
1678
 
 
1679
    COUNT_TOK_AND_RETURN (',');
 
1680
  }
 
1681
        YY_BREAK
 
1682
 
 
1683
// In some cases, spaces in matrix constants can turn into commas.
 
1684
// If commas are required, spaces are not important in matrix
 
1685
// constants so we just eat them.  If we don't check for continuations
 
1686
// here we can end up inserting too many commas.
 
1687
 
 
1688
case 10:
 
1689
YY_RULE_SETUP
 
1690
#line 406 "lex.l"
 
1691
{
 
1692
    current_input_column += octave_leng;
 
1693
 
 
1694
    int tmp = eat_continuation ();
 
1695
    int bin_op = next_token_is_bin_op (true);
 
1696
    int postfix_un_op = next_token_is_postfix_unary_op (true);
 
1697
 
 
1698
    if (! (postfix_un_op || bin_op)
 
1699
        && nesting_level.is_bracket_or_brace ()
 
1700
        && lexer_flags.convert_spaces_to_comma)
 
1701
      {
 
1702
        if ((tmp & ATE_NEWLINE) == ATE_NEWLINE)
 
1703
          {
 
1704
            maybe_warn_separator_insert (';');
 
1705
 
 
1706
            yyunput (';', octave_text);
 
1707
          }
 
1708
 
 
1709
        lexer_flags.quote_is_transpose = false;
 
1710
        lexer_flags.convert_spaces_to_comma = true;
 
1711
 
 
1712
        maybe_warn_separator_insert (',');
 
1713
 
 
1714
        COUNT_TOK_AND_RETURN (',');
 
1715
      }
 
1716
  }
 
1717
        YY_BREAK
 
1718
 
 
1719
// Semicolons are handled as row seprators in matrix constants.  If we
 
1720
// don't eat whitespace here we can end up inserting too many
 
1721
// semicolons.
 
1722
 
 
1723
case 11:
 
1724
/* rule 11 can match eol */
 
1725
YY_RULE_SETUP
 
1726
#line 439 "lex.l"
 
1727
{
 
1728
    scan_for_comments (octave_text);
 
1729
    fixup_column_count (octave_text);
 
1730
    eat_whitespace ();
 
1731
    lexer_flags.quote_is_transpose = false;
 
1732
    lexer_flags.convert_spaces_to_comma = true;
 
1733
    COUNT_TOK_AND_RETURN (';');
 
1734
  }
 
1735
        YY_BREAK
 
1736
 
 
1737
// In some cases, new lines can also become row separators.  If we
 
1738
// don't eat whitespace here we can end up inserting too many
 
1739
// semicolons.
 
1740
 
 
1741
case 12:
 
1742
/* rule 12 can match eol */
 
1743
#line 455 "lex.l"
 
1744
case 13:
 
1745
/* rule 13 can match eol */
 
1746
YY_RULE_SETUP
 
1747
#line 455 "lex.l"
 
1748
{
 
1749
    scan_for_comments (octave_text);
 
1750
    fixup_column_count (octave_text);
 
1751
    eat_whitespace ();
 
1752
 
 
1753
    lexer_flags.quote_is_transpose = false;
 
1754
    lexer_flags.convert_spaces_to_comma = true;
 
1755
 
 
1756
    if (nesting_level.none ())
 
1757
      return LEXICAL_ERROR;
 
1758
 
 
1759
    if (nesting_level.is_bracket_or_brace ())
 
1760
      {
 
1761
        maybe_warn_separator_insert (';');
 
1762
 
 
1763
        COUNT_TOK_AND_RETURN (';');
 
1764
      }
 
1765
  }
 
1766
        YY_BREAK
 
1767
case 14:
 
1768
YY_RULE_SETUP
 
1769
#line 474 "lex.l"
 
1770
{
 
1771
    nesting_level.bracket ();
 
1772
 
 
1773
    current_input_column += octave_leng;
 
1774
    lexer_flags.quote_is_transpose = false;
 
1775
    lexer_flags.convert_spaces_to_comma = true;
 
1776
 
 
1777
    if (lexer_flags.defining_func && ! lexer_flags.parsed_function_name)
 
1778
      lexer_flags.looking_at_return_list = true;
 
1779
    else
 
1780
      lexer_flags.looking_at_matrix_or_assign_lhs = true;
 
1781
 
 
1782
    promptflag--;
 
1783
    eat_whitespace ();
 
1784
 
 
1785
    lexer_flags.bracketflag++;
 
1786
    BEGIN (MATRIX_START);
 
1787
    COUNT_TOK_AND_RETURN ('[');
 
1788
  }
 
1789
        YY_BREAK
 
1790
case 15:
 
1791
YY_RULE_SETUP
 
1792
#line 494 "lex.l"
 
1793
{
 
1794
    nesting_level.remove ();
 
1795
 
 
1796
    TOK_RETURN (']');
 
1797
  }
 
1798
        YY_BREAK
 
1799
 
 
1800
// Imaginary numbers.
 
1801
 
 
1802
case 16:
 
1803
YY_RULE_SETUP
 
1804
#line 504 "lex.l"
 
1805
{
 
1806
    handle_number ();
 
1807
    COUNT_TOK_AND_RETURN (IMAG_NUM);
 
1808
  }
 
1809
        YY_BREAK
 
1810
 
 
1811
// Real numbers.  Don't grab the `.' part of a dot operator as part of
 
1812
// the constant.
 
1813
 
 
1814
case 17:
 
1815
*yy_cp = (yy_hold_char); /* undo effects of setting up octave_text */
 
1816
(yy_c_buf_p) = yy_cp -= 2;
 
1817
YY_DO_BEFORE_ACTION; /* set up octave_text again */
 
1818
#line 515 "lex.l"
 
1819
case 18:
 
1820
YY_RULE_SETUP
 
1821
#line 515 "lex.l"
 
1822
{
 
1823
    handle_number ();
 
1824
    COUNT_TOK_AND_RETURN (NUM);
 
1825
  }
 
1826
        YY_BREAK
 
1827
 
 
1828
// Eat whitespace.  Whitespace inside matrix constants is handled by
 
1829
// the <MATRIX_START> start state code above.
 
1830
 
 
1831
case 19:
 
1832
YY_RULE_SETUP
 
1833
#line 525 "lex.l"
 
1834
{
 
1835
    current_input_column += octave_leng;
 
1836
  }
 
1837
        YY_BREAK
 
1838
 
 
1839
// Continuation lines.  Allow comments after continuations.
 
1840
 
 
1841
case 20:
 
1842
/* rule 20 can match eol */
 
1843
#line 534 "lex.l"
 
1844
case 21:
 
1845
/* rule 21 can match eol */
 
1846
YY_RULE_SETUP
 
1847
#line 534 "lex.l"
 
1848
{
 
1849
    if (octave_text[0] == '\\')
 
1850
      gripe_matlab_incompatible_continuation ();
 
1851
    scan_for_comments (octave_text);
 
1852
    promptflag--;
 
1853
    current_input_column = 1;
 
1854
  }
 
1855
        YY_BREAK
 
1856
 
 
1857
// End of file.
 
1858
 
 
1859
case YY_STATE_EOF(INITIAL):
 
1860
case YY_STATE_EOF(COMMAND_START):
 
1861
case YY_STATE_EOF(MATRIX_START):
 
1862
case YY_STATE_EOF(NESTED_FUNCTION_END):
 
1863
case YY_STATE_EOF(NESTED_FUNCTION_BEGIN):
 
1864
#line 546 "lex.l"
 
1865
{
 
1866
    TOK_RETURN (END_OF_INPUT);
 
1867
  }
 
1868
        YY_BREAK
 
1869
 
 
1870
// Identifiers.  Truncate the token at the first space or tab but
 
1871
// don't write directly on octave_text.
 
1872
 
 
1873
case 22:
 
1874
YY_RULE_SETUP
 
1875
#line 555 "lex.l"
 
1876
{
 
1877
    int id_tok = handle_identifier ();
 
1878
 
 
1879
    if (id_tok >= 0)
 
1880
      COUNT_TOK_AND_RETURN (id_tok);
 
1881
  }
 
1882
        YY_BREAK
 
1883
 
 
1884
// Function handles.
 
1885
 
 
1886
case 23:
 
1887
YY_RULE_SETUP
 
1888
#line 566 "lex.l"
 
1889
{
 
1890
    current_input_column++;
 
1891
    lexer_flags.quote_is_transpose = false;
 
1892
    lexer_flags.convert_spaces_to_comma = false;
 
1893
    lexer_flags.looking_at_function_handle++;
 
1894
    COUNT_TOK_AND_RETURN ('@');
 
1895
  }
 
1896
        YY_BREAK
 
1897
 
 
1898
// A new line character.  New line characters inside matrix constants
 
1899
// are handled by the <MATRIX_START> start state code above.  If closest
 
1900
// nesting is inside parentheses, don't return a row separator.
 
1901
 
 
1902
case 24:
 
1903
/* rule 24 can match eol */
 
1904
YY_RULE_SETUP
 
1905
#line 580 "lex.l"
 
1906
{
 
1907
    current_input_column = 1;
 
1908
    lexer_flags.quote_is_transpose = false;
 
1909
    lexer_flags.convert_spaces_to_comma = true;
 
1910
    if (nesting_level.none ())
 
1911
      COUNT_TOK_AND_RETURN ('\n');
 
1912
    else if (nesting_level.is_paren ())
 
1913
      gripe_matlab_incompatible ("bare newline inside parentheses");
 
1914
    else if (nesting_level.is_bracket_or_brace ())
 
1915
      return LEXICAL_ERROR;
 
1916
  }
 
1917
        YY_BREAK
 
1918
 
 
1919
// Single quote can either be the beginning of a string or a transpose
 
1920
// operator. 
 
1921
 
 
1922
case 25:
 
1923
YY_RULE_SETUP
 
1924
#line 597 "lex.l"
 
1925
{
 
1926
    current_input_column++;
 
1927
    lexer_flags.convert_spaces_to_comma = true;
 
1928
 
 
1929
    if (lexer_flags.quote_is_transpose)
 
1930
      {
 
1931
        do_comma_insert_check ();
 
1932
        COUNT_TOK_AND_RETURN (QUOTE);
 
1933
      }
 
1934
    else
 
1935
      COUNT_TOK_AND_RETURN (handle_string ('\''));
 
1936
  }
 
1937
        YY_BREAK
 
1938
 
 
1939
// Double quotes always begin strings.
 
1940
 
 
1941
case 26:
 
1942
YY_RULE_SETUP
 
1943
#line 614 "lex.l"
 
1944
{
 
1945
    current_input_column++;
 
1946
    COUNT_TOK_AND_RETURN (handle_string ('"'));
 
1947
}
 
1948
        YY_BREAK
 
1949
 
 
1950
// Gobble comments.  If closest nesting is inside parentheses, don't
 
1951
// return a new line.
 
1952
 
 
1953
case 27:
 
1954
YY_RULE_SETUP
 
1955
#line 624 "lex.l"
 
1956
{
 
1957
    std::string help_txt;
 
1958
 
 
1959
    if (! help_buf.empty ())
 
1960
      help_txt = help_buf.top ();
 
1961
 
 
1962
    if (help_txt.empty ()
 
1963
        && lexer_flags.beginning_of_function
 
1964
        && nesting_level.none ())
 
1965
      {
 
1966
        lexer_flags.beginning_of_function = false;
 
1967
 
 
1968
        std::string txt = grab_help_text ();
 
1969
 
 
1970
        if (! help_buf.empty ())
 
1971
          help_buf.pop ();
 
1972
 
 
1973
        help_buf.push (txt);
 
1974
 
 
1975
        octave_comment_buffer::append (txt);
 
1976
      }
 
1977
    else
 
1978
      {
 
1979
        std::string buf;
 
1980
 
 
1981
        bool begin_comment = true;
 
1982
 
 
1983
        int c;
 
1984
        while ((c = yyinput ()) != EOF && c != '\n')
 
1985
          {
 
1986
            if (begin_comment && (c == '#' || c == '%'))
 
1987
              ; /* Skip leading comment characters. */
 
1988
            else
 
1989
              buf += static_cast<char> (c);
 
1990
          }
 
1991
 
 
1992
        octave_comment_buffer::append (buf);
 
1993
      }
 
1994
 
 
1995
    current_input_column = 1;
 
1996
    lexer_flags.quote_is_transpose = false;
 
1997
    lexer_flags.convert_spaces_to_comma = true;
 
1998
 
 
1999
    maybe_gripe_matlab_incompatible_comment (octave_text[0]);
 
2000
 
 
2001
    if (YY_START == COMMAND_START)
 
2002
      BEGIN (INITIAL);
 
2003
 
 
2004
    if (nesting_level.none ())
 
2005
      {
 
2006
        lexer_flags.doing_rawcommand = false;
 
2007
        COUNT_TOK_AND_RETURN ('\n');
 
2008
      }
 
2009
    else if (nesting_level.is_bracket_or_brace ())
 
2010
      COUNT_TOK_AND_RETURN (';');
 
2011
  }
 
2012
        YY_BREAK
 
2013
 
 
2014
// Other operators.
 
2015
 
 
2016
case 28:
 
2017
YY_RULE_SETUP
 
2018
#line 685 "lex.l"
 
2019
{ BIN_OP_RETURN (':', false); }
 
2020
        YY_BREAK
 
2021
case 29:
 
2022
YY_RULE_SETUP
 
2023
#line 687 "lex.l"
 
2024
{ XBIN_OP_RETURN (EPLUS, false); }
 
2025
        YY_BREAK
 
2026
case 30:
 
2027
YY_RULE_SETUP
 
2028
#line 688 "lex.l"
 
2029
{ XBIN_OP_RETURN (EMINUS, false); }
 
2030
        YY_BREAK
 
2031
case 31:
 
2032
YY_RULE_SETUP
 
2033
#line 689 "lex.l"
 
2034
{ BIN_OP_RETURN (EMUL, false); }
 
2035
        YY_BREAK
 
2036
case 32:
 
2037
YY_RULE_SETUP
 
2038
#line 690 "lex.l"
 
2039
{ BIN_OP_RETURN (EDIV, false); }
 
2040
        YY_BREAK
 
2041
case 33:
 
2042
YY_RULE_SETUP
 
2043
#line 691 "lex.l"
 
2044
{ BIN_OP_RETURN (ELEFTDIV, false); }
 
2045
        YY_BREAK
 
2046
case 34:
 
2047
YY_RULE_SETUP
 
2048
#line 692 "lex.l"
 
2049
{ BIN_OP_RETURN (EPOW, false); }
 
2050
        YY_BREAK
 
2051
case 35:
 
2052
YY_RULE_SETUP
 
2053
#line 693 "lex.l"
 
2054
{ XBIN_OP_RETURN (EPOW, false); }
 
2055
        YY_BREAK
 
2056
case 36:
 
2057
YY_RULE_SETUP
 
2058
#line 694 "lex.l"
 
2059
{ do_comma_insert_check (); BIN_OP_RETURN (TRANSPOSE, true); }
 
2060
        YY_BREAK
 
2061
case 37:
 
2062
YY_RULE_SETUP
 
2063
#line 695 "lex.l"
 
2064
{ do_comma_insert_check (); XBIN_OP_RETURN (PLUS_PLUS, true); }
 
2065
        YY_BREAK
 
2066
case 38:
 
2067
YY_RULE_SETUP
 
2068
#line 696 "lex.l"
 
2069
{ do_comma_insert_check (); XBIN_OP_RETURN (MINUS_MINUS, true); }
 
2070
        YY_BREAK
 
2071
case 39:
 
2072
YY_RULE_SETUP
 
2073
#line 697 "lex.l"
 
2074
{ BIN_OP_RETURN (EXPR_LE, false); }
 
2075
        YY_BREAK
 
2076
case 40:
 
2077
YY_RULE_SETUP
 
2078
#line 698 "lex.l"
 
2079
{ BIN_OP_RETURN (EXPR_EQ, false); }
 
2080
        YY_BREAK
 
2081
case 41:
 
2082
YY_RULE_SETUP
 
2083
#line 699 "lex.l"
 
2084
{ BIN_OP_RETURN (EXPR_NE, false); }
 
2085
        YY_BREAK
 
2086
case 42:
 
2087
YY_RULE_SETUP
 
2088
#line 700 "lex.l"
 
2089
{ XBIN_OP_RETURN (EXPR_NE, false); }
 
2090
        YY_BREAK
 
2091
case 43:
 
2092
YY_RULE_SETUP
 
2093
#line 701 "lex.l"
 
2094
{ BIN_OP_RETURN (EXPR_GE, false); }
 
2095
        YY_BREAK
 
2096
case 44:
 
2097
YY_RULE_SETUP
 
2098
#line 702 "lex.l"
 
2099
{ BIN_OP_RETURN (EXPR_AND, false); }
 
2100
        YY_BREAK
 
2101
case 45:
 
2102
YY_RULE_SETUP
 
2103
#line 703 "lex.l"
 
2104
{ BIN_OP_RETURN (EXPR_OR, false); }
 
2105
        YY_BREAK
 
2106
case 46:
 
2107
YY_RULE_SETUP
 
2108
#line 704 "lex.l"
 
2109
{ BIN_OP_RETURN (EXPR_LT, false); }
 
2110
        YY_BREAK
 
2111
case 47:
 
2112
YY_RULE_SETUP
 
2113
#line 705 "lex.l"
 
2114
{ BIN_OP_RETURN (EXPR_GT, false); }
 
2115
        YY_BREAK
 
2116
case 48:
 
2117
YY_RULE_SETUP
 
2118
#line 706 "lex.l"
 
2119
{ BIN_OP_RETURN ('+', false); }
 
2120
        YY_BREAK
 
2121
case 49:
 
2122
YY_RULE_SETUP
 
2123
#line 707 "lex.l"
 
2124
{ BIN_OP_RETURN ('-', false); }
 
2125
        YY_BREAK
 
2126
case 50:
 
2127
YY_RULE_SETUP
 
2128
#line 708 "lex.l"
 
2129
{ BIN_OP_RETURN ('*', false); }
 
2130
        YY_BREAK
 
2131
case 51:
 
2132
YY_RULE_SETUP
 
2133
#line 709 "lex.l"
 
2134
{ BIN_OP_RETURN ('/', false); }
 
2135
        YY_BREAK
 
2136
case 52:
 
2137
YY_RULE_SETUP
 
2138
#line 710 "lex.l"
 
2139
{ BIN_OP_RETURN (LEFTDIV, false); }
 
2140
        YY_BREAK
 
2141
case 53:
 
2142
YY_RULE_SETUP
 
2143
#line 711 "lex.l"
 
2144
{ BIN_OP_RETURN (';', true); }
 
2145
        YY_BREAK
 
2146
case 54:
 
2147
YY_RULE_SETUP
 
2148
#line 712 "lex.l"
 
2149
{ BIN_OP_RETURN (',', true); }
 
2150
        YY_BREAK
 
2151
case 55:
 
2152
YY_RULE_SETUP
 
2153
#line 713 "lex.l"
 
2154
{ BIN_OP_RETURN (POW, false); }
 
2155
        YY_BREAK
 
2156
case 56:
 
2157
YY_RULE_SETUP
 
2158
#line 714 "lex.l"
 
2159
{ XBIN_OP_RETURN (POW, false); }
 
2160
        YY_BREAK
 
2161
case 57:
 
2162
YY_RULE_SETUP
 
2163
#line 715 "lex.l"
 
2164
{ BIN_OP_RETURN ('=', true); }
 
2165
        YY_BREAK
 
2166
case 58:
 
2167
YY_RULE_SETUP
 
2168
#line 716 "lex.l"
 
2169
{ BIN_OP_RETURN (EXPR_AND_AND, false); }
 
2170
        YY_BREAK
 
2171
case 59:
 
2172
YY_RULE_SETUP
 
2173
#line 717 "lex.l"
 
2174
{ BIN_OP_RETURN (EXPR_OR_OR, false); }
 
2175
        YY_BREAK
 
2176
case 60:
 
2177
YY_RULE_SETUP
 
2178
#line 718 "lex.l"
 
2179
{ XBIN_OP_RETURN (LSHIFT, false); }
 
2180
        YY_BREAK
 
2181
case 61:
 
2182
YY_RULE_SETUP
 
2183
#line 719 "lex.l"
 
2184
{ XBIN_OP_RETURN (RSHIFT, false); }
 
2185
        YY_BREAK
 
2186
case 62:
 
2187
YY_RULE_SETUP
 
2188
#line 721 "lex.l"
 
2189
{
 
2190
    if (octave_text[0] == '~')
 
2191
      BIN_OP_RETURN (EXPR_NOT, false);
 
2192
    else
 
2193
      XBIN_OP_RETURN (EXPR_NOT, false);
 
2194
  }
 
2195
        YY_BREAK
 
2196
case 63:
 
2197
YY_RULE_SETUP
 
2198
#line 728 "lex.l"
 
2199
{
 
2200
    lexer_flags.looking_at_indirect_ref = false;
 
2201
    nesting_level.paren ();
 
2202
    promptflag--;
 
2203
    TOK_RETURN ('(');
 
2204
  }
 
2205
        YY_BREAK
 
2206
case 64:
 
2207
YY_RULE_SETUP
 
2208
#line 735 "lex.l"
 
2209
{
 
2210
    nesting_level.remove ();
 
2211
    current_input_column++;
 
2212
    lexer_flags.quote_is_transpose = true;
 
2213
    lexer_flags.convert_spaces_to_comma = nesting_level.is_bracket_or_brace ();
 
2214
    do_comma_insert_check ();
 
2215
    COUNT_TOK_AND_RETURN (')');
 
2216
  }
 
2217
        YY_BREAK
 
2218
case 65:
 
2219
YY_RULE_SETUP
 
2220
#line 744 "lex.l"
 
2221
{ TOK_RETURN ('.'); }
 
2222
        YY_BREAK
 
2223
case 66:
 
2224
YY_RULE_SETUP
 
2225
#line 746 "lex.l"
 
2226
{ XBIN_OP_RETURN (ADD_EQ, false); }
 
2227
        YY_BREAK
 
2228
case 67:
 
2229
YY_RULE_SETUP
 
2230
#line 747 "lex.l"
 
2231
{ XBIN_OP_RETURN (SUB_EQ, false); }
 
2232
        YY_BREAK
 
2233
case 68:
 
2234
YY_RULE_SETUP
 
2235
#line 748 "lex.l"
 
2236
{ XBIN_OP_RETURN (MUL_EQ, false); }
 
2237
        YY_BREAK
 
2238
case 69:
 
2239
YY_RULE_SETUP
 
2240
#line 749 "lex.l"
 
2241
{ XBIN_OP_RETURN (DIV_EQ, false); }
 
2242
        YY_BREAK
 
2243
case 70:
 
2244
YY_RULE_SETUP
 
2245
#line 750 "lex.l"
 
2246
{ XBIN_OP_RETURN (LEFTDIV_EQ, false); }
 
2247
        YY_BREAK
 
2248
case 71:
 
2249
YY_RULE_SETUP
 
2250
#line 751 "lex.l"
 
2251
{ XBIN_OP_RETURN (ADD_EQ, false); }
 
2252
        YY_BREAK
 
2253
case 72:
 
2254
YY_RULE_SETUP
 
2255
#line 752 "lex.l"
 
2256
{ XBIN_OP_RETURN (SUB_EQ, false); }
 
2257
        YY_BREAK
 
2258
case 73:
 
2259
YY_RULE_SETUP
 
2260
#line 753 "lex.l"
 
2261
{ XBIN_OP_RETURN (EMUL_EQ, false); }
 
2262
        YY_BREAK
 
2263
case 74:
 
2264
YY_RULE_SETUP
 
2265
#line 754 "lex.l"
 
2266
{ XBIN_OP_RETURN (EDIV_EQ, false); }
 
2267
        YY_BREAK
 
2268
case 75:
 
2269
YY_RULE_SETUP
 
2270
#line 755 "lex.l"
 
2271
{ XBIN_OP_RETURN (ELEFTDIV_EQ, false); }
 
2272
        YY_BREAK
 
2273
case 76:
 
2274
YY_RULE_SETUP
 
2275
#line 756 "lex.l"
 
2276
{ XBIN_OP_RETURN (POW_EQ, false); }
 
2277
        YY_BREAK
 
2278
case 77:
 
2279
YY_RULE_SETUP
 
2280
#line 757 "lex.l"
 
2281
{ XBIN_OP_RETURN (EPOW_EQ, false); }
 
2282
        YY_BREAK
 
2283
case 78:
 
2284
YY_RULE_SETUP
 
2285
#line 758 "lex.l"
 
2286
{ XBIN_OP_RETURN (AND_EQ, false); }
 
2287
        YY_BREAK
 
2288
case 79:
 
2289
YY_RULE_SETUP
 
2290
#line 759 "lex.l"
 
2291
{ XBIN_OP_RETURN (OR_EQ, false); }
 
2292
        YY_BREAK
 
2293
case 80:
 
2294
YY_RULE_SETUP
 
2295
#line 760 "lex.l"
 
2296
{ XBIN_OP_RETURN (LSHIFT_EQ, false); }
 
2297
        YY_BREAK
 
2298
case 81:
 
2299
YY_RULE_SETUP
 
2300
#line 761 "lex.l"
 
2301
{ XBIN_OP_RETURN (RSHIFT_EQ, false); }
 
2302
        YY_BREAK
 
2303
case 82:
 
2304
YY_RULE_SETUP
 
2305
#line 763 "lex.l"
 
2306
{
 
2307
    nesting_level.brace ();
 
2308
 
 
2309
    current_input_column += octave_leng;
 
2310
    lexer_flags.quote_is_transpose = false;
 
2311
    lexer_flags.convert_spaces_to_comma = true;
 
2312
 
 
2313
    promptflag--;
 
2314
    eat_whitespace ();
 
2315
 
 
2316
    lexer_flags.braceflag++;
 
2317
    BEGIN (MATRIX_START);
 
2318
    COUNT_TOK_AND_RETURN ('{');
 
2319
  }
 
2320
        YY_BREAK
 
2321
case 83:
 
2322
YY_RULE_SETUP
 
2323
#line 778 "lex.l"
 
2324
{
 
2325
    nesting_level.remove ();
 
2326
 
 
2327
    TOK_RETURN ('}');
 
2328
  }
 
2329
        YY_BREAK
 
2330
 
 
2331
// Unrecognized input is a lexical error.
 
2332
 
 
2333
case 84:
 
2334
YY_RULE_SETUP
 
2335
#line 788 "lex.l"
 
2336
{
 
2337
    // EOF happens here if we are parsing nested functions.
 
2338
 
 
2339
    yyunput (octave_text[0], octave_text);
 
2340
 
 
2341
    int c = yyinput ();
 
2342
 
 
2343
    if (c != EOF)
 
2344
      {
 
2345
        current_input_column++;
 
2346
 
 
2347
        error ("invalid character `%s' (ASCII %d) near line %d, column %d",
 
2348
               undo_string_escape (static_cast<char> (c)), c,
 
2349
               input_line_number, current_input_column);
 
2350
 
 
2351
        return LEXICAL_ERROR;
 
2352
      }
 
2353
    else
 
2354
      TOK_RETURN (END_OF_INPUT);
 
2355
  }
 
2356
        YY_BREAK
 
2357
case 85:
 
2358
YY_RULE_SETUP
 
2359
#line 809 "lex.l"
 
2360
ECHO;
 
2361
        YY_BREAK
 
2362
#line 2363 "<stdout>"
 
2363
 
 
2364
        case YY_END_OF_BUFFER:
 
2365
                {
 
2366
                /* Amount of text matched not including the EOB char. */
 
2367
                int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
 
2368
 
 
2369
                /* Undo the effects of YY_DO_BEFORE_ACTION. */
 
2370
                *yy_cp = (yy_hold_char);
 
2371
                YY_RESTORE_YY_MORE_OFFSET
 
2372
 
 
2373
                if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
 
2374
                        {
 
2375
                        /* We're scanning a new file or input source.  It's
 
2376
                         * possible that this happened because the user
 
2377
                         * just pointed octave_in at a new source and called
 
2378
                         * octave_lex().  If so, then we have to assure
 
2379
                         * consistency between YY_CURRENT_BUFFER and our
 
2380
                         * globals.  Here is the right place to do so, because
 
2381
                         * this is the first action (other than possibly a
 
2382
                         * back-up) that will match for the new input source.
 
2383
                         */
 
2384
                        (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
 
2385
                        YY_CURRENT_BUFFER_LVALUE->yy_input_file = octave_in;
 
2386
                        YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
 
2387
                        }
 
2388
 
 
2389
                /* Note that here we test for yy_c_buf_p "<=" to the position
 
2390
                 * of the first EOB in the buffer, since yy_c_buf_p will
 
2391
                 * already have been incremented past the NUL character
 
2392
                 * (since all states make transitions on EOB to the
 
2393
                 * end-of-buffer state).  Contrast this with the test
 
2394
                 * in input().
 
2395
                 */
 
2396
                if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
 
2397
                        { /* This was really a NUL. */
 
2398
                        yy_state_type yy_next_state;
 
2399
 
 
2400
                        (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
 
2401
 
 
2402
                        yy_current_state = yy_get_previous_state(  );
 
2403
 
 
2404
                        /* Okay, we're now positioned to make the NUL
 
2405
                         * transition.  We couldn't have
 
2406
                         * yy_get_previous_state() go ahead and do it
 
2407
                         * for us because it doesn't know how to deal
 
2408
                         * with the possibility of jamming (and we don't
 
2409
                         * want to build jamming into it because then it
 
2410
                         * will run more slowly).
 
2411
                         */
 
2412
 
 
2413
                        yy_next_state = yy_try_NUL_trans( yy_current_state );
 
2414
 
 
2415
                        yy_bp = (yytext_ptr) + YY_MORE_ADJ;
 
2416
 
 
2417
                        if ( yy_next_state )
 
2418
                                {
 
2419
                                /* Consume the NUL. */
 
2420
                                yy_cp = ++(yy_c_buf_p);
 
2421
                                yy_current_state = yy_next_state;
 
2422
                                goto yy_match;
 
2423
                                }
 
2424
 
 
2425
                        else
 
2426
                                {
 
2427
                                yy_cp = (yy_c_buf_p);
 
2428
                                goto yy_find_action;
 
2429
                                }
 
2430
                        }
 
2431
 
 
2432
                else switch ( yy_get_next_buffer(  ) )
 
2433
                        {
 
2434
                        case EOB_ACT_END_OF_FILE:
 
2435
                                {
 
2436
                                (yy_did_buffer_switch_on_eof) = 0;
 
2437
 
 
2438
                                if ( octave_wrap( ) )
 
2439
                                        {
 
2440
                                        /* Note: because we've taken care in
 
2441
                                         * yy_get_next_buffer() to have set up
 
2442
                                         * octave_text, we can now set up
 
2443
                                         * yy_c_buf_p so that if some total
 
2444
                                         * hoser (like flex itself) wants to
 
2445
                                         * call the scanner after we return the
 
2446
                                         * YY_NULL, it'll still work - another
 
2447
                                         * YY_NULL will get returned.
 
2448
                                         */
 
2449
                                        (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
 
2450
 
 
2451
                                        yy_act = YY_STATE_EOF(YY_START);
 
2452
                                        goto do_action;
 
2453
                                        }
 
2454
 
 
2455
                                else
 
2456
                                        {
 
2457
                                        if ( ! (yy_did_buffer_switch_on_eof) )
 
2458
                                                YY_NEW_FILE;
 
2459
                                        }
 
2460
                                break;
 
2461
                                }
 
2462
 
 
2463
                        case EOB_ACT_CONTINUE_SCAN:
 
2464
                                (yy_c_buf_p) =
 
2465
                                        (yytext_ptr) + yy_amount_of_matched_text;
 
2466
 
 
2467
                                yy_current_state = yy_get_previous_state(  );
 
2468
 
 
2469
                                yy_cp = (yy_c_buf_p);
 
2470
                                yy_bp = (yytext_ptr) + YY_MORE_ADJ;
 
2471
                                goto yy_match;
 
2472
 
 
2473
                        case EOB_ACT_LAST_MATCH:
 
2474
                                (yy_c_buf_p) =
 
2475
                                &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
 
2476
 
 
2477
                                yy_current_state = yy_get_previous_state(  );
 
2478
 
 
2479
                                yy_cp = (yy_c_buf_p);
 
2480
                                yy_bp = (yytext_ptr) + YY_MORE_ADJ;
 
2481
                                goto yy_find_action;
 
2482
                        }
 
2483
                break;
 
2484
                }
 
2485
 
 
2486
        default:
 
2487
                YY_FATAL_ERROR(
 
2488
                        "fatal flex scanner internal error--no action found" );
 
2489
        } /* end of action switch */
 
2490
                } /* end of scanning one token */
 
2491
} /* end of octave_lex */
 
2492
 
 
2493
/* yy_get_next_buffer - try to read in a new buffer
 
2494
 *
 
2495
 * Returns a code representing an action:
 
2496
 *      EOB_ACT_LAST_MATCH -
 
2497
 *      EOB_ACT_CONTINUE_SCAN - continue scanning from current position
 
2498
 *      EOB_ACT_END_OF_FILE - end of file
 
2499
 */
 
2500
static int yy_get_next_buffer (void)
 
2501
{
 
2502
        register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
 
2503
        register char *source = (yytext_ptr);
 
2504
        register int number_to_move, i;
 
2505
        int ret_val;
 
2506
 
 
2507
        if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
 
2508
                YY_FATAL_ERROR(
 
2509
                "fatal flex scanner internal error--end of buffer missed" );
 
2510
 
 
2511
        if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
 
2512
                { /* Don't try to fill the buffer, so this is an EOF. */
 
2513
                if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
 
2514
                        {
 
2515
                        /* We matched a single character, the EOB, so
 
2516
                         * treat this as a final EOF.
 
2517
                         */
 
2518
                        return EOB_ACT_END_OF_FILE;
 
2519
                        }
 
2520
 
 
2521
                else
 
2522
                        {
 
2523
                        /* We matched some text prior to the EOB, first
 
2524
                         * process it.
 
2525
                         */
 
2526
                        return EOB_ACT_LAST_MATCH;
 
2527
                        }
 
2528
                }
 
2529
 
 
2530
        /* Try to read more data. */
 
2531
 
 
2532
        /* First move last chars to start of buffer. */
 
2533
        number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;
 
2534
 
 
2535
        for ( i = 0; i < number_to_move; ++i )
 
2536
                *(dest++) = *(source++);
 
2537
 
 
2538
        if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
 
2539
                /* don't do the read, it's not guaranteed to return an EOF,
 
2540
                 * just force an EOF
 
2541
                 */
 
2542
                YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
 
2543
 
 
2544
        else
 
2545
                {
 
2546
                        int num_to_read =
 
2547
                        YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
 
2548
 
 
2549
                while ( num_to_read <= 0 )
 
2550
                        { /* Not enough room in the buffer - grow it. */
 
2551
 
 
2552
                        /* just a shorter name for the current buffer */
 
2553
                        YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
 
2554
 
 
2555
                        int yy_c_buf_p_offset =
 
2556
                                (int) ((yy_c_buf_p) - b->yy_ch_buf);
 
2557
 
 
2558
                        if ( b->yy_is_our_buffer )
 
2559
                                {
 
2560
                                int new_size = b->yy_buf_size * 2;
 
2561
 
 
2562
                                if ( new_size <= 0 )
 
2563
                                        b->yy_buf_size += b->yy_buf_size / 8;
 
2564
                                else
 
2565
                                        b->yy_buf_size *= 2;
 
2566
 
 
2567
                                b->yy_ch_buf = (char *)
 
2568
                                        /* Include room in for 2 EOB chars. */
 
2569
                                        octave_realloc((void *) b->yy_ch_buf,b->yy_buf_size + 2  );
 
2570
                                }
 
2571
                        else
 
2572
                                /* Can't grow it, we don't own it. */
 
2573
                                b->yy_ch_buf = 0;
 
2574
 
 
2575
                        if ( ! b->yy_ch_buf )
 
2576
                                YY_FATAL_ERROR(
 
2577
                                "fatal error - scanner input buffer overflow" );
 
2578
 
 
2579
                        (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
 
2580
 
 
2581
                        num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
 
2582
                                                number_to_move - 1;
 
2583
 
 
2584
                        }
 
2585
 
 
2586
                if ( num_to_read > YY_READ_BUF_SIZE )
 
2587
                        num_to_read = YY_READ_BUF_SIZE;
 
2588
 
 
2589
                /* Read in more data. */
 
2590
                YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
 
2591
                        (yy_n_chars), (size_t) num_to_read );
 
2592
 
 
2593
                YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
 
2594
                }
 
2595
 
 
2596
        if ( (yy_n_chars) == 0 )
 
2597
                {
 
2598
                if ( number_to_move == YY_MORE_ADJ )
 
2599
                        {
 
2600
                        ret_val = EOB_ACT_END_OF_FILE;
 
2601
                        octave_restart(octave_in  );
 
2602
                        }
 
2603
 
 
2604
                else
 
2605
                        {
 
2606
                        ret_val = EOB_ACT_LAST_MATCH;
 
2607
                        YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
 
2608
                                YY_BUFFER_EOF_PENDING;
 
2609
                        }
 
2610
                }
 
2611
 
 
2612
        else
 
2613
                ret_val = EOB_ACT_CONTINUE_SCAN;
 
2614
 
 
2615
        (yy_n_chars) += number_to_move;
 
2616
        YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
 
2617
        YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
 
2618
 
 
2619
        (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
 
2620
 
 
2621
        return ret_val;
 
2622
}
 
2623
 
 
2624
/* yy_get_previous_state - get the state just before the EOB char was reached */
 
2625
 
 
2626
    static yy_state_type yy_get_previous_state (void)
 
2627
{
 
2628
        register yy_state_type yy_current_state;
 
2629
        register char *yy_cp;
 
2630
    
 
2631
        yy_current_state = (yy_start);
 
2632
 
 
2633
        for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
 
2634
                {
 
2635
                register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
 
2636
                if ( yy_accept[yy_current_state] )
 
2637
                        {
 
2638
                        (yy_last_accepting_state) = yy_current_state;
 
2639
                        (yy_last_accepting_cpos) = yy_cp;
 
2640
                        }
 
2641
                while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
 
2642
                        {
 
2643
                        yy_current_state = (int) yy_def[yy_current_state];
 
2644
                        if ( yy_current_state >= 433 )
 
2645
                                yy_c = yy_meta[(unsigned int) yy_c];
 
2646
                        }
 
2647
                yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
 
2648
                }
 
2649
 
 
2650
        return yy_current_state;
 
2651
}
 
2652
 
 
2653
/* yy_try_NUL_trans - try to make a transition on the NUL character
 
2654
 *
 
2655
 * synopsis
 
2656
 *      next_state = yy_try_NUL_trans( current_state );
 
2657
 */
 
2658
    static yy_state_type yy_try_NUL_trans  (yy_state_type yy_current_state )
 
2659
{
 
2660
        register int yy_is_jam;
 
2661
        register char *yy_cp = (yy_c_buf_p);
 
2662
 
 
2663
        register YY_CHAR yy_c = 1;
 
2664
        if ( yy_accept[yy_current_state] )
 
2665
                {
 
2666
                (yy_last_accepting_state) = yy_current_state;
 
2667
                (yy_last_accepting_cpos) = yy_cp;
 
2668
                }
 
2669
        while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
 
2670
                {
 
2671
                yy_current_state = (int) yy_def[yy_current_state];
 
2672
                if ( yy_current_state >= 433 )
 
2673
                        yy_c = yy_meta[(unsigned int) yy_c];
 
2674
                }
 
2675
        yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
 
2676
        yy_is_jam = (yy_current_state == 432);
 
2677
 
 
2678
        return yy_is_jam ? 0 : yy_current_state;
 
2679
}
 
2680
 
 
2681
    static void yyunput (int c, register char * yy_bp )
 
2682
{
 
2683
        register char *yy_cp;
 
2684
    
 
2685
    yy_cp = (yy_c_buf_p);
 
2686
 
 
2687
        /* undo effects of setting up octave_text */
 
2688
        *yy_cp = (yy_hold_char);
 
2689
 
 
2690
        if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
 
2691
                { /* need to shift things up to make room */
 
2692
                /* +2 for EOB chars. */
 
2693
                register int number_to_move = (yy_n_chars) + 2;
 
2694
                register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
 
2695
                                        YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
 
2696
                register char *source =
 
2697
                                &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
 
2698
 
 
2699
                while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
 
2700
                        *--dest = *--source;
 
2701
 
 
2702
                yy_cp += (int) (dest - source);
 
2703
                yy_bp += (int) (dest - source);
 
2704
                YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
 
2705
                        (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
 
2706
 
 
2707
                if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
 
2708
                        YY_FATAL_ERROR( "flex scanner push-back overflow" );
 
2709
                }
 
2710
 
 
2711
        *--yy_cp = (char) c;
 
2712
 
 
2713
        (yytext_ptr) = yy_bp;
 
2714
        (yy_hold_char) = *yy_cp;
 
2715
        (yy_c_buf_p) = yy_cp;
 
2716
}
 
2717
 
 
2718
#ifndef YY_NO_INPUT
 
2719
#ifdef __cplusplus
 
2720
    static int yyinput (void)
 
2721
#else
 
2722
    static int input  (void)
 
2723
#endif
 
2724
 
 
2725
{
 
2726
        int c;
 
2727
    
 
2728
        *(yy_c_buf_p) = (yy_hold_char);
 
2729
 
 
2730
        if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
 
2731
                {
 
2732
                /* yy_c_buf_p now points to the character we want to return.
 
2733
                 * If this occurs *before* the EOB characters, then it's a
 
2734
                 * valid NUL; if not, then we've hit the end of the buffer.
 
2735
                 */
 
2736
                if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
 
2737
                        /* This was really a NUL. */
 
2738
                        *(yy_c_buf_p) = '\0';
 
2739
 
 
2740
                else
 
2741
                        { /* need more input */
 
2742
                        int offset = (yy_c_buf_p) - (yytext_ptr);
 
2743
                        ++(yy_c_buf_p);
 
2744
 
 
2745
                        switch ( yy_get_next_buffer(  ) )
 
2746
                                {
 
2747
                                case EOB_ACT_LAST_MATCH:
 
2748
                                        /* This happens because yy_g_n_b()
 
2749
                                         * sees that we've accumulated a
 
2750
                                         * token and flags that we need to
 
2751
                                         * try matching the token before
 
2752
                                         * proceeding.  But for input(),
 
2753
                                         * there's no matching to consider.
 
2754
                                         * So convert the EOB_ACT_LAST_MATCH
 
2755
                                         * to EOB_ACT_END_OF_FILE.
 
2756
                                         */
 
2757
 
 
2758
                                        /* Reset buffer status. */
 
2759
                                        octave_restart(octave_in );
 
2760
 
 
2761
                                        /*FALLTHROUGH*/
 
2762
 
 
2763
                                case EOB_ACT_END_OF_FILE:
 
2764
                                        {
 
2765
                                        if ( octave_wrap( ) )
 
2766
                                                return EOF;
 
2767
 
 
2768
                                        if ( ! (yy_did_buffer_switch_on_eof) )
 
2769
                                                YY_NEW_FILE;
 
2770
#ifdef __cplusplus
 
2771
                                        return yyinput();
 
2772
#else
 
2773
                                        return input();
 
2774
#endif
 
2775
                                        }
 
2776
 
 
2777
                                case EOB_ACT_CONTINUE_SCAN:
 
2778
                                        (yy_c_buf_p) = (yytext_ptr) + offset;
 
2779
                                        break;
 
2780
                                }
 
2781
                        }
 
2782
                }
 
2783
 
 
2784
        c = *(unsigned char *) (yy_c_buf_p);    /* cast for 8-bit char's */
 
2785
        *(yy_c_buf_p) = '\0';   /* preserve octave_text */
 
2786
        (yy_hold_char) = *++(yy_c_buf_p);
 
2787
 
 
2788
        return c;
 
2789
}
 
2790
#endif  /* ifndef YY_NO_INPUT */
 
2791
 
 
2792
/** Immediately switch to a different input stream.
 
2793
 * @param input_file A readable stream.
 
2794
 * 
 
2795
 * @note This function does not reset the start condition to @c INITIAL .
 
2796
 */
 
2797
    void octave_restart  (FILE * input_file )
 
2798
{
 
2799
    
 
2800
        if ( ! YY_CURRENT_BUFFER ){
 
2801
        octave_ensure_buffer_stack ();
 
2802
                YY_CURRENT_BUFFER_LVALUE =
 
2803
            octave__create_buffer(octave_in,YY_BUF_SIZE );
 
2804
        }
 
2805
 
 
2806
        octave__init_buffer(YY_CURRENT_BUFFER,input_file );
 
2807
        octave__load_buffer_state( );
 
2808
}
 
2809
 
 
2810
/** Switch to a different input buffer.
 
2811
 * @param new_buffer The new input buffer.
 
2812
 * 
 
2813
 */
 
2814
    void octave__switch_to_buffer  (YY_BUFFER_STATE  new_buffer )
 
2815
{
 
2816
    
 
2817
        /* TODO. We should be able to replace this entire function body
 
2818
         * with
 
2819
         *              octave_pop_buffer_state();
 
2820
         *              octave_push_buffer_state(new_buffer);
 
2821
     */
 
2822
        octave_ensure_buffer_stack ();
 
2823
        if ( YY_CURRENT_BUFFER == new_buffer )
 
2824
                return;
 
2825
 
 
2826
        if ( YY_CURRENT_BUFFER )
 
2827
                {
 
2828
                /* Flush out information for old buffer. */
 
2829
                *(yy_c_buf_p) = (yy_hold_char);
 
2830
                YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
 
2831
                YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
 
2832
                }
 
2833
 
 
2834
        YY_CURRENT_BUFFER_LVALUE = new_buffer;
 
2835
        octave__load_buffer_state( );
 
2836
 
 
2837
        /* We don't actually know whether we did this switch during
 
2838
         * EOF (octave_wrap()) processing, but the only time this flag
 
2839
         * is looked at is after octave_wrap() is called, so it's safe
 
2840
         * to go ahead and always set it.
 
2841
         */
 
2842
        (yy_did_buffer_switch_on_eof) = 1;
 
2843
}
 
2844
 
 
2845
static void octave__load_buffer_state  (void)
 
2846
{
 
2847
        (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
 
2848
        (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
 
2849
        octave_in = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
 
2850
        (yy_hold_char) = *(yy_c_buf_p);
 
2851
}
 
2852
 
 
2853
/** Allocate and initialize an input buffer state.
 
2854
 * @param file A readable stream.
 
2855
 * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
 
2856
 * 
 
2857
 * @return the allocated buffer state.
 
2858
 */
 
2859
    YY_BUFFER_STATE octave__create_buffer  (FILE * file, int  size )
 
2860
{
 
2861
        YY_BUFFER_STATE b;
 
2862
    
 
2863
        b = (YY_BUFFER_STATE) octave_alloc(sizeof( struct yy_buffer_state )  );
 
2864
        if ( ! b )
 
2865
                YY_FATAL_ERROR( "out of dynamic memory in octave__create_buffer()" );
 
2866
 
 
2867
        b->yy_buf_size = size;
 
2868
 
 
2869
        /* yy_ch_buf has to be 2 characters longer than the size given because
 
2870
         * we need to put in 2 end-of-buffer characters.
 
2871
         */
 
2872
        b->yy_ch_buf = (char *) octave_alloc(b->yy_buf_size + 2  );
 
2873
        if ( ! b->yy_ch_buf )
 
2874
                YY_FATAL_ERROR( "out of dynamic memory in octave__create_buffer()" );
 
2875
 
 
2876
        b->yy_is_our_buffer = 1;
 
2877
 
 
2878
        octave__init_buffer(b,file );
 
2879
 
 
2880
        return b;
 
2881
}
 
2882
 
 
2883
/** Destroy the buffer.
 
2884
 * @param b a buffer created with octave__create_buffer()
 
2885
 * 
 
2886
 */
 
2887
    void octave__delete_buffer (YY_BUFFER_STATE  b )
 
2888
{
 
2889
    
 
2890
        if ( ! b )
 
2891
                return;
 
2892
 
 
2893
        if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
 
2894
                YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
 
2895
 
 
2896
        if ( b->yy_is_our_buffer )
 
2897
                octave_free((void *) b->yy_ch_buf  );
 
2898
 
 
2899
        octave_free((void *) b  );
 
2900
}
 
2901
 
 
2902
#ifndef __cplusplus
 
2903
extern int isatty (int );
 
2904
#endif /* __cplusplus */
 
2905
    
 
2906
/* Initializes or reinitializes a buffer.
 
2907
 * This function is sometimes called more than once on the same buffer,
 
2908
 * such as during a octave_restart() or at EOF.
 
2909
 */
 
2910
    static void octave__init_buffer  (YY_BUFFER_STATE  b, FILE * file )
 
2911
 
 
2912
{
 
2913
        int oerrno = errno;
 
2914
    
 
2915
        octave__flush_buffer(b );
 
2916
 
 
2917
        b->yy_input_file = file;
 
2918
        b->yy_fill_buffer = 1;
 
2919
 
 
2920
    /* If b is the current buffer, then octave__init_buffer was _probably_
 
2921
     * called from octave_restart() or through yy_get_next_buffer.
 
2922
     * In that case, we don't want to reset the lineno or column.
 
2923
     */
 
2924
    if (b != YY_CURRENT_BUFFER){
 
2925
        b->yy_bs_lineno = 1;
 
2926
        b->yy_bs_column = 0;
 
2927
    }
 
2928
 
 
2929
        b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
 
2930
    
 
2931
        errno = oerrno;
 
2932
}
 
2933
 
 
2934
/** Discard all buffered characters. On the next scan, YY_INPUT will be called.
 
2935
 * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
 
2936
 * 
 
2937
 */
 
2938
    void octave__flush_buffer (YY_BUFFER_STATE  b )
 
2939
{
 
2940
        if ( ! b )
 
2941
                return;
 
2942
 
 
2943
        b->yy_n_chars = 0;
 
2944
 
 
2945
        /* We always need two end-of-buffer characters.  The first causes
 
2946
         * a transition to the end-of-buffer state.  The second causes
 
2947
         * a jam in that state.
 
2948
         */
 
2949
        b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
 
2950
        b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
 
2951
 
 
2952
        b->yy_buf_pos = &b->yy_ch_buf[0];
 
2953
 
 
2954
        b->yy_at_bol = 1;
 
2955
        b->yy_buffer_status = YY_BUFFER_NEW;
 
2956
 
 
2957
        if ( b == YY_CURRENT_BUFFER )
 
2958
                octave__load_buffer_state( );
 
2959
}
 
2960
 
 
2961
/** Pushes the new state onto the stack. The new state becomes
 
2962
 *  the current state. This function will allocate the stack
 
2963
 *  if necessary.
 
2964
 *  @param new_buffer The new state.
 
2965
 *  
 
2966
 */
 
2967
void octave_push_buffer_state (YY_BUFFER_STATE new_buffer )
 
2968
{
 
2969
        if (new_buffer == NULL)
 
2970
                return;
 
2971
 
 
2972
        octave_ensure_buffer_stack();
 
2973
 
 
2974
        /* This block is copied from octave__switch_to_buffer. */
 
2975
        if ( YY_CURRENT_BUFFER )
 
2976
                {
 
2977
                /* Flush out information for old buffer. */
 
2978
                *(yy_c_buf_p) = (yy_hold_char);
 
2979
                YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
 
2980
                YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
 
2981
                }
 
2982
 
 
2983
        /* Only push if top exists. Otherwise, replace top. */
 
2984
        if (YY_CURRENT_BUFFER)
 
2985
                (yy_buffer_stack_top)++;
 
2986
        YY_CURRENT_BUFFER_LVALUE = new_buffer;
 
2987
 
 
2988
        /* copied from octave__switch_to_buffer. */
 
2989
        octave__load_buffer_state( );
 
2990
        (yy_did_buffer_switch_on_eof) = 1;
 
2991
}
 
2992
 
 
2993
/** Removes and deletes the top of the stack, if present.
 
2994
 *  The next element becomes the new top.
 
2995
 *  
 
2996
 */
 
2997
void octave_pop_buffer_state (void)
 
2998
{
 
2999
        if (!YY_CURRENT_BUFFER)
 
3000
                return;
 
3001
 
 
3002
        octave__delete_buffer(YY_CURRENT_BUFFER );
 
3003
        YY_CURRENT_BUFFER_LVALUE = NULL;
 
3004
        if ((yy_buffer_stack_top) > 0)
 
3005
                --(yy_buffer_stack_top);
 
3006
 
 
3007
        if (YY_CURRENT_BUFFER) {
 
3008
                octave__load_buffer_state( );
 
3009
                (yy_did_buffer_switch_on_eof) = 1;
 
3010
        }
 
3011
}
 
3012
 
 
3013
/* Allocates the stack if it does not exist.
 
3014
 *  Guarantees space for at least one push.
 
3015
 */
 
3016
static void octave_ensure_buffer_stack (void)
 
3017
{
 
3018
        int num_to_alloc;
 
3019
    
 
3020
        if (!(yy_buffer_stack)) {
 
3021
 
 
3022
                /* First allocation is just for 2 elements, since we don't know if this
 
3023
                 * scanner will even need a stack. We use 2 instead of 1 to avoid an
 
3024
                 * immediate realloc on the next call.
 
3025
         */
 
3026
                num_to_alloc = 1;
 
3027
                (yy_buffer_stack) = (struct yy_buffer_state**)octave_alloc
 
3028
                                                                (num_to_alloc * sizeof(struct yy_buffer_state*)
 
3029
                                                                );
 
3030
                
 
3031
                memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
 
3032
                                
 
3033
                (yy_buffer_stack_max) = num_to_alloc;
 
3034
                (yy_buffer_stack_top) = 0;
 
3035
                return;
 
3036
        }
 
3037
 
 
3038
        if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
 
3039
 
 
3040
                /* Increase the buffer to prepare for a possible push. */
 
3041
                int grow_size = 8 /* arbitrary grow size */;
 
3042
 
 
3043
                num_to_alloc = (yy_buffer_stack_max) + grow_size;
 
3044
                (yy_buffer_stack) = (struct yy_buffer_state**)octave_realloc
 
3045
                                                                ((yy_buffer_stack),
 
3046
                                                                num_to_alloc * sizeof(struct yy_buffer_state*)
 
3047
                                                                );
 
3048
 
 
3049
                /* zero only the new slots.*/
 
3050
                memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
 
3051
                (yy_buffer_stack_max) = num_to_alloc;
 
3052
        }
 
3053
}
 
3054
 
 
3055
/** Setup the input buffer state to scan directly from a user-specified character buffer.
 
3056
 * @param base the character buffer
 
3057
 * @param size the size in bytes of the character buffer
 
3058
 * 
 
3059
 * @return the newly allocated buffer state object. 
 
3060
 */
 
3061
YY_BUFFER_STATE octave__scan_buffer  (char * base, yy_size_t  size )
 
3062
{
 
3063
        YY_BUFFER_STATE b;
 
3064
    
 
3065
        if ( size < 2 ||
 
3066
             base[size-2] != YY_END_OF_BUFFER_CHAR ||
 
3067
             base[size-1] != YY_END_OF_BUFFER_CHAR )
 
3068
                /* They forgot to leave room for the EOB's. */
 
3069
                return 0;
 
3070
 
 
3071
        b = (YY_BUFFER_STATE) octave_alloc(sizeof( struct yy_buffer_state )  );
 
3072
        if ( ! b )
 
3073
                YY_FATAL_ERROR( "out of dynamic memory in octave__scan_buffer()" );
 
3074
 
 
3075
        b->yy_buf_size = size - 2;      /* "- 2" to take care of EOB's */
 
3076
        b->yy_buf_pos = b->yy_ch_buf = base;
 
3077
        b->yy_is_our_buffer = 0;
 
3078
        b->yy_input_file = 0;
 
3079
        b->yy_n_chars = b->yy_buf_size;
 
3080
        b->yy_is_interactive = 0;
 
3081
        b->yy_at_bol = 1;
 
3082
        b->yy_fill_buffer = 0;
 
3083
        b->yy_buffer_status = YY_BUFFER_NEW;
 
3084
 
 
3085
        octave__switch_to_buffer(b  );
 
3086
 
 
3087
        return b;
 
3088
}
 
3089
 
 
3090
/** Setup the input buffer state to scan a string. The next call to octave_lex() will
 
3091
 * scan from a @e copy of @a str.
 
3092
 * @param yystr a NUL-terminated string to scan
 
3093
 * 
 
3094
 * @return the newly allocated buffer state object.
 
3095
 * @note If you want to scan bytes that may contain NUL values, then use
 
3096
 *       octave__scan_bytes() instead.
 
3097
 */
 
3098
YY_BUFFER_STATE octave__scan_string (yyconst char * yystr )
 
3099
{
 
3100
    
 
3101
        return octave__scan_bytes(yystr,strlen(yystr) );
 
3102
}
 
3103
 
 
3104
/** Setup the input buffer state to scan the given bytes. The next call to octave_lex() will
 
3105
 * scan from a @e copy of @a bytes.
 
3106
 * @param bytes the byte buffer to scan
 
3107
 * @param len the number of bytes in the buffer pointed to by @a bytes.
 
3108
 * 
 
3109
 * @return the newly allocated buffer state object.
 
3110
 */
 
3111
YY_BUFFER_STATE octave__scan_bytes  (yyconst char * yybytes, int  _yybytes_len )
 
3112
{
 
3113
        YY_BUFFER_STATE b;
 
3114
        char *buf;
 
3115
        yy_size_t n;
 
3116
        int i;
 
3117
    
 
3118
        /* Get memory for full buffer, including space for trailing EOB's. */
 
3119
        n = _yybytes_len + 2;
 
3120
        buf = (char *) octave_alloc(n  );
 
3121
        if ( ! buf )
 
3122
                YY_FATAL_ERROR( "out of dynamic memory in octave__scan_bytes()" );
 
3123
 
 
3124
        for ( i = 0; i < _yybytes_len; ++i )
 
3125
                buf[i] = yybytes[i];
 
3126
 
 
3127
        buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
 
3128
 
 
3129
        b = octave__scan_buffer(buf,n );
 
3130
        if ( ! b )
 
3131
                YY_FATAL_ERROR( "bad buffer in octave__scan_bytes()" );
 
3132
 
 
3133
        /* It's okay to grow etc. this buffer, and we should throw it
 
3134
         * away when we're done.
 
3135
         */
 
3136
        b->yy_is_our_buffer = 1;
 
3137
 
 
3138
        return b;
 
3139
}
 
3140
 
 
3141
#ifndef YY_EXIT_FAILURE
 
3142
#define YY_EXIT_FAILURE 2
 
3143
#endif
 
3144
 
 
3145
static void yy_fatal_error (yyconst char* msg )
 
3146
{
 
3147
        (void) fprintf( stderr, "%s\n", msg );
 
3148
        exit( YY_EXIT_FAILURE );
 
3149
}
 
3150
 
 
3151
/* Redefine yyless() so it works in section 3 code. */
 
3152
 
 
3153
#undef yyless
 
3154
#define yyless(n) \
 
3155
        do \
 
3156
                { \
 
3157
                /* Undo effects of setting up octave_text. */ \
 
3158
        int yyless_macro_arg = (n); \
 
3159
        YY_LESS_LINENO(yyless_macro_arg);\
 
3160
                octave_text[octave_leng] = (yy_hold_char); \
 
3161
                (yy_c_buf_p) = octave_text + yyless_macro_arg; \
 
3162
                (yy_hold_char) = *(yy_c_buf_p); \
 
3163
                *(yy_c_buf_p) = '\0'; \
 
3164
                octave_leng = yyless_macro_arg; \
 
3165
                } \
 
3166
        while ( 0 )
 
3167
 
 
3168
/* Accessor  methods (get/set functions) to struct members. */
 
3169
 
 
3170
/** Get the current line number.
 
3171
 * 
 
3172
 */
 
3173
int octave_get_lineno  (void)
 
3174
{
 
3175
        
 
3176
    return octave_lineno;
 
3177
}
 
3178
 
 
3179
/** Get the input stream.
 
3180
 * 
 
3181
 */
 
3182
FILE *octave_get_in  (void)
 
3183
{
 
3184
        return octave_in;
 
3185
}
 
3186
 
 
3187
/** Get the output stream.
 
3188
 * 
 
3189
 */
 
3190
FILE *octave_get_out  (void)
 
3191
{
 
3192
        return octave_out;
 
3193
}
 
3194
 
 
3195
/** Get the length of the current token.
 
3196
 * 
 
3197
 */
 
3198
int octave_get_leng  (void)
 
3199
{
 
3200
        return octave_leng;
 
3201
}
 
3202
 
 
3203
/** Get the current token.
 
3204
 * 
 
3205
 */
 
3206
 
 
3207
char *octave_get_text  (void)
 
3208
{
 
3209
        return octave_text;
 
3210
}
 
3211
 
 
3212
/** Set the current line number.
 
3213
 * @param line_number
 
3214
 * 
 
3215
 */
 
3216
void octave_set_lineno (int  line_number )
 
3217
{
 
3218
    
 
3219
    octave_lineno = line_number;
 
3220
}
 
3221
 
 
3222
/** Set the input stream. This does not discard the current
 
3223
 * input buffer.
 
3224
 * @param in_str A readable stream.
 
3225
 * 
 
3226
 * @see octave__switch_to_buffer
 
3227
 */
 
3228
void octave_set_in (FILE *  in_str )
 
3229
{
 
3230
        octave_in = in_str ;
 
3231
}
 
3232
 
 
3233
void octave_set_out (FILE *  out_str )
 
3234
{
 
3235
        octave_out = out_str ;
 
3236
}
 
3237
 
 
3238
int octave_get_debug  (void)
 
3239
{
 
3240
        return octave__flex_debug;
 
3241
}
 
3242
 
 
3243
void octave_set_debug (int  bdebug )
 
3244
{
 
3245
        octave__flex_debug = bdebug ;
 
3246
}
 
3247
 
 
3248
static int yy_init_globals (void)
 
3249
{
 
3250
        /* Initialization is the same as for the non-reentrant scanner.
 
3251
     * This function is called from octave_lex_destroy(), so don't allocate here.
 
3252
     */
 
3253
 
 
3254
    (yy_buffer_stack) = 0;
 
3255
    (yy_buffer_stack_top) = 0;
 
3256
    (yy_buffer_stack_max) = 0;
 
3257
    (yy_c_buf_p) = (char *) 0;
 
3258
    (yy_init) = 0;
 
3259
    (yy_start) = 0;
 
3260
 
 
3261
/* Defined in main.c */
 
3262
#ifdef YY_STDINIT
 
3263
    octave_in = stdin;
 
3264
    octave_out = stdout;
 
3265
#else
 
3266
    octave_in = (FILE *) 0;
 
3267
    octave_out = (FILE *) 0;
 
3268
#endif
 
3269
 
 
3270
    /* For future reference: Set errno on error, since we are called by
 
3271
     * octave_lex_init()
 
3272
     */
 
3273
    return 0;
 
3274
}
 
3275
 
 
3276
/* octave_lex_destroy is for both reentrant and non-reentrant scanners. */
 
3277
int octave_lex_destroy  (void)
 
3278
{
 
3279
    
 
3280
    /* Pop the buffer stack, destroying each element. */
 
3281
        while(YY_CURRENT_BUFFER){
 
3282
                octave__delete_buffer(YY_CURRENT_BUFFER  );
 
3283
                YY_CURRENT_BUFFER_LVALUE = NULL;
 
3284
                octave_pop_buffer_state();
 
3285
        }
 
3286
 
 
3287
        /* Destroy the stack itself. */
 
3288
        octave_free((yy_buffer_stack) );
 
3289
        (yy_buffer_stack) = NULL;
 
3290
 
 
3291
    /* Reset the globals. This is important in a non-reentrant scanner so the next time
 
3292
     * octave_lex() is called, initialization will occur. */
 
3293
    yy_init_globals( );
 
3294
 
 
3295
    return 0;
 
3296
}
 
3297
 
 
3298
/*
 
3299
 * Internal utility routines.
 
3300
 */
 
3301
 
 
3302
#ifndef yytext_ptr
 
3303
static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
 
3304
{
 
3305
        register int i;
 
3306
        for ( i = 0; i < n; ++i )
 
3307
                s1[i] = s2[i];
 
3308
}
 
3309
#endif
 
3310
 
 
3311
#ifdef YY_NEED_STRLEN
 
3312
static int yy_flex_strlen (yyconst char * s )
 
3313
{
 
3314
        register int n;
 
3315
        for ( n = 0; s[n]; ++n )
 
3316
                ;
 
3317
 
 
3318
        return n;
 
3319
}
 
3320
#endif
 
3321
 
 
3322
void *octave_alloc (yy_size_t  size )
 
3323
{
 
3324
        return (void *) malloc( size );
 
3325
}
 
3326
 
 
3327
void *octave_realloc  (void * ptr, yy_size_t  size )
 
3328
{
 
3329
        /* The cast to (char *) in the following accommodates both
 
3330
         * implementations that use char* generic pointers, and those
 
3331
         * that use void* generic pointers.  It works with the latter
 
3332
         * because both ANSI C and C++ allow castless assignment from
 
3333
         * any pointer type to void*, and deal with argument conversions
 
3334
         * as though doing an assignment.
 
3335
         */
 
3336
        return (void *) realloc( (char *) ptr, size );
 
3337
}
 
3338
 
 
3339
void octave_free (void * ptr )
 
3340
{
 
3341
        free( (char *) ptr );   /* see octave_realloc() for (char *) cast */
 
3342
}
 
3343
 
 
3344
#define YYTABLES_NAME "yytables"
 
3345
 
 
3346
#line 809 "lex.l"
 
3347
 
 
3348
 
 
3349
 
 
3350
// GAG.
 
3351
//
 
3352
// If we're reading a matrix and the next character is '[', make sure
 
3353
// that we insert a comma ahead of it.
 
3354
 
 
3355
void
 
3356
do_comma_insert_check (void)
 
3357
{
 
3358
  int spc_gobbled = eat_continuation ();
 
3359
 
 
3360
  int c = yyinput ();
 
3361
 
 
3362
  yyunput (c, octave_text);
 
3363
 
 
3364
  if (spc_gobbled)
 
3365
    yyunput (' ', octave_text);
 
3366
 
 
3367
  lexer_flags.do_comma_insert = (lexer_flags.bracketflag && c == '[');
 
3368
}
 
3369
 
 
3370
// Fix things up for errors or interrupts.  The parser is never called
 
3371
// recursively, so it is always safe to reinitialize its state before
 
3372
// doing any parsing.
 
3373
 
 
3374
void
 
3375
reset_parser (void)
 
3376
{
 
3377
  // Start off on the right foot.
 
3378
  BEGIN (INITIAL);
 
3379
 
 
3380
  parser_end_of_input = false;
 
3381
  end_tokens_expected = 0;
 
3382
 
 
3383
  while (! symtab_context.empty ())
 
3384
    symtab_context.pop ();
 
3385
 
 
3386
  // We do want a prompt by default.
 
3387
  promptflag = 1;
 
3388
 
 
3389
  // Error may have occurred inside some brackets, braces, or parentheses.
 
3390
  nesting_level.clear ();
 
3391
 
 
3392
  // Clear out the stack of token info used to track line and column
 
3393
  // numbers.
 
3394
  while (! token_stack.empty ())
 
3395
    {
 
3396
      delete token_stack.top ();
 
3397
      token_stack.pop ();
 
3398
    }
 
3399
 
 
3400
  // Can be reset by defining a function.
 
3401
  if (! (reading_script_file || reading_fcn_file))
 
3402
    {
 
3403
      current_input_column = 1;
 
3404
      input_line_number = command_editor::current_command_number () - 1;
 
3405
    }
 
3406
 
 
3407
  // Only ask for input from stdin if we are expecting interactive
 
3408
  // input.
 
3409
  if ((interactive || forced_interactive)
 
3410
      && ! (reading_fcn_file
 
3411
            || reading_script_file
 
3412
            || get_input_from_eval_string
 
3413
            || input_from_startup_file))
 
3414
    octave_restart (stdin);
 
3415
 
 
3416
  // Clear the buffer for help text.
 
3417
  while (! help_buf.empty ())
 
3418
    help_buf.pop ();
 
3419
 
 
3420
  // Reset other flags.
 
3421
  lexer_flags.init ();
 
3422
}
 
3423
 
 
3424
// If we read some newlines, we need figure out what column we're
 
3425
// really looking at.
 
3426
 
 
3427
static void
 
3428
fixup_column_count (char *s)
 
3429
{
 
3430
  char c;
 
3431
  while ((c = *s++) != '\0')
 
3432
    {
 
3433
      if (c == '\n')
 
3434
          current_input_column = 1;
 
3435
      else
 
3436
        current_input_column++;
 
3437
    }
 
3438
}
 
3439
 
 
3440
// Include these so that we don't have to link to libfl.a.
 
3441
 
 
3442
int
 
3443
octave_wrap (void)
 
3444
{
 
3445
  return 1;
 
3446
}
 
3447
 
 
3448
// Tell us all what the current buffer is.
 
3449
 
 
3450
YY_BUFFER_STATE
 
3451
current_buffer (void)
 
3452
{
 
3453
  return YY_CURRENT_BUFFER;
 
3454
}
 
3455
 
 
3456
// Create a new buffer.
 
3457
 
 
3458
YY_BUFFER_STATE
 
3459
create_buffer (FILE *f)
 
3460
{
 
3461
  return octave__create_buffer (f, YY_BUF_SIZE);
 
3462
}
 
3463
 
 
3464
// Start reading a new buffer.
 
3465
 
 
3466
void
 
3467
switch_to_buffer (YY_BUFFER_STATE buf)
 
3468
{
 
3469
  octave__switch_to_buffer (buf);
 
3470
}
 
3471
 
 
3472
// Delete a buffer.
 
3473
 
 
3474
void
 
3475
delete_buffer (YY_BUFFER_STATE buf)
 
3476
{
 
3477
  octave__delete_buffer (buf);
 
3478
}
 
3479
 
 
3480
// Restore a buffer (for unwind-prot).
 
3481
 
 
3482
void
 
3483
restore_input_buffer (void *buf)
 
3484
{
 
3485
  switch_to_buffer (static_cast<YY_BUFFER_STATE> (buf));
 
3486
}
 
3487
 
 
3488
// Delete a buffer (for unwind-prot).
 
3489
 
 
3490
void
 
3491
delete_input_buffer (void *buf)
 
3492
{
 
3493
  delete_buffer (static_cast<YY_BUFFER_STATE> (buf));
 
3494
}
 
3495
 
 
3496
static void
 
3497
prep_for_function (void)
 
3498
{
 
3499
  end_tokens_expected++;
 
3500
 
 
3501
  // Prepare for local symbols.
 
3502
 
 
3503
  tmp_local_sym_tab = new symbol_table ();
 
3504
 
 
3505
  promptflag--;
 
3506
 
 
3507
  lexer_flags.defining_func = true;
 
3508
  lexer_flags.parsed_function_name = false;
 
3509
  lexer_flags.beginning_of_function = true;
 
3510
 
 
3511
  if (! (reading_fcn_file || reading_script_file))
 
3512
    input_line_number = 1;
 
3513
}
 
3514
 
 
3515
static void
 
3516
prep_for_nested_function (void)
 
3517
{
 
3518
  lexer_flags.parsing_nested_function = 1;
 
3519
  help_buf.push (std::string ());
 
3520
  prep_for_function ();
 
3521
  // We're still only expecting one end token for this set of functions.
 
3522
  end_tokens_expected--;
 
3523
  yylval.tok_val = new token (input_line_number, current_input_column);
 
3524
  token_stack.push (yylval.tok_val);
 
3525
}
 
3526
 
 
3527
// Handle keywords.  Return -1 if the keyword should be ignored.
 
3528
 
 
3529
static int
 
3530
is_keyword_token (const std::string& s)
 
3531
{
 
3532
  int l = input_line_number;
 
3533
  int c = current_input_column;
 
3534
 
 
3535
  int len = s.length ();
 
3536
 
 
3537
  const octave_kw *kw = octave_kw_hash::in_word_set (s.c_str (), len);
 
3538
 
 
3539
  if (kw)
 
3540
    {
 
3541
      yylval.tok_val = 0;
 
3542
 
 
3543
      switch (kw->kw_id)
 
3544
        {
 
3545
        case break_kw:
 
3546
        case case_kw:
 
3547
        case catch_kw:
 
3548
        case continue_kw:
 
3549
        case else_kw:
 
3550
        case elseif_kw:
 
3551
        case global_kw:
 
3552
        case otherwise_kw:
 
3553
        case return_kw:
 
3554
        case static_kw:
 
3555
        case until_kw:
 
3556
        case unwind_protect_cleanup_kw:
 
3557
          break;
 
3558
 
 
3559
        case end_kw:
 
3560
          if (lexer_flags.looking_at_object_index)
 
3561
            return 0;
 
3562
          else
 
3563
            {
 
3564
              if (reading_fcn_file && end_tokens_expected == 1)
 
3565
                return -1;
 
3566
              else
 
3567
                {
 
3568
                  yylval.tok_val = new token (token::simple_end, l, c);
 
3569
                  end_tokens_expected--;
 
3570
                }
 
3571
            }
 
3572
          break;
 
3573
 
 
3574
        case end_try_catch_kw:
 
3575
          end_tokens_expected--;
 
3576
          yylval.tok_val = new token (token::try_catch_end, l, c);
 
3577
          break;
 
3578
 
 
3579
        case end_unwind_protect_kw:
 
3580
          end_tokens_expected--;
 
3581
          yylval.tok_val = new token (token::unwind_protect_end, l, c);
 
3582
          break;
 
3583
 
 
3584
        case endfor_kw:
 
3585
          end_tokens_expected--;
 
3586
          yylval.tok_val = new token (token::for_end, l, c);
 
3587
          break;
 
3588
 
 
3589
        case endfunction_kw:
 
3590
          {
 
3591
            if (reading_fcn_file && end_tokens_expected == 1)
 
3592
              return -1;
 
3593
            else
 
3594
              {
 
3595
                yylval.tok_val = new token (token::function_end, l, c);
 
3596
                end_tokens_expected--;
 
3597
              }
 
3598
          }
 
3599
          break;
 
3600
 
 
3601
        case endif_kw:
 
3602
          end_tokens_expected--;
 
3603
          yylval.tok_val = new token (token::if_end, l, c);
 
3604
          break;
 
3605
 
 
3606
        case endswitch_kw:
 
3607
          end_tokens_expected--;
 
3608
          yylval.tok_val = new token (token::switch_end, l, c);
 
3609
          break;
 
3610
 
 
3611
        case endwhile_kw:
 
3612
          end_tokens_expected--;
 
3613
          yylval.tok_val = new token (token::while_end, l, c);
 
3614
          break;
 
3615
 
 
3616
        case for_kw:
 
3617
        case while_kw:
 
3618
          end_tokens_expected++;
 
3619
          // Fall through...
 
3620
 
 
3621
        case do_kw:
 
3622
          promptflag--;
 
3623
          lexer_flags.looping++;
 
3624
          break;
 
3625
 
 
3626
        case if_kw:
 
3627
        case try_kw:
 
3628
        case switch_kw:
 
3629
        case unwind_protect_kw:
 
3630
          end_tokens_expected++;
 
3631
          promptflag--;
 
3632
          break;
 
3633
 
 
3634
        case function_kw:
 
3635
          {
 
3636
            if (lexer_flags.defining_func)
 
3637
              {
 
3638
                if (reading_fcn_file)
 
3639
                  {
 
3640
                    if (lexer_flags.parsing_nested_function)
 
3641
                      {
 
3642
                        BEGIN (NESTED_FUNCTION_END);
 
3643
 
 
3644
                        yylval.tok_val = new token (token::function_end, l, c);
 
3645
                        token_stack.push (yylval.tok_val);
 
3646
 
 
3647
                        return END;
 
3648
                      }
 
3649
                    else
 
3650
                      {
 
3651
                        prep_for_nested_function ();
 
3652
 
 
3653
                        return FCN;
 
3654
                      }
 
3655
                  }
 
3656
                else
 
3657
                  {
 
3658
                    error ("nested functions not implemented in this context");
 
3659
 
 
3660
                    if ((reading_fcn_file || reading_script_file)
 
3661
                        && ! curr_fcn_file_name.empty ())
 
3662
                      error ("near line %d of file `%s.m'",
 
3663
                             input_line_number, curr_fcn_file_name.c_str ());
 
3664
                    else
 
3665
                      error ("near line %d", input_line_number);
 
3666
 
 
3667
                    return LEXICAL_ERROR;
 
3668
                  }
 
3669
              }
 
3670
            else
 
3671
              prep_for_function ();
 
3672
          }
 
3673
          break;
 
3674
 
 
3675
        case magic_file_kw:
 
3676
          {
 
3677
            if ((reading_fcn_file || reading_script_file)
 
3678
                && ! curr_fcn_file_full_name.empty ())
 
3679
              yylval.tok_val = new token (curr_fcn_file_full_name, l, c);
 
3680
            else
 
3681
              yylval.tok_val = new token ("stdin", l, c);
 
3682
          }
 
3683
          break;
 
3684
 
 
3685
        case magic_line_kw:
 
3686
          yylval.tok_val = new token (static_cast<double> (l), "", l, c);
 
3687
          break;
 
3688
 
 
3689
        case varargin_kw:
 
3690
          if (! lexer_flags.looking_at_parameter_list)
 
3691
            return 0;
 
3692
          break;
 
3693
 
 
3694
        case varargout_kw:
 
3695
          if (! (lexer_flags.looking_at_return_list
 
3696
                 || (lexer_flags.defining_func
 
3697
                     && ! lexer_flags.parsed_function_name)))
 
3698
            return 0;
 
3699
          break;
 
3700
 
 
3701
        default:
 
3702
          panic_impossible ();
 
3703
        }
 
3704
 
 
3705
      if (! yylval.tok_val)
 
3706
        yylval.tok_val = new token (l, c);
 
3707
 
 
3708
      token_stack.push (yylval.tok_val);
 
3709
 
 
3710
      return kw->tok;
 
3711
    }
 
3712
 
 
3713
  return 0;
 
3714
}
 
3715
 
 
3716
// Try to find an identifier.  All binding to global or builtin
 
3717
// variables occurs when expressions are evaluated.
 
3718
 
 
3719
static symbol_record *
 
3720
lookup_identifier (const std::string& name)
 
3721
{
 
3722
  std::string sym_name = name;
 
3723
 
 
3724
  if (curr_sym_tab == fbi_sym_tab
 
3725
      && lexer_flags.parsing_nested_function)
 
3726
    sym_name = parent_function_name + ":" + sym_name;
 
3727
 
 
3728
  return curr_sym_tab->lookup (sym_name, true);
 
3729
}
 
3730
 
 
3731
static bool
 
3732
is_variable (const std::string& name)
 
3733
{
 
3734
  symbol_record *sr = curr_sym_tab->lookup (name);
 
3735
 
 
3736
  return sr && sr->is_variable ();
 
3737
}
 
3738
 
 
3739
static void
 
3740
force_local_variable (const std::string& name)
 
3741
{
 
3742
  if (! is_variable (name))
 
3743
    curr_sym_tab->clear (name);
 
3744
 
 
3745
  symbol_record *sr = curr_sym_tab->lookup (name, true);
 
3746
 
 
3747
  if (sr)
 
3748
    sr->define (octave_value ());
 
3749
}
 
3750
 
 
3751
// Grab the help text from an function file.
 
3752
 
 
3753
// FIXME -- gobble_leading_white_space() in parse.y
 
3754
// duplicates some of this code!
 
3755
 
 
3756
static std::string
 
3757
grab_help_text (void)
 
3758
{
 
3759
  std::string buf;
 
3760
 
 
3761
  bool begin_comment = true;
 
3762
  bool in_comment = true;
 
3763
  bool discard_space = true;
 
3764
 
 
3765
  int c = 0;
 
3766
 
 
3767
  while ((c = yyinput ()) != EOF)
 
3768
    {
 
3769
      if (begin_comment)
 
3770
        {
 
3771
          if (c == '%' || c == '#')
 
3772
            continue;
 
3773
          else if (discard_space && c == ' ')
 
3774
            {
 
3775
              discard_space = false;
 
3776
              continue;
 
3777
            }
 
3778
          else
 
3779
            begin_comment = false;
 
3780
        }       
 
3781
 
 
3782
      if (in_comment)
 
3783
        {
 
3784
          buf += static_cast<char> (c);
 
3785
 
 
3786
          if (c == '\n')
 
3787
            {
 
3788
              in_comment = false;
 
3789
              discard_space = true;
 
3790
            }
 
3791
        }
 
3792
      else
 
3793
        {
 
3794
          switch (c)
 
3795
            {
 
3796
            case '#':
 
3797
            case '%':
 
3798
              maybe_gripe_matlab_incompatible_comment (octave_text[0]);
 
3799
              in_comment = true;
 
3800
              begin_comment = true;
 
3801
              break;
 
3802
 
 
3803
            case ' ':
 
3804
            case '\t':
 
3805
              break;
 
3806
 
 
3807
            default:
 
3808
              goto done;
 
3809
            }
 
3810
        }
 
3811
    }
 
3812
 
 
3813
 done:
 
3814
 
 
3815
  if (c)
 
3816
    yyunput (c, octave_text);
 
3817
 
 
3818
  return buf;
 
3819
}
 
3820
 
 
3821
// Return 1 if the given character matches any character in the given
 
3822
// string.
 
3823
 
 
3824
static bool
 
3825
match_any (char c, const char *s)
 
3826
{
 
3827
  char tmp;
 
3828
  while ((tmp = *s++) != '\0')
 
3829
    {
 
3830
      if (c == tmp)
 
3831
        return true;
 
3832
    }
 
3833
  return false;
 
3834
}
 
3835
 
 
3836
// Given information about the spacing surrounding an operator,
 
3837
// return 1 if it looks like it should be treated as a binary
 
3838
// operator.  For example,
 
3839
//
 
3840
//   [ 1 + 2 ]  or  [ 1+ 2]  or  [ 1+2 ]  ==>  binary
 
3841
//
 
3842
//   [ 1 +2 ]  ==>  unary
 
3843
 
 
3844
static bool
 
3845
looks_like_bin_op (bool spc_prev, int next_char)
 
3846
{
 
3847
  bool spc_next = (next_char == ' ' || next_char == '\t');
 
3848
 
 
3849
  return ((spc_prev && spc_next) || ! spc_prev);
 
3850
}
 
3851
 
 
3852
// Recognize separators.  If the separator is a CRLF pair, it is
 
3853
// replaced by a single LF.
 
3854
 
 
3855
static bool
 
3856
next_token_is_sep_op (void)
 
3857
{
 
3858
  bool retval = false;
 
3859
 
 
3860
  int c1 = yyinput ();
 
3861
 
 
3862
  if (c1 == '\r')
 
3863
    {
 
3864
      int c2 = yyinput ();
 
3865
 
 
3866
      if (c2 == '\n')
 
3867
        {
 
3868
          c1 = '\n';
 
3869
 
 
3870
          retval = true;
 
3871
        }
 
3872
      else
 
3873
        yyunput (c2, octave_text);
 
3874
    }
 
3875
  else
 
3876
    retval = match_any (c1, ",;\n]");
 
3877
 
 
3878
  yyunput (c1, octave_text);
 
3879
 
 
3880
  return retval;
 
3881
}
 
3882
 
 
3883
// Try to determine if the next token should be treated as a postfix
 
3884
// unary operator.  This is ugly, but it seems to do the right thing.
 
3885
 
 
3886
static bool
 
3887
next_token_is_postfix_unary_op (bool spc_prev)
 
3888
{
 
3889
  bool un_op = false;
 
3890
 
 
3891
  int c0 = yyinput ();
 
3892
 
 
3893
  if (c0 == '\'' && ! spc_prev)
 
3894
    {
 
3895
      un_op = true;
 
3896
    }
 
3897
  else if (c0 == '.')
 
3898
    {
 
3899
      int c1 = yyinput ();
 
3900
      un_op = (c1 == '\'');
 
3901
      yyunput (c1, octave_text);
 
3902
    }
 
3903
  else if (c0 == '+')
 
3904
    {
 
3905
      int c1 = yyinput ();
 
3906
      un_op = (c1 == '+');
 
3907
      yyunput (c1, octave_text);
 
3908
    }
 
3909
  else if (c0 == '-')
 
3910
    {
 
3911
      int c1 = yyinput ();
 
3912
      un_op = (c1 == '-');
 
3913
      yyunput (c1, octave_text);
 
3914
    }
 
3915
 
 
3916
  yyunput (c0, octave_text);
 
3917
 
 
3918
  return un_op;
 
3919
}
 
3920
 
 
3921
// Try to determine if the next token should be treated as a binary
 
3922
// operator.
 
3923
//
 
3924
// This kluge exists because whitespace is not always ignored inside
 
3925
// the square brackets that are used to create matrix objects (though
 
3926
// spacing only really matters in the cases that can be interpreted
 
3927
// either as binary ops or prefix unary ops: currently just +, -).
 
3928
//
 
3929
// Note that a line continuation directly following a + or - operator
 
3930
// (e.g., the characters '[' 'a' ' ' '+' '\' LFD 'b' ']') will be
 
3931
// parsed as a binary operator.
 
3932
 
 
3933
static bool
 
3934
next_token_is_bin_op (bool spc_prev)
 
3935
{
 
3936
  bool bin_op = false;
 
3937
 
 
3938
  int c0 = yyinput ();
 
3939
 
 
3940
  switch (c0)
 
3941
    {
 
3942
    case '+':
 
3943
    case '-':
 
3944
      {
 
3945
        int c1 = yyinput ();
 
3946
 
 
3947
        switch (c1)
 
3948
          {
 
3949
          case '+':
 
3950
          case '-':
 
3951
            // Unary ops, spacing doesn't matter.
 
3952
            break;
 
3953
 
 
3954
          case '=':
 
3955
            // Binary ops, spacing doesn't matter.
 
3956
            bin_op = true;
 
3957
            break;
 
3958
 
 
3959
          default:
 
3960
            // Could be either, spacing matters.
 
3961
            bin_op = looks_like_bin_op (spc_prev, c1);
 
3962
            break;
 
3963
          }
 
3964
 
 
3965
        yyunput (c1, octave_text);
 
3966
      }
 
3967
      break;
 
3968
 
 
3969
    case ':':
 
3970
    case '/':
 
3971
    case '\\':
 
3972
    case '^':
 
3973
      // Always a binary op (may also include /=, \=, and ^=).
 
3974
      bin_op = true;
 
3975
      break;
 
3976
 
 
3977
    // .+ .- ./ .\ .^ .* .**
 
3978
    case '.':
 
3979
      {
 
3980
        int c1 = yyinput ();
 
3981
 
 
3982
        if (match_any (c1, "+-/\\^*"))
 
3983
          // Always a binary op (may also include .+=, .-=, ./=, ...).
 
3984
          bin_op = true;
 
3985
        else if (! isdigit (c1) && c1 != ' ' && c1 != '\t' && c1 != '.')
 
3986
          // A structure element reference is a binary op.
 
3987
          bin_op = true;
 
3988
 
 
3989
        yyunput (c1, octave_text);
 
3990
      }
 
3991
      break;
 
3992
 
 
3993
    // = == & && | || * **
 
3994
    case '=':
 
3995
    case '&':
 
3996
    case '|':
 
3997
    case '*':
 
3998
      // Always a binary op (may also include ==, &&, ||, **).
 
3999
      bin_op = true;
 
4000
      break;
 
4001
 
 
4002
    // < <= <> > >=
 
4003
    case '<':
 
4004
    case '>':
 
4005
      // Always a binary op (may also include <=, <>, >=).
 
4006
      bin_op = true;
 
4007
      break;
 
4008
 
 
4009
    // ~= !=
 
4010
    case '~':
 
4011
    case '!':
 
4012
      {
 
4013
        int c1 = yyinput ();
 
4014
 
 
4015
        // ~ and ! can be unary ops, so require following =.
 
4016
        if (c1 == '=')
 
4017
          bin_op = true;
 
4018
 
 
4019
        yyunput (c1, octave_text);
 
4020
      }
 
4021
      break;
 
4022
 
 
4023
    default:
 
4024
      break;
 
4025
    }
 
4026
 
 
4027
  yyunput (c0, octave_text);
 
4028
 
 
4029
  return bin_op;
 
4030
}
 
4031
 
 
4032
// Used to delete trailing white space from tokens.
 
4033
 
 
4034
static std::string
 
4035
strip_trailing_whitespace (char *s)
 
4036
{
 
4037
  std::string retval = s;
 
4038
 
 
4039
  size_t pos = retval.find_first_of (" \t");
 
4040
 
 
4041
  if (pos != NPOS)
 
4042
    retval.resize (pos);
 
4043
 
 
4044
  return retval;
 
4045
}
 
4046
 
 
4047
static void
 
4048
scan_for_comments (const char *text)
 
4049
{
 
4050
  std::string comment_buf;
 
4051
 
 
4052
  bool in_comment = false;
 
4053
  bool beginning_of_comment = false;
 
4054
 
 
4055
  int len = strlen (text);
 
4056
  int i = 0;
 
4057
 
 
4058
  while (i < len)
 
4059
    {
 
4060
      char c = text[i++];
 
4061
 
 
4062
      switch (c)
 
4063
        {
 
4064
        case '%':
 
4065
        case '#':
 
4066
          if (in_comment)
 
4067
            {
 
4068
              if (! beginning_of_comment)
 
4069
                comment_buf += static_cast<char> (c);
 
4070
            }
 
4071
          else
 
4072
            {
 
4073
              maybe_gripe_matlab_incompatible_comment (c);
 
4074
              in_comment = true;
 
4075
              beginning_of_comment = true;
 
4076
            }
 
4077
          break;
 
4078
 
 
4079
        case '\n':
 
4080
          if (in_comment)
 
4081
            {
 
4082
              comment_buf += static_cast<char> (c);
 
4083
              octave_comment_buffer::append (comment_buf);
 
4084
              comment_buf.resize (0);
 
4085
              in_comment = false;
 
4086
              beginning_of_comment = false;
 
4087
            }
 
4088
          break;
 
4089
 
 
4090
        case '\r':
 
4091
          if (in_comment)
 
4092
            comment_buf += static_cast<char> (c);
 
4093
          if (i < len)
 
4094
            {
 
4095
              c = text[i++];
 
4096
 
 
4097
              if (c == '\n')
 
4098
                {
 
4099
                  if (in_comment)
 
4100
                    {
 
4101
                      comment_buf += static_cast<char> (c);
 
4102
                      octave_comment_buffer::append (comment_buf);
 
4103
                      in_comment = false;
 
4104
                      beginning_of_comment = false;
 
4105
                    }
 
4106
                }
 
4107
            }
 
4108
 
 
4109
        default:
 
4110
          if (in_comment)
 
4111
            {
 
4112
              comment_buf += static_cast<char> (c);
 
4113
              beginning_of_comment = false;
 
4114
            }
 
4115
          break;
 
4116
        }
 
4117
    }
 
4118
 
 
4119
  if (! comment_buf.empty ())
 
4120
    octave_comment_buffer::append (comment_buf);
 
4121
}
 
4122
 
 
4123
// Discard whitespace, including comments and continuations.
 
4124
//
 
4125
// Return value is logical OR of the following values:
 
4126
//
 
4127
//  ATE_NOTHING      : no spaces to eat
 
4128
//  ATE_SPACE_OR_TAB : space or tab in input
 
4129
//  ATE_NEWLINE      : bare new line in input
 
4130
 
 
4131
static yum_yum
 
4132
eat_whitespace (void)
 
4133
{
 
4134
  yum_yum retval = ATE_NOTHING;
 
4135
 
 
4136
  std::string comment_buf;
 
4137
 
 
4138
  bool in_comment = false;
 
4139
  bool beginning_of_comment = false;
 
4140
 
 
4141
  int c = 0;
 
4142
 
 
4143
  while ((c = yyinput ()) != EOF)
 
4144
    {
 
4145
      current_input_column++;
 
4146
 
 
4147
      switch (c)
 
4148
        {
 
4149
        case ' ':
 
4150
        case '\t':
 
4151
          if (in_comment)
 
4152
            {
 
4153
              comment_buf += static_cast<char> (c);
 
4154
              beginning_of_comment = false;
 
4155
            }
 
4156
          retval |= ATE_SPACE_OR_TAB;
 
4157
          break;
 
4158
 
 
4159
        case '\n':
 
4160
          retval |= ATE_NEWLINE;
 
4161
          if (in_comment)
 
4162
            {
 
4163
              comment_buf += static_cast<char> (c);
 
4164
              octave_comment_buffer::append (comment_buf);
 
4165
              comment_buf.resize (0);
 
4166
              in_comment = false;
 
4167
              beginning_of_comment = false;
 
4168
            }
 
4169
          current_input_column = 0;
 
4170
          break;
 
4171
 
 
4172
        case '#':
 
4173
        case '%':
 
4174
          if (in_comment)
 
4175
            {
 
4176
              if (! beginning_of_comment)
 
4177
                comment_buf += static_cast<char> (c);
 
4178
            }
 
4179
          else
 
4180
            {
 
4181
              maybe_gripe_matlab_incompatible_comment (c);
 
4182
              in_comment = true;
 
4183
              beginning_of_comment = true;
 
4184
            }
 
4185
          break;
 
4186
 
 
4187
        case '.':
 
4188
          if (in_comment)
 
4189
            {
 
4190
              comment_buf += static_cast<char> (c);
 
4191
              beginning_of_comment = false;
 
4192
              break;
 
4193
            }
 
4194
          else
 
4195
            {
 
4196
              if (have_ellipsis_continuation ())
 
4197
                break;
 
4198
              else
 
4199
                goto done;
 
4200
            }
 
4201
 
 
4202
        case '\\':
 
4203
          if (in_comment)
 
4204
            {
 
4205
              comment_buf += static_cast<char> (c);
 
4206
              beginning_of_comment = false;
 
4207
              break;
 
4208
            }
 
4209
          else
 
4210
            {
 
4211
              if (have_continuation ())
 
4212
                break;
 
4213
              else
 
4214
                goto done;
 
4215
            }
 
4216
 
 
4217
        case '\r':
 
4218
          if (in_comment)
 
4219
            comment_buf += static_cast<char> (c);
 
4220
          c = yyinput ();
 
4221
          if (c == EOF)
 
4222
            break;
 
4223
          else if (c == '\n')
 
4224
            {
 
4225
              retval |= ATE_NEWLINE;
 
4226
              if (in_comment)
 
4227
                {
 
4228
                  comment_buf += static_cast<char> (c);
 
4229
                  octave_comment_buffer::append (comment_buf);
 
4230
                  in_comment = false;
 
4231
                  beginning_of_comment = false;
 
4232
                }
 
4233
              current_input_column = 0;
 
4234
              break;
 
4235
            }
 
4236
 
 
4237
          // Fall through...
 
4238
 
 
4239
        default:
 
4240
          if (in_comment)
 
4241
            {
 
4242
              comment_buf += static_cast<char> (c);
 
4243
              beginning_of_comment = false;
 
4244
              break;
 
4245
            }
 
4246
          else
 
4247
            goto done;
 
4248
        }
 
4249
    }
 
4250
 
 
4251
  if (! comment_buf.empty ())
 
4252
    octave_comment_buffer::append (comment_buf);
 
4253
 
 
4254
 done:
 
4255
  yyunput (c, octave_text);
 
4256
  current_input_column--;
 
4257
  return retval;
 
4258
}
 
4259
 
 
4260
static inline bool
 
4261
looks_like_hex (const char *s, int len)
 
4262
{
 
4263
  return (len > 2 && s[0] == '0' && (s[1] == 'x' || s[1] == 'X'));
 
4264
}
 
4265
 
 
4266
static void
 
4267
handle_number (void)
 
4268
{
 
4269
  double value = 0.0;
 
4270
  int nread = 0;
 
4271
 
 
4272
  if (looks_like_hex (octave_text, strlen (octave_text)))
 
4273
    {
 
4274
      unsigned long ival;
 
4275
 
 
4276
      nread = sscanf (octave_text, "%lx", &ival);
 
4277
 
 
4278
      value = static_cast<double> (ival);
 
4279
    }
 
4280
  else
 
4281
    {
 
4282
      char *tmp = strsave (octave_text);
 
4283
 
 
4284
      char *idx = strpbrk (tmp, "Dd");
 
4285
 
 
4286
      if (idx)
 
4287
        *idx = 'e';
 
4288
 
 
4289
      nread = sscanf (tmp, "%lf", &value);
 
4290
 
 
4291
      delete [] tmp;
 
4292
    }
 
4293
 
 
4294
  // If octave_text doesn't contain a valid number, we are in deep doo doo.
 
4295
 
 
4296
  assert (nread == 1);
 
4297
 
 
4298
  lexer_flags.quote_is_transpose = true;
 
4299
  lexer_flags.convert_spaces_to_comma = true;
 
4300
 
 
4301
  yylval.tok_val = new token (value, octave_text, input_line_number,
 
4302
                              current_input_column);
 
4303
 
 
4304
  token_stack.push (yylval.tok_val);
 
4305
 
 
4306
  current_input_column += octave_leng;
 
4307
 
 
4308
  do_comma_insert_check ();
 
4309
}
 
4310
 
 
4311
// We have seen a backslash and need to find out if it should be
 
4312
// treated as a continuation character.  If so, this eats it, up to
 
4313
// and including the new line character.
 
4314
//
 
4315
// Match whitespace only, followed by a comment character or newline.
 
4316
// Once a comment character is found, discard all input until newline.
 
4317
// If non-whitespace characters are found before comment
 
4318
// characters, return 0.  Otherwise, return 1.
 
4319
 
 
4320
static bool
 
4321
have_continuation (bool trailing_comments_ok)
 
4322
{
 
4323
  std::ostringstream buf;
 
4324
 
 
4325
  std::string comment_buf;
 
4326
 
 
4327
  bool in_comment = false;
 
4328
  bool beginning_of_comment = false;
 
4329
 
 
4330
  int c = 0;
 
4331
 
 
4332
  while ((c = yyinput ()) != EOF)
 
4333
    {
 
4334
      buf << static_cast<char> (c);
 
4335
 
 
4336
      switch (c)
 
4337
        {
 
4338
        case ' ':
 
4339
        case '\t':
 
4340
          if (in_comment)
 
4341
            {
 
4342
              comment_buf += static_cast<char> (c);
 
4343
              beginning_of_comment = false;
 
4344
            }
 
4345
          break;
 
4346
 
 
4347
        case '%':
 
4348
        case '#':
 
4349
          if (trailing_comments_ok)
 
4350
            {
 
4351
              if (in_comment)
 
4352
                {
 
4353
                  if (! beginning_of_comment)
 
4354
                    comment_buf += static_cast<char> (c);
 
4355
                }
 
4356
              else
 
4357
                {
 
4358
                  maybe_gripe_matlab_incompatible_comment (c);
 
4359
                  in_comment = true;
 
4360
                  beginning_of_comment = true;
 
4361
                }
 
4362
            }
 
4363
          else
 
4364
            goto cleanup;
 
4365
          break;
 
4366
 
 
4367
        case '\n':
 
4368
          if (in_comment)
 
4369
            {
 
4370
              comment_buf += static_cast<char> (c);
 
4371
              octave_comment_buffer::append (comment_buf);
 
4372
            }
 
4373
          current_input_column = 0;
 
4374
          promptflag--;
 
4375
          gripe_matlab_incompatible_continuation ();
 
4376
          return true;
 
4377
 
 
4378
        case '\r':
 
4379
          if (in_comment)
 
4380
            comment_buf += static_cast<char> (c);
 
4381
          c = yyinput ();
 
4382
          if (c == EOF)
 
4383
            break;
 
4384
          else if (c == '\n')
 
4385
            {
 
4386
              if (in_comment)
 
4387
                {
 
4388
                  comment_buf += static_cast<char> (c);
 
4389
                  octave_comment_buffer::append (comment_buf);
 
4390
                }
 
4391
              current_input_column = 0;
 
4392
              promptflag--;
 
4393
              gripe_matlab_incompatible_continuation ();
 
4394
              return true;
 
4395
            }
 
4396
 
 
4397
          // Fall through...
 
4398
 
 
4399
        default:
 
4400
          if (in_comment)
 
4401
            {
 
4402
              comment_buf += static_cast<char> (c);
 
4403
              beginning_of_comment = false;
 
4404
            }
 
4405
          else
 
4406
            goto cleanup;
 
4407
          break;
 
4408
        }
 
4409
    }
 
4410
 
 
4411
  yyunput (c, octave_text);
 
4412
  return false;
 
4413
 
 
4414
cleanup:
 
4415
 
 
4416
  std::string s = buf.str ();
 
4417
 
 
4418
  int len = s.length ();
 
4419
  while (len--)
 
4420
    yyunput (s[len], octave_text);
 
4421
 
 
4422
  return false;
 
4423
}
 
4424
 
 
4425
// We have seen a `.' and need to see if it is the start of a
 
4426
// continuation.  If so, this eats it, up to and including the new
 
4427
// line character.
 
4428
 
 
4429
static bool
 
4430
have_ellipsis_continuation (bool trailing_comments_ok)
 
4431
{
 
4432
  char c1 = yyinput ();
 
4433
  if (c1 == '.')
 
4434
    {
 
4435
      char c2 = yyinput ();
 
4436
      if (c2 == '.' && have_continuation (trailing_comments_ok))
 
4437
        return true;
 
4438
      else
 
4439
        {
 
4440
          yyunput (c2, octave_text);
 
4441
          yyunput (c1, octave_text);
 
4442
        }
 
4443
    }
 
4444
  else
 
4445
    yyunput (c1, octave_text);
 
4446
 
 
4447
  return false;
 
4448
}
 
4449
 
 
4450
// See if we have a continuation line.  If so, eat it and the leading
 
4451
// whitespace on the next line.
 
4452
//
 
4453
// Return value is the same as described for eat_whitespace().
 
4454
 
 
4455
static yum_yum
 
4456
eat_continuation (void)
 
4457
{
 
4458
  int retval = ATE_NOTHING;
 
4459
 
 
4460
  int c = yyinput ();
 
4461
 
 
4462
  if ((c == '.' && have_ellipsis_continuation ())
 
4463
      || (c == '\\' && have_continuation ()))
 
4464
    retval = eat_whitespace ();
 
4465
  else
 
4466
    yyunput (c, octave_text);
 
4467
 
 
4468
  return retval;
 
4469
}
 
4470
 
 
4471
static int
 
4472
handle_string (char delim, int text_style)
 
4473
{
 
4474
  std::ostringstream buf;
 
4475
 
 
4476
  int bos_line = input_line_number;
 
4477
  int bos_col = current_input_column;
 
4478
 
 
4479
  int c;
 
4480
  int escape_pending = 0;
 
4481
 
 
4482
  while ((c = yyinput ()) != EOF)
 
4483
    {
 
4484
      current_input_column++;
 
4485
 
 
4486
      if (c == '\\')
 
4487
        {
 
4488
          if (delim == '\'' || escape_pending)
 
4489
            {
 
4490
              buf << static_cast<char> (c);
 
4491
              escape_pending = 0;
 
4492
            }
 
4493
          else
 
4494
            {
 
4495
              if (have_continuation (false))
 
4496
                escape_pending = 0;
 
4497
              else
 
4498
                {
 
4499
                  buf << static_cast<char> (c);
 
4500
                  escape_pending = 1;
 
4501
                }
 
4502
            }
 
4503
          continue;
 
4504
        }
 
4505
      else if (c == '.')
 
4506
        {
 
4507
          if (delim == '\'' || ! have_ellipsis_continuation (false))
 
4508
            buf << static_cast<char> (c);
 
4509
        }
 
4510
      else if (c == '\n')
 
4511
        {
 
4512
          error ("unterminated string constant");
 
4513
          break;
 
4514
        }
 
4515
      else if (c == delim)
 
4516
        {
 
4517
          if (escape_pending)
 
4518
            buf << static_cast<char> (c);
 
4519
          else
 
4520
            {
 
4521
              c = yyinput ();
 
4522
              if (c == delim)
 
4523
                {
 
4524
                  buf << static_cast<char> (c);             
 
4525
                  if (lexer_flags.doing_rawcommand)
 
4526
                    buf << static_cast<char> (c);
 
4527
                }
 
4528
              else
 
4529
                {
 
4530
                  std::string s;  
 
4531
                  yyunput (c, octave_text);
 
4532
 
 
4533
                  if (lexer_flags.doing_rawcommand || delim == '\'')
 
4534
                    s = buf.str ();
 
4535
                  else
 
4536
                    s = do_string_escapes (buf.str ());
 
4537
 
 
4538
                  if (text_style && lexer_flags.doing_rawcommand)
 
4539
                    s = std::string (1, delim) + s + std::string (1, delim);
 
4540
                  else
 
4541
                    {
 
4542
                      lexer_flags.quote_is_transpose = true;
 
4543
                      lexer_flags.convert_spaces_to_comma = true;
 
4544
                    }
 
4545
 
 
4546
                  yylval.tok_val = new token (s, bos_line, bos_col);
 
4547
                  token_stack.push (yylval.tok_val);
 
4548
 
 
4549
                  if (delim == '"')
 
4550
                    gripe_matlab_incompatible ("\" used as string delimiter");
 
4551
                  else if (delim == '\'')
 
4552
                    gripe_single_quote_string ();
 
4553
 
 
4554
                  return delim == '"' ? DQ_STRING : SQ_STRING;
 
4555
                }
 
4556
            }
 
4557
        }
 
4558
      else
 
4559
        {
 
4560
          buf << static_cast<char> (c);
 
4561
        }
 
4562
 
 
4563
      escape_pending = 0;
 
4564
    }
 
4565
 
 
4566
  return LEXICAL_ERROR;
 
4567
}
 
4568
 
 
4569
static bool
 
4570
next_token_is_assign_op (void)
 
4571
{
 
4572
  bool retval = false;
 
4573
 
 
4574
  int c0 = yyinput ();
 
4575
 
 
4576
  switch (c0)
 
4577
    {
 
4578
    case '=':
 
4579
      {
 
4580
        int c1 = yyinput ();
 
4581
        yyunput (c1, octave_text);
 
4582
        if (c1 != '=')
 
4583
          retval = true;
 
4584
      }
 
4585
      break;
 
4586
 
 
4587
    case '+':
 
4588
    case '-':
 
4589
    case '*':
 
4590
    case '/':
 
4591
    case '\\':
 
4592
    case '&':
 
4593
    case '|':
 
4594
      {
 
4595
        int c1 = yyinput ();
 
4596
        yyunput (c1, octave_text);
 
4597
        if (c1 == '=')
 
4598
          retval = true;
 
4599
      }
 
4600
      break;
 
4601
 
 
4602
    case '.':
 
4603
      {
 
4604
        int c1 = yyinput ();
 
4605
        if (match_any (c1, "+-*/\\"))
 
4606
          {
 
4607
            int c2 = yyinput ();
 
4608
            yyunput (c2, octave_text);
 
4609
            if (c2 == '=')
 
4610
              retval = true;
 
4611
          }
 
4612
        yyunput (c1, octave_text);
 
4613
      }
 
4614
      break;
 
4615
 
 
4616
    case '>':
 
4617
      {
 
4618
        int c1 = yyinput ();
 
4619
        if (c1 == '>')
 
4620
          {
 
4621
            int c2 = yyinput ();
 
4622
            yyunput (c2, octave_text);
 
4623
            if (c2 == '=')
 
4624
              retval = true;
 
4625
          }
 
4626
        yyunput (c1, octave_text);
 
4627
      }
 
4628
      break;
 
4629
 
 
4630
    case '<':
 
4631
      {
 
4632
        int c1 = yyinput ();
 
4633
        if (c1 == '<')
 
4634
          {
 
4635
            int c2 = yyinput ();
 
4636
            yyunput (c2, octave_text);
 
4637
            if (c2 == '=')
 
4638
              retval = true;
 
4639
          }
 
4640
        yyunput (c1, octave_text);
 
4641
      }
 
4642
      break;
 
4643
 
 
4644
    default:
 
4645
      break;
 
4646
    }
 
4647
 
 
4648
  yyunput (c0, octave_text);
 
4649
 
 
4650
  return retval;
 
4651
}
 
4652
 
 
4653
static bool
 
4654
next_token_is_index_op (void)
 
4655
{
 
4656
  int c = yyinput ();
 
4657
  yyunput (c, octave_text);
 
4658
  return c == '(' || c == '{';
 
4659
}
 
4660
 
 
4661
static int
 
4662
handle_close_bracket (bool spc_gobbled, int bracket_type)
 
4663
{
 
4664
  int retval = bracket_type;
 
4665
 
 
4666
  if (! nesting_level.none ())
 
4667
    {
 
4668
      nesting_level.remove ();
 
4669
 
 
4670
      if (bracket_type == ']')
 
4671
        lexer_flags.bracketflag--;
 
4672
      else if (bracket_type == '}')
 
4673
        lexer_flags.braceflag--;
 
4674
      else
 
4675
        panic_impossible ();
 
4676
    }
 
4677
 
 
4678
  if (lexer_flags.bracketflag == 0 && lexer_flags.braceflag == 0)
 
4679
    BEGIN (INITIAL);
 
4680
 
 
4681
  if (bracket_type == ']'
 
4682
      && next_token_is_assign_op ()
 
4683
      && ! lexer_flags.looking_at_return_list)
 
4684
    {
 
4685
      retval = CLOSE_BRACE;
 
4686
    }
 
4687
  else if ((lexer_flags.bracketflag || lexer_flags.braceflag)
 
4688
           && lexer_flags.convert_spaces_to_comma
 
4689
           && (nesting_level.is_bracket ()
 
4690
               || (nesting_level.is_brace ()
 
4691
                   && ! lexer_flags.looking_at_object_index)))
 
4692
    {
 
4693
      bool index_op = next_token_is_index_op ();
 
4694
 
 
4695
      // Don't insert comma if we are looking at something like
 
4696
      //
 
4697
      //   [x{i}{j}] or [x{i}(j)]
 
4698
      //
 
4699
      // but do if we are looking at
 
4700
      //
 
4701
      //   [x{i} {j}] or [x{i} (j)]
 
4702
 
 
4703
      if (spc_gobbled || ! (bracket_type == '}' && index_op))
 
4704
        {
 
4705
          bool bin_op = next_token_is_bin_op (spc_gobbled);
 
4706
 
 
4707
          bool postfix_un_op = next_token_is_postfix_unary_op (spc_gobbled);
 
4708
 
 
4709
          bool sep_op = next_token_is_sep_op ();
 
4710
 
 
4711
          if (! (postfix_un_op || bin_op || sep_op))
 
4712
            {
 
4713
              maybe_warn_separator_insert (',');
 
4714
 
 
4715
              yyunput (',', octave_text);
 
4716
              return retval;
 
4717
            }
 
4718
        }
 
4719
    }
 
4720
 
 
4721
  lexer_flags.quote_is_transpose = true;
 
4722
  lexer_flags.convert_spaces_to_comma = true;
 
4723
 
 
4724
  return retval;
 
4725
}
 
4726
 
 
4727
static void
 
4728
maybe_unput_comma (int spc_gobbled)
 
4729
{
 
4730
  if (nesting_level.is_bracket ()
 
4731
      || (nesting_level.is_brace ()
 
4732
          && ! lexer_flags.looking_at_object_index))
 
4733
    {
 
4734
      int bin_op = next_token_is_bin_op (spc_gobbled);
 
4735
 
 
4736
      int postfix_un_op = next_token_is_postfix_unary_op (spc_gobbled);
 
4737
 
 
4738
      int c1 = yyinput ();
 
4739
      int c2 = yyinput ();
 
4740
 
 
4741
      yyunput (c2, octave_text);
 
4742
      yyunput (c1, octave_text);
 
4743
 
 
4744
      int sep_op = next_token_is_sep_op ();
 
4745
 
 
4746
      int dot_op = (c1 == '.'
 
4747
                    && (isalpha (c2) || isspace (c2) || c2 == '_'));
 
4748
 
 
4749
      if (postfix_un_op || bin_op || sep_op || dot_op)
 
4750
        return;
 
4751
 
 
4752
      int index_op = (c1 == '(' || c1 == '{');
 
4753
 
 
4754
      // If there is no space before the indexing op, we don't insert
 
4755
      // a comma.
 
4756
 
 
4757
      if (index_op && ! spc_gobbled)
 
4758
        return;
 
4759
 
 
4760
      maybe_warn_separator_insert (',');
 
4761
 
 
4762
      yyunput (',', octave_text);
 
4763
    }
 
4764
}
 
4765
 
 
4766
// Figure out exactly what kind of token to return when we have seen
 
4767
// an identifier.  Handles keywords.  Return -1 if the identifier
 
4768
// should be ignored.
 
4769
 
 
4770
static int
 
4771
handle_identifier (void)
 
4772
{
 
4773
  std::string tok = strip_trailing_whitespace (octave_text);
 
4774
 
 
4775
  int c = octave_text[octave_leng-1];
 
4776
 
 
4777
  int cont_is_spc = eat_continuation ();
 
4778
 
 
4779
  int spc_gobbled = (cont_is_spc || c == ' ' || c == '\t');
 
4780
 
 
4781
  // If we are expecting a structure element, avoid recognizing
 
4782
  // keywords and other special names and return STRUCT_ELT, which is
 
4783
  // a string that is also a valid identifier.  But first, we have to
 
4784
  // decide whether to insert a comma.
 
4785
 
 
4786
  if (lexer_flags.looking_at_indirect_ref)
 
4787
    {
 
4788
      do_comma_insert_check ();
 
4789
 
 
4790
      maybe_unput_comma (spc_gobbled);
 
4791
 
 
4792
      yylval.tok_val = new token (tok, input_line_number,
 
4793
                                  current_input_column);
 
4794
 
 
4795
      token_stack.push (yylval.tok_val);
 
4796
 
 
4797
      lexer_flags.quote_is_transpose = true;
 
4798
      lexer_flags.convert_spaces_to_comma = true;
 
4799
 
 
4800
      current_input_column += octave_leng;
 
4801
 
 
4802
      return STRUCT_ELT;
 
4803
    }
 
4804
 
 
4805
  int kw_token = is_keyword_token (tok);
 
4806
 
 
4807
  if (lexer_flags.looking_at_function_handle)
 
4808
    {
 
4809
      if (kw_token)
 
4810
        {
 
4811
          error ("function handles may not refer to keywords");
 
4812
 
 
4813
          return LEXICAL_ERROR;
 
4814
        }
 
4815
      else
 
4816
        TOK_PUSH_AND_RETURN (tok, FCN_HANDLE);
 
4817
    }
 
4818
 
 
4819
  // If we have a regular keyword, return it.
 
4820
  // Keywords can be followed by identifiers (TOK_RETURN handles
 
4821
  // that).
 
4822
 
 
4823
  if (kw_token)
 
4824
    {
 
4825
      if (kw_token < 0)
 
4826
        return kw_token;
 
4827
      else
 
4828
        TOK_RETURN (kw_token);
 
4829
    }
 
4830
 
 
4831
  // See if we have a plot keyword (title, using, with, or clear).
 
4832
 
 
4833
  int c1 = yyinput ();
 
4834
 
 
4835
  bool next_tok_is_paren = (c1 == '(');
 
4836
 
 
4837
  bool next_tok_is_eq = false;
 
4838
  if (c1 == '=')
 
4839
    {
 
4840
      int c2 = yyinput ();
 
4841
      yyunput (c2, octave_text);
 
4842
 
 
4843
      if (c2 != '=')
 
4844
        next_tok_is_eq = true;
 
4845
    }
 
4846
 
 
4847
  yyunput (c1, octave_text);
 
4848
 
 
4849
  // Make sure we put the return values of a function in the symbol
 
4850
  // table that is local to the function.
 
4851
 
 
4852
  // If we are defining a function and we have not seen the function
 
4853
  // name yet and the next token is `=', then this identifier must be
 
4854
  // the only return value for the function and it belongs in the
 
4855
  // local symbol table.
 
4856
 
 
4857
  if (next_tok_is_eq
 
4858
      && lexer_flags.defining_func
 
4859
      && ! lexer_flags.parsed_function_name)
 
4860
    curr_sym_tab = tmp_local_sym_tab;
 
4861
 
 
4862
  // Kluge alert.
 
4863
  //
 
4864
  // If we are looking at a text style function, set up to gobble its
 
4865
  // arguments.
 
4866
  //
 
4867
  // If the following token is `=', or if we are parsing a function
 
4868
  // return list or function parameter list, or if we are looking at
 
4869
  // something like [ab,cd] = foo (), force the symbol to be inserted
 
4870
  // as a variable in the current symbol table.
 
4871
 
 
4872
  if (is_command_name (tok) && ! is_variable (tok))
 
4873
    {
 
4874
      if (next_tok_is_eq
 
4875
          || lexer_flags.looking_at_return_list
 
4876
          || lexer_flags.looking_at_parameter_list
 
4877
          || lexer_flags.looking_at_matrix_or_assign_lhs)
 
4878
        {
 
4879
          force_local_variable (tok);
 
4880
        }
 
4881
      else if (! (next_tok_is_paren || lexer_flags.looking_at_object_index))
 
4882
        {
 
4883
          BEGIN (COMMAND_START);
 
4884
        }
 
4885
 
 
4886
      if (is_rawcommand_name (tok) && ! lexer_flags.looking_at_object_index)
 
4887
        {
 
4888
          lexer_flags.doing_rawcommand = true;
 
4889
          BEGIN (COMMAND_START);
 
4890
        }
 
4891
    }
 
4892
 
 
4893
  // Find the token in the symbol table.  Beware the magic
 
4894
  // transformation of the end keyword...
 
4895
 
 
4896
  if (tok == "end")
 
4897
    tok = "__end__";    
 
4898
 
 
4899
  yylval.tok_val = new token (lookup_identifier (tok),
 
4900
                              input_line_number,
 
4901
                              current_input_column);
 
4902
 
 
4903
  token_stack.push (yylval.tok_val);
 
4904
 
 
4905
  // After seeing an identifer, it is ok to convert spaces to a comma
 
4906
  // (if needed).
 
4907
 
 
4908
  lexer_flags.convert_spaces_to_comma = true;
 
4909
 
 
4910
  if (! next_tok_is_eq)
 
4911
    {
 
4912
      lexer_flags.quote_is_transpose = true;
 
4913
 
 
4914
      do_comma_insert_check ();
 
4915
 
 
4916
      maybe_unput_comma (spc_gobbled);
 
4917
    }
 
4918
 
 
4919
  current_input_column += octave_leng;
 
4920
 
 
4921
  return NAME;
 
4922
}
 
4923
 
 
4924
void
 
4925
lexical_feedback::init (void)
 
4926
{
 
4927
  // Not initially defining a matrix list.
 
4928
  bracketflag = 0;
 
4929
 
 
4930
  // Not initially defining a cell array list.
 
4931
  braceflag = 0;
 
4932
 
 
4933
  // Not initially inside a loop or if statement.
 
4934
  looping = 0;
 
4935
 
 
4936
  // Not initially defining a function.
 
4937
  beginning_of_function = false;
 
4938
  defining_func = false;
 
4939
  parsed_function_name = false;
 
4940
  parsing_nested_function = 0;
 
4941
 
 
4942
  // Not initiallly looking at a function handle.
 
4943
  looking_at_function_handle = 0;
 
4944
 
 
4945
  // Not parsing a function return or parameter list.
 
4946
  looking_at_return_list = false;
 
4947
  looking_at_parameter_list = false;
 
4948
 
 
4949
  // Not parsing a matrix or the left hand side of multi-value
 
4950
  // assignment statement.
 
4951
  looking_at_matrix_or_assign_lhs = false;
 
4952
 
 
4953
  // Not parsing an object index.
 
4954
  looking_at_object_index = 0;
 
4955
 
 
4956
  // No need to do comma insert or convert spaces to comma at
 
4957
  // beginning of input. 
 
4958
  convert_spaces_to_comma = true;
 
4959
  do_comma_insert = false;
 
4960
 
 
4961
  // Not initially doing any plotting or setting of plot attributes.
 
4962
  doing_rawcommand = false;
 
4963
 
 
4964
  // Not initially looking at indirect references.
 
4965
  looking_at_indirect_ref = false;
 
4966
 
 
4967
  // Quote marks strings intially.
 
4968
  quote_is_transpose = false;
 
4969
}
 
4970
 
 
4971
bool
 
4972
is_keyword (const std::string& s)
 
4973
{
 
4974
  return octave_kw_hash::in_word_set (s.c_str (), s.length ()) != 0;
 
4975
}
 
4976
 
 
4977
DEFCMD (iskeyword, args, ,
 
4978
  "-*- texinfo -*-\n\
 
4979
@deftypefn {Built-in Function} {} iskeyword (@var{name})\n\
 
4980
Return true if @var{name} is an Octave keyword.  If @var{name}\n\
 
4981
is omitted, return a list of keywords.\n\
 
4982
@end deftypefn")
 
4983
{
 
4984
  octave_value retval;
 
4985
 
 
4986
  int argc = args.length () + 1;
 
4987
 
 
4988
  string_vector argv = args.make_argv ("iskeyword");
 
4989
 
 
4990
  if (error_state)
 
4991
    return retval;
 
4992
 
 
4993
  if (argc == 1)
 
4994
    {
 
4995
      string_vector lst (TOTAL_KEYWORDS);
 
4996
 
 
4997
      for (int i = 0; i < TOTAL_KEYWORDS; i++)
 
4998
        lst[i] = wordlist[i].name;
 
4999
 
 
5000
      retval = Cell (lst.qsort ());
 
5001
    }
 
5002
  else if (argc == 2)
 
5003
    {
 
5004
      retval = is_keyword (argv[1]);
 
5005
    }
 
5006
  else
 
5007
    print_usage ();
 
5008
 
 
5009
  return retval;
 
5010
}
 
5011
 
 
5012
 
 
5013
static void
 
5014
maybe_warn_separator_insert (char sep)
 
5015
{
 
5016
  std::string nm = curr_fcn_file_full_name;
 
5017
 
 
5018
  if (nm.empty ())
 
5019
    warning_with_id ("Octave:separator-insert",
 
5020
                     "potential auto-insertion of `%c' near line %d",
 
5021
                     sep, input_line_number);
 
5022
  else
 
5023
    warning_with_id ("Octave:separator-insert",
 
5024
                     "potential auto-insertion of `%c' near line %d of file %s",
 
5025
                     sep, input_line_number, nm.c_str ());
 
5026
}
 
5027
 
 
5028
static void
 
5029
gripe_single_quote_string (void)
 
5030
{
 
5031
  std::string nm = curr_fcn_file_full_name;
 
5032
 
 
5033
  if (nm.empty ())
 
5034
    warning_with_id ("Octave:single-quote-string",
 
5035
                     "single quote delimited string near line %d",
 
5036
                     input_line_number);
 
5037
  else
 
5038
    warning_with_id ("Octave:single-quote-string",
 
5039
                     "single quote delimited string near line %d of file %s",
 
5040
                     input_line_number, nm.c_str ());
 
5041
}
 
5042
 
 
5043
static void
 
5044
gripe_matlab_incompatible (const std::string& msg)
 
5045
{
 
5046
  warning_with_id ("Octave:matlab-incompatible",
 
5047
                   "potential Matlab compatibility problem: %s",
 
5048
                   msg.c_str ());
 
5049
}
 
5050
 
 
5051
static void
 
5052
maybe_gripe_matlab_incompatible_comment (char c)
 
5053
{
 
5054
  if (c == '#')
 
5055
    gripe_matlab_incompatible ("# used as comment character");
 
5056
}
 
5057
 
 
5058
static void
 
5059
gripe_matlab_incompatible_continuation (void)
 
5060
{
 
5061
  gripe_matlab_incompatible ("\\ used as line continuation marker");
 
5062
}
 
5063
 
 
5064
static void
 
5065
gripe_matlab_incompatible_operator (const std::string& op)
 
5066
{
 
5067
  std::string t = op;
 
5068
  int n = t.length ();
 
5069
  if (t[n-1] == '\n')
 
5070
    t.resize (n-1);
 
5071
  gripe_matlab_incompatible (t + " used as operator");
 
5072
}
 
5073
 
 
5074
DEFUN (__token_count__, , ,
 
5075
  "-*- texinfo -*-\n\
 
5076
@deftypefn {Built-in Function} {} __token_count__\n\
 
5077
Number of language tokens processed since Octave startup.\n\
 
5078
@end deftypefn")
 
5079
{
 
5080
  return octave_value (Vtoken_count);
 
5081
}
 
5082
 
 
5083
/*
 
5084
;;; Local Variables: ***
 
5085
;;; mode: C++ ***
 
5086
;;; End: ***
 
5087
*/
 
5088