/* A lexical scanner generated by flex */

/* scanner skeleton version:
 * $Id: vms_yy.c,v 1.2 1996/03/26 22:39:41 georgev Exp $
 */

#define FLEX_SCANNER

#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 <osfcn.h>

/* use prototypes in function declarations */
#define YY_USE_PROTOS

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

#else	/* ! __cplusplus */

#ifdef __STDC__

#ifdef __GNUC__
#include <stddef.h>
void *malloc( size_t );
void free( void* );
#else
#include <stdlib.h>
#endif	/* __GNUC__ */

#define YY_USE_PROTOS
#define YY_USE_CONST

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


#ifdef __TURBOC__
#define YY_USE_CONST
#endif


#ifndef YY_USE_CONST
#define const
#endif


#ifdef YY_USE_PROTOS
#define YY_PROTO(proto) proto
#else
#define YY_PROTO(proto) ()
/* we can't get here if it's an ANSI C compiler, or a C++ compiler,
 * so it's got to be a K&R compiler, and therefore there's no standard
 * place from which to include these definitions
 */
int read();
#endif


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

/* returned upon end-of-file */
#define YY_END_TOK 0

/* copy whatever the last rule matched to the standard output */

/* cast to (char *) is because for 8-bit chars, yytext is (unsigned char *) */
/* this used to be an fputs(), but since the string might contain NUL's,
 * we now use fwrite()
 */
#define ECHO (void) fwrite( (char *) yytext, yyleng, 1, yyout )

/* gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
 * is returned in "result".
 */
#define YY_INPUT(buf,result,max_size) \
	if ( (result = read( fileno(yyin), (char *) buf, max_size )) < 0 ) \
	    YY_FATAL_ERROR( "read() in flex scanner failed" );
#define YY_NULL 0

/* 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.
 */
#define yyterminate() return ( YY_NULL )

/* report a fatal error */

/* The funky do-while is used to turn this macro definition into
 * a single C statement (which needs a semi-colon terminator).
 * This avoids problems with code like:
 *
 * 	if ( something_happens )
 *		YY_FATAL_ERROR( "oops, the something happened" );
 *	else
 *		everything_okay();
 *
 * 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 YY_FATAL_ERROR() call.
 */

#define YY_FATAL_ERROR(msg) \
	do \
		{ \
		(void) fputs( msg, stderr ); \
		(void) putc( '\n', stderr ); \
		exit( 1 ); \
		} \
	while ( 0 )

/* default yywrap function - always treat EOF as an EOF */
#define yywrap() 1

/* 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 *

/* 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 \
	do \
		{ \
		yy_init_buffer( yy_current_buffer, yyin ); \
		yy_load_buffer_state(); \
		} \
	while ( 0 )

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

/* code executed at the end of each rule */
#define YY_BREAK break;

#define YY_END_OF_BUFFER_CHAR 0

#ifndef YY_BUF_SIZE
#define YY_BUF_SIZE (YY_READ_BUF_SIZE * 2) /* size of default input buffer */
#endif

typedef struct yy_buffer_state *YY_BUFFER_STATE;

#define YY_CHAR char
# line 1 "ncgen.l"
#define INITIAL 0
# line 2 "ncgen.l"
/*********************************************************************
 *   Copyright 1993, UCAR/Unidata
 *   See netcdf/COPYRIGHT file for copying and redistribution conditions.
 *   $Id: vms_yy.c,v 1.2 1996/03/26 22:39:41 georgev Exp $
 *********************************************************************/

#define	STREQ(a, b)	(*(a) == *(b) && strcmp((a), (b)) == 0)

/* lex specification for tokens for ncgen */

char errstr[100];		/* for short error messages */
extern long strtol();
void expand_escapes();

#include <string.h>
#include <ctype.h>
#include <limits.h>
#include "ncgentab.h"
# line 25 "ncgen.l"

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

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

/* 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_c_buf_p = yy_cp = yy_bp + n; \
		YY_DO_BEFORE_ACTION; /* set up yytext again */ \
		} \
	while ( 0 )

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


struct yy_buffer_state
    {
    FILE *yy_input_file;

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

    /* size of input buffer in bytes, not including room for EOB characters*/
    int yy_buf_size;	

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

    int yy_eof_status;		/* whether we've seen an EOF on this buffer */
#define EOF_NOT_SEEN 0
    /* "pending" happens when the EOF has been seen but there's still
     * some text process
     */
#define EOF_PENDING 1
#define EOF_DONE 2
    };

static YY_BUFFER_STATE yy_current_buffer;

/* 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 YY_CHAR yy_hold_char;

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



#ifndef YY_USER_ACTION
#define YY_USER_ACTION
#endif

#ifndef YY_USER_INIT
#define YY_USER_INIT
#endif

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

YY_CHAR *yytext;
int yyleng;

FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;

#define YY_END_OF_BUFFER 30
typedef int yy_state_type;
static const short int yy_accept[241] =
    {   0,
        0,    0,   30,   28,   27,   17,   28,   28,   28,   28,
       18,   28,   21,   21,   16,   16,   16,   16,   16,   16,
       16,   16,   16,   16,   16,   16,   16,   16,   16,   16,
       16,   16,   16,   16,   16,   16,   16,   16,   27,    0,
        2,    0,    0,    0,   18,    0,   21,    0,    0,   18,
       18,    0,   19,    1,   22,   22,   22,   21,   20,    0,
       21,   21,   16,   16,   16,   16,   16,   16,   16,    0,
       16,   16,   16,   16,   16,   16,   16,   16,   16,   16,
       16,   16,   16,   16,   16,   16,   16,   16,   16,   16,
       16,   16,   16,   16,   16,   16,    2,   23,    0,    0,

        0,   18,    0,    0,   18,    1,   22,   18,   22,   16,
       16,   16,   16,   16,   16,   16,   16,   16,   16,    7,
       15,   16,   16,   14,   16,   16,   16,   16,   16,   16,
       16,   16,   16,   16,    7,   16,   16,   16,   16,   16,
       16,   26,   24,    0,    0,   18,   14,   18,   19,   18,
        5,    4,   16,   16,   16,   16,   16,   16,   16,   16,
        7,   16,    3,   16,   16,   16,   16,   16,   16,   16,
       16,   16,   16,   16,   16,   16,   24,    0,   25,    0,
       12,   16,   16,   16,   16,   16,   16,   16,    6,   16,
       16,   16,   16,   16,   16,   16,   16,   16,   16,    8,

       16,   16,   16,   16,   16,   16,   16,   16,   16,   16,
       16,   16,   16,   16,   16,   13,   13,   16,   16,   16,
       16,   16,   16,   16,   15,   16,   16,   16,   16,   16,
       16,    9,   16,   16,   16,   16,   11,   16,   10,    0
    } ;

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

       40,   41,   42,   43,   44,   23,   23,   45,   46,   47,
       48,   23,   23,   49,   50,   51,   52,   53,   23,   54,
       55,   23,   56,    1,    1,    1,    1
    } ;

static const YY_CHAR yy_meta[57] =
    {   0,
        1,    1,    2,    1,    3,    1,    4,    1,    1,    5,
        5,    5,    1,    5,    5,    5,    5,    5,    5,    4,
        4,    4,    4,    4,    4,    4,    4,    4,    4,    4,
        4,    4,    4,    4,    1,    5,    5,    5,    5,    5,
        5,    4,    4,    4,    4,    4,    4,    4,    4,    4,
        4,    4,    4,    4,    4,    6
    } ;

static const short int yy_base[251] =
    {   0,
        0,    0,  411,  465,  408,  465,   53,  374,   50,   55,
       86,  399,  124,  171,    0,  373,  385,   58,   64,   54,
       53,  378,   41,  386,  382,  376,  387,  344,  355,   65,
      352,  347,  338,  345,  344,  340,  335,  345,  378,   79,
      465,   80,  374,   76,    0,  180,    0,  110,  342,    0,
      465,  139,  465,    0,  123,  194,  160,  465,  465,    0,
        0,  465,    0,  347,  362,  345,  349,  342,  320,   81,
      174,  235,  344,  322,  339,  327,  341,  336,  338,  349,
      335,  335,  323,  299,  313,  296,  299,  292,  295,  291,
      294,  289,  303,  290,  292,  287,   98,  465,  330,  113,

      329,  271,  307,  203,  307,    0,  465,  212,  130,  314,
      302,  315,  310,  312,  288,    0,    0,  309,  286,  303,
      276,  295,  298,    0,  289,  283,  287,  286,  267,  257,
      269,  264,  266,  266,  261,  258,   73,  254,  249,  253,
      252,  465,  465,  217,  289,  465,  465,    0,    0,  465,
        0,    0,  280,  266,  267,  244,  257,  235,  265,  237,
        0,  262,    0,  248,  252,  261,  260,  225,  226,  219,
      227,  251,  228,  215,  219,  228,  465,  258,  465,  257,
      465,  232,  242,  218,  234,  237,  206,  230,    0,  226,
      228,  192,  201,  200,  220,  197,  193,  198,  211,    0,

      210,  179,  197,  173,  352,  187,  186,  164,  158,  152,
      156,  172,  150,  155,  139,    0,  387,  175,  169,  128,
      133,  118,  129,  111,    0,  127,  108,   82,   89,   69,
       83,    0,   95,   57,   81,   69,  465,   56,  465,  465,
      422,  428,  431,  436,  442,   59,  446,  449,  454,  459
    } ;

static const short int yy_def[251] =
    {   0,
      240,    1,  240,  240,  240,  240,  241,  242,  240,  240,
      240,  240,  240,  240,  243,  243,  243,  243,  243,  243,
      243,  243,  243,  243,  243,  243,  243,  243,  243,  243,
      243,  243,  243,  243,  243,  243,  243,  243,  240,  241,
      240,  241,  240,  244,   11,  240,   14,  240,  240,   11,
      240,  240,  240,  245,   13,   55,   56,  240,  240,  246,
       14,  240,  243,  243,  243,  243,  243,  243,  243,  240,
      243,  243,  243,  243,  243,  243,  243,  243,  243,  243,
      243,  243,  243,  243,  243,  243,  243,  243,  243,  243,
      243,  243,  243,  243,  243,  243,  241,  240,  240,  240,

      247,  240,  240,  240,  240,  245,  240,   57,  246,  243,
      243,  243,  243,  243,  243,  243,  243,  243,  243,  243,
      243,  243,  243,  243,  243,  243,  243,  243,  243,  243,
      243,  243,  243,  243,  243,  243,  243,  243,  243,  243,
      243,  240,  240,  240,  248,  240,  240,   56,   56,  240,
      243,  243,  243,  243,  243,  243,  243,  243,  243,  243,
      243,  243,  243,  243,  243,  243,  243,  243,  243,  243,
      243,  243,  243,  243,  243,  243,  240,  240,  240,  240,
      240,  243,  243,  243,  243,  243,  243,  243,  243,  243,
      243,  243,  243,  243,  243,  243,  243,  243,  243,  243,

      243,  243,  243,  243,  249,  243,  243,  243,  243,  243,
      243,  243,  243,  243,  243,  250,  249,  243,  243,  243,
      243,  243,  243,  243,  243,  243,  243,  243,  243,  243,
      243,  243,  243,  243,  243,  243,  240,  243,  240,    0,
      240,  240,  240,  240,  240,  240,  240,  240,  240,  240
    } ;

static const short int yy_nxt[522] =
    {   0,
        4,    5,    6,    7,    8,    9,   10,   11,   12,   13,
       14,   14,    4,   15,   16,   17,   18,   19,   20,   15,
       15,   21,   15,   22,   15,   23,   15,   24,   25,   15,
       26,   27,   15,   15,    4,   15,   28,   29,   30,   19,
       31,   15,   15,   32,   33,   15,   34,   15,   35,   36,
       15,   37,   38,   15,   15,    4,   41,   45,   78,   46,
       47,   47,   45,  109,   46,   47,   47,   48,  239,   70,
       71,   66,   48,   72,   72,   72,   79,   73,   75,   67,
       49,  239,   41,   97,   68,  100,  100,   42,  172,   48,
      102,  102,  102,  237,   48,   50,   50,   50,   74,   76,

       86,   41,   51,   52,   53,   69,  238,  237,   87,   51,
      173,  236,   88,   42,   42,   70,   70,  143,  235,  102,
      102,  102,  144,  144,   51,   52,   53,  232,  234,  101,
       51,   45,   42,   55,   55,   55,  233,   56,   56,   56,
       56,   57,   56,  232,  104,  104,  107,   58,  105,  105,
      105,  124,   59,  107,  231,  240,   60,  230,   59,   56,
       56,   56,   56,   57,   56,   70,   70,  107,   58,  108,
      108,  108,  229,   59,  107,  228,  240,   60,   45,   59,
       61,   61,   61,   72,   72,   72,  227,   45,   48,   46,
       46,   46,  226,  225,   62,  225,  224,   48,  223,   59,

      222,  240,  221,   56,   56,   56,  161,  220,   59,  219,
       48,   56,  105,  105,  105,   62,  218,  240,  240,   48,
       59,  177,  240,  215,  161,  214,  178,  178,  148,   59,
      149,  213,  212,   56,  211,  150,  210,  205,  205,  209,
      200,  208,  207,  240,   72,   72,   72,  206,  205,  204,
      148,  116,  149,  117,  203,  202,  150,  201,  116,  200,
      199,  179,  177,  198,  197,  189,  196,  195,  194,  163,
      193,  192,  181,  116,  191,  117,  190,  189,  188,  116,
      102,  102,  102,  187,  186,  185,  163,  146,  184,   53,
      183,  182,  181,  179,  146,  176,  175,  174,  163,  161,

      171,  170,  169,  168,  167,  152,  151,  166,  165,  146,
      164,   53,  163,  162,  161,  146,  105,  105,  105,  160,
      159,  158,  157,   51,  156,   53,  155,  154,  153,  152,
       51,  151,  147,  142,  142,  141,  140,  139,  138,  137,
      136,  135,  134,  133,  132,   51,  131,   53,  130,  129,
      128,   51,  216,  216,  216,  216,  216,  216,  127,  216,
      216,  126,  125,  124,  216,  123,  122,  121,  120,  119,
      118,  115,  114,  113,  112,  111,  110,  103,   98,   39,
       96,   95,   94,   93,   92,   91,  216,  216,  216,  216,
      216,  216,  216,   90,  216,  216,   89,   85,   84,  216,

       83,   82,   81,   80,   77,   65,   64,   54,   44,   39,
      240,  240,  240,  240,  240,  240,  240,  240,  240,  240,
      240,  216,   40,   40,   40,   40,   40,   40,   43,   43,
       43,   43,   43,   43,   63,   63,   99,  240,   99,   99,
       99,   99,  106,  240,  106,  106,  106,  106,  145,  240,
      145,  180,  240,  180,  217,  217,  217,  217,  217,  216,
      216,  216,  216,  216,    3,  240,  240,  240,  240,  240,
      240,  240,  240,  240,  240,  240,  240,  240,  240,  240,
      240,  240,  240,  240,  240,  240,  240,  240,  240,  240,
      240,  240,  240,  240,  240,  240,  240,  240,  240,  240,

      240,  240,  240,  240,  240,  240,  240,  240,  240,  240,
      240,  240,  240,  240,  240,  240,  240,  240,  240,  240,
      240
    } ;

static const short int yy_chk[522] =
    {   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,    1,    1,    1,    7,    9,   23,    9,
        9,    9,   10,  246,   10,   10,   10,    9,  238,   19,
       19,   18,   10,   19,   19,   19,   23,   20,   21,   18,
       10,  236,   40,   42,   18,   44,   44,    7,  137,    9,
       70,   70,   70,  235,   10,   11,   11,   11,   20,   21,

       30,   97,   11,   11,   11,   18,  234,  233,   30,   11,
      137,  231,   30,   40,   42,   48,   48,  100,  230,   48,
       48,   48,  100,  100,   11,   11,   11,  229,  228,   44,
       11,   13,   97,   13,   13,   13,  227,   13,   13,   13,
       13,   13,   13,  226,   52,   52,   55,   13,   52,   52,
       52,  224,   13,  109,  223,   55,   13,  222,  109,   13,
       13,   13,   13,   13,   13,   57,   57,   55,   13,   57,
       57,   57,  221,   13,  109,  220,   55,   13,   14,  109,
       14,   14,   14,   71,   71,   71,  219,   46,   14,   46,
       46,   46,  218,  215,   14,  214,  213,   46,  212,   14,

      211,   56,  210,   56,   56,   56,  209,  208,   46,  207,
       14,   56,  104,  104,  104,   14,  206,  108,  108,   46,
       14,  144,   56,  204,  203,  202,  144,  144,  108,   46,
      108,  201,  199,   56,  198,  108,  197,  196,  195,  194,
      193,  192,  191,   56,   72,   72,   72,  190,  188,  187,
      108,   72,  108,   72,  186,  185,  108,  184,   72,  183,
      182,  180,  178,  176,  175,  174,  173,  172,  171,  170,
      169,  168,  167,   72,  166,   72,  165,  164,  162,   72,
      102,  102,  102,  160,  159,  158,  157,  102,  156,  102,
      155,  154,  153,  145,  102,  141,  140,  139,  138,  136,

      135,  134,  133,  132,  131,  130,  129,  128,  127,  102,
      126,  102,  125,  123,  122,  102,  105,  105,  105,  121,
      120,  119,  118,  105,  115,  105,  114,  113,  112,  111,
      105,  110,  103,  101,   99,   96,   95,   94,   93,   92,
       91,   90,   89,   88,   87,  105,   86,  105,   85,   84,
       83,  105,  205,  205,  205,  205,  205,  205,   82,  205,
      205,   81,   80,   79,  205,   78,   77,   76,   75,   74,
       73,   69,   68,   67,   66,   65,   64,   49,   43,   39,
       38,   37,   36,   35,   34,   33,  205,  217,  217,  217,
      217,  217,  217,   32,  217,  217,   31,   29,   28,  217,

       27,   26,   25,   24,   22,   17,   16,   12,    8,    5,
        3,    0,    0,    0,    0,    0,    0,    0,    0,    0,
        0,  217,  241,  241,  241,  241,  241,  241,  242,  242,
      242,  242,  242,  242,  243,  243,  244,    0,  244,  244,
      244,  244,  245,    0,  245,  245,  245,  245,  247,    0,
      247,  248,    0,  248,  249,  249,  249,  249,  249,  250,
      250,  250,  250,  250,  240,  240,  240,  240,  240,  240,
      240,  240,  240,  240,  240,  240,  240,  240,  240,  240,
      240,  240,  240,  240,  240,  240,  240,  240,  240,  240,
      240,  240,  240,  240,  240,  240,  240,  240,  240,  240,

      240,  240,  240,  240,  240,  240,  240,  240,  240,  240,
      240,  240,  240,  240,  240,  240,  240,  240,  240,  240,
      240
    } ;

static yy_state_type yy_last_accepting_state;
static YY_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

/* these variables are all declared out here so that section 3 code can
 * manipulate them
 */
/* points to current character in buffer */
static YY_CHAR *yy_c_buf_p = (YY_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;

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 yyunput YY_PROTO(( YY_CHAR c, YY_CHAR *buf_ptr ));
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 ));

#define yy_new_buffer yy_create_buffer

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

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



    if ( yy_init )
	{
	YY_USER_INIT;

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

	if ( ! yyin )
	    yyin = stdin;

	if ( ! yyout )
	    yyout = stdout;

	if ( yy_current_buffer )
	    yy_init_buffer( yy_current_buffer, yyin );
	else
	    yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE );

	yy_load_buffer_state();

	yy_init = 0;
	}

    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_match:
	do
	    {
	    register YY_CHAR yy_c = yy_ec[*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 = yy_def[yy_current_state];
		if ( yy_current_state >= 241 )
		    yy_c = yy_meta[yy_c];
		}
	    yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
	    ++yy_cp;
	    }
	while ( yy_current_state != 240 );
	yy_cp = yy_last_accepting_cpos;
	yy_current_state = yy_last_accepting_state;

yy_find_action:
	yy_act = yy_accept[yy_current_state];

	YY_DO_BEFORE_ACTION;
	YY_USER_ACTION;

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


	switch ( yy_act )
	    {
	    case 0: /* must backtrack */
	    /* 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:
# line 26 "ncgen.l"
/* comment */ ;
	YY_BREAK
case 2:
# line 28 "ncgen.l"
{
			 if(yyleng > MAXTRST) {
				yyerror("string too long, truncated\n");
			        yytext[MAXTRST-1] = '\0';
			 }
			 expand_escapes(termstring,yytext,yyleng);
		 	 return (TERMSTRING);
		        }
	YY_BREAK
case 3:
# line 37 "ncgen.l"
{return (FLOAT_K);}
	YY_BREAK
case 4:
# line 38 "ncgen.l"
{return (CHAR_K);}
	YY_BREAK
case 5:
# line 39 "ncgen.l"
{return (BYTE_K);}
	YY_BREAK
case 6:
# line 40 "ncgen.l"
{return (SHORT_K);}
	YY_BREAK
case 7:
# line 41 "ncgen.l"
{return (LONG_K);}
	YY_BREAK
case 8:
# line 42 "ncgen.l"
{return (DOUBLE_K);}
	YY_BREAK
case 9:
# line 43 "ncgen.l"
{long_val = -1;
			 return (NC_UNLIMITED_K);}
	YY_BREAK
case 10:
# line 46 "ncgen.l"
{return (DIMENSIONS);}
	YY_BREAK
case 11:
# line 47 "ncgen.l"
{return (VARIABLES);}
	YY_BREAK
case 12:
# line 48 "ncgen.l"
{return (DATA);}
	YY_BREAK
case 13:
# line 49 "ncgen.l"
{
		char *s = (char*)yytext+strlen("netcdf");
		char *t = (char*)yytext+yyleng-1;
		while (isspace(*s))
			s++;
		while (isspace(*t))
			t--;
		t++;
		netcdfname = (char *) emalloc(t-s+1);
		(void) strncpy(netcdfname, s, t-s);
		netcdfname[t-s] = '\0';
		return (NETCDF);
		}
	YY_BREAK
case 14:
# line 63 "ncgen.l"
{    /* double missing values */
		double_val = FILL_DOUBLE;  /* IEEE double infinity */
		return (DOUBLE_CONST);
		}
	YY_BREAK
case 15:
# line 68 "ncgen.l"
{    /* float missing values */
		float_val = FILL_FLOAT;  /* IEEE float infinity */
		return (FLOAT_CONST);
		}
	YY_BREAK
case 16:
# line 72 "ncgen.l"
{
		if ((yylval = lookup(yytext)) == NULL) {
			yylval = install(yytext);
			}
		return (IDENT);
		}
	YY_BREAK
case 17:
# line 79 "ncgen.l"
{
		lineno++ ;
		}
	YY_BREAK
case 18:
# line 82 "ncgen.l"
{
		if (sscanf((char*)yytext, "%le", &double_val) != 1) {
		    sprintf(errstr,"bad long or double constant: %s",(char*)yytext);
		    yyerror(errstr);
		}
                return (DOUBLE_CONST);
                }
	YY_BREAK
case 19:
# line 89 "ncgen.l"
{
		if (sscanf((char*)yytext, "%e", &float_val) != 1) {
		    sprintf(errstr,"bad float constant: %s",(char*)yytext);
		    yyerror(errstr);
		}
                return (FLOAT_CONST);
                }
	YY_BREAK
case 20:
# line 96 "ncgen.l"
{
		if (sscanf((char*)yytext, "%hd", &short_val) != 1) {
		    sprintf(errstr,"bad short constant: %s",(char*)yytext);
		    yyerror(errstr);
		}
		return (SHORT_CONST);
	        }
	YY_BREAK
case 21:
# line 103 "ncgen.l"
{
#ifdef cray	/* machines where longs have more precision than doubles. */
    		char *ptr;
		long_val = strtol((char*)yytext, &ptr, 0);
		if (ptr == (char*)yytext) {
		    sprintf(errstr,"bad long constant: %s",(char*)yytext);
		    yyerror(errstr);
		}
		return (LONG_CONST);
#else		/* machines where doubles have more precision than longs. */
		/*
		 * Because strtol and sscanf with "%ld" may silently give
		 * bad results from undetected overflow for strings like
		 * "30000000000", we scan as double first.
		 */
		double dd;
#ifdef VMS  /* work around bug in VMS strtol() */
		if (STREQ((char*)yytext, "-2147483648")) {
		    long_val = -2147483648;
		    return (LONG_CONST);
		}
#endif /* VMS */
		if (sscanf((char*)yytext, "%le", &dd) != 1) {
		    sprintf(errstr,"bad long constant: %s",(char*)yytext);
		    yyerror(errstr);
		}
		if (dd < LONG_MIN  ||  dd > LONG_MAX) {
		    double_val = dd;
		    return DOUBLE_CONST;
		} else {
		    long_val = dd;
		    return LONG_CONST;
		}
#endif /* cray */
	        }
	YY_BREAK
case 22:
# line 138 "ncgen.l"
{
		long dd;
#ifdef VMS  /* work around bug in VMS strtol() */
		if (STREQ((char*)yytext, "-2147483648")) {
		    long_val = -2147483648;
		    return (LONG_CONST);
		}
#endif /* VMS */
		if (sscanf((char*)yytext, "%li", &dd) != 1) {
		    sprintf(errstr,"bad long constant: %s",(char*)yytext);
		    yyerror(errstr);
		}
		long_val = dd;
		return LONG_CONST;
	        }
	YY_BREAK
case 23:
# line 153 "ncgen.l"
{
	        (void) sscanf((char*)&yytext[1],"%c",&byte_val);
		return (BYTE_CONST);
                }
	YY_BREAK
case 24:
# line 157 "ncgen.l"
{
		byte_val = strtol((char*)&yytext[2], (char **) 0, 8);
		return (BYTE_CONST);
                }
	YY_BREAK
case 25:
# line 161 "ncgen.l"
{
		byte_val = strtol((char*)&yytext[2], (char **) 0, 16);
		return (BYTE_CONST);
                }
	YY_BREAK
case 26:
# line 165 "ncgen.l"
{
	       switch ((char)yytext[2]) {
	          case 'a': byte_val = '\007'; break; /* not everyone under-
						       * stands '\a' yet */
     	          case 'b': byte_val = '\b'; break;
		  case 'f': byte_val = '\f'; break;
		  case 'n': byte_val = '\n'; break;
		  case 'r': byte_val = '\r'; break;
		  case 't': byte_val = '\t'; break;
		  case 'v': byte_val = '\v'; break;
		  case '\\': byte_val = '\\'; break;
		  case '?': byte_val = '\?'; break;
		  case '\'': byte_val = '\''; break;
		  default: byte_val = (char)yytext[2];
	           }
		return (BYTE_CONST);
                }
	YY_BREAK
case 27:
# line 183 "ncgen.l"
{/* whitespace */ ;
		}
	YY_BREAK
case 28:
# line 185 "ncgen.l"
return (yytext[0]) ;
	YY_BREAK
case 29:
# line 186 "ncgen.l"
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 = yy_cp - yytext - 1;

		/* undo the effects of YY_DO_BEFORE_ACTION */
		*yy_cp = yy_hold_char;

		/* 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 yyinput().
		 */
		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 + 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 + 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_last_accepting_cpos;
			    yy_current_state = yy_last_accepting_state;
			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 + YY_MORE_ADJ;

			    yy_act = YY_STATE_EOF((yy_start - 1) / 2);
			    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 + yy_amount_of_matched_text;

			yy_current_state = yy_get_previous_state();

			yy_cp = yy_c_buf_p;
			yy_bp = yytext + 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 + YY_MORE_ADJ;
			goto yy_find_action;
		    }
		break;
		}

	    default:
#ifdef FLEX_DEBUG
		printf( "action # %d\n", yy_act );
#endif
		YY_FATAL_ERROR(
			"fatal flex scanner internal error--no action found" );
	    }
	}
    }


/* yy_get_next_buffer - try to read in a new buffer
 *
 * synopsis
 *     int yy_get_next_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 YY_CHAR *dest = yy_current_buffer->yy_ch_buf;
    register YY_CHAR *source = yytext - 1; /* copy prev. char, too */
    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" );

    /* try to read more data */

    /* first move last chars to start of buffer */
    number_to_move = yy_c_buf_p - yytext;

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

    if ( yy_current_buffer->yy_eof_status != EOF_NOT_SEEN )
	/* 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;

	if ( num_to_read > YY_READ_BUF_SIZE )
	    num_to_read = YY_READ_BUF_SIZE;

	else if ( num_to_read <= 0 )
	    YY_FATAL_ERROR( "fatal error - scanner input buffer overflow" );

	/* 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 == 1 )
	    {
	    ret_val = EOB_ACT_END_OF_FILE;
	    yy_current_buffer->yy_eof_status = EOF_DONE;
	    }

	else
	    {
	    ret_val = EOB_ACT_LAST_MATCH;
	    yy_current_buffer->yy_eof_status = 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 begins at the second character in yy_ch_buf; the first
     * character is the one which preceded it before reading in the latest
     * buffer; it needs to be kept around in case it's a newline, so
     * yy_get_previous_state() will have with '^' rules active
     */

    yytext = &yy_current_buffer->yy_ch_buf[1];

    return ( ret_val );
    }


/* yy_get_previous_state - get the state just before the EOB char was reached
 *
 * synopsis
 *     yy_state_type yy_get_previous_state();
 */

static yy_state_type yy_get_previous_state()

    {
    register yy_state_type yy_current_state;
    register YY_CHAR *yy_cp;

    yy_current_state = yy_start;

    for ( yy_cp = yytext + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp )
	{
	register YY_CHAR yy_c = (*yy_cp ? yy_ec[*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 = yy_def[yy_current_state];
	    if ( yy_current_state >= 241 )
		yy_c = yy_meta[yy_c];
	    }
	yy_current_state = yy_nxt[yy_base[yy_current_state] + 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( register yy_state_type yy_current_state )
#else
static yy_state_type yy_try_NUL_trans( yy_current_state )
register yy_state_type yy_current_state;
#endif

    {
    register int yy_is_jam;
    register YY_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 = yy_def[yy_current_state];
	if ( yy_current_state >= 241 )
	    yy_c = yy_meta[yy_c];
	}
    yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
    yy_is_jam = (yy_current_state == 240);

    return ( yy_is_jam ? 0 : yy_current_state );
    }


#ifdef YY_USE_PROTOS
static void yyunput( YY_CHAR c, register YY_CHAR *yy_bp )
#else
static void yyunput( c, yy_bp )
YY_CHAR c;
register YY_CHAR *yy_bp;
#endif

    {
    register YY_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 */
	register int number_to_move = yy_n_chars + 2; /* +2 for EOB chars */
	register YY_CHAR *dest =
	    &yy_current_buffer->yy_ch_buf[yy_current_buffer->yy_buf_size + 2];
	register YY_CHAR *source =
	    &yy_current_buffer->yy_ch_buf[number_to_move];

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

	yy_cp += dest - source;
	yy_bp += 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" );
	}

    if ( yy_cp > yy_bp && yy_cp[-1] == '\n' )
	yy_cp[-2] = '\n';

    *--yy_cp = c;

    /* note: the formal parameter *must* be called "yy_bp" for this
     *       macro to now work correctly
     */
    YY_DO_BEFORE_ACTION; /* set up yytext again */
    }


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

    {
    int c;
    YY_CHAR *yy_cp = yy_c_buf_p;

    *yy_cp = 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 */
	    yytext = yy_c_buf_p;
	    ++yy_c_buf_p;

	    switch ( yy_get_next_buffer() )
		{
		case EOB_ACT_END_OF_FILE:
		    {
		    if ( yywrap() )
			{
			yy_c_buf_p = yytext + YY_MORE_ADJ;
			return ( EOF );
			}

		    YY_NEW_FILE;

#ifdef __cplusplus
		    return ( yyinput() );
#else
		    return ( input() );
#endif
		    }
		    break;

		case EOB_ACT_CONTINUE_SCAN:
		    yy_c_buf_p = yytext + YY_MORE_ADJ;
		    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 = *yy_c_buf_p;
    yy_hold_char = *++yy_c_buf_p;

    return ( c );
    }


#ifdef YY_USE_PROTOS
void yyrestart( FILE *input_file )
#else
void yyrestart( input_file )
FILE *input_file;
#endif

    {
    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 = 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) malloc( 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 = (YY_CHAR *) malloc( (unsigned) (b->yy_buf_size + 2) );

    if ( ! b->yy_ch_buf )
	YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );

    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 == yy_current_buffer )
	yy_current_buffer = (YY_BUFFER_STATE) 0;

    free( (char *) b->yy_ch_buf );
    free( (char *) b );
    }


#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

    {
    b->yy_input_file = file;

    /* we put in the '\n' and start reading from [1] so that an
     * initial match-at-newline will be true.
     */

    b->yy_ch_buf[0] = '\n';
    b->yy_n_chars = 1;

    /* 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[1] = YY_END_OF_BUFFER_CHAR;
    b->yy_ch_buf[2] = YY_END_OF_BUFFER_CHAR;

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

    b->yy_eof_status = EOF_NOT_SEEN;
    }
# line 186 "ncgen.l"
