/* A lexical scanner generated by flex */

/* Scanner skeleton version:
 * $Header: /home/daffy/u0/vern/flex/RCS/flex.skl,v 2.89 96/05/25 21:02:21 vern Exp $
 */

#define FLEX_SCANNER
#define YY_FLEX_MAJOR_VERSION 2
#define YY_FLEX_MINOR_VERSION 5

#include <stdio.h>


/* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */
#ifdef c_plusplus
#ifndef __cplusplus
#define __cplusplus
#endif
#endif


#ifdef __cplusplus

#include <stdlib.h>
#include <unistd.h>

/* Use prototypes in function declarations. */
#define YY_USE_PROTOS

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

#else	/* ! __cplusplus */

#if __STDC__

#define YY_USE_PROTOS
#define YY_USE_CONST

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

#ifdef __TURBOC__
 #pragma warn -rch
 #pragma warn -use
#include <io.h>
#include <stdlib.h>
#define YY_USE_CONST
#define YY_USE_PROTOS
#endif

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


#ifdef YY_USE_PROTOS
#define YY_PROTO(proto) proto
#else
#define YY_PROTO(proto) ()
#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 yyrestart( yyin )

#define YY_END_OF_BUFFER_CHAR 0

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

typedef struct yy_buffer_state *YY_BUFFER_STATE;

extern int yyleng;
extern FILE *yyin, *yyout;

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

/* The funky do-while in the following #define is used to turn the definition
 * int a single C statement (which needs a semi-colon terminator).  This
 * avoids problems with code like:
 *
 * 	if ( condition_holds )
 *		yyless( 5 );
 *	else
 *		do_something_else();
 *
 * Prior to using the do-while the compiler would get upset at the
 * "else" because it interpreted the "if" statement as being all
 * done when it reached the ';' after the yyless() call.
 */

/* Return all but the first 'n' matched characters back to the input stream. */

#define yyless(n) \
	do \
		{ \
		/* Undo effects of setting up yytext. */ \
		*yy_cp = yy_hold_char; \
		YY_RESTORE_YY_MORE_OFFSET \
		yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \
		YY_DO_BEFORE_ACTION; /* set up yytext 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).
 */
typedef unsigned int yy_size_t;


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;

	/* 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 yyrestart()), so that the user can continue scanning by
	 * just pointing yyin at a new input file.
	 */
#define YY_BUFFER_EOF_PENDING 2
	};

static YY_BUFFER_STATE yy_current_buffer = 0;

/* 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".
 */
#define YY_CURRENT_BUFFER yy_current_buffer


/* yy_hold_char holds the character lost when yytext is formed. */
static char yy_hold_char;

static int yy_n_chars;		/* number of characters read into yy_ch_buf */


int yyleng;

/* 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 yywrap()'s to do buffer switches
 * instead of setting up a fresh yyin.  A bit of a hack ...
 */
static int yy_did_buffer_switch_on_eof;

void yyrestart YY_PROTO(( FILE *input_file ));

void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer ));
void yy_load_buffer_state YY_PROTO(( void ));
YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size ));
void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b ));
void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file ));
void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b ));
#define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer )

YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size ));
YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *str ));
YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len ));

static void *yy_flex_alloc YY_PROTO(( yy_size_t ));
static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t ));
static void yy_flex_free YY_PROTO(( void * ));

#define yy_new_buffer yy_create_buffer

#define yy_set_interactive(is_interactive) \
	{ \
	if ( ! yy_current_buffer ) \
		yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
	yy_current_buffer->yy_is_interactive = is_interactive; \
	}

#define yy_set_bol(at_bol) \
	{ \
	if ( ! yy_current_buffer ) \
		yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
	yy_current_buffer->yy_at_bol = at_bol; \
	}

#define YY_AT_BOL() (yy_current_buffer->yy_at_bol)

typedef unsigned char YY_CHAR;
FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;
typedef int yy_state_type;
extern char *yytext;
#define yytext_ptr yytext

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

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

#define YY_NUM_RULES 68
#define YY_END_OF_BUFFER 69
static yyconst short int yy_accept[230] =
    {   0,
        0,    0,   69,   67,   65,    3,   56,   25,   67,   41,
       67,   67,   46,   47,   41,   41,   40,   41,   41,    7,
        7,    7,   66,   42,   41,   45,   41,   63,   63,   48,
       43,   57,   44,   65,   41,   31,   41,    5,    5,    5,
        0,    0,   28,    0,   51,    0,    0,   55,    0,   49,
       36,   34,   35,   23,    1,    2,   37,   22,    7,    7,
       11,    0,    0,    0,   32,   33,   52,   50,   53,   58,
       63,   63,    0,   60,   54,    0,    0,   28,    0,    5,
        0,    0,   30,    5,   20,   19,    5,    5,    0,    0,
        0,    6,   26,   27,    6,   29,    0,    0,    0,   64,

        0,    2,   22,    0,    0,   24,   10,    0,   38,   59,
       63,    0,    6,    5,   20,   19,    0,    0,   14,   13,
        0,    0,   19,    0,    8,    0,   21,   17,   16,    0,
        9,    0,    0,    0,   23,    0,   12,   12,    0,   22,
       39,   63,   14,   13,    0,    0,   19,    0,    8,    0,
       21,    0,   13,    0,    0,   15,    0,   20,    0,   12,
        0,   19,    0,   16,    0,    0,   18,    0,    0,    0,
       22,   63,    0,   13,    0,    0,   15,    0,   20,    0,
        0,   19,    0,   14,    0,    0,   13,    0,   19,    0,
       17,    0,    0,   16,    0,    0,   63,    0,   14,    0,

        0,   13,    0,   19,    0,   13,    0,   16,   61,    0,
       63,    0,   13,    0,   63,    0,    0,   63,    0,   62,
       63,   63,   63,   63,   63,   63,   63,    4,    0
    } ;

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

       41,   42,   43,   43,   44,   43,   43,   45,   43,   46,
       47,   43,   43,   43,   43,   48,   49,   43,   43,   50,
       43,   43,   51,   52,   53,    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,    1
    } ;

static yyconst int yy_meta[54] =
    {   0,
        1,    1,    2,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    3,    3,
        3,    1,    1,    1,    1,    1,    1,    4,    4,    5,
        6,    6,    6,    6,    7,    1,    5,    5,    5,    5,
        5,    5,    8,    8,    8,    8,    8,    8,    8,    8,
        1,    1,    1
    } ;

static yyconst short int yy_base[236] =
    {   0,
        0,   52,  307,  827,   60,  827,  280,  827,   15,  827,
      286,    0,  827,  827,   45,  263,  262,   63,   72,   81,
      233,   74,   35,  253,  247,  242,   52,    0,  225,   71,
      827,  205,  827,  130,   88,  116,   68,  135,  202,  169,
      198,  106,  218,  139,  827,  210,  203,  827,  235,  827,
      827,  827,  827,  151,  827,    0,  827,  163,  194,  206,
      827,  234,    0,   74,  827,  827,  827,  827,  827,  208,
        0,  187,   88,  827,  827,    0,  211,  239,  109,  244,
      119,  249,  827,  256,  261,  273,  179,    0,  148,  290,
      158,  298,   59,  827,  323,  827,  186,  182,  177,  827,

      306,    0,  311,  340,  221,  279,    0,  183,  827,  827,
      153,  314,  328,  353,  346,  358,  370,  381,  384,  387,
      399,  415,  402,  425,  390,  428,  431,  434,  437,  449,
      440,  154,  152,  452,  460,  468,  471,  479,  483,  486,
      827,  151,  489,  492,  504,  520,  507,  530,  495,  533,
      536,  544,  547,  555,  559,  562,  565,  570,  578,  586,
      589,  592,  600,  603,  611,  615,  618,  148,  138,  621,
      626,  145,  634,  637,  645,  649,  652,  655,  660,  668,
      671,  674,  677,  680,  688,  691,  694,  697,  700,  703,
      706,  714,  717,  720,  133,  123,  116,  723,  726,  734,

      737,  740,  743,  746,  749,  752,  755,  758,  827,  116,
      109,  761,  764,  209,  102,  784,  139,  102,  136,  827,
       89,   71,   69,   77,   72,   34,   33,    0,  827,  787,
      793,  801,  807,  810,  818
    } ;

static yyconst short int yy_def[236] =
    {   0,
      229,    1,  229,  229,  229,  229,  229,  229,  229,  229,
      229,  230,  229,  229,  229,  229,  229,  229,  229,  229,
       20,  229,  229,  229,  229,  229,  229,  231,  231,  229,
      229,  229,  229,  229,  229,  229,  229,  229,   38,  229,
      229,  229,  229,  229,  229,  229,  229,  229,  229,  229,
      229,  229,  229,  229,  229,  232,  229,  229,   20,  229,
      229,  229,  233,  229,  229,  229,  229,  229,  229,  229,
      231,  231,  229,  229,  229,   34,  229,   43,  229,  229,
      229,  229,  229,  229,  229,  229,   38,   40,  229,  229,
      229,  229,  229,  229,  229,  229,  229,  229,  229,  229,

      229,  232,  234,  229,  229,  229,  233,  229,  229,  229,
      231,  229,  229,  229,  229,  229,  229,  229,  229,  229,
      229,  229,  234,  229,  229,  229,  229,  229,  229,  229,
      229,  229,  229,  229,  229,  229,  234,  137,  229,  229,
      229,  231,  229,  229,  229,  229,  229,  229,  229,  229,
      229,  229,  229,  229,  229,  229,  229,  229,  229,  137,
      229,  229,  229,  229,  229,  229,  229,  229,  229,  229,
      229,  231,  229,  229,  229,  229,  229,  229,  229,  229,
      229,  229,  229,  229,  229,  229,  229,  229,  229,  229,
      229,  229,  229,  229,  229,  229,  231,  229,  229,  229,

      229,  229,  229,  229,  229,  229,  229,  229,  229,  229,
      231,  229,  229,  229,  231,  229,  235,  231,  235,  229,
      231,  231,  231,  231,  231,  231,  231,  231,    0,  229,
      229,  229,  229,  229,  229
    } ;

static yyconst short int yy_nxt[881] =
    {   0,
        4,    5,    6,    5,    7,    8,    9,   10,   11,   12,
       13,   14,   15,   16,   10,   17,   18,   19,   20,   21,
       22,   23,   24,   25,   26,   27,    4,   28,   28,   28,
       28,   28,   28,   28,   29,   30,   28,   28,   28,   28,
       28,   28,   28,   28,   28,   28,   28,   28,   28,   28,
       31,   32,   33,   34,   46,   34,   64,   50,   47,   65,
       93,   41,   93,   41,  228,   35,  227,   36,   37,   51,
       38,   39,   40,   42,   73,   43,   69,   70,   44,   44,
       44,   54,   54,   54,   55,   74,   85,   85,   85,   56,
       58,   73,   60,   60,   60,  108,   57,   58,  109,   59,

       59,   60,   74,   62,   81,  226,   82,   82,   82,   61,
       62,  225,   52,   62,   62,  224,  223,   83,   61,   83,
       62,   62,   91,  222,   92,   92,   92,  115,  115,  115,
       63,   76,   81,   76,   84,   84,   84,  119,  119,  119,
       53,  220,  221,   77,  220,   78,   79,  218,   80,   80,
       80,   86,  215,   87,   87,   88,  214,   44,   44,   44,
      211,   89,  210,   61,   90,   97,  125,  125,  125,   54,
       54,   54,   61,  209,   90,   90,  128,  128,  128,  197,
      101,  103,  103,  103,   63,   86,  196,   88,   88,   88,
      101,  101,  104,  195,  172,   89,  169,  168,   90,   41,

      142,   41,  104,  104,  131,  131,  131,  141,   90,   90,
      216,   42,  216,   43,  217,  133,   44,   44,   44,   93,
       94,   93,   58,  132,   60,   60,   60,  112,  229,  113,
      113,  113,  111,  110,   91,   62,   95,   95,   95,  106,
      106,  106,   96,  229,  100,   62,   62,  105,   99,  105,
       98,  229,  106,  106,  106,  112,   75,  114,  114,  114,
      116,   72,   80,   80,   80,  120,   68,   82,   82,   82,
      117,   67,  120,  118,   84,   84,   84,   66,  121,   85,
       85,   85,  229,  118,  118,  121,   53,   52,  121,  121,
      122,  123,  123,  123,   48,  121,  121,  106,  106,  106,

      122,  122,  124,  126,   45,  126,  229,  229,  127,  127,
      127,  229,  124,  124,  129,  229,   92,   92,   92,  134,
      229,  134,  229,  229,  135,  135,  135,  130,  229,  103,
      103,  103,  143,  143,  143,  229,  229,  130,  130,  129,
      136,   95,   95,   95,  144,  229,  113,  113,  113,   97,
      138,  138,  130,  139,  229,  139,  229,  145,  140,  140,
      140,  229,  130,  130,  115,  115,  115,  145,  145,  144,
      229,  114,  114,  114,  229,  146,  147,  147,  147,   97,
      229,  229,  145,  229,  229,  146,  146,  148,  149,  149,
      149,  229,  145,  145,  150,  229,  150,  148,  148,  151,

      151,  151,  119,  119,  119,  153,  153,  153,  125,  125,
      125,  229,  155,  152,  155,  229,  154,  156,  156,  156,
      123,  123,  123,  152,  152,  229,  154,  154,  157,  229,
      157,  159,  229,  158,  158,  158,  229,  229,  161,  229,
      161,  160,  160,  162,  162,  162,  127,  127,  127,  127,
      127,  127,  128,  128,  128,  164,  164,  164,  131,  131,
      131,  229,  166,  163,  166,  229,  165,  167,  167,  167,
      135,  135,  135,  163,  163,  229,  165,  165,  135,  135,
      135,  170,  229,  170,  229,  229,  171,  171,  171,  229,
      229,  229,  170,  229,  170,  229,  229,  171,  171,  171,

      229,  140,  140,  140,  140,  140,  140,  143,  143,  143,
      174,  174,  174,  149,  149,  149,  229,  176,  173,  176,
      229,  175,  177,  177,  177,  147,  147,  147,  173,  173,
      229,  175,  175,  178,  229,  178,  180,  229,  179,  179,
      179,  229,  229,  181,  229,  181,  180,  180,  182,  182,
      182,  151,  151,  151,  151,  151,  151,  183,  229,  183,
      229,  229,  184,  184,  184,  153,  153,  153,  186,  229,
      186,  229,  229,  187,  187,  187,  185,  156,  156,  156,
      156,  156,  156,  158,  158,  158,  185,  185,  158,  158,
      158,  188,  229,  188,  229,  229,  189,  189,  189,  188,

      229,  188,  229,  229,  189,  189,  189,  162,  162,  162,
      162,  162,  162,  190,  229,  190,  229,  229,  191,  191,
      191,  164,  164,  164,  193,  229,  193,  229,  229,  194,
      194,  194,  192,  167,  167,  167,  167,  167,  167,  171,
      171,  171,  192,  192,  171,  171,  171,  198,  229,  198,
      229,  229,  199,  199,  199,  174,  174,  174,  201,  229,
      201,  229,  229,  202,  202,  202,  200,  177,  177,  177,
      177,  177,  177,  179,  179,  179,  200,  200,  179,  179,
      179,  203,  229,  203,  229,  229,  204,  204,  204,  182,
      182,  182,  182,  182,  182,  184,  184,  184,  184,  184,

      184,  205,  229,  205,  229,  229,  206,  206,  206,  187,
      187,  187,  187,  187,  187,  189,  189,  189,  189,  189,
      189,  191,  191,  191,  191,  191,  191,  207,  229,  207,
      229,  229,  208,  208,  208,  194,  194,  194,  194,  194,
      194,  199,  199,  199,  199,  199,  199,  212,  229,  212,
      229,  229,  213,  213,  213,  202,  202,  202,  202,  202,
      202,  204,  204,  204,  204,  204,  204,  206,  206,  206,
      206,  206,  206,  208,  208,  208,  208,  208,  208,  213,
      213,  213,  213,  213,  213,  216,  229,  216,  229,  217,
       49,   49,   49,  229,   49,   71,   71,   71,   71,   71,

       71,  102,  229,  102,  102,  102,  102,  102,  102,  107,
      107,  107,  137,  229,  137,  229,  229,  137,  219,  219,
      219,  219,  219,  219,  219,  219,    3,  229,  229,  229,
      229,  229,  229,  229,  229,  229,  229,  229,  229,  229,
      229,  229,  229,  229,  229,  229,  229,  229,  229,  229,
      229,  229,  229,  229,  229,  229,  229,  229,  229,  229,
      229,  229,  229,  229,  229,  229,  229,  229,  229,  229,
      229,  229,  229,  229,  229,  229,  229,  229,  229,  229
    } ;

static yyconst short int yy_chk[881] =
    {   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,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    2,    9,    2,   23,   15,    9,   23,
       93,    5,   93,    5,  227,    2,  226,    2,    2,   15,
        2,    2,    2,    5,   30,    5,   27,   27,    5,    5,
        5,   18,   18,   18,   19,   30,   37,   37,   37,   19,
       22,   73,   22,   22,   22,   64,   19,   20,   64,   20,

       20,   20,   73,   22,   35,  225,   35,   35,   35,   20,
       20,  224,   35,   22,   22,  223,  222,   36,   20,   36,
       20,   20,   42,  221,   42,   42,   42,   79,   79,   79,
       20,   34,   36,   34,   36,   36,   36,   81,   81,   81,
       36,  219,  218,   34,  217,   34,   34,  215,   34,   34,
       34,   38,  211,   38,   38,   38,  210,   44,   44,   44,
      197,   38,  196,   38,   38,   44,   89,   89,   89,   54,
       54,   54,   38,  195,   38,   38,   91,   91,   91,  172,
       54,   58,   58,   58,   38,   40,  169,   40,   40,   40,
       54,   54,   58,  168,  142,   40,  133,  132,   40,   41,

      111,   41,   58,   58,   97,   97,   97,  108,   40,   40,
      214,   41,  214,   41,  214,   99,   41,   41,   41,   43,
       43,   43,   60,   98,   60,   60,   60,   77,   87,   77,
       77,   77,   72,   70,   43,   60,   43,   43,   43,  105,
      105,  105,   43,   59,   49,   60,   60,   62,   47,   62,
       46,   39,   62,   62,   62,   78,   32,   78,   78,   78,
       80,   29,   80,   80,   80,   82,   26,   82,   82,   82,
       80,   25,   84,   80,   84,   84,   84,   24,   82,   85,
       85,   85,   21,   80,   80,   84,   17,   16,   82,   82,
       85,   86,   86,   86,   11,   84,   84,  106,  106,  106,

       85,   85,   86,   90,    7,   90,    3,    0,   90,   90,
       90,    0,   86,   86,   92,    0,   92,   92,   92,  101,
        0,  101,    0,    0,  101,  101,  101,   92,    0,  103,
      103,  103,  112,  112,  112,    0,    0,   92,   92,   95,
      103,   95,   95,   95,  113,    0,  113,  113,  113,   95,
      103,  103,   95,  104,    0,  104,    0,  113,  104,  104,
      104,    0,   95,   95,  115,  115,  115,  113,  113,  114,
        0,  114,  114,  114,    0,  115,  116,  116,  116,  114,
        0,    0,  114,    0,    0,  115,  115,  116,  117,  117,
      117,    0,  114,  114,  118,    0,  118,  116,  116,  118,

      118,  118,  119,  119,  119,  120,  120,  120,  125,  125,
      125,    0,  121,  119,  121,    0,  120,  121,  121,  121,
      123,  123,  123,  119,  119,    0,  120,  120,  122,    0,
      122,  123,    0,  122,  122,  122,    0,    0,  124,    0,
      124,  123,  123,  124,  124,  124,  126,  126,  126,  127,
      127,  127,  128,  128,  128,  129,  129,  129,  131,  131,
      131,    0,  130,  128,  130,    0,  129,  130,  130,  130,
      134,  134,  134,  128,  128,    0,  129,  129,  135,  135,
      135,  136,    0,  136,    0,    0,  136,  136,  136,  137,
      137,  137,  138,    0,  138,    0,    0,  138,  138,  138,

      137,  139,  139,  139,  140,  140,  140,  143,  143,  143,
      144,  144,  144,  149,  149,  149,    0,  145,  143,  145,
        0,  144,  145,  145,  145,  147,  147,  147,  143,  143,
        0,  144,  144,  146,    0,  146,  147,    0,  146,  146,
      146,    0,    0,  148,    0,  148,  147,  147,  148,  148,
      148,  150,  150,  150,  151,  151,  151,  152,    0,  152,
        0,    0,  152,  152,  152,  153,  153,  153,  154,    0,
      154,    0,    0,  154,  154,  154,  153,  155,  155,  155,
      156,  156,  156,  157,  157,  157,  153,  153,  158,  158,
      158,  159,    0,  159,    0,    0,  159,  159,  159,  160,

        0,  160,    0,    0,  160,  160,  160,  161,  161,  161,
      162,  162,  162,  163,    0,  163,    0,    0,  163,  163,
      163,  164,  164,  164,  165,    0,  165,    0,    0,  165,
      165,  165,  164,  166,  166,  166,  167,  167,  167,  170,
      170,  170,  164,  164,  171,  171,  171,  173,    0,  173,
        0,    0,  173,  173,  173,  174,  174,  174,  175,    0,
      175,    0,    0,  175,  175,  175,  174,  176,  176,  176,
      177,  177,  177,  178,  178,  178,  174,  174,  179,  179,
      179,  180,    0,  180,    0,    0,  180,  180,  180,  181,
      181,  181,  182,  182,  182,  183,  183,  183,  184,  184,

      184,  185,    0,  185,    0,    0,  185,  185,  185,  186,
      186,  186,  187,  187,  187,  188,  188,  188,  189,  189,
      189,  190,  190,  190,  191,  191,  191,  192,    0,  192,
        0,    0,  192,  192,  192,  193,  193,  193,  194,  194,
      194,  198,  198,  198,  199,  199,  199,  200,    0,  200,
        0,    0,  200,  200,  200,  201,  201,  201,  202,  202,
      202,  203,  203,  203,  204,  204,  204,  205,  205,  205,
      206,  206,  206,  207,  207,  207,  208,  208,  208,  212,
      212,  212,  213,  213,  213,  216,    0,  216,    0,  216,
      230,  230,  230,    0,  230,  231,  231,  231,  231,  231,

      231,  232,    0,  232,  232,  232,  232,  232,  232,  233,
      233,  233,  234,    0,  234,    0,    0,  234,  235,  235,
      235,  235,  235,  235,  235,  235,  229,  229,  229,  229,
      229,  229,  229,  229,  229,  229,  229,  229,  229,  229,
      229,  229,  229,  229,  229,  229,  229,  229,  229,  229,
      229,  229,  229,  229,  229,  229,  229,  229,  229,  229,
      229,  229,  229,  229,  229,  229,  229,  229,  229,  229,
      229,  229,  229,  229,  229,  229,  229,  229,  229,  229
    } ;

static yy_state_type yy_last_accepting_state;
static char *yy_last_accepting_cpos;

/* 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 *yytext;
#define INITIAL 0
/********************************************************************
*        
*  File:  datafile.lex, lexyy.c  
*
*  Contents: lexical analyzer for evolver data files.
*            Constructed from datafile.lex by lex.
*/ 

/* will have my own input() and output() */

#ifdef FLEX_SCANNER
#define YY_INPUT(buf,result,max_size) \
     { \
       int c = kb_input(); \
       result = (c == 0) ? YY_NULL : (buf[0] = c, 1); \
     }
#else
/* lex scanner */
#undef input
#undef unput
#define input kb_input
#define unput rawunput
#endif

#include "include.h"
#include "lex.h"
#include "ytab.h"

static int previous_char = 0;  /* for CR conversion */
static int BUFFSIZE = 0; /* size of lex buffer */
static char *buff = NULL; /* lex buffer, expandable */
static int  spot = 0;
#define ERRBUFFSIZE 80
static char errbuff[ERRBUFFSIZE+4];  /* for reporting spot of error */
static int  errspot;
extern int ubuff_spot;

struct ckey { char *name; int token; } const_expr_keywords[] =
{
  {"pi",PI_TOK},
  {"e",E_TOK},
  {"g",G_TOK}
};

void savein (int);
void get_more_input(void);
int keyword_compare ( struct ckey *, struct ckey *);

/* Wrapper for yylex() to buffer look-ahead token */
#define UNPUTMAX 10
int unputted_tok[UNPUTMAX];  /* unput token number   */
int unput_tok_count;  /* 1 if token was unput */
YYSTYPE yylval;

char kb_input_new (void);
void kb_unput(char);
int kblex (void);
#define KB_INPUT kb_input_new
#define KB_UNPUT kb_unput

/* for generation of bad tokens for error message generation */
/* for use with -E command line option */
int next_err_token = 0;  /* token in file for which to generate error */
int token_count; /* resets on file initialization */
int err_tok_gen_flag;  /* whether -E option in effect */

/***********************************************************************
* function: kb_yylex()
* purpose: to be called to get next token.
*/
int kb_yylex(YYSTYPE *lvalp  /* for pure parser destination for yylval */)
{
  if ( lvalp )
  { PROF_FINISH(yyparse); /* exclude from yyparse time */
  }

  PROF_START(yylex);

  if ( unput_tok_count ) 
  { tok = unputted_tok[--unput_tok_count]; 
  }
  else 
  { 
    /* clean out previous data */
    /* memset(&yylval,0,sizeof(yylval)); time hog*/
    /*  tok = yylex(); */
    if ( err_tok_gen_flag )
    { if ( token_count == next_err_token )
      { tok = GEN_ERROR_TOKEN;
        if ( yytext )
          strcpy(yytext,"generated error");
        next_err_token++;
        token_count += 10000000; /* just one error per file */
        return tok;
      }
      token_count++;
    }
    tok = kblex();
  }

  switch ( tok )
  { case '(' : parens++; break;
    case ')' : parens--; break;
    case '{' : brace_depth++; break;
    case '}' : brace_depth--; break;
  }

  if ( lvalp ) 
  {
    {
      /* non-movsd substitute for     *lvalp = yylval; */
      int i;
      int *dest = (int*)lvalp;
      int *src  = (int*)&yylval;
      for ( i = 0 ; i < sizeof(yylval)/sizeof(int) ; i++ )
         *(dest++) = *(src++);
    }

    PROF_START(yyparse);
  }


  PROF_FINISH(yylex);
  return tok;
} // end kb_yylex()

/*********************************************************************
* function: unput_tok()
* purpose: For unputting unneeded look-ahead token 
*/
void unput_tok()
{ 
  if ( unput_tok_count >= UNPUTMAX )
    kb_error(2324,"Internal error: unputted_tok stack overflow.\n",DATAFILE_ERROR);
  unputted_tok[unput_tok_count++] = tok;
  /* fprintf(stderr,"UNPUT %3d %s %s\n",tok,tokname(tok),yytext); */
  /* tok = UNPUTTED_TOK; */ /* some places depend on knowing unput lookahead */
 
} // end unput_tok()

int rawinput(void);
int yyback(int *,int);
/* #define yyoutput yyout_unused */
/* #define yyunput yyunput_unused */

extern FILE *data_fd;
extern char *cmdptr;
int line_no = 1;

int macro_flag;  /* tells macro() identifier is being #define'd */
/* return values for macro() */
#define NO_MACRO  0
#define WAS_MACRO_DEF 1
#define MACRO_EXPANDED 2

char *whitespace = " \t\r,:;";   /* whitespace */

#define SUBMAX 500
int  macro_max;
int  macro_subs_top;  /* index of top of string space */
int  macro_subs_max;   /* space allocated for strings */

struct dkey { char *name; int token; } datafile_keywords[] =
{ {"calculate_in_3d",CALC_IN_3D_TOK},
  {"vertices_predicted",VERTICES_PREDICTED_TOK},
  {"edges_predicted",EDGES_PREDICTED_TOK},
  {"facets_predicted",FACETS_PREDICTED_TOK},
  {"bodies_predicted",BODIES_PREDICTED_TOK},
  {"facetedges_predicted",FACETEDGES_PREDICTED_TOK},
  {"quantities_predicted",QUANTITIES_PREDICTED_TOK},
  {"method_instances_predicted",METHOD_INSTANCES_PREDICTED_TOK},
  {"opacity",OPACITY_TOK},
  {"mpi_local_bodies",MPI_LOCAL_BODIES_NODE},
  {"clip_coeff",CLIP_COEFF_TOK},
  {"slice_coeff",SLICE_COEFF_TOK},
  {"on_constraint",ON_CONSTRAINT_TOK},
  {"hit_constraint",HIT_CONSTRAINT_TOK},
  {"value_of_constraint",VALUE_OF_CONSTRAINT_TOK},
  {"on_boundary",ON_BOUNDARY_TOK},
  {"on_quantity",ON_QUANTITY_TOK},
  {"on_method_instance",ON_METHOD_INSTANCE_TOK},
  {"content_rank",CONTENT_RANK_TOK},
  {"high_constraint",V_HIGH_CONSTRAINT},
  {"high_boundary",V_HIGH_BOUNDARY},
  {"suppress_warning",SUPPRESS_WARNING_TOK},
  {"unsuppress_warning",UNSUPPRESS_WARNING_TOK},
  {"volume_method_name",VOLUME_METHOD_NAME_TOK},
  {"partner_hitting",PARTNER_HITTING_TOK},
  {"procedure",PROCEDURE_WORD_TOK},
  {"display_origin",DISPLAY_ORIGIN_TOK},
  {"length_method_name",LENGTH_METHOD_NAME_TOK},
  {"area_method_name",AREA_METHOD_NAME_TOK},
  {"hessian_special_normal_vector",HESSIAN_SPECIAL_NORMAL_VECTOR_TOK},
  {"keep_originals",KEEP_ORIGINALS_TOK},
  {"element_modulus",ELEMENT_MODULUS_TOK},
  {"swap_colors",SWAP_COLORS_TOK},
  {"self",SELF_TOK},
  {"conserved",CONSERVED_TOK},
  {"actual_volume",ACTUAL_VOLUME_TOK},
  {"keep_macros",KEEP_MACROS_TOK},
  {"pdelta",PDELTA_TOK},
  {"on_assign_call",ON_ASSIGN_CALL_TOK},
  {"tolerance",TOLERANCE_TOK},
  {"lagrange_multiplier",LAGRANGE_MULTIPLIER_TOK},
  {"evolver_version",VERSION_TOK},
  {"orientation",ORIENTATION_TOK},
  {"ignore_constraints",IGNORE_CONSTRAINTS_TOK},
  {"ignore_fixed",IGNORE_FIXED_TOK},
  {"load_library",LOAD_LIBRARY_TOK},
  {"interp_bdry_param",INTERP_BDRY_PARAM_TOK},
  {"axial_point",AXIAL_POINT_TOK},
  {"lagrange",LAGRANGE_TOK},
  {"lagrange_order",LAGRANGE_ORDER_TOK},
  {"parameter_1",PARAMETER_1_TOK},
  {"parameter_2",PARAMETER_2_TOK},
  {"optimizing_parameter",OPTIMIZING_PARAMETER_TOK},
  {"optimising_parameter",OPTIMIZING_PARAMETER_TOK},
  {"everything_quantities",V_EVERYTHING_QUANTITIES_TOK},
  {"value",VALUE_TOK},
  {"target",TARGET_TOK},
  {"define",DEFINE_TOK},
  {"attribute",ATTRIBUTE_TOK},
  {"method_instance",METHOD_INSTANCE_TOK},
  {"method",METHOD_TOK},
  {"scalar_integrand",SCALAR_INTEGRAND_TOK},
  {"vector_integrand",VECTOR_INTEGRAND_TOK},
  {"k_vector_order",K_VEC_ORDER_TOK},
  {"form_integrand",FORM_INTEGRAND_TOK},
  {"mobility",MOBILITY_TOK},
  {"mobility_tensor",MOBILITY_TENSOR_TOK},
  {"bare",BARE_TOK},
  {"boundary_curvature",BOUNDARY_CURVATURE_TOK},
  {"modulus",MODULUS_TOK},
  {"info_only",INFO_ONLY_TOK},
  {"global_method",GLOBAL_METHOD_TOK},
  {"global",GLOBAL_TOK},
  {"area_fixed",AREA_FIXED_TOK},
  {"fixed_area",AREA_FIXED_TOK},
  {"view_matrix",VIEW_MATRIX_TOK},
  {"view_transforms",VIEW_TRANSFORMS_TOK},
  {"view_transform_generators",VIEW_TRANSFORM_GENS_TOK},
  {"homothety",HOMOTHETY_TOK},
  {"approximate_curvature",APPROX_CURV_TOK},
  {"approx_curvature",APPROX_CURV_TOK},
  {"phasefile",PHASEFILE_TOK},
  {"phase",PHASE_TOK},
  {"autopop",AUTOPOP_TOK},
  {"autopop_quartic",AUTOPOP_QUARTIC_TOK},
  {"autochop",AUTOCHOP_TOK},
  {"total_time",TOTAL_TIME_TOK},
  {"effective_area",EFFECTIVE_AREA_TOK},
  {"runge_kutta",RUNGE_KUTTA_TOK},
  {"color",COLOR_TOK},
  {"backcolor",BACKCOLOR_TOK},
  {"frontcolor",FRONTCOLOR_TOK},
  {"mean_curvature_integral",MEAN_CURV_INT_TOK},
  {"normal_curvature",NORMAL_CURVATURE_TOK},
  {"square_curvature",SQUARE_CURVATURE_TOK},
  {"squared_curvature",SQUARE_CURVATURE_TOK},
  {"square_gaussian_curvature",SQGAUSS_TOK},
  {"squared_gaussian_curvature",SQGAUSS_TOK},
  {"gauss_curvature",GAUSS_CURVATURE_TOK},
  {"insulating_knot_energy",INSULATING_KNOT_ENERGY_TOK},
  {"conducting_knot_energy",CONDUCTING_KNOT_ENERGY_TOK},
  {"space_dimension",SPACE_DIMENSION_TOK},
  {"surface_dimension",SURFACE_DIMENSION_TOK},
  {"simplex_representation",SIMPLEX_REP_TOK},
  {"metric",METRIC_TOK},
  {"klein_metric",KLEIN_METRIC_TOK},
  {"conformal_metric",CONFORMAL_TOK},
  {"fixed",FIXED_TOK},
  {"no_refine",NO_REFINE_TOK},
  {"no_transform",NO_TRANSFORM_TOK},
  {"hit_partner",HIT_PARTNER_TOK},
  {"centerofmass",CENTEROFMASS_TOK},
  {"no_display",NODISPLAY_TOK},
  {"noncontent",NONCONTENT_TOK},
  {"efixed",EFIXED_TOK},
  {"symmetry_group",SYMMETRY_GROUP_TOK},
  {"wrap",WRAP_TOK},
  {"torus",TORUS_TOK},
  {"torus_filled",TORUS_FILLED_TOK},
  {"torus_periods",TORUS_PERIODS_TOK},
  {"periods",PERIODS_TOK},
  {"display_periods",DISPLAY_PERIODS_TOK},
  {"string",STRING_TOK},
  {"soapfilm",SOAPFILM_TOK},
  {"wulff",WULFF_TOK},
  {"boundary",BOUNDARY_TOK},
  {"boundaries",BOUNDARY_TOK},
  {"constraint",CONSTRAINT_TOK},
  {"constraints",CONSTRAINT_TOK},
  {"surface_energy",SURFACE_ENERGY_TOK},
  {"formula",FUNCTION_TOK},
  {"function",FUNCTION_TOK},
  {"parameter",PARAMETERS_TOK},
  {"parameters",PARAMETERS_TOK},
  {"parameter_file",PARAMETER_FILE_TOK},
  {"symmetric_content",SYMMETRIC_CONTENT_TOK},
  {"integral_order",V_INTEGRAL_ORDER},
  {"integral_order_1d",V_INTEGRAL_ORDER_1D},
  {"integral_order_2d",V_INTEGRAL_ORDER_2D},
  {"integration_order",V_INTEGRAL_ORDER},
  {"integration_order_1d",V_INTEGRAL_ORDER_1D},
  {"integration_order_2d",V_INTEGRAL_ORDER_2D},
  {"constraint_tolerance",CONSTRAINT_TOLERANCE_TOK},
  {"convex",CONVEX_TOK},
  {"nonwall",NONWALL_TOK},
  {"nonnegative",NONNEGATIVE_TOK},
  {"nonpositive",NONPOSITIVE_TOK},
  {"global",GLOBAL_TOK},
  {"energy",ENERGY_TOK},
  {"content",CONTENT_TOK},
  {"quadratic",QUADRATIC_TOK},
  {"linear",LINEAR_TOK},
  {"area_normalization",MEAN_CURV_TOK},
  {"jiggle",JIGGLE_TOK},
  {"diffusion",DIFFUSION_TOK},
  {"merit_factor",MERITFACTOR_TOK},
  {"gravity_constant",GRAV_CONST_TOK},
  {"spring_constant",SPRING_CONSTANT_TOK},
  {"gap_constant",GAP_CONSTANT_TOK},
  {"scale",SCALE_TOK},
  {"pscale",PSCALE_TOK},
  {"temperature",TEMPERATURE_TOK},
  {"pressure",PRESSURE_TOK},
  {"volume",VOLUME_TOK},
  {"density",DENSITY_TOK},
  {"tension",DENSITY_TOK},
  {"nodisplay",NODISPLAY_TOK},
  {"scale_limit",SCALE_LIMIT_TOK},
  {"zoom_vertex",ZOOM_VERTEX_TOK},
  {"zoom_radius",ZOOM_RADIUS_TOK},
  {"quantity",QUANTITY_TOK},
  {"volconst",VOLCONST_TOK},
  {"read",READ_TOK},
  {"and",AND_TOK},
  {"or",OR_TOK},
  {"not",NOT_TOK},
  {"mod",'%'},
  {"imod",IMOD_TOK},
  {"idiv",IDIV_TOK},
  {"dot_product",DOT_TOK},
  {"pi",PI_TOK},
  {"e",E_TOK},
  {"g",G_TOK},
  {"original",ORIGINAL_TOK},
  {"vertices",VERTICES_TOK},
  {"vertex",VERTICES_TOK},
  {"edges",EDGES_TOK},
  {"edge",EDGES_TOK},
  {"faces",FACES_TOK},
  {"face",FACES_TOK},
  {"facets",FACES_TOK},
  {"facet",FACES_TOK},
  {"bodies",BODIES_TOK},
  {"body",BODIES_TOK},
  {"facet_edges",FACETEDGES_TOK},
  {"facet_edge",FACETEDGES_TOK},
  {"facetedges",FACETEDGES_TOK},
  {"facetedge",FACETEDGES_TOK}
};


struct ckey mathfunc_keywords[] = {
  {"wrap_inverse",WRAP_INVERSE_NODE},
  {"ellipticK",ELLIPTICK_NODE},
  {"ellipticE",ELLIPTICE_NODE},
  {"log",LOG_NODE},
  {"exp",EXP_NODE},
  {"sin",SIN_NODE},
  {"cos",COS_NODE},
  {"tan",TAN_NODE},
  {"asin",ASIN_NODE},
  {"acos",ACOS_NODE},
  {"atan",ATAN_NODE},
  {"sinh",SINH_NODE},
  {"cosh",COSH_NODE},
  {"tanh",TANH_NODE},
  {"asinh",ASINH_NODE},
  {"acosh",ACOSH_NODE},
  {"atanh",ATANH_NODE},
  {"sqrt",SQRT_NODE},
  {"sqr",SQR_NODE},
  {"ceil",CEIL_NODE},
  {"floor",FLOOR_NODE},
  {"abs",ABS_NODE}
};

struct ckey mathfunc2_keywords[] = { /* two arguments */
  {"wrap_compose",WRAP_COMPOSE_NODE},
  {"atan2",ATAN2_NODE},
  {"incompleteEllipticF",INCOMPLETE_ELLIPTICF_NODE},
  {"incompleteEllipticE",INCOMPLETE_ELLIPTICE_NODE},
  {"maximum",MAXIMUM_NODE},
  {"minimum",MINIMUM_NODE},
  {"pow",POW_NODE}
};

struct ckey command_keywords[] =
{ {"normal",NORMAL_TOK},
  {"nonnegative",NONNEGATIVE_TOK},
  {"nonpositive",NONPOSITIVE_TOK},
  {"normal_vector",NORMAL_VECTOR_TOK},
  {"no_dump",NO_DUMP_TOK},
  {"p_velocity",P_VELOCITY_TOK},
  {"p_force",P_FORCE_TOK},
  {"no_hessian_normal",NO_HESSIAN_NORMAL_TOK},
  {"make_thread_lists",MAKE_THREAD_LISTS_TOK},
  {"facet_crosscut",FACET_CROSSCUT_TOK},
  {"detorus",DETORUS_TOK},
  {"is_constraint",IS_CONSTRAINT_TOK},
  {"valid_constraint",VALID_CONSTRAINT_TOK},
  {"valid_boundary",VALID_BOUNDARY_TOK},
  {"profiling",PROFILING_TOK},
  {"reset_profiling",RESET_PROFILING_TOK},
  {"suppress_warning",SUPPRESS_WARNING_TOK},
  {"unsuppress_warning",UNSUPPRESS_WARNING_TOK},
  {"delete_text",DELETE_TEXT_TOK},
  {"display_text", DISPLAY_TEXT_TOK},
  {"simplex_to_fe", SIMPLEX_TO_FE_TOK},
  {"addload", ADDLOAD_TOK},
  {"replace_load", REPLACE_LOAD_TOK},
  {"whereami",WHEREAMI_TOK},
  {"breakpoint",BREAKPOINT_TOK},
  {"breakpoints",BREAKPOINT_TOK},
  {"abort",ABORT_TOK},
  {"subcommand",SUBCOMMAND_TOK},
  {"global",GLOBAL_TOK},
  {"repartition",REPARTITION_TOK},
  {"free_discards",FREE_DISCARDS_TOK},
  {"dump_memlist",DUMP_MEMLIST_TOK},
  {"reverse_orientation",REVERSE_ORIENTATION_TOK},
  {"matrix_multiply",MATRIX_MULTIPLY_TOK},
  {"matrix_inverse",MATRIX_INVERSE_TOK},
  {"matrix_determinant",MATRIX_DETERMINANT_TOK},
  {"mid_edge",MID_EDGE_TOK},
  {"mid_facet",MID_FACET_TOK},
  {"flush_counts",FLUSH_COUNTS_TOK},
  {"valid_element",VALID_ELEMENT_TOK},
  {"reset_counts",RESET_COUNTS_TOK},
  {"vertex_merge",MERGE_VERTEX_TOK},
  {"edge_merge",MERGE_EDGE_TOK},
  {"facet_merge",MERGE_FACET_TOK},
  {"mpi_task",MPI_TASK_ATTR_TOK},
  {"mean_curvature",MEAN_CURVATURE_TOK},
  {"element_modulus",ELEMENT_MODULUS_TOK},
  {"ignore_constraints",IGNORE_CONSTRAINTS_TOK},
  {"ignore_fixed",IGNORE_FIXED_TOK},
  {"global_method",GLOBAL_METHOD_TOK},
  {"scalar_integrand",SCALAR_INTEGRAND_TOK},
  {"vector_integrand",VECTOR_INTEGRAND_TOK},
  {"k_vector_order",K_VEC_ORDER_TOK},
  {"form_integrand",FORM_INTEGRAND_TOK},
  {"info_only",INFO_ONLY_TOK},
  {"method",METHOD_TOK},
  {"parallel_exec",PARALLEL_EXEC_TOK},
  {"task_exec",TASK_EXEC_TOK},
  {"pop",POP_TOK},
  {"pop_tri_to_edge",POP_TRI_TO_EDGE_TOK},
  {"pop_edge_to_tri",POP_EDGE_TO_TRI_TOK},
  {"pop_quad_to_quad",POP_QUAD_TO_QUAD_TOK},
  {"local",LOCAL_TOK},
  {"for",FOR_TOK},
  {"warning_messages",WARNING_MESSAGES_TOK},
  {"equiangulate",EQUIANGULATE_TOK},
  {"no_refine",NO_REFINE_TOK},
  {"no_transform",NO_TRANSFORM_TOK},
  {"hit_partner",HIT_PARTNER_TOK},
  {"centerofmass",CENTEROFMASS_TOK},
  {"no_display",NODISPLAY_TOK},
  {"vertexnormal",VERTEXNORMAL_TOK},
  {"colorfile",COLORFILE_TOK},
  {"date_and_time",DATE_AND_TIME_TOK},
  {"evolver_version",EVOLVER_VERSION_TOK},
  {"exprint",EXPRINT_TOK},
  {"energy",ENERGY_TOK},
  {"info_only",INFO_ONLY_TOK},
  {"conserved",CONSERVED_TOK},
  {"exec",EXEC_TOK},
  {"wrap_vertex",WRAP_VERTEX_TOK},
  {"self",SELF_TOK},
  {"is_defined",IS_DEFINED_TOK},
  {"nodisplay",NODISPLAY_TOK},
  {"no_display",NODISPLAY_TOK},
  {"function",FUNCTION_TOK},
  {"reorder_storage",REORDER_STORAGE_TOK},
  {"renumber_all",RENUMBER_ALL_TOK},
/*  {"view_matrix",VIEW_MATRIX_TOK}, */
  {"pause",PAUSE_TOK},
  {"pdelta",PDELTA_TOK},
  {"on_assign_call",ON_ASSIGN_CALL_TOK},
  {"pscale",PSCALE_TOK},
  {"scale",SCALE_TOK},
  {"tolerance",TOLERANCE_TOK},
  {"method_instance",METHOD_INSTANCE_TOK},
  {"logfile",LOGFILE_TOK},
  {"keylogfile",KEYLOGFILE_TOK},
  {"frontbody",FRONTBODY_TOK},
  {"backbody",BACKBODY_TOK},
  {"new_vertex",NEWVERTEX_TOK},
  {"new_edge",NEWEDGE_TOK},
  {"new_facet",NEWFACET_TOK},
  {"new_body",NEWBODY_TOK},
  {"noncontent",NONCONTENT_TOK},
/*  {"inverse_periods",INVERSE_PERIODS_TOK}, */
  {"return",RETURN_TOK},
  {"postscript",POSTSCRIPT_TOK},
  {"ooglfile",OOGLFILE_TOK},
  {"binary_off_file",BINARY_OFF_FILE_TOK},
  {"vertex_average",VERTEX_AVERAGE_TOK},
  {"raw_vertex_average",RAW_VERTEX_AVERAGE_TOK},
  {"rawest_vertex_average",RAWEST_VERTEX_AVERAGE_TOK},
  {"axial_point",AXIAL_POINT_TOK},
  {"metis_factor",METIS_FACTOR_TOK},
  {"lagrange",LAGRANGE_TOK},
  {"metis",METIS_TOK},
  {"metis_readjust",METIS_READJUST_TOK},
  {"body_metis",BODY_METIS_TOK},
  {"kmetis",KMETIS_TOK},
  {"ometis",OMETIS_TOK},
  {"sizeof",SIZEOF_TOK},
  {"move",MOVE_TOK},
  {"geompipe",GEOMPIPE_TOK},
  {"convert_to_quantities",CONVERT_TO_QUANTS_TOK},
  {"edgeswap",EDGESWAP_TOK},
  {"t1_edgeswap",T1_EDGESWAP_TOK},
/*  {"torus_periods",TORUS_PERIODS_TOK}, */
  {"break",BREAK_TOK},
  {"volfixed",FIXEDVOL_TOK},
  {"continue",CONTINUE_TOK},
  {"volconst",VOLCONST_TOK},
  {"ritz",RITZ_TOK},
  {"orientation",ORIENTATION_TOK},
  {"eigenprobe",EIGENPROBE_TOK},
  {"lanczos",LANCZOS_TOK},
  {"tetra_point",TETRA_POINT_TOK},
  {"triple_point",TRIPLE_POINT_TOK},
  {"value",VALUE_TOK},
  {"target",TARGET_TOK},
  {"datafilename",DATAFILENAME_TOK},
  {"geomview",GEOMVIEW_TOK},
  {"saddle",HESSIAN_SADDLE_TOK},
  {"midv",MIDV_TOK},
  {"define",DEFINE_TOK},
  {"attribute",ATTRIBUTE_TOK},
  {"attributes",ATTRIBUTE_TOK},
  {"string",STRING_TOK},
  {"sobolev",SOBOLEV_TOK},
  {"sobolev_seek",SOBOLEV_SEEK_TOK},
  {"dirichlet",DIRICHLET_TOK},
  {"dirichlet_seek",DIRICHLET_SEEK_TOK},
  {"wrap",WRAP_TOK},
  {"total",TOTAL_TOK},
  {"history",HISTORY_TOK},
  {"fix",FIX_TOK},
  {"unfix",UNFIX_TOK},
  {"bare",BARE_TOK},
  {"phase",PHASE_TOK},
  {"foreach",FOREACH_TOK},
  {"rebody", REBODY_TOK},
  {"burchard", BURCHARD_TOK},
  {"close_show",CLOSE_SHOW_TOK},
  {"show_off",CLOSE_SHOW_TOK},
/*  {"view_transforms",VIEW_TRANSFORMS_TOK}, */
/*  {"view_transform_swap_colors",VIEW_TRANSFORM_SWAP_COLORS_TOK}, */
/*  {"view_transform_parity",VIEW_TRANSFORM_PARITY_TOK}, */
  {"transform_depth",TRANSFORM_DEPTH_TOK},
  {"transform_expr",TRANSFORM_EXPR_TOK},
  {"modulus",MODULUS_TOK},
  {"boundary",BOUNDARY_TOK},
  {"on_constraint",ON_CONSTRAINT_TOK},
  {"hit_constraint",HIT_CONSTRAINT_TOK},
  {"value_of_constraint",VALUE_OF_CONSTRAINT_TOK},
  {"on_boundary",ON_BOUNDARY_TOK},
  {"on_quantity",ON_QUANTITY_TOK},
  {"on_method_instance",ON_METHOD_INSTANCE_TOK},
  {"hessian",HESSIAN_TOK},
  {"hessian_seek",HESSIAN_SEEK_TOK},
  {"hessian_menu",HESSIAN_MENU_TOK},
  {"help",HELP_TOK},
  {"quit",QUIT_TOK},
  {"exit",QUIT_TOK},
  {"bye",QUIT_TOK},
  {"dump",DUMP_TOK},
  {"load",LOAD_TOK},
  {"permload",PERMLOAD_TOK},
  {"quantity",QUANTITY_TOK},
  {"spring_constant",GAP_CONSTANT_TOK},
  {"gap_constant",GAP_CONSTANT_TOK},
  {"notch",NOTCH_TOK},
  {"while",WHILE_TOK},
  {"do",DO_TOK},
  {"if",IF_TOK},
  {"then",THEN_TOK},
  {"else",ELSE_TOK},
  {"histogram",HISTOGRAM_TOK},
  {"loghistogram",LOGHISTOGRAM_TOK},
  {"show_expr",SHOW_EXPR_TOK},
  {"show_trans",SHOW_TRANS_TOK},
  {"dihedral",DIHEDRAL_TOK},
  {"max",MAX_TOK},
  {"min",MIN_TOK},
  {"avg",AVG_TOK},
  {"sum",SUM_TOK},
  {"count",COUNT_TOK},
  {"print",PRINT_TOK},
  {"eprint",EPRINT_TOK},
  {"printf",PRINTF_TOK},
  {"errprintf",ERRPRINTF_TOK},
  {"sprintf",SPRINTF_TOK},
  {"binary_printf",BINARY_PRINTF_TOK},
  {"procedures",PROCEDURES_TOK},
  {"procedure",PROCEDURE_WORD_TOK},
  {"on",ON_TOK},
  {"counts",COUNTS_TOK},
  {"extrapolate",EXTRAPOLATE_TOK},
  {"off",OFF_TOK},
  {"areaweed",AREAWEED_TOK},
  {"edgeweed",EDGEWEED_TOK},
  {"edge_divide",EDGEDIVIDE_TOK},
  {"alice",ALICE_TOK},
  {"stability_test",STABILITY_TEST_TOK},
  {"zoom",ZOOM_TOK},
  {"utest",UTEST_TOK},
  {"system",SYSTEM_TOK},
  {"chdir",CHDIR_TOK},
  {"longj",LONG_JIGGLE_TOK},
  {"rawv",RAW_VERAVG_TOK},
  {"rawestv",RAWEST_VERAVG_TOK},
  {"go",GO_TOK},
  {"refine",REFINE_TOK},
  {"check",CHECK_TOK},
  {"show_vol",SHOW_VOL_TOK},
  {"id",ID_TOK},
  {"oid",OID_TOK},
  {"and",AND_TOK},
  {"or",OR_TOK},
  {"not",NOT_TOK},
  {"mod",'%'},
  {"imod",IMOD_TOK},
  {"idiv",IDIV_TOK},
  {"dot_product",DOT_TOK},
  {"pi",PI_TOK},
  {"e",E_TOK},
  {"g",G_TOK},
  {"original",ORIGINAL_TOK},
  {"fixed",FIXED_TOK},
  {"vertices",VERTICES_TOK},
  {"vertex",VERTICES_TOK},
  {"edges",EDGES_TOK},
  {"edge",EDGES_TOK},
  {"facets",FACETS_TOK},
  {"facet",FACETS_TOK},
  {"faces",FACETS_TOK},
  {"face",FACETS_TOK},
  {"facet_edges",FACETEDGES_TOK},
  {"facet_edge",FACETEDGES_TOK},
  {"facetedges",FACETEDGES_TOK},
  {"facetedge",FACETEDGES_TOK},
  {"bodies",BODIES_TOK},
  {"body",BODIES_TOK},
  {"topinfo",TOPINFO_TOK},
  {"bottominfo",BOTTOMINFO_TOK},
  {"length",LENGTH_TOK},
  {"valence",VALENCE_TOK},
  {"area",AREA_TOK},
  {"volume",VOLUME_TOK},
  {"sqcurve",SQ_MEAN_CURV_TOK},
  {"where",WHERE_TOK},
  {"list",LIST_TOK},
  {"show",SHOW_TOK},
  {"showq",SHOWQ_TOK},
  {"delete",DELETE_TOK},
  {"dissolve",DISSOLVE_TOK},
  {"refine",REFINE_TOK},
  {"shell",SHELL_TOK},
  {"constraint",CONSTRAINT_TOK},
  {"pressure",PRESSURE_TOK},
  {"color",COLOR_TOK},
  {"backcolor",BACKCOLOR_TOK},
  {"frontcolor",FRONTCOLOR_TOK},
  {"opacity",OPACITY_TOK},
  {"volume",VOLUME_TOK},
  {"density",DENSITY_TOK},
  {"tension",DENSITY_TOK},
  {"set",SET_TOK},
  {"read",READ_TOK},
  {"unset",UNSET_TOK},
  {"recalc",RECALC_TOK},
  {"optimize",OPTIMIZE_TOK},
  {"optimise",OPTIMIZE_TOK},
  {"autochop",AUTOCHOP_TOK}
 }; 

struct ckey togglenames[] = {
  {"force_edgeswap",FORCE_EDGESWAP_NODE},
  {"show_all_edges",SHOW_ALL_EDGES_NODE},
  {"K_altitude_mode",K_ALTITUDE_FLAG_NODE},
  {"show_bounding_box",BOX_FLAG_NODE},
  {"septum_flag",SEPTUM_FLAG_NODE},
  {"view_transforms_use_unique_point",VIEW_TRANSFORMS_USE_UNIQUE_NODE},
  {"detorus_sticky",DETORUS_STICKY_NODE},
  {"immediate_autopop",IMMEDIATE_AUTOPOP_NODE},
  {"star_finagling",STAR_FINAGLING_NODE},
  {"force_deletion",FORCE_DELETION_NODE},
  {"function_quantity_sparse",FUNCTION_QUANTITY_SPARSE_NODE},
  {"slice_view",SLICE_VIEW_NODE},
  {"clip_view",CLIP_VIEW_NODE},
  {"quietload",QUIETLOAD_NODE},
  {"big_endian",BIG_ENDIAN_NODE},
  {"little_endian",LITTLE_ENDIAN_NODE},
  {"full_bounding_box",FULL_BOUNDING_BOX_NODE},
  {"pop_disjoin",POP_DISJOIN_NODE},
  {"pop_enjoin",POP_ENJOIN_NODE},
  {"pop_to_edge",POP_TO_EDGE_NODE},
  {"pop_to_face",POP_TO_FACE_NODE},
  {"mpi_debug",MPI_DEBUG_NODE},
  {"smooth_graph",SMOOTH_GRAPH_NODE},
  {"bezier_basis",BEZIER_BASIS_NODE},
  {"break_after_warning",BREAK_AFTER_WARNING_NODE},
  {"break_on_warning",BREAK_ON_WARNING_NODE},
  {"blas_flag",BLAS_FLAG_NODE},
  {"diffusion",DIFFUSION_NODE},
  {"augmented_hessian",AUGMENTED_HESSIAN_NODE},
  {"sparse_constraints",SPARSE_CONSTRAINTS_NODE},
  {"visibility_test", VISIBILITY_TEST_NODE},
  {"circular_arc_draw",CIRCULAR_ARC_DRAW_NODE},
  {"rgb_colors",RGB_COLORS_FLAG_NODE},
  {"kraynikpopvertex",KRAYNIKPOPVERTEX_FLAG_NODE},
  {"kraynikpopedge",KRAYNIKPOPEDGE_FLAG_NODE},
  {"sobolev_mode",SOBOLEV_MODE_NODE},
  {"dirichlet_mode",DIRICHLET_MODE_NODE},
  {"verbose",VERBOSE_NODE},
  {"torus_filled",TORUS_FILLED_NODE},
  {"ambient_pressure",AMBIENT_PRESSURE_NODE},
  {"backcull",BACKCULL_NODE},
  {"rotate_lights",ROTATE_LIGHTS_NODE},
  {"interp_normals",INTERP_NORMALS_NODE},
  {"volgrads_every",VOLGRADS_EVERY_NODE},
  {"zener_drag",ZENER_DRAG_NODE},
  {"hessian_special_normal",HESSIAN_SPECIAL_NORMAL_NODE},
  {"hessian_normal_perp",HESSIAN_NORMAL_PERP_NODE},
  {"show_all_quantities",SHOW_ALL_QUANTITIES_NODE},
  {"pscolorflag",PSCOLORFLAG_NODE},
  {"ps_colorflag",PSCOLORFLAG_NODE},
  {"ps_cmykflag",PS_CMYKFLAG_NODE},
  {"ps_gridflag",GRIDFLAG_NODE},
  {"gridflag",GRIDFLAG_NODE},
  {"crossingflag",CROSSINGFLAG_NODE},
  {"ps_crossingflag",CROSSINGFLAG_NODE},
  {"labelflag",LABELFLAG_NODE},
  {"ps_labelflag",LABELFLAG_NODE},
  {"hessian_normal_one",HESSIAN_NORMAL_ONE_NODE},
  {"interp_bdry_param",INTERP_BDRY_PARAM_NODE},
  {"hessian_double_normal",HESSIAN_DOUBLE_NORMAL_NODE},
  {"h_inverse_metric",H_INVERSE_METRIC_NODE},
  {"squared_gradient",SQUARED_GRADIENT_NODE},
  {"linear_metric",LINEAR_METRIC_NODE},
  {"metric_convert",METRIC_CONVERT_NODE},
  {"quantities_only",QUANTITIES_ONLY_NODE},
  {"ysmp",YSMP_NODE},
  {"mkl",MKL_NODE},
  {"bunch_kaufman",BUNCH_KAUFMAN_NODE},
  {"bunch_kauffman",BUNCH_KAUFMAN_NODE},
  {"hessian_normal",HESSIAN_NORMAL_NODE},
  {"jiggle",JIGGLE_TOGGLE_NODE},
  {"assume_oriented",ASSUME_ORIENTED_NODE},
  {"ribiere",RIBIERE_CG_NODE},
  {"area_normalization",MEAN_CURV_NODE},
  {"force_pos_def",FORCE_POS_DEF_NODE},
  {"autodisplay",AUTODISPLAY_NODE},
  {"lagrange",LAGRANGE_NODE},
  {"quadratic",QUADRATIC_NODE},
  {"linear",LINEAR_NODE},
  {"show_inner",SHOW_INNER_NODE},
  {"area_fixed",AREA_FIXED_TOK},
  {"fixed_area",AREA_FIXED_TOK},
  {"clipped",CLIPPED_CELLS_NODE},
  {"clipped_cells",CLIPPED_CELLS_NODE},
  {"raw_cells",RAW_CELLS_NODE},
  {"connected",CONNECTED_CELLS_NODE},
  {"connected_cells",CONNECTED_CELLS_NODE},
  {"show_outer",SHOW_OUTER_NODE},
  {"colormap",COLORMAP_NODE},
  {"thicken",THICKEN_NODE},
  {"hessian_diff",HESSIAN_DIFF_NODE},
  {"normal_motion",NORMAL_MOTION_NODE},
  {"runge_kutta",RUNGE_KUTTA_NODE},
  {"deturck",DETURCK_NODE},
  {"kusner",KUSNER_NODE},
  {"view_4d",VIEW_4D_NODE},
  {"conf_edge",CONF_EDGE_SQCURV_NODE},
  {"mean_curvature_integral",MEAN_CURV_INT_NODE},
  {"sqgauss",SQGAUSS_NODE},
  {"autopop",AUTOPOP_NODE},
  {"autopop_quartic",AUTOPOP_QUARTIC_NODE},
  {"old_area",OLD_AREA_NODE}, 
  {"approx_curv",APPROX_CURV_NODE},
  {"check_increase",CHECK_INCREASE_NODE},
  {"debug",DEBUG_NODE},
  {"memdebug",MEMDEBUG_NODE},
  {"itdebug",ITDEBUG_NODE},
  {"gravity",GRAVITY_NODE},
  {"effective_area",EFFECTIVE_AREA_NODE},
  {"estimate",ESTIMATE_NODE},
  {"post_project",POST_PROJECT_NODE},
  {"transforms",TRANSFORMS_NODE},
  {"quiet",QUIET_NODE},
  {"quietgo",QUIETGO_NODE},
  {"hessian_quiet",HESSIAN_QUIET_NODE},
  {"conj_grad",CONJ_GRAD_NODE},
  {"homothety",HOMOTHETY_NODE},
  {"facet_colors",FACET_COLORS_NODE},
  {"shading",SHADING_NODE},
  {"div_normal_curvature",DIV_NORMAL_CURVATURE_NODE},
  {"normal_curvature",NORMAL_CURVATURE_NODE},
  {"boundary_curvature",BOUNDARY_CURVATURE_NODE},
  {"self_similar",SELF_SIMILAR_NODE},
  {"gv_binary",GV_BINARY_NODE},
  {"metric_conversion",METRIC_CONVERSION_NODE},
  {"autorecalc",AUTORECALC_NODE},
  {"pinning",PINNING_NODE}
  };
struct ckey colornames[] = {
    {"clear",CLEAR},     /* transparent */
    {"transparent",CLEAR},     /* transparent */
    {"black",BLACK},            /* dark colors */
    {"blue",BLUE},
    {"green",GREEN},
    {"cyan",CYAN},
    {"red",RED},
    {"magenta",MAGENTA},
    {"brown",BROWN},
    {"lightgray",LIGHTGRAY},
    {"lightgrey",LIGHTGRAY},
    {"gray",LIGHTGRAY},
    {"grey",LIGHTGRAY},
    {"darkgray",DARKGRAY},            /* light colors */
    {"darkgrey",DARKGRAY},            /* light colors */
    {"lightblue",LIGHTBLUE},
    {"lightgreen",LIGHTGREEN},
    {"lightcyan",LIGHTCYAN},
    {"lightred",LIGHTRED},
    {"lightmagenta",LIGHTMAGENTA},
    {"yellow",YELLOW},
    {"white",WHITE}
    };

struct ckey internal_variables[] = {
  {"bounding_box_color",V_BOUNDING_BOX_COLOR},
  {"detorus_epsilon",V_DETORUS_EPSILON},
  {"high_constraint",V_HIGH_CONSTRAINT},
  {"high_boundary",V_HIGH_BOUNDARY},
  {"autochop_length",V_AUTOCHOP_LENGTH},
  {"string_curve_tolerance",V_STRING_CURVE_TOLERANCE},
  {"corona_state",V_CORONA_STATE},
  {"mpi_maxtask",V_MPI_MAXTASK}, 
  {"this_task",V_THIS_TASK}, /* MPI task number */
  {"window_aspect_ratio",V_WINDOW_ASPECT_RATIO},
  {"mindeg_debug_level",V_MINDEG_DEBUG_LEVEL},
  {"mindeg_min_region_size",V_MINDEG_MIN_REGION_SIZE},
  {"mindeg_margin",V_MINDEG_MARGIN},
  {"fix_count",V_FIX_COUNT},
  {"unfix_count",V_UNFIX_COUNT},
  {"edge_delete_count",V_EDGE_DELETE_COUNT},
  {"facet_delete_count",V_FACET_DELETE_COUNT},
  {"vertex_dissolve_count",V_VERTEX_DISSOLVE_COUNT},
  {"edge_dissolve_count",V_EDGE_DISSOLVE_COUNT},
  {"facet_dissolve_count",V_FACET_DISSOLVE_COUNT},
  {"body_dissolve_count",V_BODY_DISSOLVE_COUNT},
  {"edge_refine_count",V_EDGE_REFINE_COUNT},
  {"facet_refine_count",V_FACET_REFINE_COUNT},
  {"vertex_pop_count",V_VERTEX_POP_COUNT},
  {"edge_pop_count",V_EDGE_POP_COUNT},
  {"pop_tri_to_edge_count",V_POP_TRI_TO_EDGE_COUNT},
  {"pop_edge_to_tri_count",V_POP_EDGE_TO_TRI_COUNT},
  {"pop_quad_to_quad_count",V_POP_QUAD_TO_QUAD_COUNT},
  {"edgeswap_count",V_EDGESWAP_COUNT},
  {"t1_edgeswap_count",V_T1_EDGESWAP_COUNT},
  {"ps_labelsize",V_PS_LABELSIZE},
  {"ps_stringwidth",V_PS_STRINGWIDTH},
  {"ps_fixededgewidth",V_PS_FIXEDEDGEWIDTH},
  {"ps_tripleedgewidth",V_PS_TRIPLEEDGEWIDTH},
  {"ps_conedgewidth",V_PS_CONEDGEWIDTH},
  {"ps_bareedgewidth",V_PS_BAREEDGEWIDTH},
  {"ps_gridedgewidth",V_PS_GRIDEDGEWIDTH},
  {"scrollbuffersize",V_SCROLLBUFFERSIZE},
  {"visibility_debug",V_VISIBILITY_DEBUG},
  {"check_count",V_CHECK_COUNT},
  {"bad_next_prev_count",V_BAD_NEXT_PREV_COUNT},
  {"inconsistent_bodies_count",V_INCONSISTENT_BODIES_COUNT},
  {"edge_loop_count",V_EDGE_LOOP_COUNT},
  {"edges_same_vertices_count",V_EDGES_SAME_VERTICES_COUNT},
  {"facets_same_vertices_count",V_FACETS_SAME_VERTICES_COUNT},
  {"bad_error_count",V_BAD_ERRORS_COUNT}, 

  {"breakflag",V_BREAKFLAG},
  {"everything_quantities",V_EVERYTHING_QUANTITIES},
  {"gravity_constant",GRAV_CONST_TOK},
  {"hessian_slant_cutoff",V_HESSIAN_SLANT_CUTOFF},
  {"ambient_pressure_value",V_AMBIENT_PRESSURE},
  {"last_error",V_LAST_ERROR},
  {"memory_arena",V_MEMARENA},
  {"memory_used",V_MEMUSED},
  {"background",V_BACKGROUND},
  {"brightness",V_BRIGHTNESS},
  {"diffusion_coeff",V_DIFFUSION},
  {"transform_count",V_TRANSFORM_COUNT},
  {"scale_limit",V_SCALE_LIMIT},
  {"clock",V_CLOCK},
  {"cpu_counter",V_CPU_COUNTER},
  {"target_tolerance",V_TARGET_TOLERANCE},
  {"thickness",V_THICKNESS},
  {"spring_constant",V_GAP_CONSTANT},
  {"gap_constant",V_GAP_CONSTANT},
  {"lagrange_order",V_LAGRANGE_ORDER},
  {"last_eigenvalue",V_LAST_EIGENVALUE},
  {"last_hessian_scale",V_LAST_HESSIAN_SCALE},
  {"integral_order",V_INTEGRAL_ORDER},
  {"integral_order_1d",V_INTEGRAL_ORDER_1D},
  {"integral_order_2d",V_INTEGRAL_ORDER_2D},
  {"integration_order",V_INTEGRAL_ORDER},
  {"integration_order_1d",V_INTEGRAL_ORDER_1D},
  {"integration_order_2d",V_INTEGRAL_ORDER_2D},
  {"random_seed",V_RANDOM_SEED},
  {"random",V_RANDOM},
  {"linear_metric_mix",V_LINEAR_METRIC_MIX},
  {"quadratic_metric_mix",V_QUADRATIC_METRIC_MIX},
  {"pickvnum",V_PICKVNUM},
  {"pickenum",V_PICKENUM},
  {"pickfnum",V_PICKFNUM},
  {"eigen_pos",V_EIGENPOS},
  {"eigen_neg",V_EIGENNEG},
  {"eigen_zero",V_EIGENZERO},
  {"eigenpos",V_EIGENPOS},
  {"eigenneg",V_EIGENNEG},
  {"eigenzero",V_EIGENZERO},
  {"total_time",V_TIME},
  {"jiggle_temperature",V_JIG_TEMP},
  {"iteration_counter",V_ITER_COUNTER},
  {"scale_scale",V_SCALE_SCALE},
  {"vertex_count",V_VERTEXCOUNT},
  {"edge_count",V_EDGECOUNT},
  {"facet_count",V_FACETCOUNT},
  {"body_count",V_BODYCOUNT},
  {"facetedge_count",V_FACETEDGECOUNT},
  {"total_energy",V_ENERGY},
  {"total_area",V_AREA},
  {"total_length",V_LENGTH},
  {"scale",V_SCALE},
  {"space_dimension",V_SPACE_DIMENSION},
  {"surface_dimension",V_SURFACE_DIMENSION},
  {"torus",V_TORUS},
  {"symmetry_group",V_SYMMETRY_GROUP},
  {"simplex_representation",V_SIMPLEX},
  {"constraint_tolerance",V_TOLERANCE},
  {"hessian_epsilon",V_HESS_EPSILON},
  {"equi_count",V_EQUI_COUNT},
  {"delete_count",V_DELETE_COUNT},
  {"refine_count",V_REFINE_COUNT},
  {"notch_count",V_NOTCH_COUNT},
  {"dissolve_count",V_DISSOLVE_COUNT},
  {"pop_count",V_POP_COUNT},
  {"where_count",V_WHERE_COUNT}
 };
/* %option array */

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

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

#ifndef YY_NO_UNPUT
static void yyunput YY_PROTO(( int c, char *buf_ptr ));
#endif

#ifndef yytext_ptr
static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int ));
#endif

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

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

#if YY_STACK_USED
static int yy_start_stack_ptr = 0;
static int yy_start_stack_depth = 0;
static int *yy_start_stack = 0;
#ifndef YY_NO_PUSH_STATE
static void yy_push_state YY_PROTO(( int new_state ));
#endif
#ifndef YY_NO_POP_STATE
static void yy_pop_state YY_PROTO(( void ));
#endif
#ifndef YY_NO_TOP_STATE
static int yy_top_state YY_PROTO(( void ));
#endif

#else
#define YY_NO_PUSH_STATE 1
#define YY_NO_POP_STATE 1
#define YY_NO_TOP_STATE 1
#endif

#ifdef YY_MALLOC_DECL
YY_MALLOC_DECL
#else
#if __STDC__
#ifndef __cplusplus
#include <stdlib.h>
#endif
#else
/* Just try to get by without declaring the routines.  This will fail
 * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int)
 * or sizeof(void*) != sizeof(int).
 */
#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( yytext, yyleng, 1, yyout )
#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->yy_is_interactive ) \
		{ \
		int c = '*', n; \
		for ( n = 0; n < max_size && \
			     (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
			buf[n] = (char) c; \
		if ( c == '\n' ) \
			buf[n++] = (char) c; \
		if ( c == EOF && ferror( yyin ) ) \
			YY_FATAL_ERROR( "input in flex scanner failed" ); \
		result = n; \
		} \
	else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \
		  && ferror( yyin ) ) \
		YY_FATAL_ERROR( "input in flex scanner failed" );
#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

/* Default declaration of generated scanner - a define so the user can
 * easily add parameters.
 */
#ifndef YY_DECL
#define YY_DECL int yylex YY_PROTO(( void ))
#endif

/* Code executed at the beginning of each rule, after yytext and yyleng
 * 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 \
	if ( yyleng > 0 ) \
		yy_current_buffer->yy_at_bol = \
				(yytext[yyleng - 1] == '\n'); \
	YY_USER_ACTION

YY_DECL
	{
	register yy_state_type yy_current_state;
	register char *yy_cp, *yy_bp;
	register int yy_act;



	if ( yy_init )
		{
		yy_init = 0;

#ifdef YY_USER_INIT
		YY_USER_INIT;
#endif

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

		if ( ! yyin )
			yyin = stdin;

		if ( ! yyout )
			yyout = stdout;

		if ( ! yy_current_buffer )
			yy_current_buffer =
				yy_create_buffer( yyin, YY_BUF_SIZE );

		yy_load_buffer_state();
		}

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

		/* Support of yytext. */
		*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_current_state += YY_AT_BOL();
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 >= 230 )
					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] != 827 );

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
{ /* eat comment */
         register int c;
         in_comment = 1;
         for ( ; ; )
          { while ( (c = input()) != '*' && c != 0 )
          if ( c == '\n' ) line_no++; /* eat up text of comment */
            if ( c == '*' )
              { while ( (c = input()) == '*' ) ;
                if ( c == '/' ) break;    /* found the end */ 
            if ( c == '\n' ) line_no++; 
              }
            if ( c == 0 && yywrap() )
              { kb_error(2325,"End-of-file in comment\n",DATAFILE_ERROR ); break; }
          }
         in_comment = 0; 
       }
	YY_BREAK
case 2:
YY_RULE_SETUP
/* comment */ ;
	YY_BREAK
case 3:
YY_RULE_SETUP
{ line_no++; }
	YY_BREAK
case 4:
YY_RULE_SETUP
{ errspot -= 15; line_no--; }
	YY_BREAK
case 5:
YY_RULE_SETUP
{ char *c = strtok(yytext,whitespace);
               yylval.r = atof(strtok(yytext,whitespace));
               yylval.i = atoi(strtok(yytext,whitespace));
               if ( lists_flag==LISTS_FULL ) return(tok=LEAD_INTEGER_TOK); 
               else if ( uminus_flag || c[0] != '-' )  
                 return(tok = (fabs(yylval.r) > MAXINT) ? REAL_TOK: INTEGER_TOK);
               else { unput_string(c+1);  c[1] = 0;
               return (tok = minus_type(c[0])); 
             }
          }
	YY_BREAK
case 6:
YY_RULE_SETUP
{ char *c = strtok(yytext,whitespace);
               yylval.i = atoi(c); 
               yylval.r = atof(strtok(c,whitespace));
               yylval.qnum = 0;
               if ((lists_flag!=LISTS_OFF) && uminus_flag && (parens==0))
               return(tok = (fabs(yylval.r) > MAXINT) ? REAL_TOK: INTEGER_TOK);
               else { unput_string(c+1);  c[1] = 0;
               return (tok = minus_type(c[0])); 
             }
          }
	YY_BREAK
case 7:
YY_RULE_SETUP
{ yylval.i = atoi(yytext); 
            yylval.r = atof(strtok(yytext,whitespace));
            yylval.qnum = 0;
            return(tok = (fabs(yylval.r) > MAXINT) ? REAL_TOK: INTEGER_TOK);
          }
	YY_BREAK
case 8:
YY_RULE_SETUP
{ yylval.i = atoi(yytext);
              yylval.qnum = atoi(strchr(yytext,'@')+1);
              return(tok = LEAD_INTEGER_AT_TOK);
            }
	YY_BREAK
case 9:
YY_RULE_SETUP
{ yylval.i = atoi(yytext);
              yylval.qnum = atoi(strchr(yytext,'@')+1);
              return(tok = INTEGER_AT_TOK);
            }
	YY_BREAK
case 10:
YY_RULE_SETUP
{ sscanf(yytext+2,"%x",&yylval.i); 
              yylval.r = (REAL)(yylval.i);
              return(tok = INTEGER_TOK);
            }  /* hex */
	YY_BREAK
case 11:
YY_RULE_SETUP
{ char *c = yytext;  /* binary */
              yylval.i = 0;
              while ( isdigit(*c) ) { yylval.i = 2*yylval.i + *c - '0'; c++;}
              yylval.r = (REAL)(yylval.i);
              return(tok = INTEGER_TOK);
            }
	YY_BREAK
case 12:
YY_RULE_SETUP
return VERSIONTOKEN_TOK;
	YY_BREAK
case 13:
case 14:
case 15:
case 16:
case 17:
case 18:
YY_RULE_SETUP
{ 
             char *c = strtok(yytext,whitespace);
             yylval.r = atof(c); 
             if ((lists_flag!=LISTS_OFF) && uminus_flag && (parens==0))
               return(tok = REAL_TOK); 
             else 
             { unput_string(c+1);   c[1] = 0;
               verb_flag = 0;  
               return (tok = minus_type(c[0])); 
             }
          }
	YY_BREAK
case 19:
case 20:
case 21:
case 22:
case 23:
case 24:
YY_RULE_SETUP
{ yylval.r = atof(yytext);
     return(tok = REAL_TOK); }
	YY_BREAK
case 25:
YY_RULE_SETUP
{ /* read quoted string */
              int n;
          in_quote = 1;
          for (n=0;;n++)
          { int c;
        c = input();
        if ( c == '\n' ) line_no++;
        if ( c == '"' && (n == 0 || (yytext[n-1] != '\\')) ) break; 
        if ( n < 198 ) yytext[n] = c;
        else if ( n==199 )
          kb_error(2326,"Quoted string over 198 characters.",WARNING);
              }
          yytext[n] = 0;
          reduce_string(yytext);
          in_quote = 0;
          return(tok = QUOTATION_TOK);
        }
	YY_BREAK
case 26:
YY_RULE_SETUP
verb_flag = 0; return (tok = minus_type('-'));   
	YY_BREAK
case 27:
*yy_cp = yy_hold_char; /* undo effects of setting up yytext */
yy_c_buf_p = yy_cp -= 1;
YY_DO_BEFORE_ACTION; /* set up yytext again */
YY_RULE_SETUP
verb_flag = 0; return (tok = minus_type('-'));   
	YY_BREAK
case 28:
YY_RULE_SETUP
{ if (datafile_flag && uminus_flag && (parens == 0) )  
               return(tok = UMINUS_TOK);
             else { verb_flag = 0; return ( tok = minus_type('-') );}
           }
	YY_BREAK
case 29:
YY_RULE_SETUP
{ verb_flag = 2; yylval.i = SUBASSIGN_OP; return (tok= ASSIGNOP_TOK);}
	YY_BREAK
case 30:
YY_RULE_SETUP
{ return ( tok = minus_type('-')); }
	YY_BREAK
case 31:
YY_RULE_SETUP
{ if (datafile_flag && uminus_flag && (parens == 0) ) 
               return ( tok = UMINUS_TOK);
             else { verb_flag = 0; return ( tok = minus_type('-') ); }
           }
	YY_BREAK
case 32:
YY_RULE_SETUP
{ verb_flag = 2; return (tok= ASSIGN_TOK);}
	YY_BREAK
case 33:
YY_RULE_SETUP
{ verb_flag = 2; 
             kb_error(2327,"You mistyped ';=' for ':='?\n",WARNING);
             return (tok= ASSIGN_TOK);
           }
	YY_BREAK
case 34:
YY_RULE_SETUP
{ verb_flag = 2; yylval.i = PLUSASSIGN_OP; return (tok= ASSIGNOP_TOK);}
	YY_BREAK
case 35:
YY_RULE_SETUP
{ verb_flag = 2; yylval.i = SUBASSIGN_OP; return (tok= ASSIGNOP_TOK);}
	YY_BREAK
case 36:
YY_RULE_SETUP
{ verb_flag = 2; yylval.i = MULTASSIGN_OP; return (tok= ASSIGNOP_TOK);}
	YY_BREAK
case 37:
YY_RULE_SETUP
{ verb_flag = 2; yylval.i = DIVASSIGN_OP; return (tok= ASSIGNOP_TOK);}
	YY_BREAK
case 38:
YY_RULE_SETUP
{ verb_flag = 2; return (tok = PERM_ASSIGN_TOK);}
	YY_BREAK
case 39:
YY_RULE_SETUP
{ verb_flag = 2; return (tok = REDEFINE_TOK); }
	YY_BREAK
case 40:
YY_RULE_SETUP
{ return (tok = minus_type('-'));  }
	YY_BREAK
case 41:
YY_RULE_SETUP
{ verb_flag = 0 ;  return(tok = yytext[0]); }
	YY_BREAK
case 42:
YY_RULE_SETUP
{ verb_flag = 1; return tok = ';'; }
	YY_BREAK
case 43:
YY_RULE_SETUP
{  verb_flag = 1; return(tok = yytext[0]); }
	YY_BREAK
case 44:
YY_RULE_SETUP
{  return(tok = yytext[0]);  }
	YY_BREAK
case 45:
YY_RULE_SETUP
{ return tok = (datafile_flag ? '=' : EQ_TOK); }
	YY_BREAK
case 46:
YY_RULE_SETUP
{   verb_flag = 0; return(tok = yytext[0]); }
	YY_BREAK
case 47:
YY_RULE_SETUP
{  return(tok = yytext[0]);  }
	YY_BREAK
case 48:
YY_RULE_SETUP
{  return(tok = yytext[0]);  }
	YY_BREAK
case 49:
YY_RULE_SETUP
{ return(tok = '^'); }
	YY_BREAK
case 50:
YY_RULE_SETUP
{ return(tok = EQ_TOK); }
	YY_BREAK
case 51:
YY_RULE_SETUP
{ return(tok = NE_TOK); }
	YY_BREAK
case 52:
YY_RULE_SETUP
{ return(tok = LE_TOK); }
	YY_BREAK
case 53:
YY_RULE_SETUP
{ return(tok = GE_TOK); }
	YY_BREAK
case 54:
YY_RULE_SETUP
{ return(tok = OR_TOK); }
	YY_BREAK
case 55:
YY_RULE_SETUP
{ return(tok = AND_TOK); }
	YY_BREAK
case 56:
YY_RULE_SETUP
{ return(tok = NOT_TOK); }
	YY_BREAK
case 57:
YY_RULE_SETUP
{ return (tok = PIPE_TOK); /* pipe followed by quoted string */ }
	YY_BREAK
case 58:
YY_RULE_SETUP
{ return (tok = REDIRECT_TOK); /* for redirection */ }
	YY_BREAK
case 59:
YY_RULE_SETUP
{ return (tok = REDIRECTOVER_TOK); /* for overwrite redirection */ }
	YY_BREAK
case 60:
YY_RULE_SETUP
{ return (tok = BACKQUOTE_COMMA_TOK); }
	YY_BREAK
case 61:
YY_RULE_SETUP
{ if (!datafile_flag)
             kb_error(1880,"#define valid only in top of datafile.\n",WARNING);
             macro_flag = 1;
           }
	YY_BREAK
case 62:
YY_RULE_SETUP
{ /* nested include */
             char *name = strchr(yytext,'"')+1;/* initial quote + 1 */
             *strchr(name,'"') = 0; /* replace final quote by 0 */
             push_commandfd(NULL,name);
           }
	YY_BREAK
case 63:
YY_RULE_SETUP
{ strncpy(yylval.lexeme,yytext,LEXEME_SIZE);
                           if ( !macro() ) return identcase(yytext); 
                         } 
	YY_BREAK
case 64:
YY_RULE_SETUP
{ yylval.i = yytext[1]; return tok = QUOTED_LETTER_TOK; }
	YY_BREAK
case 65:
YY_RULE_SETUP
;
	YY_BREAK
case 66:
YY_RULE_SETUP
{ if ( cond_expr_flag ) return tok = ':';}
	YY_BREAK
case 67:
YY_RULE_SETUP
{ if ( isprint(yytext[0]) )
            sprintf(errmsg,"Illegal token: %c\n",yytext[0]);
          else
            sprintf(errmsg,"Illegal token: 0x%02X\n",yytext[0]);
          yyerror(errmsg);
          return tok=LEXERROR;
        }
	YY_BREAK
case 68:
YY_RULE_SETUP
ECHO;
	YY_BREAK
case YY_STATE_EOF(INITIAL):
	yyterminate();

	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->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 yyin at a new source and called
			 * yylex().  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->yy_n_chars;
			yy_current_buffer->yy_input_file = yyin;
			yy_current_buffer->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->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 ( yywrap() )
					{
					/* Note: because we've taken care in
					 * yy_get_next_buffer() to have set up
					 * yytext, 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->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 yylex */


/* 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()
	{
	register char *dest = yy_current_buffer->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->yy_ch_buf[yy_n_chars + 1] )
		YY_FATAL_ERROR(
		"fatal flex scanner internal error--end of buffer missed" );

	if ( yy_current_buffer->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->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_n_chars = 0;

	else
		{
		int num_to_read =
			yy_current_buffer->yy_buf_size - number_to_move - 1;

		while ( num_to_read <= 0 )
			{ /* Not enough room in the buffer - grow it. */
#ifdef YY_USES_REJECT
			YY_FATAL_ERROR(
"input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
#else

			/* 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. */
					yy_flex_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->yy_buf_size -
						number_to_move - 1;
#endif
			}

		if ( num_to_read > YY_READ_BUF_SIZE )
			num_to_read = YY_READ_BUF_SIZE;

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

	if ( yy_n_chars == 0 )
		{
		if ( number_to_move == YY_MORE_ADJ )
			{
			ret_val = EOB_ACT_END_OF_FILE;
			yyrestart( yyin );
			}

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

	else
		ret_val = EOB_ACT_CONTINUE_SCAN;

	yy_n_chars += number_to_move;
	yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR;
	yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;

	yytext_ptr = &yy_current_buffer->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()
	{
	register yy_state_type yy_current_state;
	register char *yy_cp;

	yy_current_state = yy_start;
	yy_current_state += YY_AT_BOL();

	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 >= 230 )
				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 );
 */

#ifdef YY_USE_PROTOS
static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state )
#else
static yy_state_type yy_try_NUL_trans( yy_current_state )
yy_state_type yy_current_state;
#endif
	{
	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 >= 230 )
			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 == 229);

	return yy_is_jam ? 0 : yy_current_state;
	}


#ifndef YY_NO_UNPUT
#ifdef YY_USE_PROTOS
static void yyunput( int c, register char *yy_bp )
#else
static void yyunput( c, yy_bp )
int c;
register char *yy_bp;
#endif
	{
	register char *yy_cp = yy_c_buf_p;

	/* undo effects of setting up yytext */
	*yy_cp = yy_hold_char;

	if ( yy_cp < yy_current_buffer->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->yy_ch_buf[
					yy_current_buffer->yy_buf_size + 2];
		register char *source =
				&yy_current_buffer->yy_ch_buf[number_to_move];

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

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

		if ( yy_cp < yy_current_buffer->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;
	}
#endif	/* ifndef YY_NO_UNPUT */


#ifdef __cplusplus
static int yyinput()
#else
static int input()
#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->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_END_OF_FILE:
					{
					if ( yywrap() )
						{
						yy_c_buf_p = yytext_ptr + offset;
						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;

				case EOB_ACT_LAST_MATCH:
#ifdef __cplusplus
					YY_FATAL_ERROR(
					"unexpected last match in yyinput()" );
#else
					YY_FATAL_ERROR(
					"unexpected last match in input()" );
#endif
				}
			}
		}

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

	yy_current_buffer->yy_at_bol = (c == '\n');

	return c;
	}


#ifdef YY_USE_PROTOS
void yyrestart( FILE *input_file )
#else
void yyrestart( input_file )
FILE *input_file;
#endif
	{
	if ( ! yy_current_buffer )
		yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE );

	yy_init_buffer( yy_current_buffer, input_file );
	yy_load_buffer_state();
	}


#ifdef YY_USE_PROTOS
void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
#else
void yy_switch_to_buffer( new_buffer )
YY_BUFFER_STATE new_buffer;
#endif
	{
	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->yy_buf_pos = yy_c_buf_p;
		yy_current_buffer->yy_n_chars = yy_n_chars;
		}

	yy_current_buffer = new_buffer;
	yy_load_buffer_state();

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


#ifdef YY_USE_PROTOS
void yy_load_buffer_state( void )
#else
void yy_load_buffer_state()
#endif
	{
	yy_n_chars = yy_current_buffer->yy_n_chars;
	yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos;
	yyin = yy_current_buffer->yy_input_file;
	yy_hold_char = *yy_c_buf_p;
	}


#ifdef YY_USE_PROTOS
YY_BUFFER_STATE yy_create_buffer( FILE *file, int size )
#else
YY_BUFFER_STATE yy_create_buffer( file, size )
FILE *file;
int size;
#endif
	{
	YY_BUFFER_STATE b;

	b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
	if ( ! b )
		YY_FATAL_ERROR( "out of dynamic memory in yy_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 *) yy_flex_alloc( b->yy_buf_size + 2 );
	if ( ! b->yy_ch_buf )
		YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );

	b->yy_is_our_buffer = 1;

	yy_init_buffer( b, file );

	return b;
	}


#ifdef YY_USE_PROTOS
void yy_delete_buffer( YY_BUFFER_STATE b )
#else
void yy_delete_buffer( b )
YY_BUFFER_STATE b;
#endif
	{
	if ( ! b )
		return;

	if ( b == yy_current_buffer )
		yy_current_buffer = (YY_BUFFER_STATE) 0;

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

	yy_flex_free( (void *) b );
	}


#ifndef YY_ALWAYS_INTERACTIVE
#ifndef YY_NEVER_INTERACTIVE
extern int isatty YY_PROTO(( int ));
#endif
#endif

#ifdef YY_USE_PROTOS
void yy_init_buffer( YY_BUFFER_STATE b, FILE *file )
#else
void yy_init_buffer( b, file )
YY_BUFFER_STATE b;
FILE *file;
#endif


	{
	yy_flush_buffer( b );

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

#if YY_ALWAYS_INTERACTIVE
	b->yy_is_interactive = 1;
#else
#if YY_NEVER_INTERACTIVE
	b->yy_is_interactive = 0;
#else
	b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
#endif
#endif
	}


#ifdef YY_USE_PROTOS
void yy_flush_buffer( YY_BUFFER_STATE b )
#else
void yy_flush_buffer( b )
YY_BUFFER_STATE b;
#endif

	{
	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 )
		yy_load_buffer_state();
	}


#ifndef YY_NO_SCAN_BUFFER
#ifdef YY_USE_PROTOS
YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size )
#else
YY_BUFFER_STATE yy_scan_buffer( base, size )
char *base;
yy_size_t size;
#endif
	{
	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) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
	if ( ! b )
		YY_FATAL_ERROR( "out of dynamic memory in yy_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;

	yy_switch_to_buffer( b );

	return b;
	}
#endif


#ifndef YY_NO_SCAN_STRING
#ifdef YY_USE_PROTOS
YY_BUFFER_STATE yy_scan_string( yyconst char *str )
#else
YY_BUFFER_STATE yy_scan_string( str )
yyconst char *str;
#endif
	{
	int len;
	for ( len = 0; str[len]; ++len )
		;

	return yy_scan_bytes( str, len );
	}
#endif


#ifndef YY_NO_SCAN_BYTES
#ifdef YY_USE_PROTOS
YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len )
#else
YY_BUFFER_STATE yy_scan_bytes( bytes, len )
yyconst char *bytes;
int len;
#endif
	{
	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 *) yy_flex_alloc( n );
	if ( ! buf )
		YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );

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

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

	b = yy_scan_buffer( buf, n );
	if ( ! b )
		YY_FATAL_ERROR( "bad buffer in yy_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;
	}
#endif


#ifndef YY_NO_PUSH_STATE
#ifdef YY_USE_PROTOS
static void yy_push_state( int new_state )
#else
static void yy_push_state( new_state )
int new_state;
#endif
	{
	if ( yy_start_stack_ptr >= yy_start_stack_depth )
		{
		yy_size_t new_size;

		yy_start_stack_depth += YY_START_STACK_INCR;
		new_size = yy_start_stack_depth * sizeof( int );

		if ( ! yy_start_stack )
			yy_start_stack = (int *) yy_flex_alloc( new_size );

		else
			yy_start_stack = (int *) yy_flex_realloc(
					(void *) yy_start_stack, new_size );

		if ( ! yy_start_stack )
			YY_FATAL_ERROR(
			"out of memory expanding start-condition stack" );
		}

	yy_start_stack[yy_start_stack_ptr++] = YY_START;

	BEGIN(new_state);
	}
#endif


#ifndef YY_NO_POP_STATE
static void yy_pop_state()
	{
	if ( --yy_start_stack_ptr < 0 )
		YY_FATAL_ERROR( "start-condition stack underflow" );

	BEGIN(yy_start_stack[yy_start_stack_ptr]);
	}
#endif


#ifndef YY_NO_TOP_STATE
static int yy_top_state()
	{
	return yy_start_stack[yy_start_stack_ptr - 1];
	}
#endif

#ifndef YY_EXIT_FAILURE
#define YY_EXIT_FAILURE 2
#endif

#ifdef YY_USE_PROTOS
static void yy_fatal_error( yyconst char msg[] )
#else
static void yy_fatal_error( msg )
char msg[];
#endif
	{
	(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 yytext. */ \
		yytext[yyleng] = yy_hold_char; \
		yy_c_buf_p = yytext + n; \
		yy_hold_char = *yy_c_buf_p; \
		*yy_c_buf_p = '\0'; \
		yyleng = n; \
		} \
	while ( 0 )


/* Internal utility routines. */

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

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

	return n;
	}
#endif


#ifdef YY_USE_PROTOS
static void *yy_flex_alloc( yy_size_t size )
#else
static void *yy_flex_alloc( size )
yy_size_t size;
#endif
	{
	return (void *) malloc( size );
	}

#ifdef YY_USE_PROTOS
static void *yy_flex_realloc( void *ptr, yy_size_t size )
#else
static void *yy_flex_realloc( ptr, size )
void *ptr;
yy_size_t size;
#endif
	{
	/* 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 );
	}

#ifdef YY_USE_PROTOS
static void yy_flex_free( void *ptr )
#else
static void yy_flex_free( ptr )
void *ptr;
#endif
	{
	free( ptr );
	}

#if YY_MAIN
int main()
	{
	yylex();
	return 0;
	}
#endif


/* My own input() function to handle case insensitivity and macros */
/* and line counting */

/*********************************************************************
* function: savein()
* purpose:  for saving input for command definition 
*/
int inputbuffersize = 0;
int inputbufferspot = 0;  /* where next character will go */
int inputsave_flag = 0;  /* so only save when reading command */
char *inputbuffer;
void savein(int c)
{ if ( !inputsave_flag ) return;
  if ( inputbufferspot >= inputbuffersize )
  { int newsize = inputbuffersize?2*inputbuffersize:1000;
    inputbuffer = my_list_realloc(inputbuffer,newsize,ETERNAL_BLOCK);
    inputbuffersize = newsize;
  }
  inputbuffer[inputbufferspot++] = (char)c;
} // end savein()
 
/*********************************************************************
* function: reset_inputbuffer()
* purpose:  reset the input buffer to empty.
*/
void reset_inputbuffer()
{ inputbufferspot = 0;
  inputsave_flag = 1;
}

#define MOREMAX 1000
char morebuff[MOREMAX+2];

/*********************************************************************
* function: rawinput()
* purpose: get one character from input.
*/
int rawinput()
{
  int c=0,retval;

  if ( cmdptr ) /* read from string */
   {
     if ( *cmdptr == 0 )  /* newline at end of each line */
     { if ( previous_char != '\n' )
       { retval = previous_char = '\n';
         errbuff[errspot++] = retval; 
         savein(retval);
       }
       else retval = 0;
       goto rawreturn; 
     }
     c = *(cmdptr++);
     if ( c == MOREIN ) /* for really long input lines */
     { 
#ifdef USE_READLINE  //CSL
       prompt(CONTPROMPT,morebuff,MOREMAX);
#else
       getstring(morebuff,MOREMAX);
#endif
       cmdptr = morebuff;
       if ( !*cmdptr ) 
       { if (!in_quote && !in_comment) errbuff[errspot++] = '\n';  
         retval = '\n'; 
         savein(retval);
         goto rawexit; 
       }
       c = *(cmdptr++);
     }
   }
  else /* read from file */
   { for(;;)
     {
       if ( commandfd == NULL )  /* in case read after close */
       { retval = previous_char = 0; goto rawreturn; }
       c = getc(commandfd);
       if ( c != -1 ) break;
       pop_commandfd();  /* EOF, so pop #include stack */
       if ( !datafile_flag ) /* EOF for a command file */
       { retval =  previous_char = 0; goto rawreturn; }
     }
   }

  /* taking care of various line-ending combinations */
  if ( (c == '\n') && (previous_char == '\r') ) 
    return  rawinput();
  previous_char = c;
  if ( c == '\r' ) 
     c = '\n';

  errbuff[errspot++] = (char)c;
  retval = c;

  savein(retval);

rawexit:
  if ( errspot >= ERRBUFFSIZE ) /* need partial reset */
    { memcpy(errbuff,errbuff+ERRBUFFSIZE/2,ERRBUFFSIZE/2);
      errspot = ERRBUFFSIZE/2;
    }

rawreturn:
  return  retval;
} // end rawinput()

/***************************************************************************
* function: get_more_input()
* purpose: prompt user for more input.
*/

void get_more_input()
{int n; 
 #ifdef USE_READLINE //CSL
  prompt(MOREPROMPT,morebuff,MOREMAX);
 #else
  if ( !topflag && (!quiet_load_flag || (commandfd == stdin)) ) 
     outstring("more> ");
  getstring(morebuff,MOREMAX);
 #endif
  n = (int)strlen(morebuff); 
  if ( (morebuff[n-1] != MOREIN) && (morebuff[n-1] != '\n') )
  morebuff[n] = '\n'; morebuff[n+1] = 0;
  catfulltext(morebuff);
  cmdptr = morebuff;
}

/***************************************************************************
* function: kb_input()
* purpose: get next character from putback buffer or input.
*/
int kb_input()
{
  int c;

  if ( spot > 0 ) 
    { c = buff[--spot];
      goto input_exit;
    }

retry:
  c = rawinput();

  if ( c == '\\' )  /* line splicing */
  { /* have to do line splicing as input filter to remove 
       special character of line start */
    int cc = c;
    c = rawinput();
    if ( c == 0 ) 
    { get_more_input(); c = ' '; goto input_exit; }
    if ( c == '\n' ) 
    { int ccc;
      line_no++;
      ccc = rawinput();
      if ( ccc == 0 ) 
      { get_more_input(); c = ' '; goto input_exit; }
      rawunput(ccc); c = ' ';
    } 
    else { rawunput(c); c = cc; /* not linesplicing */ } 
  }
  if ( c == 0 && in_comment ) { get_more_input(); goto retry; }
  if ( c == 0 && in_quote ) { get_more_input(); goto retry; }
input_exit:

  return c;
} // end kb_input()

/*********************************************************************
* function: rawunput()
* purpose: put back one character to raw input stream.
*/
void rawunput(int c)
{
  if ( spot >= BUFFSIZE - 1 ) 
  { buff = my_list_realloc(buff,BUFFSIZE+500,ETERNAL_BLOCK);
    BUFFSIZE += 500;
  }

  buff[spot++] = (char)c;
} // end rawunput()

/*********************************************************************
* function: unput_string()
* purpose: put back string to input stream.
*/
void unput_string(char *s)
{ char *c;
  c = s ; while ( *c )  c++;   /* find end of token */
  while ( c != s ) { --c; unput(*c); }
} // end unput_string()

/*********************************************************************
* function: dump_buff()
* purpose: for error reporting 
*/
void dump_buff( 
  char *str,
  size_t size
)
{ int place;
  strcpy(str,"  Input line so far: \n");
  size -= (int)strlen(str)+3;
  errbuff[errspot] = 0;
  for ( place = errspot-1 ; place >= 0 ; place-- )
  { if (errbuff[place]==0 ) errbuff[place] = ' '; /* nulls creep in */ 
    if (errbuff[place]=='\n' && place < errspot-2) break;
  } 
  strncat(str,errbuff+place+1,size);
  if ( str[strlen(str)-1] != '\n' ) strcat(str,"\n");
} // end dump_buff()

/*********************************************************************
* function: yywrap()
* purpose: end of file handling for lex
*/
int yywrap()
{ /* Called at end of input.  Return 1 if really done, 0 if not */
  spot = 0; /* clean buffer */
  if ( (parens > 0) || (brace_depth > 0) || in_quote || in_comment 
         || in_function || in_control_structure /* || loopdepth */ )
    { get_more_input(); return 0; }
  if ( !help_flag )
    switch ( tok )
    { case '+': case '-': case '*': /* might be wrap symbols */
        if ( read_wrap_flag ) return 1;
        else { get_more_input(); return 0 ; }
        break;
      case UMINUS_TOK: case ',':
      case '=': case '?': case ':': case OR_TOK: case AND_TOK: case NOT_TOK:
      case EQ_TOK: case '>': case '<': case LE_TOK: case GE_TOK: case NE_TOK:
      case '/': case '%': case '^': case ON_CONSTRAINT_TOK: case VALUE_OF_CONSTRAINT_TOK:
      case HIT_CONSTRAINT_TOK: case ON_BOUNDARY_TOK: case DO_TOK: case FOR_TOK:
      case WHILE_TOK: case IF_TOK: case ELSE_TOK: case THEN_TOK: case SET_TOK:
      case DEFINE_TOK: case WHERE_TOK: case ASSIGN_TOK: case PERM_ASSIGN_TOK:
      case REDEFINE_TOK: case FUNCTION_TOK: case PROCEDURE_WORD_TOK:
      get_more_input(); return 0;
      break;
      default: return 1;
        }
  return 1;  /* done */
} // end yywrap()

/*************************************************************************
* function: macro_init()
* purpose: initialize macro definition list
*/
void macro_init()
{
  if ( macro_subs ) myfree((char *)macro_subs);
  if ( macros ) myfree((char *)macros);
  macro_subs = NULL;
  macros = NULL;
  macro_count = macro_subs_top = macro_max = macro_subs_max = 0;
} // end macro_init()

/*************************************************************************
* function: yylex_init()
* purpose: initialize lexical analyzer
*/
void yylex_init()
{
  unput_tok_count = 0;
  ubuff_spot = 0;
  spot = 0;
  errspot = 0;
  yylval.i = 0;
  yylval.r = 0.0;
  in_function = brace_depth = in_quote = in_comment = 0;
#ifdef FLEX_SCANNER
  if ( yy_current_buffer) YY_FLUSH_BUFFER;
#endif
} // end yylex_init()

/*************************************************************
*
*  Function: record_macro()
*
*  Purpose:  Record macro definition.
*/

void record_macro()
{
  int len;
  char *mspot;
  int cont_flag;
  int backslash_spot;

  macro_flag = 0;

  if ( macro_count >= macro_max )
  { if ( macro_max == 0 )
    { macro_max = 10; 
      macros = (struct macro *)mycalloc(macro_max,sizeof(struct macro));
    }
    else
    { 
      macros = (struct macro *)kb_realloc((char *)macros,
        2*macro_max*sizeof(struct macro));
      macro_max *= 2;
    }
  }

  strncpy(macros[macro_count].name,yytext,MACRONAMESIZE);

  if ( macro_subs_max == 0 )
  { macro_subs_max = 2*SUBMAX; 
    macro_subs = (char *)mycalloc(macro_subs_max,1);
  }

  /* read in macro string */
  for ( len = 0, cont_flag = 0 ; ; len++ )
    { int c = KB_INPUT();
      if ( len == 0 && (c == ' ' || c == '\t') )
      { len--;
        continue; /* skip leading whitespace */
      }
      if ( c == '\\' )
      { cont_flag = 1;
        backslash_spot = len;
      }
      else if ( c != ' ' && c != '\t' && c != '\n' && c != 0 )
        cont_flag = 0;
      if ( (c == '\0') || (c == '\n') )
      { 
        line_no++; 
        if ( !cont_flag ) 
           break; 
        cont_flag = 0;
        len = backslash_spot;
        macro_subs[macro_subs_top+len] = 0;
        len--;
        continue;
      }
      if ( macro_subs_top+len >= macro_subs_max-2 )
      { macro_subs = (char *)kb_realloc(macro_subs,macro_subs_max+2*SUBMAX);
        macro_subs_max += 2*SUBMAX;
      }
      macro_subs[macro_subs_top+len] = (char)c;
    }
  mspot = macro_subs+macro_subs_top;

  /* strip terminal comment */
  if ( strstr(mspot,"//") )
    { *strstr(mspot,"//") = 0;
      len = (int)strlen(mspot);
    }
  else mspot[len] = 0;
  /* strip trailing blanks */
  while ( (len > 0) && (mspot[len-1] == ' ') ) mspot[--len] = 0;
  macros[macro_count].subsize = len;
  macros[macro_count++].offset = macro_subs_top;
  macro_subs_top += len+1;
} // end record_macro()

/*************************************************************
*
*  Function:  macro()
*
*  Purpose: See if yytext is a macro, and do substitution.
*
*  Return:  1 if macro, 0 if not.
*/

int macro()
{
  int n,k;
  char *c;
  
  if ( macro_flag ) { record_macro(); return WAS_MACRO_DEF; }
  if ( strcmp(yytext,"_anti_line_no_") == 0 )
  { line_no--;  /* kludge line backup */
    errspot -= 15;
    return 1;
  }

  if ( !keep_macros_flag && !datafile_flag ) return 0;  /* no macros in commands */
  /* find name, simple linear search */
  for ( n = macro_count-1 ; n >= 0 ; n-- )  /* use latest definition */
     if ( strcmp(yytext,macros[n].name) == 0 ) break;

  if ( n < 0 ) return 0;   /* not found */

  /* insert string into input in reverse order so reads ok */
  c = macro_subs+macros[n].offset;
  for ( k = macros[n].subsize - 1 ; k >= 0 ; k-- )
    KB_UNPUT(c[k]);

  KB_UNPUT(' ');  /* substitution starts with whitespace; for proper
                     preservation of unary minus leading in the macro */

  return MACRO_EXPANDED;
} // end macro()

/*************************************************************************
* function: minus_type()
* purpose: for deciding type of minus sign or plus sign 
*/
int minus_type(int c /* '+' or '-' */)
{ int result;
  switch ( tok )
  {  case LEAD_INTEGER_TOK:
     case SIGNED_NUMBER_TOK:
     case INTEGER_TOK:
     case REAL_TOK:
     case PI_TOK:
     case E_TOK:
     case G_TOK:
     case PARAM_TOK: case ARRAYIDENT_TOK: case STRINGARRAY_TOK:
     case COORD_TOK: case VALUE_TOK: case BARE_TOK:
     case IDENT_TOK: case QUANTITY_NAME_TOK: case WRAP_TOK: case PERM_IDENT_TOK:
     case LENGTH_TOK: case DIHEDRAL_TOK: case VALENCE_TOK:
     case AREA_TOK: case VOLUME_TOK: case DENSITY_TOK: case TAG_TOK:
     case ID_TOK: case ORIGINAL_TOK: case SQ_MEAN_CURV_TOK:
     case OID_TOK: case INTERNAL_VARIABLE_TOK: case COLOR_TOK:
     case TOGGLEVALUE_TOK: case EXTRA_ATTRIBUTE_TOK: case PRESSURE_TOK:
     case ARRAY_ATTRIBUTE_TOK:
     case FRONTCOLOR_TOK: case BACKCOLOR_TOK: case TARGET_TOK:
     case NO_REFINE_TOK: case VOLCONST_TOK: case FRONTBODY_TOK: case NONCONTENT_TOK:
     case BACKBODY_TOK: case TETRA_POINT_TOK: case TRIPLE_POINT_TOK:
     case MIDV_TOK: case PHASE_TOK: case MODULUS_TOK: 
     case METHOD_NAME_TOK: case NODISPLAY_TOK: case HIT_PARTNER_TOK:
     case CENTEROFMASS_TOK:
     case ']': case ')':
        result = c; 
        break; 
     default: 
        result = (c=='-' ? UMINUS_TOK: UPLUS_TOK) ; 
        break;
  }
  return result; 
} // end minus_type()

/****************************************************************************
*
*  function identcase()
*
*  purpose: handle case of identifier token, maybe macro, keyword, etc.
*/
int keyword_compare(struct ckey *a, struct ckey *b)
{ return stricmp(a->name,b->name); }

int identcase(char *lexeme)
{
   int k,i;
   int type;
   struct sym *s;
   static int sorted = 0; /* flag for sorting keywords */
   struct ckey *keyptr;
   struct ckey key;  /* for bsearch key */
   char *c,*p;
   dll_func_type h;

   yylval.i = 0; 

   if ( ! sorted )
   { qsort((char*)datafile_keywords,
      sizeof(datafile_keywords)/ sizeof(struct dkey),sizeof(struct dkey),
      FCAST keyword_compare);
     qsort((char*)command_keywords,
      sizeof(command_keywords)/ sizeof(struct ckey),sizeof(struct ckey),
      FCAST keyword_compare);
     qsort((char*)togglenames,
      sizeof(togglenames)/ sizeof(struct ckey),sizeof(struct ckey),
      FCAST keyword_compare);
     qsort((char*)colornames,
      sizeof(colornames)/ sizeof(struct ckey),sizeof(struct ckey),
      FCAST keyword_compare);
     qsort((char*)internal_variables,
      sizeof(internal_variables)/ sizeof(struct ckey),sizeof(struct ckey),
      FCAST keyword_compare);
     qsort((char*)mathfunc_keywords,
      sizeof(mathfunc_keywords)/ sizeof(struct ckey),sizeof(struct ckey),
      FCAST keyword_compare);
     qsort((char*)mathfunc2_keywords,
      sizeof(mathfunc2_keywords)/ sizeof(struct ckey),sizeof(struct ckey),
      FCAST keyword_compare);
     sorted = 1;
   }

   if ( strcmp(lexeme,"_command_") == 0 )  { return tok = COMMAND_START_TOK; }
   if ( strcmp(lexeme,"_expr_") == 0 )   { return tok = EXPRESSION_START_TOK; }

   /* strip whitespace from front of lexeme */
   c = strtok(lexeme,whitespace);
   if ( c != lexeme ) { p = lexeme;  while ( *c )  *(p++) = *(c++); *p = 0;}

   if ( strlen(lexeme) == 1 )
   { char ch = lexeme[0];
     if ( verb_flag == 1 || // tok==PRINT_TOK||
       (verb_flag == 2 && (toupper(ch) < 'W'))  )
     { yylval.i=lexeme[0]; 
       if ( single_redefine[yylval.i].start ) return tok = SINGLE_REDEFD_TOK;
       switch ( yylval.i )
       { case 't': case 'l': case 'j': case 'P': case 'M':
         case 'w': case 'n': case 'm':  case 'b':
         case 'k': case 'K': case 'p': case 'y': case 'q':
           return ( tok = SINGLE_LETTER_ARG_TOK);
           case 'G': if ( verb_flag ) return ( tok = SINGLE_LETTER_ARG_TOK);
         else return tok=G_TOK;
         default: return ( tok = SINGLE_LETTER_TOK);
       } 
     }
     else 
      switch ( toupper(lexeme[0]) )
      { case 'X': case 'Y': case 'Z': case 'W':
          yylval.i = ((toupper(lexeme[0]) - 'X' + 4) % 4) + 1;
          return COORD_TOK;
        case 'P':
        { strncpy(idname,lexeme,sizeof(idname)); /* save text */
          yylval.qnum = V_PARAM_ATTR;
          yylval.etype = VERTEX;
          yylval.i = 1;
          return tok = ARRAY_ATTRIBUTE_TOK; 
        }
      }
    }

    // x1, x2, ... form of coordinates
    if ( toupper(lexeme[0]) == 'X' )
    { char *c;
      for ( c = lexeme+1 ; isdigit(*c) ; c++ ) ;
      if ( *c == 0 )
      { yylval.i = atoi(lexeme+1);
        if ( yylval.i != 0 )
          return COORD_TOK;
      }
    }

    // parameter names p1, p2, ...
    if ( toupper(lexeme[0]) == 'P' && isdigit(lexeme[1]) && !lexeme[2] )
    { yylval.i = atoi(lexeme+1);
      return PARAM_TOK;
    }

    // special gn kludge
    if ( lexeme[0] == 'g' )
    { char *c;
      for ( c = lexeme+1 ; isdigit(*c) ; c++ ) ;
      if ( *c == 0 )
      { yylval.i = atoi(lexeme+1);
        return GO_COUNT_TOK;
      }
    }

    if ( strncmp(lexeme,"usr",3) == 0 )
    { char *c;
      for ( c = lexeme+3 ; isdigit(*c) ; c++ ) ;
      if ( *c == 0 )
      { yylval.i = atoi(lexeme+3);
        return USERFUNC_TOK;
      }
    }
 
    key.name = lexeme;

#define BSEARCH(namelist)\
    (struct ckey*)bsearch((char*)&key,(char*)(namelist),\
         sizeof(namelist)/sizeof(struct ckey),\
          sizeof(struct ckey),FCAST keyword_compare);

    keyptr = BSEARCH(colornames);
    if ( keyptr )
        { yylval.r = yylval.i = keyptr->token;
          return (tok = INTEGER_TOK);
        }
    /* search math funcs */
    keyptr = BSEARCH(mathfunc_keywords);
    if ( keyptr ) {  yylval.i = keyptr->token; return (tok = MATHFUNC_TOK); }

    keyptr = BSEARCH(mathfunc2_keywords);
    if ( keyptr ) {  yylval.i  = keyptr->token; return (tok = MATHFUNC2_TOK); }

    if ( const_expr_flag )
    { for ( k=0 ; k<sizeof(const_expr_keywords)/ sizeof(struct ckey) ; k++ )
      if (stricmp(lexeme,const_expr_keywords[k].name)==0)
           return (tok = const_expr_keywords[k].token);
    }

    /* kludges for some backward compatibility */
    if ( strcmp(lexeme,"vertexnormal") == 0 )
      strcpy(lexeme,"vertex_normal");
    if ( lexeme[0] == '_' )
    {
      if ( strcmp(lexeme,"__vertex_normal") == 0 )
        strcpy(lexeme,"vertex_normal");
      if ( strcmp(lexeme,"__edge_vector") == 0 )
        strcpy(lexeme,"edge_vector");
      if ( strcmp(lexeme,"__facet_normal") == 0 )
        strcpy(lexeme,"facet_normal");
      if ( strcmp(lexeme,"__force") == 0 )
        strcpy(lexeme,"v_force");
      if ( strcmp(lexeme,"__velocity") == 0 )
        strcpy(lexeme,"v_velocity");
      if ( strcmp(lexeme,"__v_constraint_list") == 0 )
        strcpy(lexeme,"v_constraint_list");
      if ( strcmp(lexeme,"__e_constraint_list") == 0 )
        strcpy(lexeme,"e_constraint_list");
      if ( strcmp(lexeme,"__f_constraint_list") == 0 )
        strcpy(lexeme,"f_constraint_list");
     }
     
    if ( datafile_flag && !backquote_flag )
    { keyptr = BSEARCH(datafile_keywords);
      if ( keyptr ) {  return tok = keyptr->token;}
      keyptr = BSEARCH(command_keywords);
      if ( keyptr ) 
      { sprintf(errmsg,
         "Use of the keyword '%s' as an identifier is very ill-advised!\n",
           lexeme);
        kb_error(2328,errmsg, WARNING);
      }
    }
    else /* search keywords and internal variables */
    { 
      keyptr = BSEARCH(command_keywords);
      if ( keyptr ) 
      { if ( kb_stricmp(lexeme,"HELP") == 0 ) help_flag = 1;
        yylval.i = tok = keyptr->token;
        switch ( tok )
        { /* set verb_flag when expecting a command */
          case THEN_TOK: case ELSE_TOK: case DO_TOK: verb_flag = 1; break;
          /* clear verb_flag when expecting an expression */
          case PRINT_TOK: 
          case IF_TOK: case WHILE_TOK: case VIEW_TRANSFORMS_TOK: case TRANSFORM_DEPTH_TOK:
          case METIS_TOK: case KMETIS_TOK: case OMETIS_TOK: case EDGEWEED_TOK:
          case AREAWEED_TOK: case EDGEDIVIDE_TOK: case LANCZOS_TOK: case RITZ_TOK:
          case EIGENPROBE_TOK: case MOVE_TOK: case ZOOM_TOK: case LAGRANGE_TOK: case SET_TOK:
          case PRINTF_TOK: case LIST_TOK: case DELETE_TOK: case VERTEX_AVERAGE_TOK:
          case BINARY_PRINTF_TOK: 
          case DISSOLVE_TOK: case REFINE_TOK: case EDGESWAP_TOK: case FIX_TOK: case UNFIX_TOK:
              case SPRINTF_TOK: case EPRINT_TOK: case HISTOGRAM_TOK: case LOGHISTOGRAM_TOK:
          case FOREACH_TOK: case SHOW_EXPR_TOK: case UNSET_TOK:
          case HESSIAN_SADDLE_TOK: case HESSIAN_SEEK_TOK: case NOTCH_TOK:
          case AUTOCHOP_TOK: case AUTOPOP_TOK: case OPTIMIZE_TOK:
               verb_flag = 0; break;
          case SHOW_TOK: if ( verb_flag ) tok = SHOWVERB_TOK;
                      verb_flag = 0;
                      break;
          case TRANSFORM_EXPR_TOK: if ( verb_flag ) tok = TRANSFORM_EXPR_VERB_TOK;
                      verb_flag = 0;
                      break;
        }
         return tok;
      }
     }

    for ( i = 0 ; i < NUMDATATYPES ; i++ )
      if ( stricmp(lexeme,datatype_name[i]) == 0 )
      { yylval.i = DATATYPE_TOK;
        yylval.datatype = i;
        return tok = DATATYPE_TOK;
      }

    keyptr = BSEARCH(togglenames);
    if ( keyptr ) 
    { yylval.i = keyptr->token;
      if ( verb_flag != 0 ) tok = TOGGLENAME_TOK;
      else tok = TOGGLEVALUE_TOK;
      return tok;
    }
    keyptr = BSEARCH(internal_variables);
    if ( keyptr ) 
    { yylval.i = keyptr->token;
      return tok = INTERNAL_VARIABLE_TOK;
    }

    /* search local variables */
    yylval.i = lookup_local_var(lexeme);
    if ( yylval.i )
    { struct global *g;
      g = globals(yylval.i); 
      if ( g->flags & SUBROUTINE )
        return ( tok = PROCEDURE_TOK);
      else if ( g->flags & ORDINARY_PARAM )
      { switch ( g->type )
        { case VERTEX_TYPE: 
             yylval.etype = VERTEX;
             return ( tok = ELEMENT_IDENT_TOK);
          case ELEMENTID_TYPE:
             yylval.etype = -1;
             return ( tok = ELEMENT_IDENT_TOK);
          case EDGE_TYPE:
             yylval.etype = EDGE;
             return ( tok = ELEMENT_IDENT_TOK);
          case FACET_TYPE:
             yylval.etype = FACET;
             return ( tok = ELEMENT_IDENT_TOK);
          case BODY_TYPE:
             yylval.etype = BODY;
             return ( tok = ELEMENT_IDENT_TOK);
          case FACETEDGE_TYPE:
             yylval.etype = FACETEDGE;
             return ( tok = ELEMENT_IDENT_TOK);
          default:
            return ( tok = IDENT_TOK);
        }
      }
      else if ( g->flags & FUNCTION_NAME )
        return ( tok = FUNCTION_IDENT_TOK);
      else if ( g->flags & PROCEDURE_NAME )
        return ( tok = PROCEDURE_IDENT_TOK);
      else if ( g->flags & STRINGVAL )
        return ( tok = STRINGGLOBAL_TOK);
      else if ( g->flags & QUANTITY_NAME )  /* can't happen */
        return ( tok = QUANTITY_NAME_TOK);
      else if ( g->flags & METHOD_NAME )  /* can't happen */
        return ( tok = METHOD_NAME_TOK);
      else if ( g->flags & CONSTRAINT_NAME )  /* can't happen */
        return ( tok = CONSTRAINT_NAME_TOK);
      else if ( g->flags & BOUNDARY_NAME )  /* can't happen */
        return ( tok = BOUNDARY_NAME_TOK);
      else if ( g->flags & DYNAMIC_LOAD_FUNC )  /* can't happen */
        return ( tok = DYNAMIC_LOAD_FUNC_TOK);
      else if ( g->flags & ARRAY_PARAM )
	  {// if ( g->type == STRING )
	   //   return ( tok = STRINGARRAY_TOK);
		//else
          return ( tok = ARRAYIDENT_TOK);
      }
      else if ( g->flags & GLOB_LOCALVAR )
        return IDENT_TOK;
      else 
        return (tok = NEWIDENT_TOK);
    }

    /* search symbol table */
    s = symbol_lookup(lexeme);
    if ( s ) 
    { yysym = s; yylval.i = (int)(yysym-symtable); verb_flag = 0;
      return (tok = SYMBOL_TOK);
    }

    /* search parameter names */
    yylval.i = lookup_global_hash(lexeme,0,0,HASH_LOOK);
    if ( yylval.i != 0 )
    { int nametype = yylval.i & NAMETYPEMASK;
      struct global *g;
      yylval.i &= INDEXMASK; /* get plain index */

      if ( nametype == QUANTITYNAME )
        return tok = QUANTITY_NAME_TOK;
      else if ( nametype == METHODNAME )
        return tok = METHOD_NAME_TOK;
      else if ( nametype == PERM_NAME )
      { yylval.i |= PERMGLOBAL;
        if ( perm_globals(yylval.i)->flags & SUBROUTINE )
          return ( tok = PERM_PROCEDURE_TOK);
        else if ( perm_globals(yylval.i)->flags & STRINGVAL )
          return ( tok = PERM_STRINGGLOBAL_TOK);
        else if ( perm_globals(yylval.i)->flags & ARRAY_PARAM )
          return ( tok = ARRAYIDENT_TOK);
        else return (tok = PERM_IDENT_TOK);
      }
      yylval.i |= EPHGLOBAL;
      g = globals(yylval.i); 
      if ( g->flags & SUBROUTINE )
        return ( tok = PROCEDURE_TOK);
      else if ( g->flags & FUNCTION_NAME )
        return ( tok = FUNCTION_IDENT_TOK);
      else if ( g->flags & PROCEDURE_NAME )
        return ( tok = PROCEDURE_IDENT_TOK);
      else if ( g->flags & STRINGVAL )
        return ( tok = STRINGGLOBAL_TOK);
      else if ( g->flags & QUANTITY_NAME )
        return ( tok = QUANTITY_NAME_TOK);
      else if ( g->flags & METHOD_NAME )
        return ( tok = METHOD_NAME_TOK);
      else if ( g->flags & CONSTRAINT_NAME )
        return ( tok = CONSTRAINT_NAME_TOK);
      else if ( g->flags & BOUNDARY_NAME )
        return ( tok = BOUNDARY_NAME_TOK);
      else if ( g->flags & DYNAMIC_LOAD_FUNC )
        return ( tok = DYNAMIC_LOAD_FUNC_TOK);
      else if ( g->flags & ARRAY_PARAM )
        return ( tok = ARRAYIDENT_TOK);
      else 
      { switch ( g->type )
        { case VERTEX_TYPE: 
             yylval.etype = VERTEX;
             return ( tok = ELEMENT_IDENT_TOK);
          case ELEMENTID_TYPE:
             yylval.etype = -1;
             return ( tok = ELEMENT_IDENT_TOK);
          case EDGE_TYPE:
             yylval.etype = EDGE;
             return ( tok = ELEMENT_IDENT_TOK);
          case FACET_TYPE:
             yylval.etype = FACET;
             return ( tok = ELEMENT_IDENT_TOK);
          case BODY_TYPE:
             yylval.etype = BODY;
             return ( tok = ELEMENT_IDENT_TOK);
          case FACETEDGE_TYPE:
             yylval.etype = FACETEDGE;
             return ( tok = ELEMENT_IDENT_TOK);
          default:
            return ( tok = IDENT_TOK);
        }
      }
    }

    /* search extra attributes */
    for ( type = 0 ; type < NUMELEMENTS ; type++ )
    { struct extra *ex;
      int i;

      for ( i=0, ex=EXTRAS(type) ; i < web.skel[type].extra_count ; i++, ex++ )
        if ( stricmp(lexeme, ex->name) == 0 )
        { strncpy(idname,lexeme,sizeof(idname)); /* save text */
          yylval.qnum = i;
          yylval.etype = type;
          return tok = ex->array_spec.dim ? ARRAY_ATTRIBUTE_TOK: EXTRA_ATTRIBUTE_TOK; 
        }
    }

    /* search dynamic load libraries */
    h = search_libraries(lexeme);
    if ( h )
    { yylval.i = add_global(lexeme);
      globals(yylval.i)->flags |= DYNAMIC_LOAD_FUNC;
      globals(yylval.i)->value.funcptr = h;
      return ( tok = DYNAMIC_LOAD_FUNC_TOK);
    }

    /* if here, then not keyword */
    strncpy(idname,lexeme,sizeof(idname)); /* save text */
    if ( strlen(lexeme) == 1 )
    { yylval.i = lexeme[0];
      return ( tok = SINGLE_LETTER_TOK);
    }
    
   yylval.i = 0;
   return(tok = NEWIDENT_TOK) ;
} /* end identcase() */

/******************************************************************
*
*  function: keywordname()
*
*  purpose: find keyword of given token number. 
*
*/

char *keywordname(int toknum)
{  int k,i,imax;

    for ( k = 0 ; k < sizeof(command_keywords)/sizeof(struct ckey) ; k++ )
      if ( toknum == command_keywords[k].token )
      { static char name[82]; 
        strncpy(name,command_keywords[k].name,81);
        return name;
      }
    for ( k = 0 ; k < sizeof(togglenames)/sizeof(struct ckey) ; k++ )
      if ( toknum == togglenames[k].token )
      { static char name[82]; 
        strncpy(name,togglenames[k].name,81);
        return name;
      }
    for ( k = 0 ; k < sizeof(internal_variables)/sizeof(struct ckey) ; k++ )
      if ( toknum == internal_variables[k].token )
      { static char name[82]; 
        strncpy(name,internal_variables[k].name,81);
        return name;
      }

    imax = sizeof(colornames)/sizeof(struct ckey);
    for ( i = 0 ; i < imax ; i++ )
      if ( colornames[i].token == toknum )
        return colornames[i].name;

    imax = sizeof(datafile_keywords)/sizeof(struct dkey);
    for ( i = 0 ; i < imax ; i++ )
      if ( datafile_keywords[i].token == toknum )
        return datafile_keywords[i].name;

    imax = sizeof(mathfunc_keywords)/sizeof(struct ckey);
    for ( i = 0 ; i < imax ; i++ )
      if ( mathfunc_keywords[i].token == toknum )
        return mathfunc_keywords[i].name;

    imax = sizeof(mathfunc2_keywords)/sizeof(struct ckey);
    for ( i = 0 ; i < imax ; i++ )
      if ( mathfunc2_keywords[i].token == toknum )
        return mathfunc2_keywords[i].name;

   /* unfound */
   return tokname(toknum);

} // end keywordname()

/****************************************************************************
*
*  function identtype()
*
*  purpose: find type of an identifier. This version used by
*   is_variable() etc. commands.
*/

int identtype(char *word)
{
   int type;
   struct sym *s;
   struct ckey *keyptr;
   struct ckey key;  /* for bsearch key */


   if ( strlen(word) == 1 )
   {
     if ( single_redefine[yylval.i].start ) return tok = SINGLE_REDEFD_TOK;
     switch ( word[0] )
       { case 't': case 'l': case 'j': case 'P': case 'M':
         case 'w': case 'n': case 'm': case 'b':
         case 'k': case 'K': case 'p': case 'y':
           return ( tok = SINGLE_LETTER_ARG_TOK);
             case 'G': if ( verb_flag ) return tok = SINGLE_LETTER_ARG_TOK;
               else return tok = G_TOK; break;
         default: return ( tok = SINGLE_LETTER_TOK);
       } 
    }
    key.name = word;
    keyptr = BSEARCH(colornames);
    if ( keyptr )
          return  INTEGER_TOK;

    /* search math funcs */
    keyptr = BSEARCH(mathfunc_keywords);
    if ( keyptr ) {  return MATHFUNC_TOK; }

    keyptr = BSEARCH(mathfunc2_keywords);
    if ( keyptr ) {  return  MATHFUNC2_TOK; }

    /* search keywords and internal variables */
    { 
      keyptr = BSEARCH(command_keywords);
      if ( keyptr ) 
      {  
         return tok;
      }

      keyptr = BSEARCH(togglenames);
      if ( keyptr ) 
           return tok;
      keyptr = BSEARCH(internal_variables);
      if ( keyptr ) { return  INTERNAL_VARIABLE_TOK; }
    }

    /* search local variables */
    yylval.i = lookup_local_var(word);
    if ( yylval.i )
    { struct global *g;
      g = globals(yylval.i); 
      if ( g->flags & SUBROUTINE )
        return ( tok = PROCEDURE_TOK);
      else if ( g->flags & ORDINARY_PARAM )
        return ( tok = IDENT_TOK);
      else if ( g->flags & STRINGVAL )
        return ( tok = STRINGGLOBAL_TOK);
      else if ( g->flags & QUANTITY_NAME )  /* can't happen */
        return ( tok = QUANTITY_NAME_TOK);
      else if ( g->flags & METHOD_NAME )  /* can't happen */
        return ( tok = METHOD_NAME_TOK);
      else if ( g->flags & CONSTRAINT_NAME )  /* can't happen */
        return ( tok = CONSTRAINT_NAME_TOK);
      else if ( g->flags & BOUNDARY_NAME )  /* can't happen */
        return ( tok = BOUNDARY_NAME_TOK);
      else if ( g->flags & DYNAMIC_LOAD_FUNC )  /* can't happen */
        return ( tok = DYNAMIC_LOAD_FUNC_TOK);
      else if ( g->flags & ARRAY_PARAM )
        return ( tok = ARRAYIDENT_TOK);
      else if ( g->flags & GLOB_LOCALVAR )
        return IDENT_TOK;
      else return (tok = NEWIDENT_TOK);
    }

    /* search symbol table */
    s = symbol_lookup(word);
    if ( s ) 
    { yysym = s; yylval.i = (int)(yysym-symtable); verb_flag = 0;
      return (tok = SYMBOL_TOK);
    }

    /* search parameter names */
    yylval.i = lookup_perm_global(word);
    if ( yylval.i >= 0 )
      { 
        if ( perm_globals(yylval.i)->flags & SUBROUTINE )
        return ( tok = PERM_PROCEDURE_TOK);
        else if ( globals(yylval.i)->flags & STRINGVAL )
        return ( tok = PERM_STRINGGLOBAL_TOK);
        else return (tok = PERM_IDENT_TOK);
      }

    yylval.i = lookup_global(word);
    if ( yylval.i >= 0 )
      { 
        if ( globals(yylval.i)->flags & ORDINARY_PARAM )
          return ( tok = IDENT_TOK);
        if ( globals(yylval.i)->flags & SUBROUTINE )
          return ( tok = PROCEDURE_TOK);
        else if ( globals(yylval.i)->flags & STRINGVAL )
          return ( tok = STRINGGLOBAL_TOK);
        else if ( globals(yylval.i)->flags & QUANTITY_NAME )
          return ( tok = QUANTITY_NAME_TOK);
        else if ( globals(yylval.i)->flags & METHOD_NAME )
          return ( tok = METHOD_NAME_TOK);
        else if ( globals(yylval.i)->flags & DYNAMIC_LOAD_FUNC )
          return ( tok = DYNAMIC_LOAD_FUNC_TOK);
        else if ( globals(yylval.i)->flags & ARRAY_PARAM )
          return ( tok = ARRAYIDENT_TOK);
      }

    /* search extra attributes */
    for ( type = 0 ; type <= BODY ; type++ )
    { struct extra *ex;
      int i;

      for ( i = 0, ex = EXTRAS(type) ; 
         i < web.skel[type].extra_count ; i++ , ex++ )
      if ( stricmp(word, ex->name) == 0 )
      { strncpy(idname,word,sizeof(idname)); /* save text */
        yylval.qnum = i;
        yylval.etype = type;
        return tok = ex->array_spec.dim ? ARRAY_ATTRIBUTE_TOK: EXTRA_ATTRIBUTE_TOK; 
      }
    }

    /* if here, then not keyword */
    yylval.i = 0;
    return(tok = NEWIDENT_TOK) ;
} /* end identtype() */

/******************************************************************
 
   My own lexical analyzer.  Faster for my purposes and
   more comprehensible.
   
*******************************************************************/

/* States */
#define L_START  1
#define L_SLASH  2
#define L_LINECOMMENT 3
#define L_DOT 4
#define L_DIGITS 5
#define L_DIGITS_DOT 6
#define L_WHITESPACE 7
#define L_WHITESIGN 8
#define L_LINESTART 9
#define L_LEAD_INTEGER 10
#define L_LEAD_INTEGER_AT 11
#define L_INTEGER_AT 12
#define L_DIGITS_E 13
#define L_ALPHANUM 14
#define L_COLON 15
#define L_SEMICOLON 16
#define L_PLUS  17
#define L_MINUS 18
#define L_STAR  19
#define L_BANG  20
#define L_PIPE  21
#define L_AND   22
#define L_GREATER  23
#define L_COLONCOLON 24
#define L_SINGLE_QUOTE 25
#define L_HEXNUMBER   26
#define L_ZERO  27
#define L_GRGR  28
#define L_BACKQUOTE 29
#define L_SHARP  30
#define L_COLONCOLONCOLON 31
#define L_QUOTE 32
#define L_EQUAL 33
#define L_LESS  34
#define L_DIGITS_E_DIGITS 35
#define L_LEAD_MINUS 36
#define L_BACKSLASH 37
#define L_GRGRGR 38

/* Unput buffer */
int ubuff_max = 0;
int ubuff_spot = 0;  /* index of first vacant spot in unput_buff */
char *unput_buff;

/* maximum lexeme size */
int yytext_max;

/******************************************************************
*
* function: kb_input_new()
*
* purpose: fetch next input character from unput buffer or raw input.
*/
char kb_input_new()
{ char c;

  if ( ubuff_spot )
  { c = unput_buff[--ubuff_spot];
    unput_buff[ubuff_spot] = 0;
    return c;
  }
  c = rawinput();
  while ( c == 0 ) // done with this input
  { if ( yywrap() ) // check for continuation 
      return 0;   // no continuation, so done
    else
      c = rawinput();
   }
   return c;
   
} // end kb_input_new()

/******************************************************************
*
* function: kb_unput()
*
* purpose: put back lookahead character into input stream.
*/
void kb_unput( char c )
{ if ( ubuff_spot >= ubuff_max )
  { if ( unput_buff )
    { ubuff_max *= 2;
      unput_buff = realloc(unput_buff,ubuff_max);
    }
    else
    { ubuff_max = 16000;
      unput_buff = calloc(ubuff_max,sizeof(char));
    }
  }

  unput_buff[ubuff_spot++] = c;
  
} // end kb_unput()

/*********************************************************************
* 
* function: kblex()
*
* purpose: my own lexical analyzer, faster (for Evolver) and 
*          more comprehensible.
*
* return: next token number; lexeme is in yytext, and
*         other interesting data in yylval.
*/

int kblex()
{ int state;
  unsigned char nextchar;
  char *yyspot; /* first empty spot in yytext */
  int retval;

  PROF_START(kblex);

  if ( !yytext )
  { yytext_max = 200;
    yytext = calloc(yytext_max,sizeof(char));
  } 

    yyspot = yytext;
    memset(&yylval,0,sizeof(yylval));
    state = tok ? L_START : L_LINESTART;
    
    for(;;)
    { int len = yyspot-yytext;
      if ( len >= yytext_max-2 )
      { yytext_max *= 2;
        yytext = realloc(yytext,yytext_max);
        yyspot = yytext + len;
      }
      *(yyspot++) = nextchar = kb_input_new();
      switch ( state )
      {
        case L_START:
           if ( nextchar == '0' )
             state = L_ZERO;
           else if ( isdigit(nextchar) )
             state = L_DIGITS;
           else if ( isalpha(nextchar) ) 
             state = L_ALPHANUM;
           else
           switch ( nextchar )
           {
             case 0:  tok=0; goto kblex_exit;
             case '\n' : line_no++; yyspot = yytext; state = L_LINESTART;
                         break;
             case ' ': case '\t':
               yyspot--; state = L_WHITESPACE; break;
             case '/':  state = L_SLASH; break;
             case '.':  state = L_DOT; break;         
             case '_':  state = L_ALPHANUM; break;
             case ':':  state = L_COLON; break;
             case ';':  state = L_SEMICOLON; break;
             case '+':  state = L_PLUS; break;
             case '-':  state = L_MINUS; break; 
             case '*':  state = L_STAR; break; 
             case '!':  state = L_BANG; break; 
             case '|':  state = L_PIPE; break; 
             case '&':  state = L_AND; break; 
             case '>':  state = L_GREATER; break;
             case '\'': case 0x91: state = L_SINGLE_QUOTE; break;
             case '"': case 0x93: state = L_QUOTE; break;
             case '`':  state = L_BACKQUOTE; break;
             case '=':  state = L_EQUAL; break;
             case '<':  state = L_LESS; break;
             case '\\': state = L_BACKSLASH; break;
             case '#':  state = L_SHARP; break;

             case '(': verb_flag = 0;
                *yyspot = 0;  tok = nextchar; goto kblex_exit;
             case ')':
             case '^':
             case ',':
             case '?':
             case '%':
             case '[':
             case ']':
             case '}': 
             case '@':
                *yyspot = 0;  tok = nextchar; goto kblex_exit;
             case '{': verb_flag = 1;
                *yyspot = 0; tok = nextchar; goto kblex_exit;
             default:  
               sprintf(errmsg,"Illegal character '%c'\n",nextchar);
               kb_error(3658,errmsg,RECOVERABLE);
           }
           break;

        case L_BACKSLASH:
           /* allow trailing whitespace */
           while ( nextchar == ' ' || nextchar == '\t' )
              nextchar = kb_input_new();
           if ( nextchar == '\n' )
           { yyspot = yytext;
             state = L_START;
             line_no++;
             if ( datafile_flag != IN_DATAFILE )
               get_more_input();
             break;
           }
           kb_error(3659,
              "Illegal backslash. Backslash is line continuation character.\n",
                 RECOVERABLE);
           break;

        case L_EQUAL:
           if ( nextchar == '=' )
           { *yyspot = 0;
             tok = EQ_TOK;
             goto kblex_exit;
           }
           kb_unput(nextchar);
           yyspot[-1] = 0;
           tok = (datafile_flag ? '=' : EQ_TOK);
           goto kblex_exit;
           
        case L_QUOTE:
           { /* read quoted string */
             int n;
             in_quote = 1;
             for (n=0;;n++)
             { if ( nextchar == '\n' ) line_no++;
               if ( (nextchar == '"' || nextchar == 0x94) && (n == 0 || (yytext[n-1] != '\\')) ) 
                 break;
               if ( n >= yytext_max - 2 )
               { yytext_max *= 2;
                 yytext = realloc(yytext,yytext_max);
               }
               yytext[n] = nextchar;
               nextchar = kb_input_new();
             }
             yytext[n] = 0;
             reduce_string(yytext);
             in_quote = 0;
             tok = QUOTATION_TOK;
             goto kblex_exit;
           }
           break;
   
        case L_LESS:
           if ( nextchar == '=' )
           { *yyspot = 0;
             tok = LE_TOK;
             goto kblex_exit;
           }
           else
           { kb_unput(nextchar);
             yyspot[-1] = 0;
             tok = '<';
             goto kblex_exit;
           }
           break;

        case L_GREATER:
           if ( nextchar == '>' )
              state = L_GRGR;
           else if ( nextchar == '=' )
           { *yyspot = 0;
             tok = GE_TOK;
             goto kblex_exit;
           }
           else
           { kb_unput(nextchar);
             yyspot[-1] = 0;
             tok = '>';
             goto kblex_exit;
           }
           break;

        case L_GRGR:
           if ( nextchar == '>' )
           { *yyspot = 0;
             tok = REDIRECTOVER_TOK;
             state = L_GRGRGR;
           } 
		   else if ( nextchar == '2' )
           { *yyspot = 0;
             tok = REDIRECT_ERR_TOK;
             goto kblex_exit;
           } 
           else
           { kb_unput(nextchar);
             yyspot[-1] = 0;
             tok = REDIRECT_TOK;
             goto kblex_exit;
           }
           break;

        case L_GRGRGR:
           if ( nextchar == '2' )
           { *yyspot = 0;
             tok = REDIRECTOVER_ERR_TOK;
             goto kblex_exit;
           } 
           else
           { kb_unput(nextchar);
             yyspot[-1] = 0;
             tok = REDIRECTOVER_TOK;
             goto kblex_exit;
           }
           break;

        case L_SINGLE_QUOTE:
           if ( nextchar == '\'' || nextchar == 0x92 )
              kb_error(3577,"Empty single quotes.\n",RECOVERABLE);
           if ( nextchar == 0 || nextchar == '\n' )
              kb_error(3570,"Dangling single quote.\n",RECOVERABLE);
           yylval.i = nextchar;
           nextchar = kb_input_new();
           if ( nextchar != '\'' && nextchar != 0x92) 
              kb_error(3583,"Single quote not closed after one character.\n",
                              RECOVERABLE);
           yytext[1] = 0;
           tok = QUOTED_LETTER_TOK;
           goto kblex_exit;
           break;

        case L_BACKQUOTE:
           while ( nextchar == ' ' ) yyspot[-1] = nextchar = kb_input_new();
           if ( nextchar == ',' )
           { *yyspot = 0;
             tok = BACKQUOTE_COMMA_TOK;
             goto kblex_exit;
           }
           yyspot[-1] = 0;
           kb_unput(nextchar);
           tok = '`';
           goto kblex_exit;
           break;

        case L_SHARP:
           while ( isalpha(nextchar) )
              *(yyspot++) = nextchar = kb_input_new();
           yyspot[-1] = 0;
           if ( strcmp(yytext,"#define") == 0 )
           { if (!datafile_flag)
             kb_error(2853,"#define valid only in top of datafile.\n",WARNING);
             macro_flag = 1;
             state = L_START;
             yyspot = yytext;
             break;
           }
           if ( strcmp(yytext,"#include") == 0 )
           { 
             while ( (nextchar != '"' && nextchar != 0x94) && nextchar > 0 && nextchar != '\n' ) 
                nextchar = kb_input_new();
             if ( (nextchar != '"' && nextchar != 0x94) )
             { kb_error(6377,"Need double-quoted filename after #include.\n",UNRECOVERABLE);
             }
             yyspot = yytext;
             do
               *(yyspot++) = nextchar = kb_input_new();
             while ( (nextchar != '"' && nextchar != 0x94) && nextchar > 0 && nextchar != '\n');
             if ( (nextchar != '"' && nextchar != 0x94) )
             { kb_error(6378,"Unclosed quote after #include.\n",UNRECOVERABLE);
             }
             yyspot[-1] = 0;
             push_commandfd(NULL,yytext);
             state = L_LINESTART;
             yyspot = yytext;
             break;
           }         
		   sprintf(errmsg,"Illegal # directive, line %d.\n",line_no);
		   kb_error(3681,errmsg,RECOVERABLE);
           break;

        case L_ZERO:
           if ( toupper(nextchar) == 'X' )
             state = L_HEXNUMBER;
           else if ( nextchar == '.' )
             state = L_DIGITS_DOT;
           else if ( isdigit(nextchar) )
             state = L_DIGITS;
           else
           { kb_unput(nextchar);
             yyspot[-1] = 0;
             yylval.i = 0;
             verb_flag = 0;
             tok = INTEGER_TOK;
             goto kblex_exit;
           }
           break;

        case L_HEXNUMBER:
           if ( isdigit(nextchar) ||
                 (toupper(nextchar) >= 'A' && toupper(nextchar) <= 'F') )
              break;
           yyspot[-1] = 0;
           kb_unput(nextchar);
           sscanf(yytext+2,"%x",&yylval.i);
           yylval.r = (REAL)yylval.i;
           verb_flag = 0;
           tok = INTEGER_TOK;
           goto kblex_exit;

        case L_WHITESPACE:
           if ( nextchar == '+' || nextchar == '-' )
           { state = L_WHITESIGN;
             break;
           }
           if ( nextchar == ' ' || nextchar == '\t' )
           { yyspot--; break;
           }
           else
           { state = L_START;
             kb_unput(nextchar);
             yyspot--;
           }
           break;

        case L_WHITESIGN:
           kb_unput(nextchar);
           if ( !isspace(nextchar) && (yytext[0] == '-') )
           { if ( datafile_flag && uminus_flag && (parens == 0) )
             { tok = UMINUS_TOK;
               goto kblex_exit;
             }
           }
           /* else go back and treat as ordinary - */
           yyspot--;
           state = yytext[0] == '+' ? L_PLUS : L_MINUS;
           break;

        case L_LINESTART:
           if ( nextchar == 0 ) 
           { tok = 0;
             goto kblex_exit;
           }
           if ( nextchar == ' ' || nextchar == '\t' )
             yyspot--;
           else if ( isdigit(nextchar) )
             state = L_LEAD_INTEGER;
           else if ( nextchar == '-' )
             state = L_LEAD_MINUS;
           else
           { kb_unput(nextchar);
             state = L_START;
             yyspot = yytext;
           }
           break;
        
        case L_LEAD_MINUS:
           if ( isdigit(nextchar) )
             state = L_LEAD_INTEGER;
           else
           { kb_unput(nextchar);
             state = L_WHITESIGN;
             yyspot--;
           }
           break;

        case L_LEAD_INTEGER:
           if ( isdigit(nextchar) )
             break;
           if ( nextchar == '.' )
           { state = L_DIGITS_DOT;
             break;
           }           
           if ( toupper(nextchar) == 'X' )
           { state = L_HEXNUMBER;
             break;
           }
           if ( (toupper(nextchar) == 'E') || (toupper(nextchar) == 'D') )
           { state = L_DIGITS_E;
             break;
           }
           if ( nextchar == '@' )
           { state = L_LEAD_INTEGER_AT;
             break;
           }
           /* have LEAD_INTEGER_TOK*/
           kb_unput(nextchar);
           yyspot[-1] = 0;
           yylval.r = atof(yytext);
           yylval.i = atoi(yytext);
           verb_flag = 0;
           if ( lists_flag==LISTS_FULL ) 
           { tok = LEAD_INTEGER_TOK;
             goto kblex_exit;
           }
           else if ( uminus_flag || yytext[0] != '-' )
           { tok = (fabs(yylval.r) > MAXINT) ? REAL_TOK: INTEGER_TOK;
             goto kblex_exit;
           }
           else 
           { for ( yyspot -= 2 ; yyspot != yytext ; yyspot-- ) 
               kb_unput(*yyspot);
             yytext[1] = 0;
             tok = minus_type(yytext[0]);
             goto kblex_exit;
           }
           break;

        case L_DIGITS:
           if ( isdigit(nextchar) )
             break;
           if ( nextchar == '.' )
           { state = L_DIGITS_DOT;
             break;
           }
           if ( (toupper(nextchar) == 'E') || (toupper(nextchar) == 'D') )
           { state = L_DIGITS_E;
             break;
           }
           if ( nextchar == '@' )
           { state = L_INTEGER_AT;
             break;
           } 

           if ( toupper(nextchar) == 'B' )
           { char *c;
             yylval.i = 0;
             for ( c = yytext;  *c=='0' || *c=='1'  ; c++ )
               yylval.i = 2*yylval.i + (*c - '0');
             if ( c == yyspot-1 )
             { yylval.r = (REAL)yylval.i;
               verb_flag = 0;
               tok = INTEGER_TOK;
               goto kblex_exit;
             }
             /* else fall through to ordinary integer */
           }
           /* have INTEGER_TOK*/
           kb_unput(nextchar);
           yyspot[-1] = 0;
           yylval.r = atof(yytext);
           yylval.i = atoi(yytext);
           verb_flag = 0;
           tok = (fabs(yylval.r) > MAXINT) ? REAL_TOK: INTEGER_TOK;
           goto kblex_exit;

        case L_DIGITS_DOT:
           if ( (toupper(nextchar) == 'E') || (toupper(nextchar) == 'D') )
           { state = L_DIGITS_E;
             break;
           }
           if ( isdigit(nextchar) )
             break;
           if ( isalpha(nextchar) )
           { *yyspot = 0;
             tok = VERSIONTOKEN_TOK;
             goto kblex_exit;
           }
           /* have complete REAL */
           kb_unput(nextchar);
           yyspot[-1] = 0;
           yylval.r = atof(yytext);
           verb_flag = 0;
           tok = REAL_TOK;
           goto kblex_exit;

        case L_DOT:
           if ( isdigit(nextchar) )
           { state = L_DIGITS_DOT;
             break;
           }
           /* else just a dot */
           kb_unput(nextchar);
           yyspot[-1] = 0;
           tok = '.';
           goto kblex_exit;

        case L_LEAD_INTEGER_AT:
           if ( isdigit(nextchar) )
             break;
           /* have token */
           kb_unput(nextchar);
           yyspot[-1] = 0;
           yylval.i = atoi(yytext);
           yylval.qnum = atoi(strchr(yytext,'@')+1);
           if ( yylval.i == 0 )
           { sprintf(errmsg, "Missing task number, line %d.",line_no);
		     kb_error(3554,errmsg,DATAFILE_ERROR);
		   }
           verb_flag = 0;
           tok = LEAD_INTEGER_AT_TOK;
           goto kblex_exit;

        case L_INTEGER_AT:
           if ( isdigit(nextchar) )
             break;
           /* have token */
           kb_unput(nextchar);
           yyspot[-1] = 0;
           yylval.i = atoi(yytext);
           yylval.qnum = atoi(strchr(yytext,'@')+1);
           if ( yylval.i == 0 )
           {
		     sprintf(errmsg,"Missing task number. Line %d",line_no);
		     kb_error(3553,errmsg,DATAFILE_ERROR);
		   }
           verb_flag = 0;
           tok = INTEGER_AT_TOK;
           goto kblex_exit;

        case L_SLASH:
           switch ( nextchar )
           { case '*': 
              { /* eat comment */
                register int c;
                in_comment = 1;
                state = L_START;
                for ( ; ; )
                { while ( (c = kb_input_new()) != '*' && c != 0 )
                    if ( c == '\n' ) 
                    { line_no++; /* eat up text of comment */
                      state = L_LINESTART;
                    }
                  if ( c == '*' )
                  { while ( (c = kb_input_new()) == '*' ) ;
                    if ( c == '/' ) break;    /* found the end */
                    if ( c == '\n' ) 
                    { line_no++;
                      state = L_LINESTART;
                    }
                  }
                  if ( c == 0 && yywrap() )
                  { kb_error(2861,"End-of-file in comment\n",RECOVERABLE ); 
                    break; 
                  }
                }
                in_comment = 0;
                yyspot = yytext;
              }
              break;
            
            case '/': state = L_LINECOMMENT; break;
            case '=': *yyspot = 0; yylval.i = DIVASSIGN_OP; 
                       verb_flag = 0;
                       tok=ASSIGNOP_TOK;
                       goto kblex_exit;
                       
            default: kb_unput(nextchar); 
                     yyspot[-1] = 0;
                     verb_flag = 0;
                     tok = '/';
                     goto kblex_exit;
         }
         break;  /* end L_SLASH */

        case L_DIGITS_E:
          if ( isdigit(nextchar) || nextchar == '+' || nextchar == '-' )
          { state = L_DIGITS_E_DIGITS;
            break; 
          }       
		  sprintf(errmsg,"Missing exponent for scientific notation. Line %d\n",line_no);
          kb_error(3664, errmsg,  RECOVERABLE);
          break;

        case L_DIGITS_E_DIGITS:
          if ( isdigit(nextchar) ) 
            break;
          /* have token */
          kb_unput(nextchar);
          yyspot[-1] = 0;
          yylval.r = atof(yytext);
          verb_flag = 0;
          tok = REAL_TOK;
          goto kblex_exit;

        case L_ALPHANUM:
          if ( isalnum(nextchar) || nextchar == '_' )
            break;
          /* have token */
          kb_unput(nextchar);
          yyspot[-1] = 0;
          strncpy(yylval.lexeme,yytext,LEXEME_SIZE);
          retval = macro();
          if ( retval == WAS_MACRO_DEF ) 
          { /* macro() ate up rest of line */
            state = L_LINESTART;
            yyspot = yytext;
          }
          else if ( retval == MACRO_EXPANDED )
          { state = L_START;
            yyspot = yytext;
          }
          else
          {
            tok = identcase(yytext);
            goto kblex_exit;
          }
          break;

        case L_COLON:
          if ( nextchar == '=' )
          { verb_flag = 2; yyspot[-1] = 0; 
            tok = ASSIGN_TOK;
            goto kblex_exit;
          }
          if ( nextchar == ':' )
          { state = L_COLONCOLON;
            break;
          }
          kb_unput(nextchar);
          yyspot[-1] = 0;
          if ( cond_expr_flag )
          { tok = ':';
            goto kblex_exit;
          }
          /* else treat as whitespace */
          yyspot = yytext;
          state = L_START;
          break;

        case L_COLONCOLON:
          if ( nextchar == '=' )
          { verb_flag = 2; yyspot[-1] = 0; 
            tok = PERM_ASSIGN_TOK;
            goto kblex_exit;
          }
          if ( nextchar == ':' )
          { state = L_COLONCOLONCOLON;
            break;
          }          
		  sprintf(errmsg,"Illegal token '::'  Line %d\n",line_no);
		  kb_error(3568,errmsg,RECOVERABLE);
          break;

        case L_COLONCOLONCOLON:
          if ( nextchar == '=' )
          { verb_flag = 2; yyspot[-1] = 0; 
            tok = REDEFINE_TOK;
            goto kblex_exit;
          }          
		  sprintf(errmsg,"Illegal token ':::'  Line %d\n",line_no);
		  kb_error(3569,errmsg,RECOVERABLE);
          break;

        case L_SEMICOLON:
          if ( nextchar == '=' )
          { verb_flag = 2; 
            kb_error(2868,"You mistyped ';=' for ':='?\n",WARNING);
            tok= ASSIGN_TOK;
            goto kblex_exit;
          }
          kb_unput(nextchar);
          yyspot[-1] = 0;
          verb_flag = 1;
          tok = ';';
          goto kblex_exit;
 
        case L_PLUS:
          verb_flag = 0;
          if ( nextchar == '=' )
          { verb_flag = 0; *yyspot = 0;
            yylval.i = PLUSASSIGN_OP;
            tok = ASSIGNOP_TOK;
            goto kblex_exit;
          }
          if ( nextchar == '+' )
          { verb_flag = 0; *yyspot = 0;
            yylval.i = PLUSPLUS_OP;
            tok = INCREMENT_TOK;
            goto kblex_exit;
          }
          kb_unput(nextchar);
          yyspot[-1] = 0;
          tok = '+';
          goto kblex_exit;
          
        case L_MINUS:
          verb_flag = 0;
          if ( nextchar == '=' )
          { verb_flag = 0; yylval.i = SUBASSIGN_OP; 
            *yyspot = 0;
            tok= ASSIGNOP_TOK;
            goto kblex_exit;
          }
          if ( nextchar == '-' )
          { verb_flag = 0; *yyspot = 0;
            yylval.i = MINUSMINUS_OP;
            tok = INCREMENT_TOK;
            goto kblex_exit;
          }
          verb_flag = 0; 
          kb_unput(nextchar);
          tok = minus_type('-');
          goto kblex_exit;

        case L_STAR:
          verb_flag = 0;
          if ( nextchar == '=' )
          { verb_flag = 0; *yyspot = 0;
            yylval.i = MULTASSIGN_OP;
            tok = ASSIGNOP_TOK;
            goto kblex_exit;
          }
          if ( nextchar == '*' )
          { verb_flag = 0; *yyspot = 0; 
            tok = '^';
            goto kblex_exit;
          }
          kb_unput(nextchar);
          yyspot[-1] = 0;
          tok = '*';
          goto kblex_exit;

        case L_BANG:
           verb_flag = 0;
           if ( nextchar == '=' )
           { *yyspot = 0;
             tok = NE_TOK;
             goto kblex_exit;
           }
           kb_unput(nextchar);
           yyspot[-1] = 0;
           tok = NOT_TOK;
           goto kblex_exit;

        case L_PIPE:
           if ( nextchar == '|' )
           { *yyspot = 0;
             tok = OR_TOK;
             goto kblex_exit;
           }
           kb_unput(nextchar);
           yyspot[-1] = 0;
           tok = PIPE_TOK; 
           goto kblex_exit;

        case L_AND:
           if ( nextchar == '&' )
           { *yyspot = 0;
             tok = AND_TOK;
             goto kblex_exit;
           }         
		   sprintf(errmsg,"Illegal token '&'  Line %d\n",line_no);
		   kb_error(3566,errmsg,RECOVERABLE);
          break;

        case L_LINECOMMENT:
          if ( (nextchar == '\n') || (nextchar == 0) )
          { line_no++;
            state = L_LINESTART; 
            yyspot = yytext;
            break;
          }
          yyspot--;  /* don't save comment token */
          break;

        default: 
          fprintf(stderr,"Unhandled state: %d\n",state);
          *yyspot = 0;
          tok = 1;
          goto kblex_exit;
      }
    }
  kblex_exit:
  PROF_FINISH(kblex);
 
  return tok;
  
} // end kblex()
