
#line 3 "<stdout>"

#define  YY_INT_ALIGNED short int

/* A lexical scanner generated by flex */

#define FLEX_SCANNER
#define YY_FLEX_MAJOR_VERSION 2
#define YY_FLEX_MINOR_VERSION 5
#define YY_FLEX_SUBMINOR_VERSION 31
#if YY_FLEX_SUBMINOR_VERSION > 0
#define FLEX_BETA
#endif

/* First, we deal with  platform-specific or compiler-specific issues. */

/* begin standard C headers. */
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <stdlib.h>

/* end standard C headers. */

/* flex integer type definitions */

#ifndef FLEXINT_H
#define FLEXINT_H

/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */

#if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L
#include <inttypes.h>
typedef int8_t flex_int8_t;
typedef uint8_t flex_uint8_t;
typedef int16_t flex_int16_t;
typedef uint16_t flex_uint16_t;
typedef int32_t flex_int32_t;
typedef uint32_t flex_uint32_t;
#else
typedef signed char flex_int8_t;
typedef short int flex_int16_t;
typedef int flex_int32_t;
typedef unsigned char flex_uint8_t; 
typedef unsigned short int flex_uint16_t;
typedef unsigned int flex_uint32_t;
#endif /* ! C99 */

/* Limits of integral types. */
#ifndef INT8_MIN
#define INT8_MIN               (-128)
#endif
#ifndef INT16_MIN
#define INT16_MIN              (-32767-1)
#endif
#ifndef INT32_MIN
#define INT32_MIN              (-2147483647-1)
#endif
#ifndef INT8_MAX
#define INT8_MAX               (127)
#endif
#ifndef INT16_MAX
#define INT16_MAX              (32767)
#endif
#ifndef INT32_MAX
#define INT32_MAX              (2147483647)
#endif
#ifndef UINT8_MAX
#define UINT8_MAX              (255U)
#endif
#ifndef UINT16_MAX
#define UINT16_MAX             (65535U)
#endif
#ifndef UINT32_MAX
#define UINT32_MAX             (4294967295U)
#endif

#endif /* ! FLEXINT_H */

#ifdef __cplusplus

/* The "const" storage-class-modifier is valid. */
#define YY_USE_CONST

#else	/* ! __cplusplus */

#if __STDC__

#define YY_USE_CONST

#endif	/* __STDC__ */
#endif	/* ! __cplusplus */

#ifdef YY_USE_CONST
#define yyconst const
#else
#define yyconst
#endif

/* Returned upon end-of-file. */
#define YY_NULL 0

/* Promotes a possibly negative, possibly signed char to an unsigned
 * integer for use as an array index.  If the signed char is negative,
 * we want to instead treat it as an 8-bit unsigned char, hence the
 * double cast.
 */
#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)

/* Enter a start condition.  This macro really ought to take a parameter,
 * but we do it the disgusting crufty way forced on us by the ()-less
 * definition of BEGIN.
 */
#define BEGIN (yy_start) = 1 + 2 *

/* Translate the current start state into a value that can be later handed
 * to BEGIN to return to the state.  The YYSTATE alias is for lex
 * compatibility.
 */
#define YY_START (((yy_start) - 1) / 2)
#define YYSTATE YY_START

/* Action number for EOF rule of a given start state. */
#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)

/* Special action meaning "start processing a new file". */
#define YY_NEW_FILE octave_restart(octave_in  )

#define YY_END_OF_BUFFER_CHAR 0

/* Size of default input buffer. */
#ifndef YY_BUF_SIZE
#define YY_BUF_SIZE 16384
#endif

#ifndef YY_TYPEDEF_YY_BUFFER_STATE
#define YY_TYPEDEF_YY_BUFFER_STATE
typedef struct yy_buffer_state *YY_BUFFER_STATE;
#endif

extern int octave_leng;

extern FILE *octave_in, *octave_out;

#define EOB_ACT_CONTINUE_SCAN 0
#define EOB_ACT_END_OF_FILE 1
#define EOB_ACT_LAST_MATCH 2

    #define YY_LESS_LINENO(n)
    
/* Return all but the first "n" matched characters back to the input stream. */
#define yyless(n) \
	do \
		{ \
		/* Undo effects of setting up octave_text. */ \
        int yyless_macro_arg = (n); \
        YY_LESS_LINENO(yyless_macro_arg);\
		*yy_cp = (yy_hold_char); \
		YY_RESTORE_YY_MORE_OFFSET \
		(yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
		YY_DO_BEFORE_ACTION; /* set up octave_text again */ \
		} \
	while ( 0 )

#define unput(c) yyunput( c, (yytext_ptr)  )

/* The following is because we cannot portably get our hands on size_t
 * (without autoconf's help, which isn't available because we want
 * flex-generated scanners to compile on their own).
 */

#ifndef YY_TYPEDEF_YY_SIZE_T
#define YY_TYPEDEF_YY_SIZE_T
typedef unsigned int yy_size_t;
#endif

#ifndef YY_STRUCT_YY_BUFFER_STATE
#define YY_STRUCT_YY_BUFFER_STATE
struct yy_buffer_state
	{
	FILE *yy_input_file;

	char *yy_ch_buf;		/* input buffer */
	char *yy_buf_pos;		/* current position in input buffer */

	/* Size of input buffer in bytes, not including room for EOB
	 * characters.
	 */
	yy_size_t yy_buf_size;

	/* Number of characters read into yy_ch_buf, not including EOB
	 * characters.
	 */
	int yy_n_chars;

	/* Whether we "own" the buffer - i.e., we know we created it,
	 * and can realloc() it to grow it, and should free() it to
	 * delete it.
	 */
	int yy_is_our_buffer;

	/* Whether this is an "interactive" input source; if so, and
	 * if we're using stdio for input, then we want to use getc()
	 * instead of fread(), to make sure we stop fetching input after
	 * each newline.
	 */
	int yy_is_interactive;

	/* Whether we're considered to be at the beginning of a line.
	 * If so, '^' rules will be active on the next match, otherwise
	 * not.
	 */
	int yy_at_bol;

    int yy_bs_lineno; /**< The line count. */
    int yy_bs_column; /**< The column count. */
    
	/* Whether to try to fill the input buffer when we reach the
	 * end of it.
	 */
	int yy_fill_buffer;

	int yy_buffer_status;

#define YY_BUFFER_NEW 0
#define YY_BUFFER_NORMAL 1
	/* When an EOF's been seen but there's still some text to process
	 * then we mark the buffer as YY_EOF_PENDING, to indicate that we
	 * shouldn't try reading from the input source any more.  We might
	 * still have a bunch of tokens to match, though, because of
	 * possible backing-up.
	 *
	 * When we actually see the EOF, we change the status to "new"
	 * (via octave_restart()), so that the user can continue scanning by
	 * just pointing octave_in at a new input file.
	 */
#define YY_BUFFER_EOF_PENDING 2

	};
#endif /* !YY_STRUCT_YY_BUFFER_STATE */

/* Stack of input buffers. */
static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */
static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */
static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */

/* We provide macros for accessing buffer states in case in the
 * future we want to put the buffer states in a more general
 * "scanner state".
 *
 * Returns the top of the stack, or NULL.
 */
#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
                          ? (yy_buffer_stack)[(yy_buffer_stack_top)] \
                          : NULL)

/* Same as previous macro, but useful when we know that the buffer stack is not
 * NULL or when we need an lvalue. For internal use only.
 */
#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]

/* yy_hold_char holds the character lost when octave_text is formed. */
static char yy_hold_char;
static int yy_n_chars;		/* number of characters read into yy_ch_buf */
int octave_leng;

/* Points to current character in buffer. */
static char *yy_c_buf_p = (char *) 0;
static int yy_init = 1;		/* whether we need to initialize */
static int yy_start = 0;	/* start state number */

/* Flag which is used to allow octave_wrap()'s to do buffer switches
 * instead of setting up a fresh octave_in.  A bit of a hack ...
 */
static int yy_did_buffer_switch_on_eof;

void octave_restart (FILE *input_file  );
void octave__switch_to_buffer (YY_BUFFER_STATE new_buffer  );
YY_BUFFER_STATE octave__create_buffer (FILE *file,int size  );
void octave__delete_buffer (YY_BUFFER_STATE b  );
void octave__flush_buffer (YY_BUFFER_STATE b  );
void octave_push_buffer_state (YY_BUFFER_STATE new_buffer  );
void octave_pop_buffer_state (void );

static void octave_ensure_buffer_stack (void );
static void octave__load_buffer_state (void );
static void octave__init_buffer (YY_BUFFER_STATE b,FILE *file  );

#define YY_FLUSH_BUFFER octave__flush_buffer(YY_CURRENT_BUFFER )

YY_BUFFER_STATE octave__scan_buffer (char *base,yy_size_t size  );
YY_BUFFER_STATE octave__scan_string (yyconst char *yy_str  );
YY_BUFFER_STATE octave__scan_bytes (yyconst char *bytes,int len  );

void *octave_alloc (yy_size_t  );
void *octave_realloc (void *,yy_size_t  );
void octave_free (void *  );

#define yy_new_buffer octave__create_buffer

#define yy_set_interactive(is_interactive) \
	{ \
	if ( ! YY_CURRENT_BUFFER ){ \
        octave_ensure_buffer_stack (); \
		YY_CURRENT_BUFFER_LVALUE =    \
            octave__create_buffer(octave_in,YY_BUF_SIZE ); \
	} \
	YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
	}

#define yy_set_bol(at_bol) \
	{ \
	if ( ! YY_CURRENT_BUFFER ){\
        octave_ensure_buffer_stack (); \
		YY_CURRENT_BUFFER_LVALUE =    \
            octave__create_buffer(octave_in,YY_BUF_SIZE ); \
	} \
	YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
	}

#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)

/* Begin user sect3 */

typedef unsigned char YY_CHAR;

FILE *octave_in = (FILE *) 0, *octave_out = (FILE *) 0;

typedef int yy_state_type;

extern int octave_lineno;

int octave_lineno = 1;

extern char *octave_text;
#define yytext_ptr octave_text

static yy_state_type yy_get_previous_state (void );
static yy_state_type yy_try_NUL_trans (yy_state_type current_state  );
static int yy_get_next_buffer (void );
static void yy_fatal_error (yyconst char msg[]  );

/* Done after the current pattern has been matched and before the
 * corresponding action - sets up octave_text.
 */
#define YY_DO_BEFORE_ACTION \
	(yytext_ptr) = yy_bp; \
	octave_leng = (size_t) (yy_cp - yy_bp); \
	(yy_hold_char) = *yy_cp; \
	*yy_cp = '\0'; \
	(yy_c_buf_p) = yy_cp;

#define YY_NUM_RULES 86
#define YY_END_OF_BUFFER 87
/* This struct is not used in this scanner,
   but its presence is necessary. */
struct yy_trans_info
	{
	flex_int32_t yy_verify;
	flex_int32_t yy_nxt;
	};
static yyconst flex_int16_t yy_accept[256] =
    {   0,
       19,   19,   19,   19,   19,   19,    0,    0,    0,    0,
       87,   85,   19,   25,   85,   61,   27,   29,   45,   26,
       64,   65,   49,   62,   53,   63,   66,   50,   18,   18,
       28,   52,   47,   56,   48,   24,   23,   14,   51,   15,
       54,   83,   46,   84,   61,    6,    3,   85,    6,    5,
        6,    5,    6,    6,    6,    6,    4,    6,    6,    6,
        6,    6,    6,    4,    6,    6,    6,    6,    6,    6,
        6,    6,    6,    6,    6,    6,    6,   10,   13,   85,
       29,    9,   11,    7,    8,    1,   86,    2,   19,   25,
       43,   57,   79,   55,   69,   38,   67,   39,   68,   37,

       32,   30,   31,    0,   33,   18,   34,   35,   70,   18,
       18,    0,   16,    0,   59,   40,   41,   44,   60,   23,
       23,   14,    0,   20,    0,    0,   71,   77,   83,   80,
       58,   42,    6,    6,    3,    6,    6,    6,    6,    6,
        6,    6,    6,    6,    6,    6,    6,    6,    6,    6,
        6,    6,    6,    6,    6,    6,    6,    6,    6,    6,
        6,    6,    6,    6,    6,    6,    6,    6,    6,    6,
        6,    6,    6,    6,    6,   10,   13,    0,    0,    9,
       11,    7,    8,   13,    0,    0,   13,    0,   12,    0,
        9,   11,    0,    0,    7,    8,   36,   74,   72,   73,

       22,   75,    0,   76,   78,   17,   18,    0,   18,   18,
       81,   82,    0,   21,    0,    6,    6,    6,    6,    6,
        6,    6,    6,    6,    6,    6,    6,    6,    6,    6,
        6,    6,    6,    0,   13,    0,   12,    0,    0,   12,
        0,   11,    0,    0,   18,   21,    6,    6,   13,    0,
       12,    0,   11,   12,    0
    } ;

static yyconst flex_int32_t yy_ec[256] =
    {   0,
        1,    1,    1,    1,    1,    1,    1,    1,    2,    3,
        1,    1,    4,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    2,    5,    6,    7,    1,    7,    8,    9,   10,
       11,   12,   13,   14,   15,   16,   17,   18,   19,   19,
       19,   19,   19,   19,   19,   19,   19,   20,   21,   22,
       23,   24,    1,   25,   26,   26,   26,   27,   27,   26,
       28,   28,   29,   29,   28,   28,   28,   28,   28,   28,
       28,   28,   28,   28,   28,   28,   28,   30,   28,   28,
       31,   32,   33,   34,   28,    1,   26,   26,   26,   27,

       27,   26,   28,   28,   29,   29,   28,   28,   28,   28,
       28,   28,   28,   28,   28,   28,   28,   28,   28,   30,
       28,   28,   35,   36,   37,   38,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,

        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1
    } ;

static yyconst flex_int32_t yy_meta[39] =
    {   0,
        1,    2,    3,    3,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    3,    1,    1,    1,    2,    2,    1,
        3,    1,    1,    1,    1,    2,    2,    2,    2,    2,
        1,    1,    1,    1,    1,    1,    1,    1
    } ;

static yyconst flex_int16_t yy_base[266] =
    {   0,
        0,    0,   38,    0,   75,    0,  530,  529,  528,  527,
      529,  534,  526,  534,  524,  503,  534,  534,   72,  534,
      534,  534,   69,   70,  534,   71,  104,  502,  123,   72,
      534,  534,   62,  501,   74,  534,  521,  520,  102,  534,
      498,  518,   64,  534,  496,  516,  534,  514,  101,  534,
      124,  534,  514,  513,  125,  105,  534,  128,  152,  108,
      185,  484,  511,  534,  112,  143,  153,  510,  214,  509,
      155,  508,  158,  507,  170,  506,  171,  243,  279,  504,
      171,  504,  188,  503,  502,  534,  534,  534,  501,  534,
      534,  534,  534,  479,  534,  534,  534,  534,  534,  534,

      117,  478,  477,  483,  475,  170,  474,  473,  534,  308,
      191,  204,  534,  208,  472,  534,  534,  534,  471,  491,
      490,  462,  249,  534,  460,  176,  534,  534,  460,  534,
      534,  534,  458,  457,  534,  451,  450,  444,  198,  442,
      439,  431,  429,  403,  401,  226,  206,  235,  147,  237,
      260,  246,  252,  393,  334,  361,  253,  384,  272,  261,
      382,  373,  365,  265,  363,    0,  355,  290,  300,  347,
      339,  334,  329,  309,  283,    0,    0,  274,  179,  271,
      303,  268,  263,    0,  258,  221,    0,  227,  367,  292,
      257,  326,  233,  305,  211,  209,  182,  534,  534,  534,

      352,  534,  300,  534,  534,  534,  305,  320,  329,  354,
      534,  534,  341,  534,  357,  299,  200,  196,  194,  375,
      183,  374,  154,  144,  142,  378,  383,  388,  416,  131,
      113,  407,  410,  359,    0,  395,    0,  108,  412,    0,
      416,  420,  422,  411,  418,  534,  430,  436,    0,  436,
        0,  447,  454,    0,  534,  465,  468,  100,  471,  473,
      476,  479,  482,  485,  488
    } ;

static yyconst flex_int16_t yy_def[266] =
    {   0,
      255,    1,  255,    3,    1,    5,  256,  256,  257,  257,
      255,  255,  255,  255,  255,  255,  255,  255,  255,  255,
      255,  255,  255,  255,  255,  255,  255,  255,  255,  255,
      255,  255,  255,  255,  255,  255,  258,  255,  255,  255,
      255,  255,  255,  255,  255,  259,  255,  255,  259,  255,
      259,  255,  259,  259,  259,  259,  255,  259,  259,  259,
      259,   61,  259,  255,  259,  259,  259,  259,  259,  259,
      259,  259,  259,  259,  259,  259,  259,  255,  255,  255,
      260,  255,  255,  255,  255,  255,  255,  255,  255,  255,
      255,  255,  255,  255,  255,  255,  255,  255,  255,  255,

      255,  255,  255,  255,  255,  255,  255,  255,  255,  255,
      255,  255,  255,  255,  255,  255,  255,  255,  255,  255,
      258,  255,  255,  255,  255,  261,  255,  255,  255,  255,
      255,  255,  259,  255,  255,  259,  259,  259,  259,  259,
      259,  259,  259,  259,  259,  259,  259,  259,  259,  259,
      259,  259,  259,  259,   61,   61,  259,  259,  259,  259,
      259,  259,  259,  259,  255,   69,  255,  255,  262,  259,
      259,  255,  259,  259,  259,   78,   79,  255,  260,  255,
      255,  255,  255,   79,  255,  263,   79,  260,  255,  260,
      255,  255,  255,  264,  255,  255,  255,  255,  255,  255,

      255,  255,  255,  255,  255,  255,  255,  255,  255,  255,
      255,  255,  261,  255,  261,  259,  259,  259,  259,  259,
      259,  259,  259,  259,  259,   61,  259,  259,  259,  259,
      259,  262,  261,  263,   79,  263,  189,  255,  265,  189,
      264,  255,  264,  255,  255,  255,  259,  259,   79,  265,
      189,  265,  255,  189,    0,  255,  255,  255,  255,  255,
      255,  255,  255,  255,  255
    } ;

static yyconst flex_int16_t yy_nxt[573] =
    {   0,
       12,   13,   14,   15,   16,   17,   18,   19,   20,   21,
       22,   23,   24,   25,   26,   27,   28,   29,   30,   31,
       32,   33,   34,   35,   36,   37,   37,   37,   37,   37,
       38,   39,   40,   41,   42,   43,   44,   45,   46,   13,
       47,   48,   49,   50,   18,   51,   52,   53,   54,   55,
       56,   57,   58,   59,   60,   61,   62,   63,   64,   65,
       66,   67,   68,   69,   69,   69,   69,   69,   70,   71,
       72,   73,   74,   75,   76,   77,   78,   79,   80,   92,
       94,   81,   96,  115,  116,   98,  130,  110,   82,  111,
      111,   95,   97,   99,   93,   83,  118,  119,  112,  131,

      113,  121,  134,  123,  124,  125,  134,   84,  126,  134,
      237,   85,  100,  134,  134,  101,  102,  141,  103,  104,
      105,  106,  106,  136,  127,  134,  134,  142,  197,  134,
      154,  137,  134,  160,  161,  107,  139,  108,  110,  198,
      111,  111,  143,  134,  134,  134,  138,  140,  134,  112,
      144,  113,  114,  134,  134,  134,  168,  124,  125,  134,
      145,  169,  220,  146,  147,  162,  148,  149,  150,  151,
      151,  134,  134,  189,  190,  163,  164,  170,  214,  215,
      171,  189,  190,  152,  134,  153,  134,  106,  106,  192,
      192,  193,  173,  175,  194,  134,  203,  134,  113,  134,

      155,  134,  156,  156,  205,  174,  110,  134,  111,  111,
      196,  157,  195,  158,  159,  165,  208,  112,  208,  113,
      171,  209,  209,  235,  236,  210,  210,  134,  218,  189,
      190,  166,  166,  210,  210,  192,  134,  216,  134,  166,
      166,  166,  166,  166,  176,  177,  178,  134,  217,  179,
      123,  124,  125,  134,  134,  126,  180,  219,  191,  221,
      184,  134,  134,  181,  196,  227,  134,  227,  223,  195,
      228,  228,  191,  134,  224,  182,  177,  151,  151,  183,
      184,  184,  185,  230,  134,  186,  222,  231,  158,  229,
      229,  168,  124,  125,  240,  190,  126,  229,  229,  181,

      134,  233,  214,  215,  192,  192,  193,  242,  243,  194,
      134,  182,  244,  213,  244,  183,  206,  245,  245,  206,
      213,  224,  207,  207,  206,  207,  207,  192,  192,  193,
      134,  112,  194,  113,  112,  172,  113,  209,  209,  206,
      134,  206,  225,  214,  215,  225,  209,  209,  134,  133,
      225,  226,  226,  123,  124,  125,  167,  113,  126,  246,
      215,  235,  236,  133,  165,  225,  134,  225,  237,  237,
      238,  210,  210,  239,  134,  134,  168,  124,  125,  210,
      210,  169,  113,  134,  134,  134,  247,  181,  247,  134,
      133,  248,  248,  133,  134,  226,  226,  249,  236,  182,

      228,  228,  134,  183,  134,  228,  228,  133,  233,  214,
      215,  233,  214,  215,  251,  252,  158,  134,  242,  243,
      213,  192,  192,  193,  253,  243,  194,  213,  245,  245,
      134,  134,  134,  229,  229,  245,  245,  134,  251,  252,
      134,  229,  229,  134,  158,  134,  113,  248,  248,  254,
      252,  134,  134,  248,  248,  192,  192,  193,  134,  134,
      194,  129,  124,  122,  158,   86,   86,   86,   88,   88,
       88,  133,  133,  188,  188,  188,  213,  213,  213,  232,
      232,  232,  234,  234,  234,  241,  241,  241,  250,  250,
      250,  120,  120,  212,  211,  205,  204,  202,  201,  200,

      199,  128,   89,  196,  195,  191,  187,  134,  172,  134,
      167,  134,  134,  133,  134,  134,  135,  134,  132,  129,
      128,  122,  120,  117,  109,   91,   90,   89,  255,   87,
       87,   87,   87,   11,  255,  255,  255,  255,  255,  255,
      255,  255,  255,  255,  255,  255,  255,  255,  255,  255,
      255,  255,  255,  255,  255,  255,  255,  255,  255,  255,
      255,  255,  255,  255,  255,  255,  255,  255,  255,  255,
      255,  255
    } ;

static yyconst flex_int16_t yy_chk[573] =
    {   0,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    3,    3,
        3,    3,    3,    3,    3,    3,    3,    3,    3,    3,
        3,    3,    3,    3,    3,    3,    3,    3,    3,    3,
        3,    3,    3,    3,    3,    3,    3,    3,    3,    3,
        3,    3,    3,    3,    3,    3,    5,    5,    5,   19,
       23,    5,   24,   33,   33,   26,   43,   30,    5,   30,
       30,   23,   24,   26,   19,    5,   35,   35,   30,   43,

       30,  258,   49,   39,   39,   39,   56,    5,   39,   60,
      238,    5,   27,   65,  231,   27,   27,   56,   27,   27,
       27,   27,   27,   49,   39,   51,   55,   56,  101,   58,
       60,   51,  230,   65,   65,   27,   55,   27,   29,  101,
       29,   29,   58,  225,   66,  224,   51,   55,  149,   29,
       58,   29,   29,   59,   67,  223,   71,   71,   71,   73,
       59,   71,  149,   59,   59,   66,   59,   59,   59,   59,
       59,   75,   77,   81,   81,   67,   67,   71,  126,  126,
       73,  179,  179,   59,  221,   59,   61,  106,  106,   83,
       83,   83,   75,   77,   83,  219,  106,  218,  106,  139,

       61,  217,   61,   61,  197,   75,  111,  147,  111,  111,
      196,   61,  195,   61,   61,   69,  112,  111,  112,  111,
      139,  112,  112,  186,  186,  114,  114,  146,  147,  188,
      188,   69,   69,  114,  114,  193,  148,  146,  150,   69,
       69,   69,   69,   69,   78,   78,   78,  152,  146,   78,
      123,  123,  123,  153,  157,  123,   78,  148,  191,  150,
      185,  151,  160,   78,  183,  157,  164,  157,  152,  182,
      157,  157,  180,  159,  153,   78,  178,  151,  151,   78,
       79,   79,   79,  160,  175,   79,  151,  164,  151,  159,
      159,  168,  168,  168,  190,  190,  168,  159,  159,   79,

      216,  169,  169,  169,  181,  181,  181,  194,  194,  181,
      174,   79,  203,  169,  203,   79,  110,  203,  203,  110,
      169,  216,  207,  207,  110,  110,  110,  192,  192,  192,
      173,  207,  192,  207,  110,  172,  110,  208,  208,  110,
      171,  110,  155,  213,  213,  155,  209,  209,  170,  155,
      155,  155,  155,  201,  201,  201,  167,  209,  201,  215,
      215,  234,  234,  155,  165,  155,  163,  155,  189,  189,
      189,  210,  210,  189,  162,  222,  220,  220,  220,  210,
      210,  220,  210,  161,  227,  158,  222,  189,  222,  228,
      156,  222,  222,  226,  154,  226,  226,  236,  236,  189,

      227,  227,  145,  189,  144,  228,  228,  226,  232,  232,
      232,  233,  233,  233,  239,  239,  228,  229,  241,  241,
      232,  242,  242,  242,  243,  243,  242,  232,  244,  244,
      143,  247,  142,  229,  229,  245,  245,  248,  250,  250,
      141,  229,  229,  140,  229,  138,  245,  247,  247,  252,
      252,  137,  136,  248,  248,  253,  253,  253,  134,  133,
      253,  129,  125,  122,  248,  256,  256,  256,  257,  257,
      257,  259,  259,  260,  260,  260,  261,  261,  261,  262,
      262,  262,  263,  263,  263,  264,  264,  264,  265,  265,
      265,  121,  120,  119,  115,  108,  107,  105,  104,  103,

      102,   94,   89,   85,   84,   82,   80,   76,   74,   72,
       70,   68,   63,   62,   54,   53,   48,   46,   45,   42,
       41,   38,   37,   34,   28,   16,   15,   13,   11,   10,
        9,    8,    7,  255,  255,  255,  255,  255,  255,  255,
      255,  255,  255,  255,  255,  255,  255,  255,  255,  255,
      255,  255,  255,  255,  255,  255,  255,  255,  255,  255,
      255,  255,  255,  255,  255,  255,  255,  255,  255,  255,
      255,  255
    } ;

static yy_state_type yy_last_accepting_state;
static char *yy_last_accepting_cpos;

extern int octave__flex_debug;
int octave__flex_debug = 0;

/* The intent behind this definition is that it'll catch
 * any uses of REJECT which flex missed.
 */
#define REJECT reject_used_but_not_detected
#define yymore() yymore_used_but_not_detected
#define YY_MORE_ADJ 0
#define YY_RESTORE_YY_MORE_OFFSET
char *octave_text;
#line 1 "lex.l"
/*

Copyright (C) 1996, 1997 John W. Eaton

This file is part of Octave.

Octave is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2, or (at your option) any
later version.

Octave is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
for more details.

You should have received a copy of the GNU General Public License
along with Octavee; see the file COPYING.  If not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.

*/




#line 33 "lex.l"
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

#include <cctype>
#include <cstring>

#include <string>
#include <stack>

#ifdef HAVE_UNISTD_H
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#include <unistd.h>
#endif

#include "cmd-edit.h"
#include "quit.h"
#include "lo-mappers.h"
#include "lo-sstream.h"

// These would be alphabetical, but y.tab.h must be included before
// oct-gperf.h and y.tab.h must be included after token.h and the tree
// class declarations.  We can't include y.tab.h in oct-gperf.h
// because it may not be protected to allow it to be included multiple
// times.

#include "Cell.h"
#include "comment-list.h"
#include "defun.h"
#include "error.h"
#include "gripes.h"
#include "input.h"
#include "lex.h"
#include "ov.h"
#include "parse.h"
#include "pt-all.h"
#include "symtab.h"
#include "token.h"
#include "toplev.h"
#include "utils.h"
#include "variables.h"
#include <y.tab.h>
#include <oct-gperf.h>

#if ! (defined (FLEX_SCANNER) \
       && defined (YY_FLEX_MAJOR_VERSION) && YY_FLEX_MAJOR_VERSION >= 2 \
       && defined (YY_FLEX_MINOR_VERSION) && YY_FLEX_MINOR_VERSION >= 5)
#error lex.l requires flex version 2.5.4 or later
#endif

#define yylval octave_lval

// Arrange to get input via readline.

#ifdef YY_INPUT
#undef YY_INPUT
#endif
#define YY_INPUT(buf, result, max_size) \
  if ((result = octave_read (buf, max_size)) < 0) \
    YY_FATAL_ERROR ("octave_read () in flex scanner failed");

// Try to avoid crashing out completely on fatal scanner errors.
// The call to yy_fatal_error should never happen, but it avoids a
// `static function defined but not used' warning from gcc.

#ifdef YY_FATAL_ERROR
#undef YY_FATAL_ERROR
#endif
#define YY_FATAL_ERROR(msg) \
  do \
    { \
      error (msg); \
      OCTAVE_QUIT; \
      yy_fatal_error (msg); \
    } \
  while (0)

#define COUNT_TOK_AND_RETURN(tok) \
  do \
    { \
      Vtoken_count++; \
      return tok; \
    } \
  while (0)

#define TOK_RETURN(tok) \
  do \
    { \
      current_input_column += octave_leng; \
      lexer_flags.quote_is_transpose = false; \
      lexer_flags.cant_be_identifier = false; \
      lexer_flags.convert_spaces_to_comma = true; \
      COUNT_TOK_AND_RETURN (tok); \
    } \
  while (0)

#define TOK_PUSH_AND_RETURN(name, tok) \
  do \
    { \
      yylval.tok_val = new token (name, input_line_number, \
				  current_input_column); \
      token_stack.push (yylval.tok_val); \
      TOK_RETURN (tok); \
    } \
  while (0)

#define BIN_OP_RETURN(tok, convert) \
  do \
    { \
      yylval.tok_val = new token (input_line_number, current_input_column); \
      token_stack.push (yylval.tok_val); \
      current_input_column += octave_leng; \
      lexer_flags.quote_is_transpose = false; \
      lexer_flags.cant_be_identifier = true; \
      lexer_flags.convert_spaces_to_comma = convert; \
      COUNT_TOK_AND_RETURN (tok); \
    } \
  while (0)

#define XBIN_OP_RETURN(tok, convert) \
  do \
    { \
	gripe_matlab_incompatible_operator (octave_text); \
        BIN_OP_RETURN (tok, convert); \
    } \
  while (0)

// TRUE means that we have encountered EOF on the input stream.
bool parser_end_of_input = false;

// Flags that need to be shared between the lexer and parser.
lexical_feedback lexer_flags;

// Stack to hold tokens so that we can delete them when the parser is
// reset and avoid growing forever just because we are stashing some
// information.  This has to appear before lex.h is included, because
// one of the macros defined there uses token_stack.
//
// XXX FIXME XXX -- this should really be static, but that causes
// problems on some systems.
std::stack <token*> token_stack;

// Did eat_whitespace() eat a space or tab, or a newline, or both?

typedef int yum_yum;

const yum_yum ATE_NOTHING = 0;
const yum_yum ATE_SPACE_OR_TAB = 1;
const yum_yum ATE_NEWLINE = 2;

// Is the closest nesting level a square bracket, squiggly brace or a paren?

class bracket_brace_paren_nesting_level
{
public:

  bracket_brace_paren_nesting_level (void) : context () { }

  ~bracket_brace_paren_nesting_level (void) { }

  void bracket (void) { context.push (BRACKET); }
  bool is_bracket (void)
    { return ! context.empty () && context.top () == BRACKET; }

  void brace (void) {  context.push (BRACE); }
  bool is_brace (void)
    { return ! context.empty () && context.top () == BRACE; }

  void paren (void) {  context.push (PAREN); }
  bool is_paren (void)
    { return ! context.empty () && context.top () == PAREN; }

  bool is_bracket_or_brace (void)
    { return (! context.empty ()
	      && (context.top () == BRACKET || context.top () == BRACE)); }

  bool none (void) { return context.empty (); }

  void remove (void) { if (! context.empty ()) context.pop (); }

  void clear (void) { while (! context.empty ()) context.pop (); }

private:

  std::stack<int> context;

  static const int BRACKET;
  static const int BRACE;
  static const int PAREN;

  bracket_brace_paren_nesting_level (const bracket_brace_paren_nesting_level&);

  bracket_brace_paren_nesting_level&
  operator = (const bracket_brace_paren_nesting_level&);
};

const int bracket_brace_paren_nesting_level::BRACKET = 1;
const int bracket_brace_paren_nesting_level::BRACE = 2;
const int bracket_brace_paren_nesting_level::PAREN = 3;

static bracket_brace_paren_nesting_level nesting_level;

static bool Vwarn_matlab_incompatible = false;

static bool Vwarn_separator_insert = false;

static bool Vwarn_single_quote_string = false;

static unsigned int Vtoken_count = 0;

// Forward declarations for functions defined at the bottom of this
// file.

static void fixup_column_count (char *s);
static void do_comma_insert_check (void);
static int is_plot_keyword (const std::string& s);
static int is_keyword_token (const std::string& s);
static void prep_for_function (void);
static void prep_for_nested_function (void);
static std::string plot_style_token (const std::string& s);
static symbol_record *lookup_identifier (const std::string& s);
static std::string grab_help_text (void);
static bool match_any (char c, const char *s);
static bool next_token_is_sep_op (void);
static bool next_token_is_bin_op (bool spc_prev);
static bool next_token_is_postfix_unary_op (bool spc_prev);
static std::string strip_trailing_whitespace (char *s);
static void handle_number (void);
static int handle_string (char delim, int text_style = 0);
static int handle_close_bracket (bool spc_gobbled, int bracket_type);
static int handle_identifier (void);
static bool have_continuation (bool trailing_comments_ok = true);
static bool have_ellipsis_continuation (bool trailing_comments_ok = true);
static void scan_for_comments (const char *);
static yum_yum eat_whitespace (void);
static yum_yum eat_continuation (void);
static void maybe_warn_separator_insert (char sep);
static void gripe_single_quote_string (void);
static void gripe_matlab_incompatible (const std::string& msg);
static void maybe_gripe_matlab_incompatible_comment (char c);
static void gripe_matlab_incompatible_continuation (void);
static void gripe_matlab_incompatible_operator (const std::string& op);
static void gripe_deprecated_gplot (void);
static void gripe_deprecated_gsplot (void);

#line 925 "<stdout>"

#define INITIAL 0
#define COMMAND_START 1
#define MATRIX_START 2
#define NESTED_FUNCTION_END 3
#define NESTED_FUNCTION_BEGIN 4

#ifndef YY_NO_UNISTD_H
/* Special case for "unistd.h", since it is non-ANSI. We include it way
 * down here because we want the user's section 1 to have been scanned first.
 * The user has a chance to override it with an option.
 */
#include <unistd.h>
#endif

#ifndef YY_EXTRA_TYPE
#define YY_EXTRA_TYPE void *
#endif

/* Macros after this point can all be overridden by user definitions in
 * section 1.
 */

#ifndef YY_SKIP_YYWRAP
#ifdef __cplusplus
extern "C" int octave_wrap (void );
#else
extern int octave_wrap (void );
#endif
#endif

    static void yyunput (int c,char *buf_ptr  );
    
#ifndef yytext_ptr
static void yy_flex_strncpy (char *,yyconst char *,int );
#endif

#ifdef YY_NEED_STRLEN
static int yy_flex_strlen (yyconst char * );
#endif

#ifndef YY_NO_INPUT

#ifdef __cplusplus
static int yyinput (void );
#else
static int input (void );
#endif

#endif

/* Amount of stuff to slurp up with each read. */
#ifndef YY_READ_BUF_SIZE
#define YY_READ_BUF_SIZE 8192
#endif

/* Copy whatever the last rule matched to the standard output. */
#ifndef ECHO
/* This used to be an fputs(), but since the string might contain NUL's,
 * we now use fwrite().
 */
#define ECHO (void) fwrite( octave_text, octave_leng, 1, octave_out )
#endif

/* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
 * is returned in "result".
 */
#ifndef YY_INPUT
#define YY_INPUT(buf,result,max_size) \
	if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
		{ \
		int c = '*'; \
		size_t n; \
		for ( n = 0; n < max_size && \
			     (c = getc( octave_in )) != EOF && c != '\n'; ++n ) \
			buf[n] = (char) c; \
		if ( c == '\n' ) \
			buf[n++] = (char) c; \
		if ( c == EOF && ferror( octave_in ) ) \
			YY_FATAL_ERROR( "input in flex scanner failed" ); \
		result = n; \
		} \
	else \
		{ \
		errno=0; \
		while ( (result = fread(buf, 1, max_size, octave_in))==0 && ferror(octave_in)) \
			{ \
			if( errno != EINTR) \
				{ \
				YY_FATAL_ERROR( "input in flex scanner failed" ); \
				break; \
				} \
			errno=0; \
			clearerr(octave_in); \
			} \
		}\
\

#endif

/* No semi-colon after return; correct usage is to write "yyterminate();" -
 * we don't want an extra ';' after the "return" because that will cause
 * some compilers to complain about unreachable statements.
 */
#ifndef yyterminate
#define yyterminate() return YY_NULL
#endif

/* Number of entries by which start-condition stack grows. */
#ifndef YY_START_STACK_INCR
#define YY_START_STACK_INCR 25
#endif

/* Report a fatal error. */
#ifndef YY_FATAL_ERROR
#define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
#endif

/* end tables serialization structures and prototypes */

/* Default declaration of generated scanner - a define so the user can
 * easily add parameters.
 */
#ifndef YY_DECL
#define YY_DECL_IS_OURS 1

extern int octave_lex (void);

#define YY_DECL int octave_lex (void)
#endif /* !YY_DECL */

/* Code executed at the beginning of each rule, after octave_text and octave_leng
 * have been set up.
 */
#ifndef YY_USER_ACTION
#define YY_USER_ACTION
#endif

/* Code executed at the end of each rule. */
#ifndef YY_BREAK
#define YY_BREAK break;
#endif

#define YY_RULE_SETUP \
	YY_USER_ACTION

/** The main scanner function which does all the work.
 */
YY_DECL
{
	register yy_state_type yy_current_state;
	register char *yy_cp, *yy_bp;
	register int yy_act;
    
#line 299 "lex.l"


#line 1083 "<stdout>"

	if ( (yy_init) )
		{
		(yy_init) = 0;

#ifdef YY_USER_INIT
		YY_USER_INIT;
#endif

		if ( ! (yy_start) )
			(yy_start) = 1;	/* first start state */

		if ( ! octave_in )
			octave_in = stdin;

		if ( ! octave_out )
			octave_out = stdout;

		if ( ! YY_CURRENT_BUFFER ) {
			octave_ensure_buffer_stack ();
			YY_CURRENT_BUFFER_LVALUE =
				octave__create_buffer(octave_in,YY_BUF_SIZE );
		}

		octave__load_buffer_state( );
		}

	while ( 1 )		/* loops until end-of-file is reached */
		{
		yy_cp = (yy_c_buf_p);

		/* Support of octave_text. */
		*yy_cp = (yy_hold_char);

		/* yy_bp points to the position in yy_ch_buf of the start of
		 * the current run.
		 */
		yy_bp = yy_cp;

		yy_current_state = (yy_start);
yy_match:
		do
			{
			register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
			if ( yy_accept[yy_current_state] )
				{
				(yy_last_accepting_state) = yy_current_state;
				(yy_last_accepting_cpos) = yy_cp;
				}
			while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
				{
				yy_current_state = (int) yy_def[yy_current_state];
				if ( yy_current_state >= 256 )
					yy_c = yy_meta[(unsigned int) yy_c];
				}
			yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
			++yy_cp;
			}
		while ( yy_base[yy_current_state] != 534 );

yy_find_action:
		yy_act = yy_accept[yy_current_state];
		if ( yy_act == 0 )
			{ /* have to back up */
			yy_cp = (yy_last_accepting_cpos);
			yy_current_state = (yy_last_accepting_state);
			yy_act = yy_accept[yy_current_state];
			}

		YY_DO_BEFORE_ACTION;

do_action:	/* This label is used only to access EOF actions. */

		switch ( yy_act )
	{ /* beginning of action switch */
			case 0: /* must back up */
			/* undo the effects of YY_DO_BEFORE_ACTION */
			*yy_cp = (yy_hold_char);
			yy_cp = (yy_last_accepting_cpos);
			yy_current_state = (yy_last_accepting_state);
			goto yy_find_action;

case 1:
YY_RULE_SETUP
#line 301 "lex.l"
{
    BEGIN (NESTED_FUNCTION_BEGIN);
    yyunput (octave_text[0], octave_text);
    COUNT_TOK_AND_RETURN (';');
  }
	YY_BREAK
case 2:
YY_RULE_SETUP
#line 307 "lex.l"
{
    BEGIN (INITIAL);
    yyunput (octave_text[0], octave_text);
    prep_for_nested_function ();
    COUNT_TOK_AND_RETURN (FCN);
  }
	YY_BREAK

// Help and other command-style functions are a pain in the ass.  This
// stuff needs to be simplified.  May require some changes in the
// parser too.

case 3:
/* rule 3 can match eol */
YY_RULE_SETUP
#line 320 "lex.l"
{
    BEGIN (INITIAL);
    current_input_column = 1;
    lexer_flags.quote_is_transpose = false;
    lexer_flags.cant_be_identifier = false;
    lexer_flags.convert_spaces_to_comma = true;
    COUNT_TOK_AND_RETURN ('\n');
  }
	YY_BREAK
case 4:
YY_RULE_SETUP
#line 329 "lex.l"
{
    if (lexer_flags.doing_set && strcmp (octave_text, ",") == 0)
      {
	TOK_PUSH_AND_RETURN (octave_text, STRING);
      }
    else
      {
	BEGIN (INITIAL);
	if (strcmp (octave_text, ",") == 0)
	  TOK_RETURN (',');
	else
	  TOK_RETURN (';');
      }
  }
	YY_BREAK
case 5:
YY_RULE_SETUP
#line 344 "lex.l"
{
    current_input_column++;
    COUNT_TOK_AND_RETURN (handle_string (octave_text[0], true));
  }
	YY_BREAK
case 6:
YY_RULE_SETUP
#line 349 "lex.l"
{
    std::string tok = strip_trailing_whitespace (octave_text);
    TOK_PUSH_AND_RETURN (tok, STRING);
  }
	YY_BREAK

// For this and the next two rules, we're looking at ']', and we
// need to know if the next token is `=' or `=='.
//
// It would have been so much easier if the delimiters were simply
// different for the expression on the left hand side of the equals
// operator.
//
// It's also a pain in the ass to decide whether to insert a comma
// after seeing a ']' character...

case 7:
/* rule 7 can match eol */
YY_RULE_SETUP
#line 366 "lex.l"
{
    scan_for_comments (octave_text);
    fixup_column_count (octave_text);
    int c = octave_text[octave_leng-1];
    int cont_is_spc = eat_continuation ();
    bool spc_gobbled = (cont_is_spc || c == ' ' || c == '\t');
    int tok_to_return = handle_close_bracket (spc_gobbled, ']');
    if (spc_gobbled)
      yyunput (' ', octave_text);
    COUNT_TOK_AND_RETURN (tok_to_return);
  }
	YY_BREAK
case 8:
/* rule 8 can match eol */
YY_RULE_SETUP
#line 378 "lex.l"
{
    scan_for_comments (octave_text);
    fixup_column_count (octave_text);
    int c = octave_text[octave_leng-1];
    int cont_is_spc = eat_continuation ();
    bool spc_gobbled = (cont_is_spc || c == ' ' || c == '\t');
    int tok_to_return = handle_close_bracket (spc_gobbled, '}');
    if (spc_gobbled)
      yyunput (' ', octave_text);
    COUNT_TOK_AND_RETURN (tok_to_return);
  }
	YY_BREAK

// Commas are element separators in matrix constants.  If we don't
// check for continuations here we can end up inserting too many
// commas.

case 9:
YY_RULE_SETUP
#line 396 "lex.l"
{
    current_input_column += octave_leng;

    int tmp = eat_continuation ();

    lexer_flags.quote_is_transpose = false;
    lexer_flags.cant_be_identifier = false;
    lexer_flags.convert_spaces_to_comma = true;

    if ((tmp & ATE_NEWLINE) == ATE_NEWLINE)
      {
	maybe_warn_separator_insert (';');

	yyunput (';', octave_text);
      }

    COUNT_TOK_AND_RETURN (',');
  }
	YY_BREAK

// In some cases, spaces in matrix constants can turn into commas.
// If commas are required, spaces are not important in matrix
// constants so we just eat them.  If we don't check for continuations
// here we can end up inserting too many commas.

case 10:
YY_RULE_SETUP
#line 422 "lex.l"
{
    current_input_column += octave_leng;

    int tmp = eat_continuation ();
    int bin_op = next_token_is_bin_op (true);
    int postfix_un_op = next_token_is_postfix_unary_op (true);

    if (! (postfix_un_op || bin_op)
	&& nesting_level.is_bracket_or_brace ()
	&& lexer_flags.convert_spaces_to_comma)
      {
	if ((tmp & ATE_NEWLINE) == ATE_NEWLINE)
	  {
	    maybe_warn_separator_insert (';');

	    yyunput (';', octave_text);
	  }

	lexer_flags.quote_is_transpose = false;
	lexer_flags.cant_be_identifier = false;
	lexer_flags.convert_spaces_to_comma = true;

	maybe_warn_separator_insert (',');

	COUNT_TOK_AND_RETURN (',');
      }
  }
	YY_BREAK

// Semicolons are handled as row seprators in matrix constants.  If we
// don't eat whitespace here we can end up inserting too many
// semicolons.

case 11:
/* rule 11 can match eol */
YY_RULE_SETUP
#line 456 "lex.l"
{
    scan_for_comments (octave_text);
    fixup_column_count (octave_text);
    eat_whitespace ();
    lexer_flags.quote_is_transpose = false;
    lexer_flags.cant_be_identifier = false;
    lexer_flags.convert_spaces_to_comma = true;
    COUNT_TOK_AND_RETURN (';');
  }
	YY_BREAK

// In some cases, new lines can also become row separators.  If we
// don't eat whitespace here we can end up inserting too many
// semicolons.

case 12:
/* rule 12 can match eol */
#line 473 "lex.l"
case 13:
/* rule 13 can match eol */
YY_RULE_SETUP
#line 473 "lex.l"
{
    scan_for_comments (octave_text);
    fixup_column_count (octave_text);
    eat_whitespace ();

    lexer_flags.quote_is_transpose = false;
    lexer_flags.cant_be_identifier = false;
    lexer_flags.convert_spaces_to_comma = true;

    if (nesting_level.none ())
      return LEXICAL_ERROR;

    if (nesting_level.is_bracket_or_brace ())
      {
	maybe_warn_separator_insert (';');

	COUNT_TOK_AND_RETURN (';');
      }
  }
	YY_BREAK

// Open and close bracket are handled differently if we are in the range
// part of a plot command.
//

case 14:
YY_RULE_SETUP
#line 499 "lex.l"
{
    nesting_level.bracket ();

    current_input_column += octave_leng;
    lexer_flags.quote_is_transpose = false;
    lexer_flags.cant_be_identifier = false;
    lexer_flags.convert_spaces_to_comma = true;

    promptflag--;
    eat_whitespace ();

    if (lexer_flags.plotting && ! lexer_flags.past_plot_range)
      {
	lexer_flags.in_plot_range = true;
	COUNT_TOK_AND_RETURN (OPEN_BRACE);
      }
    else
      {
	lexer_flags.bracketflag++;
	BEGIN (MATRIX_START);
	COUNT_TOK_AND_RETURN ('[');
      }
  }
	YY_BREAK
case 15:
YY_RULE_SETUP
#line 523 "lex.l"
{
    nesting_level.remove ();

    if (lexer_flags.plotting && ! lexer_flags.past_plot_range)
      {
	lexer_flags.in_plot_range = false;
	TOK_RETURN (CLOSE_BRACE);
      }
    else
      TOK_RETURN (']');
  }
	YY_BREAK

// Imaginary numbers.

case 16:
YY_RULE_SETUP
#line 539 "lex.l"
{
    handle_number ();
    COUNT_TOK_AND_RETURN (IMAG_NUM);
  }
	YY_BREAK

// Real numbers.  Don't grab the `.' part of a dot operator as part of
// the constant.

case 17:
*yy_cp = (yy_hold_char); /* undo effects of setting up octave_text */
(yy_c_buf_p) = yy_cp -= 2;
YY_DO_BEFORE_ACTION; /* set up octave_text again */
#line 550 "lex.l"
case 18:
YY_RULE_SETUP
#line 550 "lex.l"
{
    handle_number ();
    COUNT_TOK_AND_RETURN (NUM);
  }
	YY_BREAK

// Eat whitespace.  Whitespace inside matrix constants is handled by
// the <MATRIX_START> start state code above.

case 19:
YY_RULE_SETUP
#line 560 "lex.l"
{
    current_input_column += octave_leng;
  }
	YY_BREAK

// Continuation lines.  Allow comments after continuations.

case 20:
/* rule 20 can match eol */
#line 569 "lex.l"
case 21:
/* rule 21 can match eol */
YY_RULE_SETUP
#line 569 "lex.l"
{
    if (octave_text[0] == '\\')
      gripe_matlab_incompatible_continuation ();
    scan_for_comments (octave_text);
    promptflag--;
    current_input_column = 1;
  }
	YY_BREAK

// An ellipsis not at the end of a line is not a continuation, but
// does have another meaning.

case 22:
YY_RULE_SETUP
#line 582 "lex.l"
{
    if (lexer_flags.looking_at_parameter_list)
      {
	warning ("`...' is deprecated; use varargin instead");
	COUNT_TOK_AND_RETURN (VARARGIN);
      }
    else if (lexer_flags.looking_at_return_list)
      {
	warning ("`...' is deprecated; use varargout instead");
	COUNT_TOK_AND_RETURN (VARARGOUT);
      }
    else
      return LEXICAL_ERROR;
  }
	YY_BREAK

// End of file.

case YY_STATE_EOF(INITIAL):
case YY_STATE_EOF(COMMAND_START):
case YY_STATE_EOF(MATRIX_START):
case YY_STATE_EOF(NESTED_FUNCTION_END):
case YY_STATE_EOF(NESTED_FUNCTION_BEGIN):
#line 601 "lex.l"
{
    TOK_RETURN (END_OF_INPUT);
  }
	YY_BREAK

// Identifiers.  Truncate the token at the first space or tab but
// don't write directly on octave_text.

case 23:
YY_RULE_SETUP
#line 610 "lex.l"
{
    int id_tok = handle_identifier ();

    if (id_tok >= 0)
      COUNT_TOK_AND_RETURN (id_tok);
  }
	YY_BREAK

// Function handles.

case 24:
YY_RULE_SETUP
#line 621 "lex.l"
{
    current_input_column++;
    lexer_flags.quote_is_transpose = false;
    lexer_flags.cant_be_identifier = false;
    lexer_flags.convert_spaces_to_comma = false;
    lexer_flags.looking_at_function_handle++;
    COUNT_TOK_AND_RETURN ('@');
  }
	YY_BREAK

// A new line character.  New line characters inside matrix constants
// are handled by the <MATRIX_START> start state code above.  If closest
// nesting is inside parentheses, don't return a row separator.

case 25:
/* rule 25 can match eol */
YY_RULE_SETUP
#line 636 "lex.l"
{
    current_input_column = 1;
    lexer_flags.quote_is_transpose = false;
    lexer_flags.cant_be_identifier = false;
    lexer_flags.convert_spaces_to_comma = true;

    if (nesting_level.none ())
      COUNT_TOK_AND_RETURN ('\n');
    else if (nesting_level.is_paren ())
      gripe_matlab_incompatible ("bare newline inside parentheses");
    else if (nesting_level.is_bracket_or_brace ())
      return LEXICAL_ERROR;
  }
	YY_BREAK

// Single quote can either be the beginning of a string or a transpose
// operator. 

case 26:
YY_RULE_SETUP
#line 655 "lex.l"
{
    current_input_column++;
    lexer_flags.convert_spaces_to_comma = true;

    if (lexer_flags.quote_is_transpose)
      {
	do_comma_insert_check ();
	COUNT_TOK_AND_RETURN (QUOTE);
      }
    else
      COUNT_TOK_AND_RETURN (handle_string ('\''));
  }
	YY_BREAK

// Double quotes always begin strings.

case 27:
YY_RULE_SETUP
#line 672 "lex.l"
{
    current_input_column++;
    COUNT_TOK_AND_RETURN (handle_string ('"'));
}
	YY_BREAK

// The colon operator is handled differently if we are in the range
// part of a plot command.

case 28:
YY_RULE_SETUP
#line 682 "lex.l"
{
    if (lexer_flags.plotting
	&& (lexer_flags.in_plot_range || lexer_flags.in_plot_using))
      BIN_OP_RETURN (COLON, true);
    else
      BIN_OP_RETURN (':', false);
  }
	YY_BREAK

// Gobble comments.  If closest nesting is inside parentheses, don't
// return a new line.

case 29:
YY_RULE_SETUP
#line 695 "lex.l"
{
    std::string help_txt;

    if (! help_buf.empty ())
      help_txt = help_buf.top ();

    if (help_txt.empty ()
	&& lexer_flags.beginning_of_function
	&& nesting_level.none ())
      {
	lexer_flags.beginning_of_function = false;

	std::string txt = grab_help_text ();

	if (! help_buf.empty ())
	  help_buf.pop ();

	help_buf.push (txt);

	octave_comment_buffer::append (txt);
      }
    else
      {
	std::string buf;

	bool begin_comment = true;

	int c;
	while ((c = yyinput ()) != EOF && c != '\n')
	  {
	    if (begin_comment && (c == '#' || c == '%'))
	      ; /* Skip leading comment characters. */
	    else
	      buf += static_cast<char> (c);
	  }

	octave_comment_buffer::append (buf);
      }

    current_input_column = 1;
    lexer_flags.quote_is_transpose = false;
    lexer_flags.cant_be_identifier = false;
    lexer_flags.convert_spaces_to_comma = true;

    maybe_gripe_matlab_incompatible_comment (octave_text[0]);

    if (YY_START == COMMAND_START)
      BEGIN (INITIAL);

    if (nesting_level.none ())
      COUNT_TOK_AND_RETURN ('\n');
    else if (nesting_level.is_bracket_or_brace ())
      COUNT_TOK_AND_RETURN (';');
  }
	YY_BREAK

// Other operators.

case 30:
YY_RULE_SETUP
#line 754 "lex.l"
{ XBIN_OP_RETURN (EPLUS, false); }
	YY_BREAK
case 31:
YY_RULE_SETUP
#line 755 "lex.l"
{ XBIN_OP_RETURN (EMINUS, false); }
	YY_BREAK
case 32:
YY_RULE_SETUP
#line 756 "lex.l"
{ BIN_OP_RETURN (EMUL, false); }
	YY_BREAK
case 33:
YY_RULE_SETUP
#line 757 "lex.l"
{ BIN_OP_RETURN (EDIV, false); }
	YY_BREAK
case 34:
YY_RULE_SETUP
#line 758 "lex.l"
{ BIN_OP_RETURN (ELEFTDIV, false); }
	YY_BREAK
case 35:
YY_RULE_SETUP
#line 759 "lex.l"
{ BIN_OP_RETURN (EPOW, false); }
	YY_BREAK
case 36:
YY_RULE_SETUP
#line 760 "lex.l"
{ XBIN_OP_RETURN (EPOW, false); }
	YY_BREAK
case 37:
YY_RULE_SETUP
#line 761 "lex.l"
{ do_comma_insert_check (); BIN_OP_RETURN (TRANSPOSE, true); }
	YY_BREAK
case 38:
YY_RULE_SETUP
#line 762 "lex.l"
{ do_comma_insert_check (); XBIN_OP_RETURN (PLUS_PLUS, true); }
	YY_BREAK
case 39:
YY_RULE_SETUP
#line 763 "lex.l"
{ do_comma_insert_check (); XBIN_OP_RETURN (MINUS_MINUS, true); }
	YY_BREAK
case 40:
YY_RULE_SETUP
#line 764 "lex.l"
{ BIN_OP_RETURN (EXPR_LE, false); }
	YY_BREAK
case 41:
YY_RULE_SETUP
#line 765 "lex.l"
{ BIN_OP_RETURN (EXPR_EQ, false); }
	YY_BREAK
case 42:
YY_RULE_SETUP
#line 766 "lex.l"
{ BIN_OP_RETURN (EXPR_NE, false); }
	YY_BREAK
case 43:
YY_RULE_SETUP
#line 767 "lex.l"
{ XBIN_OP_RETURN (EXPR_NE, false); }
	YY_BREAK
case 44:
YY_RULE_SETUP
#line 768 "lex.l"
{ BIN_OP_RETURN (EXPR_GE, false); }
	YY_BREAK
case 45:
YY_RULE_SETUP
#line 769 "lex.l"
{ BIN_OP_RETURN (EXPR_AND, false); }
	YY_BREAK
case 46:
YY_RULE_SETUP
#line 770 "lex.l"
{ BIN_OP_RETURN (EXPR_OR, false); }
	YY_BREAK
case 47:
YY_RULE_SETUP
#line 771 "lex.l"
{ BIN_OP_RETURN (EXPR_LT, false); }
	YY_BREAK
case 48:
YY_RULE_SETUP
#line 772 "lex.l"
{ BIN_OP_RETURN (EXPR_GT, false); }
	YY_BREAK
case 49:
YY_RULE_SETUP
#line 773 "lex.l"
{ BIN_OP_RETURN ('*', false); }
	YY_BREAK
case 50:
YY_RULE_SETUP
#line 774 "lex.l"
{ BIN_OP_RETURN ('/', false); }
	YY_BREAK
case 51:
YY_RULE_SETUP
#line 775 "lex.l"
{ BIN_OP_RETURN (LEFTDIV, false); }
	YY_BREAK
case 52:
YY_RULE_SETUP
#line 776 "lex.l"
{ BIN_OP_RETURN (';', true); }
	YY_BREAK
case 53:
YY_RULE_SETUP
#line 777 "lex.l"
{ BIN_OP_RETURN (',', true); }
	YY_BREAK
case 54:
YY_RULE_SETUP
#line 778 "lex.l"
{ BIN_OP_RETURN (POW, false); }
	YY_BREAK
case 55:
YY_RULE_SETUP
#line 779 "lex.l"
{ XBIN_OP_RETURN (POW, false); }
	YY_BREAK
case 56:
YY_RULE_SETUP
#line 780 "lex.l"
{ BIN_OP_RETURN ('=', true); }
	YY_BREAK
case 57:
YY_RULE_SETUP
#line 781 "lex.l"
{ BIN_OP_RETURN (EXPR_AND_AND, false); }
	YY_BREAK
case 58:
YY_RULE_SETUP
#line 782 "lex.l"
{ BIN_OP_RETURN (EXPR_OR_OR, false); }
	YY_BREAK
case 59:
YY_RULE_SETUP
#line 783 "lex.l"
{ XBIN_OP_RETURN (LSHIFT, false); }
	YY_BREAK
case 60:
YY_RULE_SETUP
#line 784 "lex.l"
{ XBIN_OP_RETURN (RSHIFT, false); }
	YY_BREAK
case 61:
YY_RULE_SETUP
#line 786 "lex.l"
{
    if (lexer_flags.plotting && ! lexer_flags.in_plot_range)
      lexer_flags.past_plot_range = true;

    if (octave_text[0] == '~')
      BIN_OP_RETURN (EXPR_NOT, false);
    else
      XBIN_OP_RETURN (EXPR_NOT, false);
  }
	YY_BREAK
case 62:
YY_RULE_SETUP
#line 796 "lex.l"
{ 
    if (lexer_flags.plotting && ! lexer_flags.in_plot_range)
      lexer_flags.past_plot_range = true;
    BIN_OP_RETURN ('+', false);
  }
	YY_BREAK
case 63:
YY_RULE_SETUP
#line 802 "lex.l"
{ 
    if (lexer_flags.plotting && ! lexer_flags.in_plot_range)
      lexer_flags.past_plot_range = true;
    BIN_OP_RETURN ('-', false);
  }
	YY_BREAK
case 64:
YY_RULE_SETUP
#line 808 "lex.l"
{
    lexer_flags.looking_at_indirect_ref = false;
    if (lexer_flags.plotting && ! lexer_flags.in_plot_range)
      lexer_flags.past_plot_range = true;
    nesting_level.paren ();
    promptflag--;
    TOK_RETURN ('(');
  }
	YY_BREAK
case 65:
YY_RULE_SETUP
#line 817 "lex.l"
{
    nesting_level.remove ();

    current_input_column++;
    lexer_flags.cant_be_identifier = true;
    lexer_flags.quote_is_transpose = true;
    lexer_flags.convert_spaces_to_comma = nesting_level.is_bracket_or_brace ();
    do_comma_insert_check ();
    COUNT_TOK_AND_RETURN (')');
  }
	YY_BREAK
case 66:
YY_RULE_SETUP
#line 828 "lex.l"
{
    TOK_RETURN ('.');
  }
	YY_BREAK
case 67:
YY_RULE_SETUP
#line 832 "lex.l"
{ XBIN_OP_RETURN (ADD_EQ, false); }
	YY_BREAK
case 68:
YY_RULE_SETUP
#line 833 "lex.l"
{ XBIN_OP_RETURN (SUB_EQ, false); }
	YY_BREAK
case 69:
YY_RULE_SETUP
#line 834 "lex.l"
{ XBIN_OP_RETURN (MUL_EQ, false); }
	YY_BREAK
case 70:
YY_RULE_SETUP
#line 835 "lex.l"
{ XBIN_OP_RETURN (DIV_EQ, false); }
	YY_BREAK
case 71:
YY_RULE_SETUP
#line 836 "lex.l"
{ XBIN_OP_RETURN (LEFTDIV_EQ, false); }
	YY_BREAK
case 72:
YY_RULE_SETUP
#line 837 "lex.l"
{ XBIN_OP_RETURN (ADD_EQ, false); }
	YY_BREAK
case 73:
YY_RULE_SETUP
#line 838 "lex.l"
{ XBIN_OP_RETURN (SUB_EQ, false); }
	YY_BREAK
case 74:
YY_RULE_SETUP
#line 839 "lex.l"
{ XBIN_OP_RETURN (EMUL_EQ, false); }
	YY_BREAK
case 75:
YY_RULE_SETUP
#line 840 "lex.l"
{ XBIN_OP_RETURN (EDIV_EQ, false); }
	YY_BREAK
case 76:
YY_RULE_SETUP
#line 841 "lex.l"
{ XBIN_OP_RETURN (ELEFTDIV_EQ, false); }
	YY_BREAK
case 77:
YY_RULE_SETUP
#line 842 "lex.l"
{ XBIN_OP_RETURN (POW_EQ, false); }
	YY_BREAK
case 78:
YY_RULE_SETUP
#line 843 "lex.l"
{ XBIN_OP_RETURN (EPOW_EQ, false); }
	YY_BREAK
case 79:
YY_RULE_SETUP
#line 844 "lex.l"
{ XBIN_OP_RETURN (AND_EQ, false); }
	YY_BREAK
case 80:
YY_RULE_SETUP
#line 845 "lex.l"
{ XBIN_OP_RETURN (OR_EQ, false); }
	YY_BREAK
case 81:
YY_RULE_SETUP
#line 846 "lex.l"
{ XBIN_OP_RETURN (LSHIFT_EQ, false); }
	YY_BREAK
case 82:
YY_RULE_SETUP
#line 847 "lex.l"
{ XBIN_OP_RETURN (RSHIFT_EQ, false); }
	YY_BREAK
case 83:
YY_RULE_SETUP
#line 849 "lex.l"
{
    nesting_level.brace ();

    current_input_column += octave_leng;
    lexer_flags.quote_is_transpose = false;
    lexer_flags.cant_be_identifier = false;
    lexer_flags.convert_spaces_to_comma = true;

    promptflag--;
    eat_whitespace ();

    lexer_flags.braceflag++;
    BEGIN (MATRIX_START);
    COUNT_TOK_AND_RETURN ('{');
  }
	YY_BREAK
case 84:
YY_RULE_SETUP
#line 865 "lex.l"
{
    nesting_level.remove ();

    TOK_RETURN ('}');
  }
	YY_BREAK

// Unrecognized input is a lexical error.

case 85:
YY_RULE_SETUP
#line 875 "lex.l"
{
    // EOF happens here if we are parsing nested functions.

    yyunput (octave_text[0], octave_text);

    int c = yyinput ();

    if (c != EOF)
      {
	current_input_column++;

	error ("invalid character `%s' (ASCII %d) near line %d, column %d",
	       undo_string_escape (static_cast<char> (c)), c,
	       input_line_number, current_input_column);

	return LEXICAL_ERROR;
      }
    else
      TOK_RETURN (END_OF_INPUT);
  }
	YY_BREAK
case 86:
YY_RULE_SETUP
#line 896 "lex.l"
ECHO;
	YY_BREAK
#line 2056 "<stdout>"

	case YY_END_OF_BUFFER:
		{
		/* Amount of text matched not including the EOB char. */
		int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;

		/* Undo the effects of YY_DO_BEFORE_ACTION. */
		*yy_cp = (yy_hold_char);
		YY_RESTORE_YY_MORE_OFFSET

		if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
			{
			/* We're scanning a new file or input source.  It's
			 * possible that this happened because the user
			 * just pointed octave_in at a new source and called
			 * octave_lex().  If so, then we have to assure
			 * consistency between YY_CURRENT_BUFFER and our
			 * globals.  Here is the right place to do so, because
			 * this is the first action (other than possibly a
			 * back-up) that will match for the new input source.
			 */
			(yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
			YY_CURRENT_BUFFER_LVALUE->yy_input_file = octave_in;
			YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
			}

		/* Note that here we test for yy_c_buf_p "<=" to the position
		 * of the first EOB in the buffer, since yy_c_buf_p will
		 * already have been incremented past the NUL character
		 * (since all states make transitions on EOB to the
		 * end-of-buffer state).  Contrast this with the test
		 * in input().
		 */
		if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
			{ /* This was really a NUL. */
			yy_state_type yy_next_state;

			(yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;

			yy_current_state = yy_get_previous_state(  );

			/* Okay, we're now positioned to make the NUL
			 * transition.  We couldn't have
			 * yy_get_previous_state() go ahead and do it
			 * for us because it doesn't know how to deal
			 * with the possibility of jamming (and we don't
			 * want to build jamming into it because then it
			 * will run more slowly).
			 */

			yy_next_state = yy_try_NUL_trans( yy_current_state );

			yy_bp = (yytext_ptr) + YY_MORE_ADJ;

			if ( yy_next_state )
				{
				/* Consume the NUL. */
				yy_cp = ++(yy_c_buf_p);
				yy_current_state = yy_next_state;
				goto yy_match;
				}

			else
				{
				yy_cp = (yy_c_buf_p);
				goto yy_find_action;
				}
			}

		else switch ( yy_get_next_buffer(  ) )
			{
			case EOB_ACT_END_OF_FILE:
				{
				(yy_did_buffer_switch_on_eof) = 0;

				if ( octave_wrap( ) )
					{
					/* Note: because we've taken care in
					 * yy_get_next_buffer() to have set up
					 * octave_text, we can now set up
					 * yy_c_buf_p so that if some total
					 * hoser (like flex itself) wants to
					 * call the scanner after we return the
					 * YY_NULL, it'll still work - another
					 * YY_NULL will get returned.
					 */
					(yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;

					yy_act = YY_STATE_EOF(YY_START);
					goto do_action;
					}

				else
					{
					if ( ! (yy_did_buffer_switch_on_eof) )
						YY_NEW_FILE;
					}
				break;
				}

			case EOB_ACT_CONTINUE_SCAN:
				(yy_c_buf_p) =
					(yytext_ptr) + yy_amount_of_matched_text;

				yy_current_state = yy_get_previous_state(  );

				yy_cp = (yy_c_buf_p);
				yy_bp = (yytext_ptr) + YY_MORE_ADJ;
				goto yy_match;

			case EOB_ACT_LAST_MATCH:
				(yy_c_buf_p) =
				&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];

				yy_current_state = yy_get_previous_state(  );

				yy_cp = (yy_c_buf_p);
				yy_bp = (yytext_ptr) + YY_MORE_ADJ;
				goto yy_find_action;
			}
		break;
		}

	default:
		YY_FATAL_ERROR(
			"fatal flex scanner internal error--no action found" );
	} /* end of action switch */
		} /* end of scanning one token */
} /* end of octave_lex */

/* yy_get_next_buffer - try to read in a new buffer
 *
 * Returns a code representing an action:
 *	EOB_ACT_LAST_MATCH -
 *	EOB_ACT_CONTINUE_SCAN - continue scanning from current position
 *	EOB_ACT_END_OF_FILE - end of file
 */
static int yy_get_next_buffer (void)
{
    	register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
	register char *source = (yytext_ptr);
	register int number_to_move, i;
	int ret_val;

	if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
		YY_FATAL_ERROR(
		"fatal flex scanner internal error--end of buffer missed" );

	if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
		{ /* Don't try to fill the buffer, so this is an EOF. */
		if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
			{
			/* We matched a single character, the EOB, so
			 * treat this as a final EOF.
			 */
			return EOB_ACT_END_OF_FILE;
			}

		else
			{
			/* We matched some text prior to the EOB, first
			 * process it.
			 */
			return EOB_ACT_LAST_MATCH;
			}
		}

	/* Try to read more data. */

	/* First move last chars to start of buffer. */
	number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;

	for ( i = 0; i < number_to_move; ++i )
		*(dest++) = *(source++);

	if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
		/* don't do the read, it's not guaranteed to return an EOF,
		 * just force an EOF
		 */
		YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;

	else
		{
			size_t num_to_read =
			YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;

		while ( num_to_read <= 0 )
			{ /* Not enough room in the buffer - grow it. */

			/* just a shorter name for the current buffer */
			YY_BUFFER_STATE b = YY_CURRENT_BUFFER;

			int yy_c_buf_p_offset =
				(int) ((yy_c_buf_p) - b->yy_ch_buf);

			if ( b->yy_is_our_buffer )
				{
				int new_size = b->yy_buf_size * 2;

				if ( new_size <= 0 )
					b->yy_buf_size += b->yy_buf_size / 8;
				else
					b->yy_buf_size *= 2;

				b->yy_ch_buf = (char *)
					/* Include room in for 2 EOB chars. */
					octave_realloc((void *) b->yy_ch_buf,b->yy_buf_size + 2  );
				}
			else
				/* Can't grow it, we don't own it. */
				b->yy_ch_buf = 0;

			if ( ! b->yy_ch_buf )
				YY_FATAL_ERROR(
				"fatal error - scanner input buffer overflow" );

			(yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];

			num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
						number_to_move - 1;

			}

		if ( num_to_read > YY_READ_BUF_SIZE )
			num_to_read = YY_READ_BUF_SIZE;

		/* Read in more data. */
		YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
			(yy_n_chars), num_to_read );

		YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
		}

	if ( (yy_n_chars) == 0 )
		{
		if ( number_to_move == YY_MORE_ADJ )
			{
			ret_val = EOB_ACT_END_OF_FILE;
			octave_restart(octave_in  );
			}

		else
			{
			ret_val = EOB_ACT_LAST_MATCH;
			YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
				YY_BUFFER_EOF_PENDING;
			}
		}

	else
		ret_val = EOB_ACT_CONTINUE_SCAN;

	(yy_n_chars) += number_to_move;
	YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
	YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;

	(yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];

	return ret_val;
}

/* yy_get_previous_state - get the state just before the EOB char was reached */

    static yy_state_type yy_get_previous_state (void)
{
	register yy_state_type yy_current_state;
	register char *yy_cp;
    
	yy_current_state = (yy_start);

	for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
		{
		register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
		if ( yy_accept[yy_current_state] )
			{
			(yy_last_accepting_state) = yy_current_state;
			(yy_last_accepting_cpos) = yy_cp;
			}
		while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
			{
			yy_current_state = (int) yy_def[yy_current_state];
			if ( yy_current_state >= 256 )
				yy_c = yy_meta[(unsigned int) yy_c];
			}
		yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
		}

	return yy_current_state;
}

/* yy_try_NUL_trans - try to make a transition on the NUL character
 *
 * synopsis
 *	next_state = yy_try_NUL_trans( current_state );
 */
    static yy_state_type yy_try_NUL_trans  (yy_state_type yy_current_state )
{
	register int yy_is_jam;
    	register char *yy_cp = (yy_c_buf_p);

	register YY_CHAR yy_c = 1;
	if ( yy_accept[yy_current_state] )
		{
		(yy_last_accepting_state) = yy_current_state;
		(yy_last_accepting_cpos) = yy_cp;
		}
	while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
		{
		yy_current_state = (int) yy_def[yy_current_state];
		if ( yy_current_state >= 256 )
			yy_c = yy_meta[(unsigned int) yy_c];
		}
	yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
	yy_is_jam = (yy_current_state == 255);

	return yy_is_jam ? 0 : yy_current_state;
}

    static void yyunput (int c, register char * yy_bp )
{
	register char *yy_cp;
    
    yy_cp = (yy_c_buf_p);

	/* undo effects of setting up octave_text */
	*yy_cp = (yy_hold_char);

	if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
		{ /* need to shift things up to make room */
		/* +2 for EOB chars. */
		register int number_to_move = (yy_n_chars) + 2;
		register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
					YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
		register char *source =
				&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];

		while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
			*--dest = *--source;

		yy_cp += (int) (dest - source);
		yy_bp += (int) (dest - source);
		YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
			(yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size;

		if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
			YY_FATAL_ERROR( "flex scanner push-back overflow" );
		}

	*--yy_cp = (char) c;

	(yytext_ptr) = yy_bp;
	(yy_hold_char) = *yy_cp;
	(yy_c_buf_p) = yy_cp;
}

#ifndef YY_NO_INPUT
#ifdef __cplusplus
    static int yyinput (void)
#else
    static int input  (void)
#endif

{
	int c;
    
	*(yy_c_buf_p) = (yy_hold_char);

	if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
		{
		/* yy_c_buf_p now points to the character we want to return.
		 * If this occurs *before* the EOB characters, then it's a
		 * valid NUL; if not, then we've hit the end of the buffer.
		 */
		if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
			/* This was really a NUL. */
			*(yy_c_buf_p) = '\0';

		else
			{ /* need more input */
			int offset = (yy_c_buf_p) - (yytext_ptr);
			++(yy_c_buf_p);

			switch ( yy_get_next_buffer(  ) )
				{
				case EOB_ACT_LAST_MATCH:
					/* This happens because yy_g_n_b()
					 * sees that we've accumulated a
					 * token and flags that we need to
					 * try matching the token before
					 * proceeding.  But for input(),
					 * there's no matching to consider.
					 * So convert the EOB_ACT_LAST_MATCH
					 * to EOB_ACT_END_OF_FILE.
					 */

					/* Reset buffer status. */
					octave_restart(octave_in );

					/*FALLTHROUGH*/

				case EOB_ACT_END_OF_FILE:
					{
					if ( octave_wrap( ) )
						return EOF;

					if ( ! (yy_did_buffer_switch_on_eof) )
						YY_NEW_FILE;
#ifdef __cplusplus
					return yyinput();
#else
					return input();
#endif
					}

				case EOB_ACT_CONTINUE_SCAN:
					(yy_c_buf_p) = (yytext_ptr) + offset;
					break;
				}
			}
		}

	c = *(unsigned char *) (yy_c_buf_p);	/* cast for 8-bit char's */
	*(yy_c_buf_p) = '\0';	/* preserve octave_text */
	(yy_hold_char) = *++(yy_c_buf_p);

	return c;
}
#endif	/* ifndef YY_NO_INPUT */

/** Immediately switch to a different input stream.
 * @param input_file A readable stream.
 * 
 * @note This function does not reset the start condition to @c INITIAL .
 */
    void octave_restart  (FILE * input_file )
{
    
	if ( ! YY_CURRENT_BUFFER ){
        octave_ensure_buffer_stack ();
		YY_CURRENT_BUFFER_LVALUE =
            octave__create_buffer(octave_in,YY_BUF_SIZE );
	}

	octave__init_buffer(YY_CURRENT_BUFFER,input_file );
	octave__load_buffer_state( );
}

/** Switch to a different input buffer.
 * @param new_buffer The new input buffer.
 * 
 */
    void octave__switch_to_buffer  (YY_BUFFER_STATE  new_buffer )
{
    
	/* TODO. We should be able to replace this entire function body
	 * with
	 *		octave_pop_buffer_state();
	 *		octave_push_buffer_state(new_buffer);
     */
	octave_ensure_buffer_stack ();
	if ( YY_CURRENT_BUFFER == new_buffer )
		return;

	if ( YY_CURRENT_BUFFER )
		{
		/* Flush out information for old buffer. */
		*(yy_c_buf_p) = (yy_hold_char);
		YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
		YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
		}

	YY_CURRENT_BUFFER_LVALUE = new_buffer;
	octave__load_buffer_state( );

	/* We don't actually know whether we did this switch during
	 * EOF (octave_wrap()) processing, but the only time this flag
	 * is looked at is after octave_wrap() is called, so it's safe
	 * to go ahead and always set it.
	 */
	(yy_did_buffer_switch_on_eof) = 1;
}

static void octave__load_buffer_state  (void)
{
    	(yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
	(yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
	octave_in = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
	(yy_hold_char) = *(yy_c_buf_p);
}

/** Allocate and initialize an input buffer state.
 * @param file A readable stream.
 * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
 * 
 * @return the allocated buffer state.
 */
    YY_BUFFER_STATE octave__create_buffer  (FILE * file, int  size )
{
	YY_BUFFER_STATE b;
    
	b = (YY_BUFFER_STATE) octave_alloc(sizeof( struct yy_buffer_state )  );
	if ( ! b )
		YY_FATAL_ERROR( "out of dynamic memory in octave__create_buffer()" );

	b->yy_buf_size = size;

	/* yy_ch_buf has to be 2 characters longer than the size given because
	 * we need to put in 2 end-of-buffer characters.
	 */
	b->yy_ch_buf = (char *) octave_alloc(b->yy_buf_size + 2  );
	if ( ! b->yy_ch_buf )
		YY_FATAL_ERROR( "out of dynamic memory in octave__create_buffer()" );

	b->yy_is_our_buffer = 1;

	octave__init_buffer(b,file );

	return b;
}

/** Destroy the buffer.
 * @param b a buffer created with octave__create_buffer()
 * 
 */
    void octave__delete_buffer (YY_BUFFER_STATE  b )
{
    
	if ( ! b )
		return;

	if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
		YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;

	if ( b->yy_is_our_buffer )
		octave_free((void *) b->yy_ch_buf  );

	octave_free((void *) b  );
}

#ifndef __cplusplus
extern int isatty (int );
#endif /* __cplusplus */
    
/* Initializes or reinitializes a buffer.
 * This function is sometimes called more than once on the same buffer,
 * such as during a octave_restart() or at EOF.
 */
    static void octave__init_buffer  (YY_BUFFER_STATE  b, FILE * file )

{
	int oerrno = errno;
    
	octave__flush_buffer(b );

	b->yy_input_file = file;
	b->yy_fill_buffer = 1;

    /* If b is the current buffer, then octave__init_buffer was _probably_
     * called from octave_restart() or through yy_get_next_buffer.
     * In that case, we don't want to reset the lineno or column.
     */
    if (b != YY_CURRENT_BUFFER){
        b->yy_bs_lineno = 1;
        b->yy_bs_column = 0;
    }

        b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
    
	errno = oerrno;
}

/** Discard all buffered characters. On the next scan, YY_INPUT will be called.
 * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
 * 
 */
    void octave__flush_buffer (YY_BUFFER_STATE  b )
{
    	if ( ! b )
		return;

	b->yy_n_chars = 0;

	/* We always need two end-of-buffer characters.  The first causes
	 * a transition to the end-of-buffer state.  The second causes
	 * a jam in that state.
	 */
	b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
	b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;

	b->yy_buf_pos = &b->yy_ch_buf[0];

	b->yy_at_bol = 1;
	b->yy_buffer_status = YY_BUFFER_NEW;

	if ( b == YY_CURRENT_BUFFER )
		octave__load_buffer_state( );
}

/** Pushes the new state onto the stack. The new state becomes
 *  the current state. This function will allocate the stack
 *  if necessary.
 *  @param new_buffer The new state.
 *  
 */
void octave_push_buffer_state (YY_BUFFER_STATE new_buffer )
{
    	if (new_buffer == NULL)
		return;

	octave_ensure_buffer_stack();

	/* This block is copied from octave__switch_to_buffer. */
	if ( YY_CURRENT_BUFFER )
		{
		/* Flush out information for old buffer. */
		*(yy_c_buf_p) = (yy_hold_char);
		YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
		YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
		}

	/* Only push if top exists. Otherwise, replace top. */
	if (YY_CURRENT_BUFFER)
		(yy_buffer_stack_top)++;
	YY_CURRENT_BUFFER_LVALUE = new_buffer;

	/* copied from octave__switch_to_buffer. */
	octave__load_buffer_state( );
	(yy_did_buffer_switch_on_eof) = 1;
}

/** Removes and deletes the top of the stack, if present.
 *  The next element becomes the new top.
 *  
 */
void octave_pop_buffer_state (void)
{
    	if (!YY_CURRENT_BUFFER)
		return;

	octave__delete_buffer(YY_CURRENT_BUFFER );
	YY_CURRENT_BUFFER_LVALUE = NULL;
	if ((yy_buffer_stack_top) > 0)
		--(yy_buffer_stack_top);

	if (YY_CURRENT_BUFFER) {
		octave__load_buffer_state( );
		(yy_did_buffer_switch_on_eof) = 1;
	}
}

/* Allocates the stack if it does not exist.
 *  Guarantees space for at least one push.
 */
static void octave_ensure_buffer_stack (void)
{
	int num_to_alloc;
    
	if (!(yy_buffer_stack)) {

		/* First allocation is just for 2 elements, since we don't know if this
		 * scanner will even need a stack. We use 2 instead of 1 to avoid an
		 * immediate realloc on the next call.
         */
		num_to_alloc = 1;
		(yy_buffer_stack) = (struct yy_buffer_state**)octave_alloc
								(num_to_alloc * sizeof(struct yy_buffer_state*)
								);
		
		memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
				
		(yy_buffer_stack_max) = num_to_alloc;
		(yy_buffer_stack_top) = 0;
		return;
	}

	if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){

		/* Increase the buffer to prepare for a possible push. */
		int grow_size = 8 /* arbitrary grow size */;

		num_to_alloc = (yy_buffer_stack_max) + grow_size;
		(yy_buffer_stack) = (struct yy_buffer_state**)octave_realloc
								((yy_buffer_stack),
								num_to_alloc * sizeof(struct yy_buffer_state*)
								);

		/* zero only the new slots.*/
		memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
		(yy_buffer_stack_max) = num_to_alloc;
	}
}

/** Setup the input buffer state to scan directly from a user-specified character buffer.
 * @param base the character buffer
 * @param size the size in bytes of the character buffer
 * 
 * @return the newly allocated buffer state object. 
 */
YY_BUFFER_STATE octave__scan_buffer  (char * base, yy_size_t  size )
{
	YY_BUFFER_STATE b;
    
	if ( size < 2 ||
	     base[size-2] != YY_END_OF_BUFFER_CHAR ||
	     base[size-1] != YY_END_OF_BUFFER_CHAR )
		/* They forgot to leave room for the EOB's. */
		return 0;

	b = (YY_BUFFER_STATE) octave_alloc(sizeof( struct yy_buffer_state )  );
	if ( ! b )
		YY_FATAL_ERROR( "out of dynamic memory in octave__scan_buffer()" );

	b->yy_buf_size = size - 2;	/* "- 2" to take care of EOB's */
	b->yy_buf_pos = b->yy_ch_buf = base;
	b->yy_is_our_buffer = 0;
	b->yy_input_file = 0;
	b->yy_n_chars = b->yy_buf_size;
	b->yy_is_interactive = 0;
	b->yy_at_bol = 1;
	b->yy_fill_buffer = 0;
	b->yy_buffer_status = YY_BUFFER_NEW;

	octave__switch_to_buffer(b  );

	return b;
}

/** Setup the input buffer state to scan a string. The next call to octave_lex() will
 * scan from a @e copy of @a str.
 * @param str a NUL-terminated string to scan
 * 
 * @return the newly allocated buffer state object.
 * @note If you want to scan bytes that may contain NUL values, then use
 *       octave__scan_bytes() instead.
 */
YY_BUFFER_STATE octave__scan_string (yyconst char * yy_str )
{
    
	return octave__scan_bytes(yy_str,strlen(yy_str) );
}

/** Setup the input buffer state to scan the given bytes. The next call to octave_lex() will
 * scan from a @e copy of @a bytes.
 * @param bytes the byte buffer to scan
 * @param len the number of bytes in the buffer pointed to by @a bytes.
 * 
 * @return the newly allocated buffer state object.
 */
YY_BUFFER_STATE octave__scan_bytes  (yyconst char * bytes, int  len )
{
	YY_BUFFER_STATE b;
	char *buf;
	yy_size_t n;
	int i;
    
	/* Get memory for full buffer, including space for trailing EOB's. */
	n = len + 2;
	buf = (char *) octave_alloc(n  );
	if ( ! buf )
		YY_FATAL_ERROR( "out of dynamic memory in octave__scan_bytes()" );

	for ( i = 0; i < len; ++i )
		buf[i] = bytes[i];

	buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR;

	b = octave__scan_buffer(buf,n );
	if ( ! b )
		YY_FATAL_ERROR( "bad buffer in octave__scan_bytes()" );

	/* It's okay to grow etc. this buffer, and we should throw it
	 * away when we're done.
	 */
	b->yy_is_our_buffer = 1;

	return b;
}

#ifndef YY_EXIT_FAILURE
#define YY_EXIT_FAILURE 2
#endif

static void yy_fatal_error (yyconst char* msg )
{
    	(void) fprintf( stderr, "%s\n", msg );
	exit( YY_EXIT_FAILURE );
}

/* Redefine yyless() so it works in section 3 code. */

#undef yyless
#define yyless(n) \
	do \
		{ \
		/* Undo effects of setting up octave_text. */ \
        int yyless_macro_arg = (n); \
        YY_LESS_LINENO(yyless_macro_arg);\
		octave_text[octave_leng] = (yy_hold_char); \
		(yy_c_buf_p) = octave_text + yyless_macro_arg; \
		(yy_hold_char) = *(yy_c_buf_p); \
		*(yy_c_buf_p) = '\0'; \
		octave_leng = yyless_macro_arg; \
		} \
	while ( 0 )

/* Accessor  methods (get/set functions) to struct members. */

/** Get the current line number.
 * 
 */
int octave_get_lineno  (void)
{
        
    return octave_lineno;
}

/** Get the input stream.
 * 
 */
FILE *octave_get_in  (void)
{
        return octave_in;
}

/** Get the output stream.
 * 
 */
FILE *octave_get_out  (void)
{
        return octave_out;
}

/** Get the length of the current token.
 * 
 */
int octave_get_leng  (void)
{
        return octave_leng;
}

/** Get the current token.
 * 
 */

char *octave_get_text  (void)
{
        return octave_text;
}

/** Set the current line number.
 * @param line_number
 * 
 */
void octave_set_lineno (int  line_number )
{
    
    octave_lineno = line_number;
}

/** Set the input stream. This does not discard the current
 * input buffer.
 * @param in_str A readable stream.
 * 
 * @see octave__switch_to_buffer
 */
void octave_set_in (FILE *  in_str )
{
        octave_in = in_str ;
}

void octave_set_out (FILE *  out_str )
{
        octave_out = out_str ;
}

int octave_get_debug  (void)
{
        return octave__flex_debug;
}

void octave_set_debug (int  bdebug )
{
        octave__flex_debug = bdebug ;
}

/* octave_lex_destroy is for both reentrant and non-reentrant scanners. */
int octave_lex_destroy  (void)
{
    
    /* Pop the buffer stack, destroying each element. */
	while(YY_CURRENT_BUFFER){
		octave__delete_buffer(YY_CURRENT_BUFFER  );
		YY_CURRENT_BUFFER_LVALUE = NULL;
		octave_pop_buffer_state();
	}

	/* Destroy the stack itself. */
	octave_free((yy_buffer_stack) );
	(yy_buffer_stack) = NULL;

    return 0;
}

/*
 * Internal utility routines.
 */

#ifndef yytext_ptr
static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
{
	register int i;
    	for ( i = 0; i < n; ++i )
		s1[i] = s2[i];
}
#endif

#ifdef YY_NEED_STRLEN
static int yy_flex_strlen (yyconst char * s )
{
	register int n;
    	for ( n = 0; s[n]; ++n )
		;

	return n;
}
#endif

void *octave_alloc (yy_size_t  size )
{
	return (void *) malloc( size );
}

void *octave_realloc  (void * ptr, yy_size_t  size )
{
	/* The cast to (char *) in the following accommodates both
	 * implementations that use char* generic pointers, and those
	 * that use void* generic pointers.  It works with the latter
	 * because both ANSI C and C++ allow castless assignment from
	 * any pointer type to void*, and deal with argument conversions
	 * as though doing an assignment.
	 */
	return (void *) realloc( (char *) ptr, size );
}

void octave_free (void * ptr )
{
	free( (char *) ptr );	/* see octave_realloc() for (char *) cast */
}

#define YYTABLES_NAME "yytables"

#undef YY_NEW_FILE
#undef YY_FLUSH_BUFFER
#undef yy_set_bol
#undef yy_new_buffer
#undef yy_set_interactive
#undef yytext_ptr
#undef YY_DO_BEFORE_ACTION

#ifdef YY_DECL_IS_OURS
#undef YY_DECL_IS_OURS
#undef YY_DECL
#endif
#line 896 "lex.l"



// GAG.
//
// If we're reading a matrix and the next character is '[', make sure
// that we insert a comma ahead of it.

void
do_comma_insert_check (void)
{
  int spc_gobbled = eat_continuation ();

  int c = yyinput ();

  yyunput (c, octave_text);

  if (spc_gobbled)
    yyunput (' ', octave_text);

  lexer_flags.do_comma_insert = (lexer_flags.bracketflag && c == '[');
}

// Fix things up for errors or interrupts.  The parser is never called
// recursively, so it is always safe to reinitialize its state before
// doing any parsing.

void
reset_parser (void)
{
  // Start off on the right foot.
  BEGIN (INITIAL);

  parser_end_of_input = false;
  end_tokens_expected = 0;

  while (! symtab_context.empty ())
    symtab_context.pop ();

  // We do want a prompt by default.
  promptflag = 1;

  // Error may have occurred inside some brackets, braces, or parentheses.
  nesting_level.clear ();

  // Clear out the stack of token info used to track line and column
  // numbers.
  while (! token_stack.empty ())
    {
      delete token_stack.top ();
      token_stack.pop ();
    }

  // Can be reset by defining a function.
  if (! (reading_script_file || reading_fcn_file))
    {
      current_input_column = 1;
      input_line_number = command_editor::current_command_number () - 1;
    }

  // Only ask for input from stdin if we are expecting interactive
  // input.
  if ((interactive || forced_interactive)
      && ! (reading_fcn_file
	    || reading_script_file
	    || get_input_from_eval_string
	    || input_from_startup_file))
    octave_restart (stdin);

  // Clear the buffer for help text.
  while (! help_buf.empty ())
    help_buf.pop ();

  // Reset other flags.
  lexer_flags.init ();
}

// If we read some newlines, we need figure out what column we're
// really looking at.

static void
fixup_column_count (char *s)
{
  char c;
  while ((c = *s++) != '\0')
    {
      if (c == '\n')
	  current_input_column = 1;
      else
	current_input_column++;
    }
}

// Include these so that we don't have to link to libfl.a.

int
octave_wrap (void)
{
  return 1;
}

// Tell us all what the current buffer is.

YY_BUFFER_STATE
current_buffer (void)
{
  return YY_CURRENT_BUFFER;
}

// Create a new buffer.

YY_BUFFER_STATE
create_buffer (FILE *f)
{
  return octave__create_buffer (f, YY_BUF_SIZE);
}

// Start reading a new buffer.

void
switch_to_buffer (YY_BUFFER_STATE buf)
{
  octave__switch_to_buffer (buf);
}

// Delete a buffer.

void
delete_buffer (YY_BUFFER_STATE buf)
{
  octave__delete_buffer (buf);
}

// Restore a buffer (for unwind-prot).

void
restore_input_buffer (void *buf)
{
  switch_to_buffer (static_cast<YY_BUFFER_STATE> (buf));
}

// Delete a buffer (for unwind-prot).

void
delete_input_buffer (void *buf)
{
  delete_buffer (static_cast<YY_BUFFER_STATE> (buf));
}

// Check to see if a character string matches any of the possible line
// styles for plots.

static std::string
plot_style_token (const std::string& s)
{
  std::string retval;

  // XXX FIXME XXX -- specify minimum match length for these.
  static const char *plot_styles[] = 
    {
      "boxes",
      "boxerrorbars",
      "boxxyerrorbars",
      "candlesticks",
      "dots",
      "errorbars",
      "financebars",
      "fsteps",
      "histeps",
      "impulses",
      "lines",
      "linespoints",
      "points",
      "steps",
      "vector",
      "xerrorbars",
      "xyerrorbars",
      "yerrorbars",
      0,
    };

  const char * const *tmp = plot_styles;
  while (*tmp)
    {
      if (almost_match (*tmp, s.c_str ()))
	{
	  retval = *tmp;
	  break;
	}

      tmp++;
    }

  return retval;
}

// Check to see if a character string matches any of the possible axes
// tags for plots.

static std::string
plot_axes_token (const std::string& s)
{
  std::string retval;

  // XXX FIXME XXX -- specify minimum match length for these.
  static const char *plot_axes[] = 
    {
      "x1y1",
      "x1y2",
      "x2y1",
      "x2y2",
      0,
    };

  const char **tmp = plot_axes;
  while (*tmp)
    {
      if (almost_match (*tmp, s.c_str ()))
	{
	  retval = *tmp;
	  break;
	}

      tmp++;
    }

  return retval;
}

// Check to see if a character string matches any one of the plot
// option keywords.  Don't match abbreviations for clear, since that's
// not a gnuplot keyword (users will probably only expect to be able
// to abbreviate actual gnuplot keywords).

static int
is_plot_keyword (const std::string& s)
{
  const char *t = s.c_str ();
  if (almost_match ("title", t, 1))
    {
      return TITLE;
    }
  else if (almost_match ("using", t, 1))
    {
      lexer_flags.in_plot_using = true;
      return USING;
    }
  else if (almost_match ("with", t, 1))
    {
      lexer_flags.in_plot_style = true;
      return WITH;
    }
  else if (almost_match ("axes", t, 2) || almost_match ("axis", t, 2))
    {
      lexer_flags.in_plot_axes = true;
      return AXES;
    }
  else if (strcmp ("clear", t) == 0)
    {
      return CLEAR;
    }
  else
    {
      return 0;
    }
}

static void
prep_for_function (void)
{
  end_tokens_expected++;

  // Prepare for local symbols.

  tmp_local_sym_tab = new symbol_table ();

  promptflag--;

  lexer_flags.defining_func = true;
  lexer_flags.parsed_function_name = false;
  lexer_flags.beginning_of_function = true;

  if (! (reading_fcn_file || reading_script_file))
    input_line_number = 1;
}

static void
prep_for_nested_function (void)
{
  lexer_flags.parsing_nested_function = 1;
  help_buf.push (std::string ());
  prep_for_function ();
  // We're still only expecting one end token for this set of functions.
  end_tokens_expected--;
  yylval.tok_val = new token (input_line_number, current_input_column);
  token_stack.push (yylval.tok_val);
}

// Handle keywords.  Return -1 if the keyword should be ignored.

static int
is_keyword_token (const std::string& s)
{
  int l = input_line_number;
  int c = current_input_column;

  if (lexer_flags.plotting)
    {
      if (lexer_flags.in_plot_style)
	{
	  std::string sty = plot_style_token (s);

	  if (! sty.empty ())
	    {
	      lexer_flags.in_plot_style = false;
	      yylval.tok_val = new token (sty, l, c);
	      token_stack.push (yylval.tok_val);
	      return STYLE;
	    }
	}
      else if (lexer_flags.in_plot_axes)
	{
	  std::string axes = plot_axes_token (s);

	  if (! axes.empty ())
	    {
	      lexer_flags.in_plot_axes = false;
	      yylval.tok_val = new token (axes, l, c);
	      token_stack.push (yylval.tok_val);
	      return AXES_TAG;
	    }
	}	
    }

  int len = s.length ();

  const octave_kw *kw = octave_kw_lookup (s.c_str (), len);

  if (kw)
    {
      yylval.tok_val = 0;

      switch (kw->kw_id)
	{
	case all_va_args_kw:
	case break_kw:
	case case_kw:
	case catch_kw:
	case continue_kw:
	case else_kw:
	case elseif_kw:
	case global_kw:
	case otherwise_kw:
	case return_kw:
	case static_kw:
	case until_kw:
	case unwind_protect_cleanup_kw:
 	  break;

	case end_kw:
	  if (lexer_flags.looking_at_object_index)
	    return 0;
	  else
	    {
	      if (reading_fcn_file && end_tokens_expected == 1)
		return -1;
	      else
		{
		  yylval.tok_val = new token (token::simple_end, l, c);
		  end_tokens_expected--;
		}
	    }
	  break;

	case end_try_catch_kw:
	  end_tokens_expected--;
	  yylval.tok_val = new token (token::try_catch_end, l, c);
	  break;

	case end_unwind_protect_kw:
	  end_tokens_expected--;
	  yylval.tok_val = new token (token::unwind_protect_end, l, c);
	  break;

	case endfor_kw:
	  end_tokens_expected--;
	  yylval.tok_val = new token (token::for_end, l, c);
	  break;

	case endfunction_kw:
	  {
	    if (reading_fcn_file && end_tokens_expected == 1)
	      return -1;
	    else
	      {
		yylval.tok_val = new token (token::function_end, l, c);
		end_tokens_expected--;
	      }
	  }
	  break;

	case endif_kw:
	  end_tokens_expected--;
	  yylval.tok_val = new token (token::if_end, l, c);
	  break;

	case endswitch_kw:
	  end_tokens_expected--;
	  yylval.tok_val = new token (token::switch_end, l, c);
	  break;

	case endwhile_kw:
	  end_tokens_expected--;
	  yylval.tok_val = new token (token::while_end, l, c);
	  break;

	case for_kw:
	case while_kw:
	  end_tokens_expected++;
	  // Fall through...

	case do_kw:
	  promptflag--;
	  lexer_flags.looping++;
	  break;

	case if_kw:
	case try_kw:
	case switch_kw:
	case unwind_protect_kw:
	  end_tokens_expected++;
	  promptflag--;
	  break;

	case gplot_kw:
	  gripe_deprecated_gplot ();
	  // Fall through...

	case __gnuplot_plot___kw:
	  lexer_flags.plotting = true;
	  yylval.tok_val = new token (token::two_dee, l, c);
	  break;

	case gsplot_kw:
	  gripe_deprecated_gsplot ();
	  // Fall through...

	case __gnuplot_splot___kw:
	  lexer_flags.plotting = true;
	  yylval.tok_val = new token (token::three_dee, l, c);
	  break;

	case replot_kw:
	  lexer_flags.plotting = true;
	  yylval.tok_val = new token (token::replot, l, c);
	  break;

	case __gnuplot_replot___kw:
	  lexer_flags.plotting = true;
	  yylval.tok_val = new token (token::gnuplot_replot, l, c);
	  break;

	case function_kw:
	  {
	    if (lexer_flags.defining_func)
	      {
		if (reading_fcn_file)
		  {
		    if (lexer_flags.parsing_nested_function)
		      {
			BEGIN (NESTED_FUNCTION_END);

			yylval.tok_val = new token (token::function_end, l, c);
			token_stack.push (yylval.tok_val);

			return END;
		      }
		    else
		      {
			prep_for_nested_function ();

			return FCN;
		      }
		  }
		else
		  {
		    error ("nested functions not implemented in this context");

		    if ((reading_fcn_file || reading_script_file)
			&& ! curr_fcn_file_name.empty ())
		      error ("near line %d of file `%s.m'",
			     input_line_number, curr_fcn_file_name.c_str ());
		    else
		      error ("near line %d", input_line_number);

		    return LEXICAL_ERROR;
		  }
	      }
	    else
	      prep_for_function ();
	  }
	  break;

        case magic_file_kw:
	  {
	    if ((reading_fcn_file || reading_script_file)
		&& ! curr_fcn_file_full_name.empty ())
	      yylval.tok_val = new token (curr_fcn_file_full_name, l, c);
	    else
	      yylval.tok_val = new token ("stdin", l, c);
	  }
	  break;

        case magic_line_kw:
	  yylval.tok_val = new token (static_cast<double> (l), "", l, c);
	  break;

	case varargin_kw:
	  if (! lexer_flags.looking_at_parameter_list)
	    return 0;
	  break;

	case varargout_kw:
	  if (! (lexer_flags.looking_at_return_list
		 || (lexer_flags.defining_func
		     && ! lexer_flags.parsed_function_name)))
	    return 0;
	  break;

	default:
	  panic_impossible ();
	}

      if (! yylval.tok_val)
	yylval.tok_val = new token (l, c);

      token_stack.push (yylval.tok_val);

      return kw->tok;
    }

  return 0;
}

// Try to find an identifier.  All binding to global or builtin
// variables occurs when expressions are evaluated.

static symbol_record *
lookup_identifier (const std::string& name)
{
  std::string sym_name = name;

  if (curr_sym_tab == fbi_sym_tab
      && lexer_flags.parsing_nested_function)
    sym_name = parent_function_name + ":" + sym_name;

  return curr_sym_tab->lookup (sym_name, true);
}

static bool
is_variable (const std::string& name)
{
  symbol_record *sr = curr_sym_tab->lookup (name);

  return sr && sr->is_variable ();
}

static void
force_local_variable (const std::string& name)
{
  if (! is_variable (name))
    curr_sym_tab->clear (name);

  symbol_record *sr = curr_sym_tab->lookup (name, true);

  if (sr)
    sr->define (octave_value ());
}

// Grab the help text from an function file.

// XXX FIXME XXX -- gobble_leading_white_space() in parse.y
// duplicates some of this code!

static std::string
grab_help_text (void)
{
  std::string buf;

  bool begin_comment = true;
  bool in_comment = true;
  bool discard_space = true;

  int c = 0;

  while ((c = yyinput ()) != EOF)
    {
      if (begin_comment)
	{
	  if (c == '%' || c == '#')
	    continue;
	  else if (discard_space && c == ' ')
	    {
	      discard_space = false;
	      continue;
	    }
	  else
	    begin_comment = false;
	}	

      if (in_comment)
	{
	  buf += static_cast<char> (c);

	  if (c == '\n')
	    {
	      in_comment = false;
	      discard_space = true;
	    }
	}
      else
	{
	  switch (c)
	    {
	    case '#':
	    case '%':
	      maybe_gripe_matlab_incompatible_comment (octave_text[0]);
	      in_comment = true;
	      begin_comment = true;
	      break;

	    case ' ':
	    case '\t':
	      break;

	    default:
	      goto done;
	    }
	}
    }

 done:

  if (c)
    yyunput (c, octave_text);

  return buf;
}

// Return 1 if the given character matches any character in the given
// string.

static bool
match_any (char c, const char *s)
{
  char tmp;
  while ((tmp = *s++) != '\0')
    {
      if (c == tmp)
	return true;
    }
  return false;
}

// Given information about the spacing surrounding an operator,
// return 1 if it looks like it should be treated as a binary
// operator.  For example,
//
//   [ 1 + 2 ]  or  [ 1+ 2]  or  [ 1+2 ]  ==>  binary
//
//   [ 1 +2 ]  ==>  unary

static bool
looks_like_bin_op (bool spc_prev, int next_char)
{
  bool spc_next = (next_char == ' ' || next_char == '\t');

  return ((spc_prev && spc_next) || ! spc_prev);
}

// Recognize separators.  If the separator is a CRLF pair, it is
// replaced by a single LF.

static bool
next_token_is_sep_op (void)
{
  bool retval = false;

  int c1 = yyinput ();

  if (c1 == '\r')
    {
      int c2 = yyinput ();

      if (c2 == '\n')
	{
	  c1 = '\n';

	  retval = true;
	}
      else
	yyunput (c2, octave_text);
    }
  else
    retval = match_any (c1, ",;\n]");

  yyunput (c1, octave_text);

  return retval;
}

// Try to determine if the next token should be treated as a postfix
// unary operator.  This is ugly, but it seems to do the right thing.

static bool
next_token_is_postfix_unary_op (bool spc_prev)
{
  bool un_op = false;

  int c0 = yyinput ();

  if (c0 == '\'' && ! spc_prev)
    {
      un_op = true;
    }
  else if (c0 == '.')
    {
      int c1 = yyinput ();
      un_op = (c1 == '\'');
      yyunput (c1, octave_text);
    }
  else if (c0 == '+')
    {
      int c1 = yyinput ();
      un_op = (c1 == '+');
      yyunput (c1, octave_text);
    }
  else if (c0 == '-')
    {
      int c1 = yyinput ();
      un_op = (c1 == '-');
      yyunput (c1, octave_text);
    }

  yyunput (c0, octave_text);

  return un_op;
}

// Try to determine if the next token should be treated as a binary
// operator.
//
// This kluge exists because whitespace is not always ignored inside
// the square brackets that are used to create matrix objects (though
// spacing only really matters in the cases that can be interpreted
// either as binary ops or prefix unary ops: currently just +, -).
//
// Note that a line continuation directly following a + or - operator
// (e.g., the characters '[' 'a' ' ' '+' '\' LFD 'b' ']') will be
// parsed as a binary operator.

static bool
next_token_is_bin_op (bool spc_prev)
{
  bool bin_op = false;

  int c0 = yyinput ();

  switch (c0)
    {
    case '+':
    case '-':
      {
	int c1 = yyinput ();

	switch (c1)
	  {
	  case '+':
	  case '-':
	    // Unary ops, spacing doesn't matter.
	    break;

	  case '=':
	    // Binary ops, spacing doesn't matter.
	    bin_op = true;
	    break;

	  default:
	    // Could be either, spacing matters.
	    bin_op = looks_like_bin_op (spc_prev, c1);
	    break;
	  }

	yyunput (c1, octave_text);
      }
      break;

    case ':':
    case '/':
    case '\\':
    case '^':
      // Always a binary op (may also include /=, \=, and ^=).
      bin_op = true;
      break;

    // .+ .- ./ .\ .^ .* .**
    case '.':
      {
	int c1 = yyinput ();

	if (match_any (c1, "+-/\\^*"))
	  // Always a binary op (may also include .+=, .-=, ./=, ...).
	  bin_op = true;
	else if (! isdigit (c1) && c1 != ' ' && c1 != '\t' && c1 != '.')
	  // A structure element reference is a binary op.
	  bin_op = true;

	yyunput (c1, octave_text);
      }
      break;

    // = == & && | || * **
    case '=':
    case '&':
    case '|':
    case '*':
      // Always a binary op (may also include ==, &&, ||, **).
      bin_op = true;
      break;

    // < <= <> > >=
    case '<':
    case '>':
      // Always a binary op (may also include <=, <>, >=).
      bin_op = true;
      break;

    // ~= !=
    case '~':
    case '!':
      {
	int c1 = yyinput ();

	// ~ and ! can be unary ops, so require following =.
	if (c1 == '=')
	  bin_op = true;

	yyunput (c1, octave_text);
      }
      break;

    default:
      break;
    }

  yyunput (c0, octave_text);

  return bin_op;
}

// Used to delete trailing white space from tokens.

static std::string
strip_trailing_whitespace (char *s)
{
  std::string retval = s;

  size_t pos = retval.find_first_of (" \t");

  if (pos != NPOS)
    retval.resize (pos);

  return retval;
}

static void
scan_for_comments (const char *text)
{
  std::string comment_buf;

  bool in_comment = false;
  bool beginning_of_comment = false;

  int len = strlen (text);
  int i = 0;

  while (i < len)
    {
      char c = text[i++];

      switch (c)
	{
	case '%':
	case '#':
	  if (in_comment)
	    {
	      if (! beginning_of_comment)
		comment_buf += static_cast<char> (c);
	    }
	  else
	    {
	      maybe_gripe_matlab_incompatible_comment (c);
	      in_comment = true;
	      beginning_of_comment = true;
	    }
	  break;

	case '\n':
	  if (in_comment)
	    {
	      comment_buf += static_cast<char> (c);
	      octave_comment_buffer::append (comment_buf);
	      comment_buf.resize (0);
	      in_comment = false;
	      beginning_of_comment = false;
	    }
	  break;

	case '\r':
	  if (in_comment)
	    comment_buf += static_cast<char> (c);
	  if (i < len)
	    {
	      c = text[i++];

	      if (c == '\n')
		{
		  if (in_comment)
		    {
		      comment_buf += static_cast<char> (c);
		      octave_comment_buffer::append (comment_buf);
		      in_comment = false;
		      beginning_of_comment = false;
		    }
		}
	    }

	default:
	  if (in_comment)
	    {
	      comment_buf += static_cast<char> (c);
	      beginning_of_comment = false;
	    }
	  break;
	}
    }

  if (! comment_buf.empty ())
    octave_comment_buffer::append (comment_buf);
}

// Discard whitespace, including comments and continuations.
//
// Return value is logical OR of the following values:
//
//  ATE_NOTHING      : no spaces to eat
//  ATE_SPACE_OR_TAB : space or tab in input
//  ATE_NEWLINE      : bare new line in input

static yum_yum
eat_whitespace (void)
{
  yum_yum retval = ATE_NOTHING;

  std::string comment_buf;

  bool in_comment = false;
  bool beginning_of_comment = false;

  int c = 0;

  while ((c = yyinput ()) != EOF)
    {
      current_input_column++;

      switch (c)
	{
	case ' ':
	case '\t':
	  if (in_comment)
	    {
	      comment_buf += static_cast<char> (c);
	      beginning_of_comment = false;
	    }
	  retval |= ATE_SPACE_OR_TAB;
	  break;

	case '\n':
	  retval |= ATE_NEWLINE;
	  if (in_comment)
	    {
	      comment_buf += static_cast<char> (c);
	      octave_comment_buffer::append (comment_buf);
	      comment_buf.resize (0);
	      in_comment = false;
	      beginning_of_comment = false;
	    }
	  current_input_column = 0;
	  break;

	case '#':
	case '%':
	  if (in_comment)
	    {
	      if (! beginning_of_comment)
		comment_buf += static_cast<char> (c);
	    }
	  else
	    {
	      maybe_gripe_matlab_incompatible_comment (c);
	      in_comment = true;
	      beginning_of_comment = true;
	    }
	  break;

	case '.':
	  if (in_comment)
	    {
	      comment_buf += static_cast<char> (c);
	      beginning_of_comment = false;
	      break;
	    }
	  else
	    {
	      if (have_ellipsis_continuation ())
		break;
	      else
		goto done;
	    }

	case '\\':
	  if (in_comment)
	    {
	      comment_buf += static_cast<char> (c);
	      beginning_of_comment = false;
	      break;
	    }
	  else
	    {
	      if (have_continuation ())
		break;
	      else
		goto done;
	    }

	default:
	  if (in_comment)
	    {
	      comment_buf += static_cast<char> (c);
	      beginning_of_comment = false;
	      break;
	    }
	  else
	    goto done;
	}
    }

  if (! comment_buf.empty ())
    octave_comment_buffer::append (comment_buf);

 done:
  yyunput (c, octave_text);
  current_input_column--;
  return retval;
}

static inline bool
looks_like_hex (const char *s, int len)
{
  return (len > 2 && s[0] == '0' && (s[1] == 'x' || s[1] == 'X'));
}

static void
handle_number (void)
{
  double value = 0.0;
  int nread = 0;

  if (looks_like_hex (octave_text, strlen (octave_text)))
    {
      unsigned long ival;

      nread = sscanf (octave_text, "%lx", &ival);

      value = static_cast<double> (ival);
    }
  else
    {
      char *tmp = strsave (octave_text);

      char *idx = strpbrk (tmp, "Dd");

      if (idx)
	*idx = 'e';

      nread = sscanf (tmp, "%lf", &value);

      delete [] tmp;
    }

  // If octave_text doesn't contain a valid number, we are in deep doo doo.

  assert (nread == 1);

  lexer_flags.quote_is_transpose = true;
  lexer_flags.cant_be_identifier = true;
  lexer_flags.convert_spaces_to_comma = true;

  if (lexer_flags.plotting && ! lexer_flags.in_plot_range)
    lexer_flags.past_plot_range = true;

  yylval.tok_val = new token (value, octave_text, input_line_number,
			      current_input_column);

  token_stack.push (yylval.tok_val);

  current_input_column += octave_leng;

  do_comma_insert_check ();
}

// We have seen a backslash and need to find out if it should be
// treated as a continuation character.  If so, this eats it, up to
// and including the new line character.
//
// Match whitespace only, followed by a comment character or newline.
// Once a comment character is found, discard all input until newline.
// If non-whitespace characters are found before comment
// characters, return 0.  Otherwise, return 1.

static bool
have_continuation (bool trailing_comments_ok)
{
  OSSTREAM buf;

  std::string comment_buf;

  bool in_comment = false;
  bool beginning_of_comment = false;

  int c = 0;

  while ((c = yyinput ()) != EOF)
    {
      buf << static_cast<char> (c);

      switch (c)
	{
	case ' ':
	case '\t':
	  if (in_comment)
	    {
	      comment_buf += static_cast<char> (c);
	      beginning_of_comment = false;
	    }
	  break;

	case '%':
	case '#':
	  if (trailing_comments_ok)
	    {
	      if (in_comment)
		{
		  if (! beginning_of_comment)
		    comment_buf += static_cast<char> (c);
		}
	      else
		{
		  maybe_gripe_matlab_incompatible_comment (c);
		  in_comment = true;
		  beginning_of_comment = true;
		}
	    }
	  else
	    goto cleanup;
	  break;

	case '\n':
	  if (in_comment)
	    {
	      comment_buf += static_cast<char> (c);
	      octave_comment_buffer::append (comment_buf);
	    }
	  current_input_column = 0;
	  promptflag--;
	  gripe_matlab_incompatible_continuation ();
	  return true;

	case '\r':
	  if (in_comment)
	    comment_buf += static_cast<char> (c);
	  c = yyinput ();
	  if (c == EOF)
	    break;
	  else if (c == '\n')
	    {
	      if (in_comment)
		{
		  comment_buf += static_cast<char> (c);
		  octave_comment_buffer::append (comment_buf);
		}
	      current_input_column = 0;
	      promptflag--;
	      gripe_matlab_incompatible_continuation ();
	      return true;
	    }

	  // Fall through...

	default:
	  if (in_comment)
	    {
	      comment_buf += static_cast<char> (c);
	      beginning_of_comment = false;
	    }
	  else
	    goto cleanup;
	  break;
	}
    }

  yyunput (c, octave_text);
  return false;

cleanup:

  buf << OSSTREAM_ENDS;
  std::string s = OSSTREAM_STR (buf);
  OSSTREAM_FREEZE (buf);

  int len = s.length ();
  while (len--)
    yyunput (s[len], octave_text);

  return false;
}

// We have seen a `.' and need to see if it is the start of a
// continuation.  If so, this eats it, up to and including the new
// line character.

static bool
have_ellipsis_continuation (bool trailing_comments_ok)
{
  char c1 = yyinput ();
  if (c1 == '.')
    {
      char c2 = yyinput ();
      if (c2 == '.' && have_continuation (trailing_comments_ok))
	return true;
      else
	{
	  yyunput (c2, octave_text);
	  yyunput (c1, octave_text);
	}
    }
  else
    yyunput (c1, octave_text);

  return false;
}

// See if we have a continuation line.  If so, eat it and the leading
// whitespace on the next line.
//
// Return value is the same as described for eat_whitespace().

static yum_yum
eat_continuation (void)
{
  int retval = ATE_NOTHING;

  int c = yyinput ();

  if ((c == '.' && have_ellipsis_continuation ())
      || (c == '\\' && have_continuation ()))
    retval = eat_whitespace ();
  else
    yyunput (c, octave_text);

  return retval;
}

static int
handle_string (char delim, int text_style)
{
  OSSTREAM buf;

  int bos_line = input_line_number;
  int bos_col = current_input_column;

  int c;
  int escape_pending = 0;

  while ((c = yyinput ()) != EOF)
    {
      current_input_column++;

      if (c == '\\')
	{
	  if (escape_pending)
	    {
	      buf << static_cast<char> (c);
	      escape_pending = 0;
	    }
	  else
	    {
	      if (have_continuation (false))
		escape_pending = 0;
	      else
		{
		  buf << static_cast<char> (c);
		  escape_pending = 1;
		}
	    }
	  continue;
	}
      else if (c == '.')
	{
	  if (! have_ellipsis_continuation (false))
	    buf << static_cast<char> (c);
	}
      else if (c == '\n')
	{
	  error ("unterminated string constant");
	  break;
	}
      else if (c == delim)
	{
	  if (escape_pending)
	    buf << static_cast<char> (c);
	  else
	    {
	      c = yyinput ();
	      if (c == delim)
		buf << static_cast<char> (c);
	      else
		{
		  yyunput (c, octave_text);
		  buf << OSSTREAM_ENDS;
		  std::string s = do_string_escapes (OSSTREAM_STR (buf));
		  OSSTREAM_FREEZE (buf);

		  if (text_style && lexer_flags.doing_set)
		    {
		      s = std::string (1, delim) + s + std::string (1, delim);
		    }
		  else
		    {
		      lexer_flags.quote_is_transpose = true;
		      lexer_flags.cant_be_identifier = true;
		      lexer_flags.convert_spaces_to_comma = true;
		    }

		  yylval.tok_val = new token (s, bos_line, bos_col);
		  token_stack.push (yylval.tok_val);

		  if (delim == '"')
		    gripe_matlab_incompatible ("\" used as string delimiter");
		  else if (delim == '\'')
		    gripe_single_quote_string ();

		  return STRING;
		}
	    }
	}
      else
	{
	  buf << static_cast<char> (c);
	}

      escape_pending = 0;
    }

  return LEXICAL_ERROR;
}

static bool
next_token_is_assign_op (void)
{
  bool retval = false;

  int c0 = yyinput ();

  switch (c0)
    {
    case '=':
      {
	int c1 = yyinput ();
	yyunput (c1, octave_text);
	if (c1 != '=')
	  retval = true;
      }
      break;

    case '+':
    case '-':
    case '*':
    case '/':
    case '\\':
    case '&':
    case '|':
      {
	int c1 = yyinput ();
	yyunput (c1, octave_text);
	if (c1 == '=')
	  retval = true;
      }
      break;

    case '.':
      {
	int c1 = yyinput ();
	if (match_any (c1, "+-*/\\"))
	  {
	    int c2 = yyinput ();
	    yyunput (c2, octave_text);
	    if (c2 == '=')
	      retval = true;
	  }
	yyunput (c1, octave_text);
      }
      break;

    case '>':
      {
	int c1 = yyinput ();
	if (c1 == '>')
	  {
	    int c2 = yyinput ();
	    yyunput (c2, octave_text);
	    if (c2 == '=')
	      retval = true;
	  }
	yyunput (c1, octave_text);
      }
      break;

    case '<':
      {
	int c1 = yyinput ();
	if (c1 == '<')
	  {
	    int c2 = yyinput ();
	    yyunput (c2, octave_text);
	    if (c2 == '=')
	      retval = true;
	  }
	yyunput (c1, octave_text);
      }
      break;

    default:
      break;
    }

  yyunput (c0, octave_text);

  return retval;
}

static bool
next_token_is_index_op (void)
{
  int c = yyinput ();
  yyunput (c, octave_text);
  return c == '(' || c == '{';
}

static int
handle_close_bracket (bool spc_gobbled, int bracket_type)
{
  int retval = bracket_type;

  if (! nesting_level.none ())
    {
      nesting_level.remove ();

      if (bracket_type == ']')
	lexer_flags.bracketflag--;
      else if (bracket_type == '}')
	lexer_flags.braceflag--;
      else
	panic_impossible ();
    }

  if (lexer_flags.bracketflag == 0 && lexer_flags.braceflag == 0)
    BEGIN (INITIAL);

  if (bracket_type == ']'
      && next_token_is_assign_op ()
      && ! lexer_flags.looking_at_return_list)
    {
      retval = CLOSE_BRACE;
    }
  else if ((lexer_flags.bracketflag || lexer_flags.braceflag)
	   && lexer_flags.convert_spaces_to_comma
	   && (nesting_level.is_bracket ()
	       || (nesting_level.is_brace ()
		   && ! lexer_flags.looking_at_object_index)))
    {
      bool index_op = next_token_is_index_op ();

      // Don't insert comma if we are looking at something like
      //
      //   [x{i}{j}] or [x{i}(j)]
      //
      // but do if we are looking at
      //
      //   [x{i} {j}] or [x{i} (j)]

      if (spc_gobbled || ! (bracket_type == '}' && index_op))
	{
	  bool bin_op = next_token_is_bin_op (spc_gobbled);

	  bool postfix_un_op = next_token_is_postfix_unary_op (spc_gobbled);

	  bool sep_op = next_token_is_sep_op ();

	  if (! (postfix_un_op || bin_op || sep_op))
	    {
	      maybe_warn_separator_insert (',');

	      yyunput (',', octave_text);
	      return retval;
	    }
	}
    }

  lexer_flags.quote_is_transpose = true;
  lexer_flags.cant_be_identifier = false;
  lexer_flags.convert_spaces_to_comma = true;

  return retval;
}

static void
maybe_unput_comma (int spc_gobbled)
{
  if (nesting_level.is_bracket ()
      || (nesting_level.is_brace ()
	  && ! lexer_flags.looking_at_object_index))
    {
      int bin_op = next_token_is_bin_op (spc_gobbled);

      int postfix_un_op = next_token_is_postfix_unary_op (spc_gobbled);

      int c1 = yyinput ();
      int c2 = yyinput ();

      yyunput (c2, octave_text);
      yyunput (c1, octave_text);

      int sep_op = next_token_is_sep_op ();

      int dot_op = (c1 == '.'
		    && (isalpha (c2) || isspace (c2) || c2 == '_'));

      if (postfix_un_op || bin_op || sep_op || dot_op)
	return;

      int index_op = (c1 == '(' || c1 == '{');

      // If there is no space before the indexing op, we don't insert
      // a comma.

      if (index_op && ! spc_gobbled)
	return;

      maybe_warn_separator_insert (',');

      yyunput (',', octave_text);
    }
}

// Figure out exactly what kind of token to return when we have seen
// an identifier.  Handles keywords.  Return -1 if the identifier
// should be ignored.

static int
handle_identifier (void)
{
  std::string tok = strip_trailing_whitespace (octave_text);

  int c = octave_text[octave_leng-1];

  int cont_is_spc = eat_continuation ();

  int spc_gobbled = (cont_is_spc || c == ' ' || c == '\t');

  // It is almost always an error for an identifier to be followed
  // directly by another identifier.  Special cases are handled
  // below.

  lexer_flags.cant_be_identifier = true;

  // If we are expecting a structure element, avoid recognizing
  // keywords and other special names and return STRUCT_ELT, which is
  // a string that is also a valid identifier.  But first, we have to
  // decide whether to insert a comma.

  if (lexer_flags.looking_at_indirect_ref)
    {
      do_comma_insert_check ();

      maybe_unput_comma (spc_gobbled);

      yylval.tok_val = new token (tok, input_line_number,
				  current_input_column);

      token_stack.push (yylval.tok_val);

      lexer_flags.cant_be_identifier = false;
      lexer_flags.quote_is_transpose = true;
      lexer_flags.convert_spaces_to_comma = true;

      current_input_column += octave_leng;

      return STRUCT_ELT;
    }

  int kw_token = is_keyword_token (tok);

  if (lexer_flags.looking_at_function_handle)
    {
      if (kw_token)
	{
	  error ("function handles may not refer to keywords");

	  return LEXICAL_ERROR;
	}
      else
	TOK_PUSH_AND_RETURN (tok, FCN_HANDLE);
    }

  // If we have a regular keyword, or a plot STYLE, return it.
  // Keywords can be followed by identifiers (TOK_RETURN handles
  // that).

  if (kw_token)
    {
      if (kw_token < 0)
	return kw_token;
      else if (kw_token == STYLE)
	{
	  current_input_column += octave_leng;
	  lexer_flags.quote_is_transpose = false;
	  lexer_flags.convert_spaces_to_comma = true;
	  return kw_token;
	}
      else
	TOK_RETURN (kw_token);
    }

  // See if we have a plot keyword (title, using, with, or clear).

  if (lexer_flags.plotting)
    {
      // Yes, we really do need both of these plot_range variables.
      // One is used to mark when we are past all possiblity of a plot
      // range, the other is used to mark when we are actually between
      // the square brackets that surround the range.

      if (! lexer_flags.in_plot_range)
	lexer_flags.past_plot_range = true;

      // Option keywords can't appear in brackets, braces, or parentheses.

      int plot_option_kw = 0;

      if (nesting_level.none ())
	plot_option_kw = is_plot_keyword (tok);
      
      if (lexer_flags.cant_be_identifier && plot_option_kw)
	TOK_RETURN (plot_option_kw);
    }

  int c1 = yyinput ();

  bool next_tok_is_paren = (c1 == '(');

  bool next_tok_is_eq = false;
  if (c1 == '=')
    {
      int c2 = yyinput ();
      yyunput (c2, octave_text);

      if (c2 != '=')
	next_tok_is_eq = true;
    }

  yyunput (c1, octave_text);

  // Make sure we put the return values of a function in the symbol
  // table that is local to the function.

  // If we are defining a function and we have not seen the function
  // name yet and the next token is `=', then this identifier must be
  // the only return value for the function and it belongs in the
  // local symbol table.

  if (next_tok_is_eq
      && lexer_flags.defining_func
      && ! lexer_flags.parsed_function_name)
    curr_sym_tab = tmp_local_sym_tab;

  // Kluge alert.
  //
  // If we are looking at a text style function, set up to gobble its
  // arguments.
  //
  // If the following token is `=', or if we are parsing a function
  // return list or function parameter list, or if we are looking at
  // something like [ab,cd] = foo (), force the symbol to be inserted
  // as a variable in the current symbol table.

  if (is_command_name (tok) && ! is_variable (tok))
    {
      if (next_tok_is_eq
	  || lexer_flags.looking_at_return_list
	  || lexer_flags.looking_at_parameter_list
	  || lexer_flags.looking_at_matrix_or_assign_lhs)
	{
	  force_local_variable (tok);
	}
      else if (! next_tok_is_paren)
	{
	  if (tok == "__gnuplot_set__")
	    lexer_flags.doing_set = true;

	  if (tok == "gset")
	    lexer_flags.doing_set = true;

	  BEGIN (COMMAND_START);
	}
    }

  // Find the token in the symbol table.  Beware the magic
  // transformation of the end keyword...

  if (tok == "end")
    tok = "__end__";    

  yylval.tok_val = new token (lookup_identifier (tok),
			      input_line_number,
			      current_input_column);

  token_stack.push (yylval.tok_val);

  // After seeing an identifer, it is ok to convert spaces to a comma
  // (if needed).

  lexer_flags.convert_spaces_to_comma = true;

  if (! next_tok_is_eq)
    {
      lexer_flags.quote_is_transpose = true;

      do_comma_insert_check ();

      maybe_unput_comma (spc_gobbled);
    }

  current_input_column += octave_leng;

  return NAME;
}

void
lexical_feedback::init (void)
{
  // Not initially defining a matrix list.
  bracketflag = 0;

  // Not initially defining a cell array list.
  braceflag = 0;

  // Not initially inside a loop or if statement.
  looping = 0;

  // Not initially defining a function.
  beginning_of_function = false;
  defining_func = false;
  parsed_function_name = false;
  parsing_nested_function = 0;

  // Not initiallly looking at a function handle.
  looking_at_function_handle = 0;

  // Not parsing a function return or parameter list.
  looking_at_return_list = false;
  looking_at_parameter_list = false;

  // Not parsing a matrix or the left hand side of multi-value
  // assignment statement.
  looking_at_matrix_or_assign_lhs = false;

  // Not parsing an object index.
  looking_at_object_index = 0;

  // Next token can be identifier.
  cant_be_identifier = false;

  // No need to do comma insert or convert spaces to comma at
  // beginning of input. 
  convert_spaces_to_comma = true;
  do_comma_insert = false;

  // Not initially doing any plotting or setting of plot attributes.
  doing_set = false;
  in_plot_range = false;
  in_plot_style = false;
  in_plot_axes = false;
  in_plot_using = false;
  past_plot_range = false;
  plotting = false;

  // Not initially looking at indirect references.
  looking_at_indirect_ref = false;

  // Quote marks strings intially.
  quote_is_transpose = false;
}

bool
is_keyword (const std::string& s)
{
  return octave_kw_lookup (s.c_str (), s.length ()) != 0;
}

DEFCMD (iskeyword, args, ,
  "-*- texinfo -*-\n\
@deftypefn {Built-in Function} {} iskeyword (@var{name})\n\
Return true if @var{name} is an Octave keyword.  If @var{name}\n\
is omitted, return a list of keywords.\n\
@end deftypefn")
{
  octave_value retval;

  int argc = args.length () + 1;

  string_vector argv = args.make_argv ("iskeyword");

  if (error_state)
    return retval;

  if (argc == 1)
    {
      string_vector lst (TOTAL_KEYWORDS);

      for (int i = 0; i < TOTAL_KEYWORDS; i++)
	lst[i] = wordlist[i].name;

      retval = Cell (lst.qsort ());
    }
  else if (argc == 2)
    {
      retval = is_keyword (argv[1]);
    }
  else
    print_usage ("iskeyword");

  return retval;
}


static void
maybe_warn_separator_insert (char sep)
{
  std::string nm = curr_fcn_file_full_name;

  if (Vwarn_separator_insert)
    {
      if (nm.empty ())
	warning ("potential auto-insertion of `%c' near line %d",
		 sep, input_line_number);
      else
	warning ("potential auto-insertion of `%c' near line %d of file %s",
		 sep, input_line_number, nm.c_str ());
    }
}

static void
gripe_single_quote_string (void)
{
  std::string nm = curr_fcn_file_full_name;

  if (Vwarn_single_quote_string)
    {
      if (nm.empty ())
	warning ("single quote delimited string near line %d",
		 input_line_number);
      else
	warning ("single quote delimited string near line %d of file %s",
		 input_line_number, nm.c_str ());
    }
}

static void
gripe_matlab_incompatible (const std::string& msg)
{
  if (Vwarn_matlab_incompatible)
    warning ("potential Matlab compatibility problem: %s", msg.c_str ());
}

static void
maybe_gripe_matlab_incompatible_comment (char c)
{
  if (c == '#')
    gripe_matlab_incompatible ("# used as comment character");
}

static void
gripe_matlab_incompatible_continuation (void)
{
  gripe_matlab_incompatible ("\\ used as line continuation marker");
}

static void
gripe_matlab_incompatible_operator (const std::string& op)
{
  std::string t = op;
  int n = t.length ();
  if (t[n-1] == '\n')
    t.resize (n-1);
  gripe_matlab_incompatible (t + " used as operator");
}

#define WARN_DEPRECATED(FOLD, FNEW) \
  do \
    { \
      static bool warned = false; \
      if (! warned) \
	{ \
	  warned = true; \
	  warning (FOLD " is deprecated and will be removed from a future"); \
	  warning ("version of Octave."); \
	  warning ("You should use the higher-level plot functions"); \
	  warning ("(\"plot\", \"mesh\", \"semilogx\", etc.) instead"); \
	  warning ("of the low-level plotting commands."); \
	  warning ("If you absolutely must use this function, use the"); \
	  warning ("internal version " FNEW " instead."); \
	} \
    } \
  while (0)

static void
gripe_deprecated_gplot (void)
{
  WARN_DEPRECATED ("gplot", "__gnuplot_plot__");
}

static void
gripe_deprecated_gsplot (void)
{
  WARN_DEPRECATED ("gsplot", "__gnuplot_splot__");
}

DEFUN (__token_count__, , ,
  "-*- texinfo -*-\n\
@deftypefn {Built-in Function} {} __token_count__\n\
Number of language tokens processed since Octave startup.\n\
@end deftypefn")
{
  return octave_value (Vtoken_count);
}

static int
warn_matlab_incompatible (void)
{
  Vwarn_matlab_incompatible = check_preference ("warn_matlab_incompatible");

  return 0;
}

static int
warn_separator_insert (void)
{
  Vwarn_separator_insert = check_preference ("warn_separator_insert");

  return 0;
}

static int
warn_single_quote_string (void)
{
  Vwarn_single_quote_string = check_preference ("warn_single_quote_string");

  return 0;
}

void
symbols_of_lex (void)
{
  DEFVAR (warn_matlab_incompatible, false, warn_matlab_incompatible,
    "-*- texinfo -*-\n\
@defvr {Built-in Variable} warn_matlab_incompatible\n\
Print warnings for Octave language features that may cause\n\
compatibility problems with Matlab.\n\
@end defvr");

  DEFVAR (warn_separator_insert, false, warn_separator_insert,
    "-*- texinfo -*-\n\
@defvr {Built-in Variable} warn_separator_insert\n\
Print warning if commas or semicolons might be inserted\n\
automatically in literal matrices.\n\
@end defvr");

  DEFVAR (warn_single_quote_string, false, warn_single_quote_string,
    "-*- texinfo -*-\n\
@defvr {Built-in Variable} warn_single_quote_string\n\
Print warning if a signle quote character is used to introduce a\n\
string constant.\n\
@end defvr");
}

/*
;;; Local Variables: ***
;;; mode: C++ ***
;;; End: ***
*/

