Logo Search packages:      
Sourcecode: nco version File versions  Download package

ncap_lex.c

#line 3 "ncap_lex.c"

#define  YY_INT_ALIGNED short int

/* A lexical scanner generated by flex */

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

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

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

/* end standard C headers. */

/* flex integer type definitions */

#ifndef FLEXINT_H
#define FLEXINT_H

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

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

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

#endif /* ! FLEXINT_H */

#ifdef __cplusplus

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

#else /* ! __cplusplus */

#if __STDC__

#define YY_USE_CONST

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

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

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

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

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

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

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

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

#define YY_END_OF_BUFFER_CHAR 0

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

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

extern int yyleng;

extern FILE *yyin, *yyout;

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

    #define YY_LESS_LINENO(n)
    
/* Return all but the first "n" matched characters back to the input stream. */
#define yyless(n) \
      do \
            { \
            /* Undo effects of setting up yytext. */ \
        int yyless_macro_arg = (n); \
        YY_LESS_LINENO(yyless_macro_arg);\
            *yy_cp = (yy_hold_char); \
            YY_RESTORE_YY_MORE_OFFSET \
            (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
            YY_DO_BEFORE_ACTION; /* set up 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).
 */

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

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

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

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

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

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

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

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

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

      int yy_buffer_status;

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

      };
#endif /* !YY_STRUCT_YY_BUFFER_STATE */

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

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

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

/* yy_hold_char holds the character lost when 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 (FILE *input_file  );
void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer  );
YY_BUFFER_STATE yy_create_buffer (FILE *file,int size  );
void yy_delete_buffer (YY_BUFFER_STATE b  );
void yy_flush_buffer (YY_BUFFER_STATE b  );
void yypush_buffer_state (YY_BUFFER_STATE new_buffer  );
void yypop_buffer_state (void );

static void yyensure_buffer_stack (void );
static void yy_load_buffer_state (void );
static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file  );

#define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER )

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

void *yyalloc (yy_size_t  );
void *yyrealloc (void *,yy_size_t  );
void yyfree (void *  );

#define yy_new_buffer yy_create_buffer

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

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

#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)

/* Begin user sect3 */

typedef unsigned char YY_CHAR;

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

typedef int yy_state_type;

extern int yylineno;

int yylineno = 1;

extern char *yytext;
#define yytext_ptr yytext

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

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

#define YY_NUM_RULES 60
#define YY_END_OF_BUFFER 61
/* This struct is not used in this scanner,
   but its presence is necessary. */
struct yy_trans_info
      {
      flex_int32_t yy_verify;
      flex_int32_t yy_nxt;
      };
static yyconst flex_int16_t yy_acclist[349] =
    {   0,
        9,    9,    2,    2,   61,   59,   60,   13,   59,   60,
       12,   60,   59,   60,   59,   60,   59,   60,   59,   60,
       59,   60,   16,   59,   60,   59,   60,   18,   59,   60,
       58,   59,   60,   55,   59,   60,   57,   59,   60,   56,
       59,   60,   46,   59,   60,16427,   46,   59,   60,16427,
       46,   59,   60,16427,   46,   59,   60,16427,   46,   59,
       60,16427,   46,   59,   60,16427,   46,   59,   60,16427,
       46,   59,   60,16427,   46,   59,   60,16427,   46,   59,
       60,16427,   46,   59,   60,16427,   46,   59,   60,16427,
       46,   59,   60,16427,   46,   59,   60,16427,   59,   60,

        6,   60,    5,   60,    6,   60,   60,    9,   60,    9,
       60,   60,   60,    3,   60,    2,   60,   60,   60,   60,
       13,   52,   15,   49,    8,   16,   16,   17,    4,   14,
       16,   18,   20,   18,   19,   53,   51,   54, 8235,   46,
    16427,   45,   16,   46,16427,   46,16427,   46,16427,   46,
    16427,   46,16427,   46,16427,   46,16427,   46,16427,   46,
    16427,   46,16427,   22,   46,16427,   46,16427,   46,16427,
       46,16427,   46,16427,   46,16427,   46,16427,   46,16427,
       46,16427,   46,16427,   46,16427,   46,16427,   50,    7,
        9,    9,    9,   10,    3,    2,   47,   48,   16,   14,

       16,   44,   16,   46,16427,   17,   46,16427,   46,16427,
       46,16427,   46,16427,   46,16427,   46,16427,   46,16427,
       46,16427,   46,16427,   46,16427,   46,16427,   46,16427,
       46,16427,   46,16427,   46,16427,   46,16427,   46,16427,
       46,16427,   46,16427,   46,16427,   46,16427,   11,   16,
       44,   42,   46,16427,   25, 8235,   46,16427,   27, 8235,
       46,16427,   46,16427,   46,16427,   46,16427,   46,16427,
       46,16427,   39, 8235,   29, 8235,   28, 8235,   46,16427,
       31, 8235,   33, 8235,   46,16427,   46,16427,   30, 8235,
       46,16427,   34, 8235,   46,16427,   36, 8235,   37, 8235,

       46,16427,   46,16427,   46,16427,   46,16427,   32, 8235,
       23,   46,16427,   46,16427,   46,16427,   46,16427,   46,
    16427,   40, 8235,   46,16427,   46,16427,   38, 8235,   46,
    16427,   26, 8235,   41, 8235,   46,16427,   46,16427,   35,
     8235,    1,   21,   46,16427,   24,   46,16427
    } ;

static yyconst flex_int16_t yy_accept[223] =
    {   0,
        1,    1,    1,    1,    1,    2,    3,    4,    5,    5,
        5,    5,    5,    6,    8,   11,   13,   15,   17,   19,
       21,   23,   26,   28,   31,   34,   37,   40,   43,   47,
       51,   55,   59,   63,   67,   71,   75,   79,   83,   87,
       91,   95,   99,  101,  103,  105,  107,  108,  110,  112,
      113,  114,  116,  118,  119,  120,  121,  122,  123,  123,
      124,  124,  125,  126,  127,  128,  128,  129,  130,  131,
      132,  133,  134,  134,  135,  136,  137,  138,  139,  139,
      140,  142,  142,  143,  143,  146,  148,  150,  152,  154,
      156,  158,  160,  162,  164,  167,  169,  171,  173,  175,

      177,  179,  181,  183,  185,  187,  189,  190,  191,  191,
      191,  192,  193,  194,  194,  195,  196,  197,  197,  198,
      198,  199,  199,  199,  200,  201,  202,  203,  206,  209,
      211,  213,  215,  217,  219,  221,  223,  225,  227,  229,
      231,  233,  235,  237,  239,  241,  243,  245,  247,  249,
      250,  250,  251,  252,  255,  255,  257,  259,  259,  261,
      263,  265,  267,  269,  271,  273,  273,  275,  275,  277,
      277,  279,  281,  281,  283,  283,  285,  287,  289,  289,
      291,  293,  293,  295,  295,  297,  297,  299,  299,  301,
      303,  305,  307,  309,  309,  311,  314,  316,  318,  318,

      320,  322,  322,  324,  326,  328,  328,  330,  332,  332,
      332,  334,  334,  336,  338,  340,  340,  342,  343,  346,
      349,  349
    } ;

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

       40,   41,   42,   43,   44,   23,   45,   46,   47,   48,
       49,   50,   23,   51,   52,   53,   54,   55,   56,   57,
       58,   59,    1,   60,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,

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

static yyconst flex_int32_t yy_meta[61] =
    {   0,
        1,    2,    3,    4,    1,    1,    1,    1,    5,    1,
        1,    1,    1,    1,    6,    6,    6,    1,    1,    1,
        1,    5,    7,    7,    7,    7,    7,    7,    7,    7,
        7,    7,    5,    1,    7,    7,    7,    7,    7,    7,
        7,    7,    7,    7,    7,    7,    7,    7,    7,    7,
        7,    7,    7,    7,    7,    7,    7,    7,    7,    1
    } ;

static yyconst flex_int16_t yy_base[235] =
    {   0,
        0,    0,   58,   59,   61,   64,   69,   77,  242,  240,
      230,  213,  238,  886,   72,  886,  211,   79,  185,  212,
      200,   84,   72,  118,  886,  182,  170,  162,   83,  144,
       84,   85,   93,  132,  158,  159,  165,  167,  179,  200,
       99,  212,  112,  886,  886,  143,   93,  191,  182,  216,
      135,    0,  110,  886,  176,  215,  135,  886,  140,  886,
       97,  886,  886,    0,  886,  220,  886,  886,    0,    0,
        0,  886,  236,  886,  886,  886,  886,  886,  169,  886,
      235,    0,  886,  225,  265,  255,  262,  263,  293,  296,
      312,  318,  319,  321,  328,  338,  353,  354,  355,  370,

      374,  376,  386,  390,  396,  412,  886,  886,  220,  115,
      305,  423,  363,  118,  221,    0,  195,  224,  886,  244,
      886,   82,  416,  423,    0,  426,    0,  452,  454,  462,
      464,  466,  474,  489,  497,  499,  501,  511,  531,  534,
      537,  538,  541,  553,  557,  569,  573,  576,  585,  886,
       58,  886,    0,  588,  252,  886,  592,  261,  886,  595,
      604,  607,  626,  627,  630,  315,  886,  327,  886,  329,
      886,  634,  380,  886,  397,  886,  642,  664,  413,  886,
      665,  440,  886,   37,  667,  450,  886,  473,  886,  668,
      674,  690,  700,  485,  886,  702,  706,  710,   51,  712,

      732,  500,  886,  738,  742,  508,  886,  744,   44,  522,
      886,  545,  886,  748,  752,  572,  886,  886,  754,  758,
      886,  809,  816,  823,  830,  837,  841,  848,  855,  862,
      869,  876,   70,  878
    } ;

static yyconst flex_int16_t yy_def[235] =
    {   0,
      221,    1,  222,  222,  223,  223,  224,  224,  225,  225,
      225,  225,  221,  221,  221,  221,  221,  226,  221,  221,
      221,  221,  221,  221,  221,  221,  221,  221,  227,  227,
      227,  227,  227,  227,  227,  227,  227,  227,  227,  227,
      227,  227,  221,  221,  221,  221,  228,  228,  221,  228,
      221,  229,  221,  221,  230,  231,  221,  221,  226,  221,
      221,  221,  221,   22,  221,  221,  221,  221,  232,   22,
       24,  221,  221,  221,  221,  221,  221,  221,  221,  221,
      227,  233,  221,  221,  227,  227,  227,  227,  227,  227,
      227,  227,  227,  227,  227,  227,  227,  227,  227,  227,

      227,  227,  227,  227,  227,  227,  221,  221,  228,  221,
      228,  221,  221,  221,  228,  229,  221,  230,  221,  231,
      221,  221,  221,  221,  232,  221,  234,  227,  227,  227,
      227,  227,  227,  227,  227,  227,  227,  227,  227,  227,
      227,  227,  227,  227,  227,  227,  227,  227,  227,  221,
      221,  221,  234,  227,  221,  221,  227,  221,  221,  227,
      227,  227,  227,  227,  227,  221,  221,  221,  221,  221,
      221,  227,  221,  221,  221,  221,  227,  227,  221,  221,
      227,  221,  221,  221,  227,  221,  221,  221,  221,  227,
      227,  227,  227,  221,  221,  227,  227,  227,  221,  227,

      227,  221,  221,  227,  227,  221,  221,  227,  221,  221,
      221,  221,  221,  227,  227,  221,  221,  221,  227,  227,
        0,  221,  221,  221,  221,  221,  221,  221,  221,  221,
      221,  221,  221,  221
    } ;

static yyconst flex_int16_t yy_nxt[947] =
    {   0,
       14,   15,   16,   15,   17,   18,   19,   20,   21,   14,
       14,   14,   22,   23,   24,   24,   24,   25,   26,   27,
       28,   14,   29,   29,   29,   30,   29,   29,   29,   31,
       29,   29,   14,   14,   29,   32,   33,   34,   35,   30,
       36,   29,   29,   37,   29,   29,   38,   29,   29,   39,
       29,   40,   41,   42,   29,   29,   29,   29,   29,   43,
       45,   45,   48,   49,   48,   48,   49,   48,   46,   46,
       53,   54,   53,   57,   50,   57,  127,   50,   53,   54,
       53,   60,   68,  218,   60,   69,   79,   79,   79,  209,
      199,   80,   80,   80,   51,  110,   79,   51,   64,   64,

       64,   80,   79,  184,   82,   82,   82,   80,   65,   66,
       67,  117,   65,  117,   82,   83,   83,   83,   86,  151,
       82,   87,   65,   66,   67,   83,  110,  150,  114,   65,
       70,   83,   71,   71,   71,   79,   57,   88,   57,   89,
       80,   72,   60,   73,  122,   60,   74,   79,  114,   75,
       90,  104,   80,   82,   72,   84,  108,   73,   85,   85,
       85,   79,   79,   74,   83,   82,   80,   80,   79,   75,
       79,  107,   79,   80,   91,   80,   83,   80,  119,   82,
       82,   78,   79,  113,  113,  113,   82,   80,   82,   77,
       83,   83,  111,  112,  111,  114,  117,   83,  117,   83,

       82,   76,   97,   79,   93,   95,   92,   94,   80,  119,
       98,   83,   96,   63,   99,   79,  100,  121,  110,   62,
       80,   82,  110,  110,  110,  115,  119,  101,   61,  102,
       58,  123,   83,   82,  124,  124,  124,  221,   79,  126,
      126,  126,  103,   80,   83,   56,  121,   84,  121,  110,
      126,  126,  126,  110,  110,  155,   82,  119,   79,  105,
      156,  106,   56,   80,  158,   79,   79,   83,   79,  159,
       80,   80,   55,   80,   55,  221,   82,  121,  221,   85,
       85,   85,  221,   82,   82,  130,   82,   83,  221,  128,
      221,  129,  221,  128,   83,   83,   79,   83,  221,   79,

      221,   80,  221,  128,   80,  129,  111,  112,  111,  221,
      128,  132,  221,  131,   82,   79,  221,   82,  166,  221,
       80,   79,   79,  167,   79,   83,   80,   80,   83,   80,
      168,   79,  170,   82,  133,  169,   80,  171,  110,   82,
       82,   79,   82,  221,   83,  221,   80,  135,  134,   82,
       83,   83,  221,   83,  221,  221,   79,   79,   79,   82,
       83,   80,   80,   80,  113,  113,  113,  137,  221,  138,
       83,  136,  221,   79,   82,   82,   82,   79,   80,   79,
      221,  221,   80,  173,   80,   83,   83,   83,  174,   79,
      139,   82,  142,   79,   80,   82,  221,   82,   80,   79,

      175,  141,   83,  221,   80,  176,   83,   82,   83,  140,
      221,   82,  221,  221,  143,   79,  179,   82,   83,  145,
       80,  180,   83,  221,  113,  113,  113,  221,   83,  144,
      124,  124,  124,   82,  146,  147,  114,  124,  124,  124,
      126,  126,  126,  182,   83,  148,  221,   65,  183,   67,
      152,   65,   67,  186,  152,   79,  149,   79,  187,  221,
       80,   65,   80,   67,  152,   79,   67,  155,   65,   79,
       80,  152,  156,   82,   80,   82,  188,  158,  221,  221,
      221,  189,  159,   82,   83,   82,   83,   82,  194,  154,
      221,  221,   79,  195,   83,   82,   83,   80,   83,  221,

       79,  221,   79,  202,   79,   80,   83,   80,  203,   80,
       82,  206,  221,  221,   79,  221,  207,  157,   82,   80,
       82,   83,   82,  221,  221,  210,  164,  165,  160,   83,
      211,   83,   82,   83,  166,  162,  163,  168,  221,  167,
      170,   79,  169,   83,  173,  171,   80,  161,  212,  174,
      221,  221,   82,  213,  221,   82,  175,  221,   82,   82,
       79,  176,   82,   83,  221,   80,   83,  221,  221,   83,
       83,  221,   79,   83,   82,  216,  179,   80,   82,   79,
      217,  180,  172,  221,   80,   83,  221,  221,  182,   83,
       82,   79,  221,  183,   82,   79,   80,   82,  186,  221,

       80,   83,  221,  187,  177,   83,   82,  188,   83,   82,
       79,  181,  189,   82,  221,   80,   82,   83,  221,  178,
       83,  221,  221,  221,   83,   82,  221,   83,   82,   79,
       79,  221,  221,   79,   80,   80,   83,  194,   80,   83,
      221,  221,  195,  221,  185,   79,  221,   82,   82,  221,
       80,   82,  190,  221,  221,   82,  221,  221,   83,   83,
      221,  192,   83,   82,  193,  221,   83,   79,   79,  221,
       79,   79,   80,   80,   83,   80,   80,  202,  191,  221,
      221,  221,  203,  221,  221,   82,   82,  221,   82,   82,
      221,  221,  221,   79,  196,   82,   83,   83,   80,   83,

       83,  221,  198,   79,  221,   79,   83,  201,   80,  206,
       80,   82,  221,   79,  207,  210,  197,  200,   80,  221,
      211,   82,   83,   82,  221,  221,  221,   82,  221,  221,
      221,   82,   83,   82,   83,  212,  221,  221,   83,  221,
      213,   79,   83,  221,   83,   79,   80,  216,  204,  221,
       80,   79,  217,   82,  208,   79,   80,   79,  205,   82,
       80,   79,   80,   82,   83,   82,   80,  221,  221,   82,
       83,  221,  221,   82,   83,   82,   83,  221,  221,   82,
       83,  221,  221,  221,   83,  221,   83,  221,  221,  221,
       83,  221,  221,  221,  221,  214,  221,  221,  221,  215,

      221,  221,  221,  221,  219,  221,  221,  221,  220,   44,
       44,   44,   44,   44,   44,   44,   47,   47,   47,   47,
       47,   47,   47,   52,   52,   52,   52,   52,   52,   52,
       54,   54,   54,   54,   54,   54,   54,   59,   59,   59,
       59,   59,   59,   59,   81,   81,   81,   81,  109,  109,
      109,  109,  109,  109,  109,  116,  221,  221,  221,  116,
      116,  116,  118,  118,  118,  118,  118,  118,  118,  120,
      120,  120,  120,  120,  120,  120,  125,  125,  221,  125,
      125,  125,  125,  153,  153,   13,  221,  221,  221,  221,
      221,  221,  221,  221,  221,  221,  221,  221,  221,  221,

      221,  221,  221,  221,  221,  221,  221,  221,  221,  221,
      221,  221,  221,  221,  221,  221,  221,  221,  221,  221,
      221,  221,  221,  221,  221,  221,  221,  221,  221,  221,
      221,  221,  221,  221,  221,  221,  221,  221,  221,  221,
      221,  221,  221,  221,  221,  221
    } ;

static yyconst flex_int16_t yy_chk[947] =
    {   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,    1,    1,    1,    1,
        3,    4,    5,    5,    5,    6,    6,    6,    3,    4,
        7,    7,    7,   15,    5,   15,  233,    6,    8,    8,
        8,   18,   23,  209,   18,   23,   29,   31,   32,  199,
      184,   29,   31,   32,    5,   47,   33,    6,   22,   22,

       22,   33,   41,  151,   29,   31,   32,   41,   22,   22,
       22,   53,   22,   53,   33,   29,   31,   32,   31,  122,
       41,   32,   22,   22,   22,   33,   47,  114,  110,   22,
       24,   41,   24,   24,   24,   34,   57,   32,   57,   32,
       34,   24,   59,   24,   61,   59,   24,   30,   51,   24,
       33,   41,   30,   34,   24,   30,   46,   24,   30,   30,
       30,   35,   36,   24,   34,   30,   35,   36,   37,   24,
       38,   43,   79,   37,   34,   38,   30,   79,   55,   35,
       36,   28,   39,   49,   49,   49,   37,   39,   38,   27,
       35,   36,   48,   48,   48,   49,  117,   37,  117,   38,

       39,   26,   38,   40,   36,   37,   35,   36,   40,   55,
       38,   39,   37,   21,   39,   42,   39,   56,   50,   20,
       42,   40,  109,  115,   48,   50,  118,   39,   19,   39,
       17,   66,   40,   42,   66,   66,   66,   13,   81,   84,
       84,   84,   40,   81,   42,   12,  120,   73,   56,   50,
       73,   73,   73,  109,  115,  155,   81,  118,   86,   42,
      155,   42,   11,   86,  158,   87,   88,   81,   85,  158,
       87,   88,   10,   85,    9,    0,   86,  120,    0,   85,
       85,   85,    0,   87,   88,   86,   85,   86,    0,   85,
        0,   85,    0,   85,   87,   88,   89,   85,    0,   90,

        0,   89,    0,   85,   90,   85,  111,  111,  111,    0,
       85,   88,    0,   87,   89,   91,    0,   90,  166,    0,
       91,   92,   93,  166,   94,   89,   92,   93,   90,   94,
      168,   95,  170,   91,   89,  168,   95,  170,  111,   92,
       93,   96,   94,    0,   91,    0,   96,   91,   90,   95,
       92,   93,    0,   94,    0,    0,   97,   98,   99,   96,
       95,   97,   98,   99,  113,  113,  113,   93,    0,   94,
       96,   92,    0,  100,   97,   98,   99,  101,  100,  102,
        0,    0,  101,  173,  102,   97,   98,   99,  173,  103,
       96,  100,   99,  104,  103,  101,    0,  102,  104,  105,

      175,   98,  100,    0,  105,  175,  101,  103,  102,   97,
        0,  104,    0,    0,  100,  106,  179,  105,  103,  102,
      106,  179,  104,    0,  112,  112,  112,    0,  105,  101,
      123,  123,  123,  106,  103,  104,  112,  124,  124,  124,
      126,  126,  126,  182,  106,  105,    0,  124,  182,  124,
      126,  124,  126,  186,  126,  128,  106,  129,  186,    0,
      128,  124,  129,  124,  126,  130,  126,  131,  124,  132,
      130,  126,  131,  128,  132,  129,  188,  133,    0,    0,
        0,  188,  133,  130,  128,  131,  129,  132,  194,  130,
        0,    0,  134,  194,  130,  133,  131,  134,  132,    0,

      135,    0,  136,  202,  137,  135,  133,  136,  202,  137,
      134,  206,    0,    0,  138,    0,  206,  132,  135,  138,
      136,  134,  137,    0,    0,  210,  138,  138,  134,  135,
      210,  136,  138,  137,  139,  136,  137,  140,    0,  139,
      141,  142,  140,  138,  143,  141,  142,  135,  212,  143,
        0,    0,  139,  212,    0,  140,  144,    0,  141,  142,
      145,  144,  143,  139,    0,  145,  140,    0,    0,  141,
      142,    0,  146,  143,  144,  216,  147,  146,  145,  148,
      216,  147,  142,    0,  148,  144,    0,    0,  149,  145,
      146,  154,    0,  149,  147,  157,  154,  148,  160,    0,

      157,  146,    0,  160,  145,  147,  149,  161,  148,  154,
      162,  148,  161,  157,    0,  162,  160,  149,    0,  146,
      154,    0,    0,    0,  157,  161,    0,  160,  162,  163,
      164,    0,    0,  165,  163,  164,  161,  172,  165,  162,
        0,    0,  172,    0,  157,  177,    0,  163,  164,    0,
      177,  165,  162,    0,    0,  172,    0,    0,  163,  164,
        0,  164,  165,  177,  165,    0,  172,  178,  181,    0,
      185,  190,  178,  181,  177,  185,  190,  191,  163,    0,
        0,    0,  191,    0,    0,  178,  181,    0,  185,  190,
        0,    0,    0,  192,  177,  191,  178,  181,  192,  185,

      190,    0,  181,  193,    0,  196,  191,  190,  193,  197,
      196,  192,    0,  198,  197,  200,  178,  185,  198,    0,
      200,  193,  192,  196,    0,    0,    0,  197,    0,    0,
        0,  198,  193,  200,  196,  201,    0,    0,  197,    0,
      201,  204,  198,    0,  200,  205,  204,  208,  192,    0,
      205,  214,  208,  201,  198,  215,  214,  219,  193,  204,
      215,  220,  219,  205,  201,  208,  220,    0,    0,  214,
      204,    0,    0,  215,  205,  219,  208,    0,    0,  220,
      214,    0,    0,    0,  215,    0,  219,    0,    0,    0,
      220,    0,    0,    0,    0,  204,    0,    0,    0,  205,

        0,    0,    0,    0,  214,    0,    0,    0,  215,  222,
      222,  222,  222,  222,  222,  222,  223,  223,  223,  223,
      223,  223,  223,  224,  224,  224,  224,  224,  224,  224,
      225,  225,  225,  225,  225,  225,  225,  226,  226,  226,
      226,  226,  226,  226,  227,  227,  227,  227,  228,  228,
      228,  228,  228,  228,  228,  229,    0,    0,    0,  229,
      229,  229,  230,  230,  230,  230,  230,  230,  230,  231,
      231,  231,  231,  231,  231,  231,  232,  232,    0,  232,
      232,  232,  232,  234,  234,  221,  221,  221,  221,  221,
      221,  221,  221,  221,  221,  221,  221,  221,  221,  221,

      221,  221,  221,  221,  221,  221,  221,  221,  221,  221,
      221,  221,  221,  221,  221,  221,  221,  221,  221,  221,
      221,  221,  221,  221,  221,  221,  221,  221,  221,  221,
      221,  221,  221,  221,  221,  221,  221,  221,  221,  221,
      221,  221,  221,  221,  221,  221
    } ;

extern int yy_flex_debug;
int yy_flex_debug = 0;

static yy_state_type *yy_state_buf=0, *yy_state_ptr=0;
static char *yy_full_match;
static int yy_lp;
static int yy_looking_for_trail_begin = 0;
static int yy_full_lp;
static int *yy_full_state;
#define YY_TRAILING_MASK 0x2000
#define YY_TRAILING_HEAD_MASK 0x4000
#define REJECT \
{ \
*yy_cp = (yy_hold_char); /* undo effects of setting up yytext */ \
yy_cp = (yy_full_match); /* restore poss. backed-over text */ \
(yy_lp) = yy_full_lp; /* restore orig. accepting pos. */ \
(yy_state_ptr) = yy_full_state; /* restore orig. state */ \
yy_current_state = *(yy_state_ptr); /* restore curr. state */ \
++(yy_lp); \
goto find_rule; \
}

#define yymore() yymore_used_but_not_detected
#define YY_MORE_ADJ 0
#define YY_RESTORE_YY_MORE_OFFSET
char *yytext;
#line 1 "ncap_lex.l"
#line 2 "ncap_lex.l"
  /* Everything from here to closing brace is placed at top of lexer */

  /* Purpose: Token generator for ncap parser */

  /* Copyright (C) 1995--2004 Charlie Zender
     
   This software may be modified and/or re-distributed under the terms of the GNU General Public License (GPL) Version 2
   The full license text is at http://www.gnu.ai.mit.edu/copyleft/gpl.html 
   and in the file nco/doc/LICENSE in the NCO source distribution.
   
   As a special exception to the terms of the GPL, you are permitted 
   to link the NCO source code with the DODS, HDF, netCDF, and UDUnits
   libraries and to distribute the resulting executables under the terms 
   of the GPL, but in addition obeying the extra stipulations of the 
   DODS, HDF, netCDF, and UDUnits licenses.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
   See the GNU General Public License for more details.
   
   The original author of this software, Charlie Zender, wants to improve it
   with the help of your suggestions, improvements, bug-reports, and patches.
   Please contact the NCO project at http://nco.sf.net or by writing
   Charlie Zender
   Department of Earth System Science
   University of California at Irvine
   Irvine, CA 92697-3100 */

  /* Example lexers:
     /data/zender/ora/lexyacc/ch3-05.l
     GCC lexer is hard-coded in C for speed, but is easy to read:
     ../src/gcc-3.x.x/c-lex.c
     Unidata ${DATA}/tmp/netcdf-3.5.1-beta10/src/ncgen/ncgen.l */

  /* Usage:
     scp ~/nco/src/nco/ncap_lex.l goldhill.cgd.ucar.edu:nco/src/nco
     scp ~/nco/src/nco/ncap_lex.l krein.math.uci.edu:nco/src/nco

     flex --stdout ~/nco/src/nco/ncap_lex.l > ~/nco/src/nco/ncap_lex.c
     flex --header-file=${HOME}/nco/src/nco/ncap_lex.h --stdout ~/nco/src/nco/ncap_lex.l > ~/nco/src/nco/ncap_lex.c
     NB: flex with -Cf or -CF not -I if this scanner will not be interactive */

  /* Standard header files */
#include <assert.h> /* assert() debugging macro */
#include <limits.h> /* Integer representation, INT_MIN, INT_MAX... */
#include <math.h> /* sin cos cos sin 3.14159 */
#include <stdio.h> /* stderr, FILE, NULL, etc. */
#include <stdlib.h> /* atof, atoi, malloc, getopt */
#include <string.h> /* strdup */

  /* 3rd party vendors */
#include <netcdf.h> /* netCDF definitions and C library */
#include "nco_netcdf.h" /* NCO wrappers for netCDF C library */

  /* Headers specific to this program */
#include "nco.h" /* netCDF Operator (NCO) definitions */
#include "ncap.h" /* netCDF arithmetic processor-specific definitions (symbol table, ...) */
#include "ncap_yacc.h" /* Symbol definitions from parser */

  /* We want yylex() errors to skip current line rather than stop execution
     We do this by provoking error in parser by returning unrecognized token
     This causes parser to read up to next ';'
     To avoid having two error messages we prefix error message to yyerror with '#'
     This causes yyerror to print current error and skip next error
     fxm: Hackish, but I see no other way */ 

/* NCO prototypes yylex() in three separate places---Ensure that all prototypes agree!
   The alternative, prototyping yylex() once in ncap.h, requires YY*STYPE (ncap_yacc.h) too
   That is unappealing since we want ncap.h segregable from parser and scanner dependencies
   (Asterisks inserted into token names in comments so that cpp does not expand token)
   1. Top of ncap_lex.l via YY*DECL token
      Define YY*DECL token so yylex() accepts re-entrant arguments (Flex p. 12, Bison p. 60) 
      Use YY*DECL on line following it definition to make prototype visible ncap_lex.c
      This quiets a compiler warning
   2. Top of ncap_yacc.y via YY*DECL token
      Required to quiet compiler warning (see additional comments in ncap_yacc.y)
   3. In ncap_lex.l ncap_ntl_scn() declaration
      Required for ncap_ntl_scn() call to yylex() (additional comments in ncap_ntl_scn()) */
#define YY_DECL int yylex(YYSTYPE *lval_ptr,prs_sct *prs_arg)
  YY_DECL;

#if defined(__GNUC__) && (defined(ENABLE_DEBUG_CUSTOM) || defined(ENABLE_OPTIMIZE_CUSTOM))
  /* CEWI fxm 20040110 Prototype functions that cause warnings with pedantic GCC compiling
     Portability of this entire section is questionable, so enclose in ifdef GCC
     We already assume lexer is flex since AT&T lex does not understand <EOF> rules
     Thus prototyping following flex-specific functions adds no additional assumptions
     See also 20040112 thread in comp.compilers */
  /* Implicit declaration warnings: -D_POSIX_SOURCE also avoids fileno warning */
  int fileno(FILE *); /* fixes: warning: implicit declaration of function `fileno', -D_POSIX_SOURCE also avoids this warning */
  int yy_flex_realloc(void *,size_t); /* fixes: warning: implicit declaration of function `yy_flex_realloc'. Is this obsolete? Other versions of flex on Linux seem to want void * yyflex_realloc(void *,size_t), which actually makes more sense given that it is a realloc() function */
  /* Missing prototypes warnings: Triggered by -Wmissing-prototypes */
  FILE *yyget_in(void); /* fixes: warning: no previous prototype for `yyget_in' */
  FILE *yyget_out(void); /* fixes: warning: no previous prototype for `yyget_out' */
  char *yyget_text(void); /* fixes: warning: no previous prototype for `yyget_text' */
  int yyget_debug(void); /* fixes: warning: no previous prototype for `yyget_debug' */
  int yyget_leng(void); /* fixes: warning: no previous prototype for `yyget_leng' */
  int yyget_lineno(void); /* fixes: warning: no previous prototype for `yyget_lineno' */
  int yylex_destroy(void); /* fixes: warning: no previous prototype for `yylex_destroy' */
  void yyset_debug(int bdebug); /* fixes: warning: no previous prototype for `yyset_debug' */
  void yyset_in(FILE *in_str); /* fixes: warning: no previous prototype for `yyset_in' */
  void yyset_lineno(int line_number); /* fixes: warning: no previous prototype for `yyset_lineno' */
  void yyset_out(FILE *out_str); /* fixes: warning: no previous prototype for `yyset_out' */
#endif /* !__GNUC__ */

  /* Global variables */
  extern size_t ncap_ncl_dpt_crr; /* [nbr] Depth of current #include file (declared in ncap.c) */
  extern size_t *ncap_ln_nbr_crr; /* [cnt] Line number (declared in ncap.c) */
  extern char **ncap_fl_spt_glb; /* [fl] Script file (declared in ncap.c) */

  /* File scope variables */
  /* fxm: turn arbitrary size into pre-processor token */
  char ncap_err_sng[200]; /* [sng] Buffer for error string */

  /* Is lexer on left or right hand side of equals sign?
     LHS should contain only a variable or attribute
     In this case return variable/attribute name to parser
     If on RHS then return attribute value or variable struture
     Initialize to false, change to true if token is '=', false is token is ';' */
  static bool RHS=False; /* [flg] Is lexer on RHS of '=' sign? */

  /* Headers necessary for INCLUDE state */
#define NCO_MAX_NCL_DPT 10
  YY_BUFFER_STATE ncl_stk[NCO_MAX_NCL_DPT]; /* Include stack */
/* %x defines exclusive start states <stt>
   Once state <stt> is active, other rules do not match until initial state is restored
   NB: State names may not contain hyphens
   CCOMMENT: Handle C comments LMB92 p. 172, p. 43
   INCLUDE: Read in #include file (from example in flex manpage)
   DMN_LST: Dimension list
   LHS_SUBSCRIPT: Left Hand Side subscripts (currently LHS casting)
   RHS_SUBSCRIPT: Right Hand Side subscripts (currently not used) */

/* Definitions:  LMB92 p. 153
   Definitions are named regular expressions, e.g., DGT [0-9]
   Definitions enclosed in braces in rules section, e.g. {DGT}, are interpreted literally
   DGT [0-9] Digit
   LPH [A-Za-z_] Alphabetic character
   LPHDGT [A-Za-z0-9_] Alphanumeric character
   XPN [eE][+-]?[0-9]+ Real number Exponent */
/* Following sections after %% are lexer rules
   Each rule is regular expression followed by C-code for action
   If token matches regular expression then C-code is executed */
#line 924 "ncap_lex.c"

#define INITIAL 0
#define CCOMMENT 1
#define DMN_LST 2
#define INCLUDE 3
#define LHS_SUBSCRIPT 4
#define RHS_SUBSCRIPT 5

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

#ifndef YY_EXTRA_TYPE
#define YY_EXTRA_TYPE void *
#endif

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

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

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

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

#ifndef YY_NO_INPUT

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

#endif

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

/* Copy whatever the last rule matched to the standard output. */
#ifndef ECHO
/* This used to be an fputs(), but since the string might contain NUL's,
 * we now use fwrite().
 */
#define ECHO (void) fwrite( 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_LVALUE->yy_is_interactive ) \
            { \
            int c = '*'; \
            size_t 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 \
            { \
            errno=0; \
            while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \
                  { \
                  if( errno != EINTR) \
                        { \
                        YY_FATAL_ERROR( "input in flex scanner failed" ); \
                        break; \
                        } \
                  errno=0; \
                  clearerr(yyin); \
                  } \
            }\
\

#endif

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

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

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

/* end tables serialization structures and prototypes */

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

extern int yylex (void);

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

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

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


#line 1083 "ncap_lex.c"

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

#ifdef YY_USER_INIT
            YY_USER_INIT;
#endif

        if ( ! (yy_state_buf) )
            (yy_state_buf) = (yy_state_type *)yyalloc(YY_BUF_SIZE + 2  );

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

            if ( ! yyin )
                  yyin = stdin;

            if ( ! yyout )
                  yyout = stdout;

            if ( ! YY_CURRENT_BUFFER ) {
                  yyensure_buffer_stack ();
                  YY_CURRENT_BUFFER_LVALUE =
                        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_state_ptr) = (yy_state_buf);
            *(yy_state_ptr)++ = yy_current_state;

yy_match:
            do
                  {
                  register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*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 >= 222 )
                              yy_c = yy_meta[(unsigned int) yy_c];
                        }
                  yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
                  *(yy_state_ptr)++ = yy_current_state;
                  ++yy_cp;
                  }
            while ( yy_base[yy_current_state] != 886 );

yy_find_action:
            yy_current_state = *--(yy_state_ptr);
            (yy_lp) = yy_accept[yy_current_state];
find_rule: /* we branch to this label when backing up */
            for ( ; ; ) /* until we find what rule we matched */
                  {
                  if ( (yy_lp) && (yy_lp) < yy_accept[yy_current_state + 1] )
                        {
                        yy_act = yy_acclist[(yy_lp)];
                        if ( yy_act & YY_TRAILING_HEAD_MASK ||
                             yy_looking_for_trail_begin )
                              {
                              if ( yy_act == yy_looking_for_trail_begin )
                                    {
                                    yy_looking_for_trail_begin = 0;
                                    yy_act &= ~YY_TRAILING_HEAD_MASK;
                                    break;
                                    }
                              }
                        else if ( yy_act & YY_TRAILING_MASK )
                              {
                              yy_looking_for_trail_begin = yy_act & ~YY_TRAILING_MASK;
                              yy_looking_for_trail_begin |= YY_TRAILING_HEAD_MASK;
                              }
                        else
                              {
                              (yy_full_match) = yy_cp;
                              yy_full_state = (yy_state_ptr);
                              yy_full_lp = (yy_lp);
                              break;
                              }
                        ++(yy_lp);
                        goto find_rule;
                        }
                  --yy_cp;
                  yy_current_state = *--(yy_state_ptr);
                  (yy_lp) = 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 1:
YY_RULE_SETUP
#line 155 "ncap_lex.l"
{
  /* INCLUDE is exclusive start state for obtaining #include filename */
  BEGIN INCLUDE;
} /* end include */
      YY_BREAK
case 2:
YY_RULE_SETUP
#line 159 "ncap_lex.l"
/* Eat whitespace */
      YY_BREAK
case 3:
YY_RULE_SETUP
#line 160 "ncap_lex.l"
{
  /* Get include file name */
  if(ncap_ncl_dpt_crr >= NCO_MAX_NCL_DPT){
    (void)fprintf(stderr,"%s: ERROR File %s nesting depth of %lu is too deep",prg_nm_get(),yytext,(unsigned long)ncap_ncl_dpt_crr);
    nco_exit(EXIT_FAILURE);
  } /* endif */
  if(dbg_lvl_get() > 1) (void)fprintf(stderr,"%s: INFO Will descend from file %s at nesting depth %lu to #include'd file %s at depth %lu\n",prg_nm_get(),ncap_fl_spt_glb[ncap_ncl_dpt_crr],(unsigned long)ncap_ncl_dpt_crr,yytext,(unsigned long)ncap_ncl_dpt_crr+1UL);
  /* Put current input buffer on stack */
  ncl_stk[ncap_ncl_dpt_crr]=YY_CURRENT_BUFFER; 
  /* Increment nesting level */
  ncap_ncl_dpt_crr++;
  /* Allocate another entry in line counter array */
  ncap_ln_nbr_crr=(size_t *)nco_realloc(ncap_ln_nbr_crr,ncap_ncl_dpt_crr+1UL); 
  /* Initialize line number counter for new file */
  ncap_ln_nbr_crr[ncap_ncl_dpt_crr]=1UL;
  /* Store file name for diagnostics */
  ncap_fl_spt_glb=(char **)nco_realloc(ncap_fl_spt_glb,ncap_ncl_dpt_crr+1UL); 
  ncap_fl_spt_glb[ncap_ncl_dpt_crr]=(char *)strdup(yytext);
  if((yyin=fopen(ncap_fl_spt_glb[ncap_ncl_dpt_crr],"r")) == NULL){
    (void)fprintf(stderr,"%s: ERROR Unable to open script file %s\n",prg_nm_get(),ncap_fl_spt_glb[ncap_ncl_dpt_crr]);
    nco_exit(EXIT_FAILURE);
  } /* endif error */

  /* Create new scanner input buffer for include file and switch to it
     Current start conditions remains active in new input buffer */
  yy_switch_to_buffer(yy_create_buffer(yyin,YY_BUF_SIZE));
  /* Return to default state, known as INITIAL state or 0 state LMB92 p. 43 */    
  BEGIN INITIAL;
} /* end enter #include file */
      YY_BREAK
case YY_STATE_EOF(INITIAL):
case YY_STATE_EOF(CCOMMENT):
case YY_STATE_EOF(DMN_LST):
case YY_STATE_EOF(INCLUDE):
case YY_STATE_EOF(LHS_SUBSCRIPT):
case YY_STATE_EOF(RHS_SUBSCRIPT):
#line 190 "ncap_lex.l"
{
  /* NB: AT&T lex does not appear to have <EOF> rules */
  bool NCO_SCRIPT_WITH_EOF_IS_TOPLEVEL=True;
  /* Emerge from #include file if nested, else exit lexer */
  if(ncap_ncl_dpt_crr > 0UL){
    /* If we are exiting a #include'd script, delete its buffers */
    NCO_SCRIPT_WITH_EOF_IS_TOPLEVEL=False; /* [flg] */
    if(dbg_lvl_get() > 1) (void)fprintf(stderr,"%s: DEBUG Found EOF, emerging from file %s at nesting depth %lu to file %s at depth %lu\n",prg_nm_get(),ncap_fl_spt_glb[ncap_ncl_dpt_crr],(unsigned long)ncap_ncl_dpt_crr,ncap_fl_spt_glb[ncap_ncl_dpt_crr-1],(unsigned long)ncap_ncl_dpt_crr-1UL);
    ncap_fl_spt_glb[ncap_ncl_dpt_crr]=(char *)nco_free(ncap_fl_spt_glb[ncap_ncl_dpt_crr]);
    /* Decrement depth of nesting */
    ncap_ncl_dpt_crr--; 
    /* De-allocate entry from line counter array */
    ncap_ln_nbr_crr=(size_t *)nco_realloc(ncap_ln_nbr_crr,ncap_ncl_dpt_crr+1UL); 
    /* De-allocate entry from script name array */
    ncap_fl_spt_glb=(char **)nco_realloc(ncap_fl_spt_glb,ncap_ncl_dpt_crr+1UL); 
  } /* endif #include'd script */
  if(NCO_SCRIPT_WITH_EOF_IS_TOPLEVEL){
    /* Emerged from zeroth level, exit lexer */
    yyterminate();
  }else{
    /* Reclaim storage used by buffer just exited */
    yy_delete_buffer(YY_CURRENT_BUFFER);
    /* Switch back to parent buffer */
    yy_switch_to_buffer(ncl_stk[ncap_ncl_dpt_crr]);
  } /* endelse */
} /* end <EOF> */
      YY_BREAK
case 4:
YY_RULE_SETUP
#line 217 "ncap_lex.l"
{
   /* CCOMMENT is exclusive start state for C comments LMB92 p. 172
      When CCOMMENT state is active, only CCOMMENT rules will match 
      (hence an "exclusive start state" rather than "regular start state")
      Thus must (re)-define line number incrementing */
  BEGIN CCOMMENT;
}
      YY_BREAK
case 5:
/* rule 5 can match eol */
YY_RULE_SETUP
#line 224 "ncap_lex.l"
{
  /* Throw away comment text but increment line counter */
  ncap_ln_nbr_crr[ncap_ncl_dpt_crr]++; 
}
      YY_BREAK
case 6:
YY_RULE_SETUP
#line 228 "ncap_lex.l"
{
  /* Throw away everything except end comment text */
}
      YY_BREAK
case 7:
YY_RULE_SETUP
#line 231 "ncap_lex.l"
{
  /* Return to default state, known as INITIAL state or 0 state LMB92 p. 43 */
  BEGIN INITIAL;
} /* end CCOMMENT start state rules */
      YY_BREAK
case 8:
YY_RULE_SETUP
#line 236 "ncap_lex.l"
{
  /* Dimension list */
  if(dbg_lvl_get() > 0) (void)fprintf(stderr,"Entering DMN_LST with %s\n",yytext);

  BEGIN DMN_LST;

  return IGNORE; 
} /* End dimension list */
      YY_BREAK
case 9:
/* rule 9 can match eol */
YY_RULE_SETUP
#line 244 "ncap_lex.l"
/* Eat whitespace */
      YY_BREAK
case 10:
YY_RULE_SETUP
#line 245 "ncap_lex.l"
{
  if(dbg_lvl_get() > 0) (void)fprintf(stderr,"Exiting DMN_LST with %s\n",yytext);

  /* Return to default state, known as INITIAL state or 0 state LMB92 p. 43 */    
  BEGIN INITIAL;
} /* End dimension list */
      YY_BREAK
case 11:
/* rule 11 can match eol */
*yy_cp = (yy_hold_char); /* undo effects of setting up yytext */
(yy_c_buf_p) = yy_cp -= 2;
YY_DO_BEFORE_ACTION; /* set up yytext again */
YY_RULE_SETUP
#line 251 "ncap_lex.l"
{
/*<DMN_LST>{LPH}{LPHDGT}*[ \t\n]*[,]?[ \t\n]* {*/
  /* Recognize dimension lists */
  if(dbg_lvl_get() > 0) (void)fprintf(stderr,"Lexing dimension list %s\n",yytext);

  /* Valid subscripts must contain alphanumeric string */
  if(yyleng < 3) goto end_dmn_lst;
     
 end_dmn_lst: /* Errors encountered during LHS processing jump to here */
  /* Return to default state, known as INITIAL state or 0 state LMB92 p. 43 */    
  BEGIN INITIAL;
} /* end dimension list */
      YY_BREAK
case 12:
/* rule 12 can match eol */
YY_RULE_SETUP
#line 264 "ncap_lex.l"
{ 
  /* NB: Remaining rules are default state, also known as INITIAL state, or 0 state */
  /* Ignore new lines */
  ncap_ln_nbr_crr[ncap_ncl_dpt_crr]++;
}
      YY_BREAK
case 13:
YY_RULE_SETUP
#line 270 "ncap_lex.l"
{ 
  /* Eat spaces and tabs */
}
      YY_BREAK
case 14:
YY_RULE_SETUP
#line 274 "ncap_lex.l"
{
  /* Enable C++ comments */
}
      YY_BREAK
case 15:
/* rule 15 can match eol */
YY_RULE_SETUP
#line 278 "ncap_lex.l"
{
  /* Process quoted strings */
  char *bfr;
                
  bfr=nco_malloc(yyleng*sizeof(char));
  strcpy(bfr,&yytext[1]);
  bfr[yyleng-2]='\0';
  
  /* Replace C-language escape codes with actual byte values */
  (void)sng_ascii_trn(bfr);
  lval_ptr->sng=strdup(bfr);       
  if(dbg_lvl_get() > 3){
    (void)fprintf(stderr,"Lexing string: %s\n",yytext);
    (void)fprintf(stderr,"Made   string: %s\n",lval_ptr->sng);
  } /* endif */
  return SNG;
} /* end quoted strings */
      YY_BREAK
case 16:
YY_RULE_SETUP
#line 296 "ncap_lex.l"
{
  /* Double or long double */
  /* NB: Tempted to prepend lexer expressions for floats and doubles with [+-]? 
     so that unary plus/minus is handled in lexer rather than parser.
     However, this has unintended side effects so let parser handle it for now */
  if(dbg_lvl_get() > 3) (void)fprintf(stderr,"Lexing a double %s\n",yytext); 
  lval_ptr->scv.val.d=strtod(yytext,(char **)NULL);
  lval_ptr->scv.type=NC_DOUBLE;
  return SCV;
} /* end double or long double */
      YY_BREAK
case 17:
YY_RULE_SETUP
#line 307 "ncap_lex.l"
{
  /* Float */
  float flt_tkn;
  if(dbg_lvl_get() > 3) (void)fprintf(stderr,"Lexing a float %s\n",yytext); 
  if(sscanf((char *)yytext,"%e",&flt_tkn) != 1){
    sprintf(ncap_err_sng,"#Bad float: %s",yytext);
    yyerror(ncap_err_sng);
    return EPROVOKE;
  } /* endif */
  lval_ptr->scv.val.f=flt_tkn;
  lval_ptr->scv.type=NC_FLOAT;
  return SCV;
} /* end float */
      YY_BREAK
case 18:
YY_RULE_SETUP
#line 321 "ncap_lex.l"
{
  /* Long */
  double dbl_tkn;
  if(dbg_lvl_get() > 3) (void)fprintf(stderr,"Lexing an integer %s\n",yytext); 
  dbl_tkn=strtod((char *)yytext, (char **)(NULL));
  if (dbl_tkn < INT_MIN || dbl_tkn > INT_MAX){
    lval_ptr->scv.val.d=dbl_tkn;
    lval_ptr->scv.type=NC_DOUBLE;
    return SCV;
  }else{
    lval_ptr->scv.val.l=(nco_long)dbl_tkn;
    lval_ptr->scv.type=NC_INT;
    return SCV;
  } /* end else */
} /* end long */
      YY_BREAK
case 19:
YY_RULE_SETUP
#line 337 "ncap_lex.l"
{
  /* Short */
  short sht_tkn;
  if(dbg_lvl_get() > 3) (void)fprintf(stderr,"Lexing a short %s\n",yytext);   
  if(sscanf((char *)yytext,"%hd",&sht_tkn) != 1){
    sprintf(ncap_err_sng,"Bad short constant: %s",(char *)yytext);
    yyerror(ncap_err_sng);
  } /* endif err */
  lval_ptr->scv.val.s=sht_tkn;
  lval_ptr->scv.type=NC_SHORT;
  return SCV;
} /* end short */
      YY_BREAK
case 20:
YY_RULE_SETUP
#line 350 "ncap_lex.l"
{
  /* Byte */
  int byt_tkn;
  if(dbg_lvl_get() > 3) (void)fprintf(stderr,"Lexing a byte %s\n",yytext); 
  if(sscanf((char *)yytext,"%d",&byt_tkn) != 1){
    sprintf(ncap_err_sng,"#Bad byte: %s",yytext);
    yyerror(ncap_err_sng);
    return EPROVOKE;
  } /* endif err */
  if(byt_tkn < -128 || byt_tkn > 127){
    lval_ptr->scv.val.l=byt_tkn;
    lval_ptr->scv.type=NC_INT;
    return SCV;    
  }else{ 
    lval_ptr->scv.val.b=byt_tkn;
    lval_ptr->scv.type=NC_BYTE;
    return SCV;                    
  } /* end else */
} /* end byte */
      YY_BREAK
case 21:
YY_RULE_SETUP
#line 370 "ncap_lex.l"
{return ABS;} /* Strategy for lexing control statements: 
1. Look for language control statements (if, while, do, for)
2. Look for NCO-defined intrinsic functions (abs, pack, unpack)
3. Look for mathematical intrinsic functions (sin, cos)
4. Look for NCO-defined named constants (M_PI, M_E) */
      YY_BREAK
case 22:
YY_RULE_SETUP
#line 375 "ncap_lex.l"
{return IF;}
      YY_BREAK
case 23:
YY_RULE_SETUP
#line 376 "ncap_lex.l"
{return PRINT;}
      YY_BREAK
case 24:
YY_RULE_SETUP
#line 378 "ncap_lex.l"
{return ABS;} /* TOKEN whitespace (: Token followed any amount of whitespace followed by opening parenthesis signifies function name, not variable name.
This disambiguates variable and functional namespaces.

Dimension reducing functions (min,max,avg,ttl) need thought
Each function should allow specification of optional dimension list, e.g., 
foo=avg(var,(/lat,lon/)); should return mean T over lat,lon dimensions

Certain functions, however, have binary versions, e.g., 
foo=min(var_1,var_2); should return point-wise minimum values

Dimension lists require syntax like (/.../) to disambiguate meanings like
foo=min(lat,lat)

End result:
foo=min(lat) Returns minimum value of lat
foo=min(lat,(/lat/)) Returns minimum value of lat
foo=min(lat,lat) Returns copy of lat (i.e., pointwise minimum of lat and lat)
foo=min(var,(/dmn_1,dmn_2/)) Returns minimum of variable over dmn_1, dmn_2 dimensions */
      YY_BREAK
case 25:
*yy_cp = (yy_hold_char); /* undo effects of setting up yytext */
(yy_c_buf_p) = yy_cp = yy_bp + 3;
YY_DO_BEFORE_ACTION; /* set up yytext again */
YY_RULE_SETUP
#line 396 "ncap_lex.l"
{return ABS;}
      YY_BREAK
case 26:
*yy_cp = (yy_hold_char); /* undo effects of setting up yytext */
(yy_c_buf_p) = yy_cp = yy_bp + 6;
YY_DO_BEFORE_ACTION; /* set up yytext again */
YY_RULE_SETUP
#line 397 "ncap_lex.l"
{return ATOSTR;}
      YY_BREAK
case 27:
*yy_cp = (yy_hold_char); /* undo effects of setting up yytext */
(yy_c_buf_p) = yy_cp = yy_bp + 3;
YY_DO_BEFORE_ACTION; /* set up yytext again */
YY_RULE_SETUP
#line 398 "ncap_lex.l"
{prs_arg->nco_op_typ=nco_op_avg;return RDC;}
      YY_BREAK
case 28:
*yy_cp = (yy_hold_char); /* undo effects of setting up yytext */
(yy_c_buf_p) = yy_cp = yy_bp + 3;
YY_DO_BEFORE_ACTION; /* set up yytext again */
YY_RULE_SETUP
#line 399 "ncap_lex.l"
{prs_arg->nco_op_typ=nco_op_min;return RDC;}
      YY_BREAK
case 29:
*yy_cp = (yy_hold_char); /* undo effects of setting up yytext */
(yy_c_buf_p) = yy_cp = yy_bp + 3;
YY_DO_BEFORE_ACTION; /* set up yytext again */
YY_RULE_SETUP
#line 400 "ncap_lex.l"
{prs_arg->nco_op_typ=nco_op_max;return RDC;}
      YY_BREAK
case 30:
*yy_cp = (yy_hold_char); /* undo effects of setting up yytext */
(yy_c_buf_p) = yy_cp = yy_bp + 3;
YY_DO_BEFORE_ACTION; /* set up yytext again */
YY_RULE_SETUP
#line 401 "ncap_lex.l"
{prs_arg->nco_op_typ=nco_op_ttl;return RDC;}
      YY_BREAK
case 31:
*yy_cp = (yy_hold_char); /* undo effects of setting up yytext */
(yy_c_buf_p) = yy_cp = yy_bp + 3;
YY_DO_BEFORE_ACTION; /* set up yytext again */
YY_RULE_SETUP
#line 402 "ncap_lex.l"
{return PACK;}
      YY_BREAK
case 32:
*yy_cp = (yy_hold_char); /* undo effects of setting up yytext */
(yy_c_buf_p) = yy_cp = yy_bp + 4;
YY_DO_BEFORE_ACTION; /* set up yytext again */
YY_RULE_SETUP
#line 403 "ncap_lex.l"
{return PACK;}
      YY_BREAK
case 33:
*yy_cp = (yy_hold_char); /* undo effects of setting up yytext */
(yy_c_buf_p) = yy_cp = yy_bp + 3;
YY_DO_BEFORE_ACTION; /* set up yytext again */
YY_RULE_SETUP
#line 404 "ncap_lex.l"
{return POWER;}
      YY_BREAK
case 34:
*yy_cp = (yy_hold_char); /* undo effects of setting up yytext */
(yy_c_buf_p) = yy_cp = yy_bp + 3;
YY_DO_BEFORE_ACTION; /* set up yytext again */
YY_RULE_SETUP
#line 405 "ncap_lex.l"
{return UNPACK;}
      YY_BREAK
case 35:
*yy_cp = (yy_hold_char); /* undo effects of setting up yytext */
(yy_c_buf_p) = yy_cp = yy_bp + 6;
YY_DO_BEFORE_ACTION; /* set up yytext again */
YY_RULE_SETUP
#line 406 "ncap_lex.l"
{return UNPACK;}
      YY_BREAK
case 36:
*yy_cp = (yy_hold_char); /* undo effects of setting up yytext */
(yy_c_buf_p) = yy_cp = yy_bp + 4;
YY_DO_BEFORE_ACTION; /* set up yytext again */
YY_RULE_SETUP
#line 407 "ncap_lex.l"
{ lval_ptr->cnv_type = NC_BYTE;return CNV_TYPE;} 
      YY_BREAK
case 37:
*yy_cp = (yy_hold_char); /* undo effects of setting up yytext */
(yy_c_buf_p) = yy_cp = yy_bp + 4;
YY_DO_BEFORE_ACTION; /* set up yytext again */
YY_RULE_SETUP
#line 408 "ncap_lex.l"
{ lval_ptr->cnv_type = NC_CHAR;return CNV_TYPE;} 
      YY_BREAK
case 38:
*yy_cp = (yy_hold_char); /* undo effects of setting up yytext */
(yy_c_buf_p) = yy_cp = yy_bp + 5;
YY_DO_BEFORE_ACTION; /* set up yytext again */
YY_RULE_SETUP
#line 409 "ncap_lex.l"
{ lval_ptr->cnv_type = NC_SHORT;return CNV_TYPE;} 
      YY_BREAK
case 39:
*yy_cp = (yy_hold_char); /* undo effects of setting up yytext */
(yy_c_buf_p) = yy_cp = yy_bp + 3;
YY_DO_BEFORE_ACTION; /* set up yytext again */
YY_RULE_SETUP
#line 410 "ncap_lex.l"
{ lval_ptr->cnv_type = NC_INT;return CNV_TYPE;} 
      YY_BREAK
case 40:
*yy_cp = (yy_hold_char); /* undo effects of setting up yytext */
(yy_c_buf_p) = yy_cp = yy_bp + 5;
YY_DO_BEFORE_ACTION; /* set up yytext again */
YY_RULE_SETUP
#line 411 "ncap_lex.l"
{ lval_ptr->cnv_type = NC_FLOAT;return CNV_TYPE;} 
      YY_BREAK
case 41:
*yy_cp = (yy_hold_char); /* undo effects of setting up yytext */
(yy_c_buf_p) = yy_cp = yy_bp + 6;
YY_DO_BEFORE_ACTION; /* set up yytext again */
YY_RULE_SETUP
#line 412 "ncap_lex.l"
{ lval_ptr->cnv_type = NC_DOUBLE;return CNV_TYPE;} 
      YY_BREAK
case 42:
YY_RULE_SETUP
#line 416 "ncap_lex.l"
{return NAMED_CONSTANT;}
      YY_BREAK
case 43:
YY_RULE_SETUP
#line 418 "ncap_lex.l"
{
/* Compare input with mathematical function names in table and return
   pointer to structure containing name, double function, float function */
   int idx;
   for(idx=0;idx<prs_arg->sym_tbl_nbr;idx++)
     if(!strcmp(yytext,(prs_arg->sym_tbl[idx]->nm))){ 
        lval_ptr->sym=prs_arg->sym_tbl[idx];
        return FUNCTION;
     } /* endif */
   (void)sprintf(ncap_err_sng,"Warning: Unable to locate function %s. Perhaps %s is a variable?",yytext,yytext);
   (void)yyerror(ncap_err_sng);       
   return EPROVOKE;             
} /* end functions */
      YY_BREAK
case 44:
YY_RULE_SETUP
#line 432 "ncap_lex.l"
{ 
  /* Recognize variable attributes, e.g., var_nm@att_nm */
  aed_sct *ptr_aed;
  char *amp_ptr;
  char *att_nm;
  char *var_nm;
  int rcd=NC_NOERR;
  int rcd_out;
  int var_id;
  long att_sz;
  nc_type type;
  ptr_unn val;
  size_t sng_lng;
  
  if(dbg_lvl_get() > 3) (void)fprintf(stderr,"Lexing attribute %s\n",yytext);
  amp_ptr=strchr(yytext,'@');
  sng_lng=amp_ptr-yytext;
  
  var_nm=(char *)nco_malloc((sng_lng+1)*sizeof(char));
  strncpy(var_nm,yytext,sng_lng);
  var_nm[sng_lng]='\0';
  att_nm=(char *)strdup(++amp_ptr);
  
  /* Assume global attribute when variable name is "global" */
  if(!strcmp(var_nm,"global")) var_id=NC_GLOBAL; else rcd=nco_inq_varid_flg(prs_arg->in_id,var_nm,&var_id);
  
  /* We are on RHS so return value of attribute (if available) to parser
     During initial scan, just return attributes on RHS */
  if(prs_arg->ntl_scn){
    if(!RHS){
      lval_ptr->aed.att_nm=(char *)strdup(att_nm);
      lval_ptr->aed.var_nm=(char *)strdup(var_nm);
      return OUT_ATT;
    }else{
      return IGNORE;
    } /* endelse */
  } /* endif */
  
  if(RHS){
    /* First check if attribute has already been saved in symbol table
       If so then obtain and return value, else check input file
       If attribute is present obtain and return value from disk else return NC_BYTE of value 0
       If attribute is NC_CHAR then return SNG type
       Other types (NC_FLOAT, NC_DOUBLE, NC_BYTE, NC_SHORT) return SCV */
    ptr_aed=ncap_aed_lookup(var_nm,att_nm,prs_arg,False);
    if(ptr_aed){
      if(ptr_aed->type == NC_CHAR){
      (void)cast_void_nctype(ptr_aed->type,&ptr_aed->val);
      lval_ptr->sng=(char *)nco_malloc((ptr_aed->sz+1)*nco_typ_lng(NC_CHAR));
      strncpy(lval_ptr->sng,(char *)(ptr_aed->val.cp),(size_t)(ptr_aed->sz));
      lval_ptr->sng[ptr_aed->sz]='\0';
      return SNG;
      }else{
      lval_ptr->scv=ptr_unn_2_scv(ptr_aed->type,ptr_aed->val);
      return SCV;  
      } /* end else */        
    } /* end if */
    if(rcd == NC_NOERR){  
      rcd=nco_inq_att_flg(prs_arg->in_id,var_id,att_nm,&type,&att_sz);
      if (rcd == NC_ENOTATT){
      (void)sprintf(ncap_err_sng,"Warning: Unable to locate RHS attribute %s of variable %s with var ID = %d in file %s. Returning 0-byte.",att_nm,var_nm,var_id,prs_arg->fl_in);
      (void)yyerror(ncap_err_sng);
      lval_ptr->scv.val.b=0;
      lval_ptr->scv.type=NC_BYTE;
      return SCV;
      } /* end if */
      if(rcd == NC_NOERR){ 
      val.vp=(void *)nco_malloc(att_sz*nco_typ_lng(type));
      rcd=nco_get_att(prs_arg->in_id,var_id,att_nm,val.vp,type);
      if(type == NC_CHAR){
        (void)cast_void_nctype(type,&val);
        lval_ptr->sng=(char *)nco_malloc((att_sz+1)*sizeof(char));
        strncpy(lval_ptr->sng,(char *)val.cp,(size_t)att_sz);
        lval_ptr->sng[att_sz]='\0'; 
        return SNG;
      }else{
        lval_ptr->scv=ptr_unn_2_scv(type,val);
        return SCV;   
      } /* end else */ 
      } /* end if */
    }else{ /* ...else rcd reported an error */
      /* Attribute is not in table or on disk so return 0-byte  */
      (void)sprintf(ncap_err_sng,"Warning: Unable to locate RHS attribute %s of variable %s with var ID = %d in file %s. Returning 0-byte.",att_nm,var_nm,var_id,prs_arg->fl_in);
      (void)yyerror(ncap_err_sng);
      lval_ptr->scv.val.b=0;
      lval_ptr->scv.type=NC_BYTE;
      return SCV;
    } /* end if */
  }/* end if RHS */
  
  /* We are on LHS so simply save information for later processing by parser
     Atrribute is valid if its associated variable is in input or output file */
  if(!RHS){
    rcd_out=nco_inq_varid_flg(prs_arg->out_id,var_nm,&var_id);
    if(rcd == NC_NOERR || rcd_out == NC_NOERR){
      lval_ptr->aed.att_nm=(char *)strdup(att_nm);
      lval_ptr->aed.var_nm=(char *)strdup(var_nm);
      return OUT_ATT;
    }else{
      (void)sprintf(ncap_err_sng,"#Warning: unable to locate variable %s. So cannot create attribute %s",var_nm,yytext);
      (void)yyerror(ncap_err_sng);
      return EPROVOKE; 
    } /* end else */
  } /* end if */
  
} /* End scalar values. Phew! */
      YY_BREAK
case 45:
*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
#line 539 "ncap_lex.l"
{
  /* Recognize variables with subscripts */
  if(dbg_lvl_get() > 3) (void)fprintf(stderr,"Lexing variable with subscripts %s\n",yytext);
  if(RHS){
    lval_ptr->var_nm_RHS=(char *)strdup(yytext);
    BEGIN RHS_SUBSCRIPT;
    return VAR;
  }else{ 
    lval_ptr->var_nm_LHS=(char *)strdup(yytext);
    BEGIN LHS_SUBSCRIPT;
    return OUT_VAR;
  } /* end else */
} /* end variables with subscripts */
      YY_BREAK
case 46:
YY_RULE_SETUP
#line 553 "ncap_lex.l"
{
  /* Recognize plain variables */
  if(dbg_lvl_get() > 3) (void)fprintf(stderr,"Lexing variable %s\n",yytext);
  if(RHS){
    lval_ptr->var_nm_RHS=(char *)strdup(yytext); 
    return VAR;
  }else{ 
    lval_ptr->var_nm_LHS=(char *)strdup(yytext);
    return OUT_VAR;
  } /* end else */
} /* end variables without subscripts */
      YY_BREAK
case 47:
/* rule 47 can match eol */
YY_RULE_SETUP
#line 565 "ncap_lex.l"
{
  /* fxm: allow whitespace in dimension list */
  /* Recognize subscripted (hyperslabbed) variables
     Hyperslabbed variables for now indicated with square brackets
     Using square brackets so development does not break functions
     Left context is described in LMB92 p. 152
     
     Subscript syntax is taken from Fortran9X specification:
     x[dmn1,dmn2,...,dmnN]
     x[a:b,c:,:d,e] */
  const char * const sbs_dlm=","; /* [sng] Subscript delimiter */
  static const char * const tpl_nm="Internally generated template";
  
  char **sbs_lst; /* [sng] Array of dimension subscripts */
  char *sbs_sng; /* [sng] Subscript */
  
  int dmn_nbr; /* [nbr] Number of dimensions */
  int idx; /* [idx] Counter */
  int jdx; /* [idx] Counter */
  
  double val=1.0; /* [frc] Value of template */
  
  var_sct *var; /* [sct] Variable */
  
  dmn_sct **dmn; /* [dmn] Dimension structure list */
  dmn_sct *dmn_item;
  dmn_sct **dmn_new;

  /* Valid subscripts must contain alphanumeric string */
  if(dbg_lvl_get() > 2) (void)fprintf(stderr,"Interpreting %s as LHS_SUBSCRIPT\n",yytext);
  if(yyleng < 3) goto end_LHS_sbs;

  if(prs_arg->ntl_scn) goto end_LHS_sbs;  
  /* Copy token into user memory and turn into list of dimension names */
  sbs_sng=(char *)nco_malloc(yyleng*sizeof(char));
  strcpy(sbs_sng,&yytext[1]);
  sbs_sng[yyleng-2]='\0';  
  sbs_lst=lst_prs(sbs_sng,sbs_dlm,&dmn_nbr);

  dmn=(dmn_sct **)nco_malloc(dmn_nbr*sizeof(dmn_sct *));
  (void)nco_redef(prs_arg->out_id);
  for( idx=0 ; idx < dmn_nbr ; idx++) {
    /* first seach for dimension in psr_arg->dmn_out */
    for( jdx =0 ; jdx < *(prs_arg->nbr_dmn_out) ; jdx++){
      dmn_item = (*(prs_arg->dmn_out))[jdx];
      if(!strcmp(sbs_lst[idx],dmn_item->nm)) { 
      dmn[idx]=dmn_item;
      break;
      }
    }
   if( jdx !=  *(prs_arg->nbr_dmn_out) ) continue;   
    /* then try seach for dimension in prs_arg->dmn_in */
   for (jdx =0 ;jdx < prs_arg->nbr_dmn_in ; jdx++){
     dmn_item = prs_arg->dmn_in[jdx];
        /* if found add dimension to  dmn_out and dmn */
     if(!strcmp(sbs_lst[idx],dmn_item->nm)) {
       /* BEWARE -- nco_dmn_out_grow() increments *(prs_arg->nbr_dmn_out) */
       dmn_new = nco_dmn_out_grow(prs_arg); 
       *dmn_new=nco_dmn_dpl(dmn_item);
       (void)nco_dmn_xrf(*dmn_new,dmn_item);
       /* write found  dimension to output  */
       (void)nco_dmn_dfn(prs_arg->fl_out,prs_arg->out_id,dmn_new,1);
       dmn[idx]=*dmn_new;
       break;
     }
   }

  if (jdx != prs_arg->nbr_dmn_in ) continue;
    /* exit action if dimension not found */
   (void)sprintf(ncap_err_sng,"Warning: Unrecognized dimension \"%s\" in LHS subscripts",sbs_lst[idx]);
   (void)yyerror(ncap_err_sng);
   (void)nco_enddef(prs_arg->out_id);
   goto end_LHS_sbs;                     
  }
  (void)nco_enddef(prs_arg->out_id);
 

  /* check that un-limited dimension is the first dimension */
  for( idx = 1 ; idx < dmn_nbr ; idx ++)
    if( dmn[idx]->is_rec_dmn ) {
      (void)sprintf(ncap_err_sng,"Warning:\"%s\" is the record dimension. It can only be the first dimension in a list",dmn[idx]->nm);
   (void)yyerror(ncap_err_sng);
   goto end_LHS_sbs;                     
  }

  /* Create template variable to cast all RHS expressions */
  var=(var_sct *)nco_malloc(sizeof(var_sct));
  
  /* Set defaults */
  (void)var_dfl_set(var); /* [fnc] Set defaults for each member of variable structure */
  /* Overwrite with LHS information */
  var->nm=(char *)strdup(tpl_nm);
  var->type=NC_DOUBLE;
  var->nbr_dim=dmn_nbr;
  var->dim=dmn;
  /* Allocate space for dimension structures */
  if(var->nbr_dim > 0) var->dmn_id=(int *)nco_malloc(var->nbr_dim*sizeof(int)); else var->dmn_id=(int *)NULL;
  if(var->nbr_dim > 0) var->cnt=(long *)nco_malloc(var->nbr_dim*sizeof(long)); else var->cnt=(long *)NULL;
  if(var->nbr_dim > 0) var->srt=(long *)nco_malloc(var->nbr_dim*sizeof(long)); else var->srt=(long *)NULL;
  if(var->nbr_dim > 0) var->end=(long *)nco_malloc(var->nbr_dim*sizeof(long)); else var->end=(long *)NULL;
  if(var->nbr_dim > 0) var->srd=(long *)nco_malloc(var->nbr_dim*sizeof(long)); else var->srd=(long *)NULL;
  
  /* Defensive programming */
  var->sz=1L; 
  /* Attach LHS dimensions to variable */
  for(idx=0;idx<dmn_nbr;idx++){
    var->dim[idx]=dmn[idx];
    var->dmn_id[idx]=dmn[idx]->id;
    var->cnt[idx]=dmn[idx]->cnt;
    var->srt[idx]=dmn[idx]->srt;
    var->end[idx]=dmn[idx]->end;
    var->srd[idx]=dmn[idx]->srd;
    var->sz*=var->cnt[idx];
  } /* end loop over dim */
  
  /* Allocate space for variable values 
     fxm: more efficient and safer to use nco_calloc() and not fill with values? */
  if((var->val.vp=(void *)nco_malloc_flg(var->sz*nco_typ_lng(var->type))) == NULL){
    (void)fprintf(stderr,"%s: ERROR Unable to malloc() %ld*%lu bytes for var_LHS() in lexer\n",prg_nm_get(),var->sz,(unsigned long)nco_typ_lng(var->type));
    nco_exit(EXIT_FAILURE); 
  } /* end if */
  
  /* Copy arbitrary value into variable 
     Placing a uniform value in variable should be unnecessary since variable
     is intended for use solely as dimensional template for nco_var_cnf_dmn() 
     Nevertheless, copy 1.0 into value for safety */
  { /* Change scope to define convenience variables which reduce de-referencing */
    long var_sz; /* [nbr] Number of elements in variable */
    size_t var_typ_sz; /* [B] Size of single element of variable */
    char *var_val_cp; /* [ptr] Pointer to values */
    
    var_sz=var->sz; /* [nbr] Number of elements in variable */
    var_typ_sz=nco_typ_lng(var->type);
    var_val_cp=(char *)var->val.vp;
    for(idx=0;idx<var_sz;idx++) (void)memcpy(var_val_cp+idx,(void *)(&val),var_typ_sz);
  } /* end scope */
  
  /* Link variable into yylex() argument for use in parser */
  prs_arg->var_LHS=var;
  
  if(dbg_lvl_get() > 2) (void)fprintf(stderr,"%s: Lexer creating LHS cast template: Template var->nm %s, var->nbr_dim %d, var->sz %li\n",prg_nm_get(),prs_arg->var_LHS->nm,prs_arg->var_LHS->nbr_dim,prs_arg->var_LHS->sz);
  
  if(0){ /* Remove some compiler warning messages CEWI */
    /* Following two statements remove "defined but not used" messages in ncap_lex.c (lex.yy.c) */
    (void)yyunput((int)NULL,(char *)NULL);
    (void)yy_flex_realloc((void *)NULL,(size_t)NULL);
    /* Remove warnings which only occur on SGI IRIX cc */
    yy_full_match=yy_full_match;
    yy_full_lp=yy_full_lp;
    yy_full_state=yy_full_state;
  } /* endif False */
  
  /* Free dimension list memory */
  (void)nco_free(sbs_sng);    
 end_LHS_sbs: /* Errors encountered during LHS processing jump to here */
  /* Return to default state, known as INITIAL state or 0 state LMB92 p. 43 */    
  BEGIN INITIAL;
} /* end LHS subscripted variables */
      YY_BREAK
case 48:
/* rule 48 can match eol */
YY_RULE_SETUP
#line 726 "ncap_lex.l"
{
  /* RHS_SUBSCRIPT */
  (void)sprintf(ncap_err_sng,"Warning RHS subscripts are not yet implemented");
  (void)yyerror(ncap_err_sng);
  /* Return to default state, known as INITIAL state or 0 state LMB92 p. 43 */    
  BEGIN INITIAL;
} /* end RHS_SUBSCRIPT */
      YY_BREAK
case 49:
YY_RULE_SETUP
#line 734 "ncap_lex.l"
{ /* And */
  return AND;
} /* end && */
      YY_BREAK
case 50:
YY_RULE_SETUP
#line 737 "ncap_lex.l"
{ /* Or */
  return OR;
} /* end || */
      YY_BREAK
case 51:
YY_RULE_SETUP
#line 740 "ncap_lex.l"
{ /* Comparison equals */
  lval_ptr->nco_rlt_opr=nco_op_eq;
  return COMPARISON;
} /* end == */
      YY_BREAK
case 52:
YY_RULE_SETUP
#line 744 "ncap_lex.l"
{ /* Comparison not equals */
  lval_ptr->nco_rlt_opr=nco_op_ne;
  return COMPARISON;
} /* end != */
      YY_BREAK
case 53:
YY_RULE_SETUP
#line 748 "ncap_lex.l"
{ /* Comparison less than or equal to */
  lval_ptr->nco_rlt_opr=nco_op_le;
  return COMPARISON;
} /* end <= */
      YY_BREAK
case 54:
YY_RULE_SETUP
#line 752 "ncap_lex.l"
{ /* Comparison greater than or equal to */
  lval_ptr->nco_rlt_opr=nco_op_ge;
  return COMPARISON;
} /* end >= */
      YY_BREAK
case 55:
YY_RULE_SETUP
#line 756 "ncap_lex.l"
{ /* Comparison less than */
  lval_ptr->nco_rlt_opr=nco_op_lt;
  return COMPARISON;
} /* end < */
      YY_BREAK
case 56:
YY_RULE_SETUP
#line 760 "ncap_lex.l"
{ /* Comparison greater than */
  lval_ptr->nco_rlt_opr=nco_op_gt;
  return COMPARISON;
} /* end > */
      YY_BREAK
case 57:
YY_RULE_SETUP
#line 765 "ncap_lex.l"
{
  /* Equals assignment */
  RHS=True; 
  return yytext[0];
} /* end equals */
      YY_BREAK
case 58:
YY_RULE_SETUP
#line 771 "ncap_lex.l"
{ 
  /* semi-colon indicates end-of-statement */
  RHS=False;
  return yytext[0]; 
} /* end semi-colon */
      YY_BREAK
case 59:
YY_RULE_SETUP
#line 777 "ncap_lex.l"
{
  /* Everything not parsed by above falls through to here */
  if(dbg_lvl_get() > 5) (void)fprintf(stderr,"%s: Following token reached last lexer rule: %s\n",prg_nm_get(),yytext);
  return yytext[0];
} /* end trickle down */
      YY_BREAK
case 60:
YY_RULE_SETUP
#line 783 "ncap_lex.l"
ECHO;
      YY_BREAK
#line 2103 "ncap_lex.c"

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

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

            if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
                  {
                  /* We're scanning a new file or input source.  It's
                   * possible that this happened because the user
                   * just pointed 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_LVALUE->yy_n_chars;
                  YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
                  YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
                  }

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

                  (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;

                  yy_current_state = yy_get_previous_state(  );

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

                  yy_next_state = yy_try_NUL_trans( yy_current_state );

                  yy_bp = (yytext_ptr) + YY_MORE_ADJ;

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

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

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

                        if ( 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_LVALUE->yy_ch_buf[(yy_n_chars)];

                        yy_current_state = yy_get_previous_state(  );

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

      default:
            YY_FATAL_ERROR(
                  "fatal flex scanner internal error--no action found" );
      } /* end of action switch */
            } /* end of scanning one token */
} /* end of 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 (void)
{
      register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
      register char *source = (yytext_ptr);
      register int number_to_move, i;
      int ret_val;

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

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

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

      /* Try to read more data. */

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

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

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

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

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

                  YY_FATAL_ERROR(
"input buffer overflow, can't enlarge buffer because scanner uses REJECT" );

                  }

            if ( num_to_read > YY_READ_BUF_SIZE )
                  num_to_read = YY_READ_BUF_SIZE;

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

            YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
            }

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

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

      else
            ret_val = EOB_ACT_CONTINUE_SCAN;

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

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

      return ret_val;
}

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

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

      (yy_state_ptr) = (yy_state_buf);
      *(yy_state_ptr)++ = yy_current_state;

      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);
            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 >= 222 )
                        yy_c = yy_meta[(unsigned int) yy_c];
                  }
            yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
            *(yy_state_ptr)++ = yy_current_state;
            }

      return yy_current_state;
}

/* yy_try_NUL_trans - try to make a transition on the NUL character
 *
 * synopsis
 *    next_state = yy_try_NUL_trans( current_state );
 */
    static yy_state_type yy_try_NUL_trans  (yy_state_type yy_current_state )
{
      register int yy_is_jam;
    
      register YY_CHAR yy_c = 1;
      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 >= 222 )
                  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 == 221);
      if ( ! yy_is_jam )
            *(yy_state_ptr)++ = yy_current_state;

      return yy_is_jam ? 0 : yy_current_state;
}

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

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

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

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

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

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

      *--yy_cp = (char) c;

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

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

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

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

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

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

                              /* Reset buffer status. */
                              yyrestart(yyin );

                              /*FALLTHROUGH*/

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

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

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

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

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

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

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

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

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

      YY_CURRENT_BUFFER_LVALUE = new_buffer;
      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;
}

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

/** Allocate and initialize an input buffer state.
 * @param file A readable stream.
 * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
 * 
 * @return the allocated buffer state.
 */
    YY_BUFFER_STATE yy_create_buffer  (FILE * file, int  size )
{
      YY_BUFFER_STATE b;
    
      b = (YY_BUFFER_STATE) yyalloc(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 *) yyalloc(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;
}

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

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

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

      yyfree((void *) b  );
}

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

{
      int oerrno = errno;
    
      yy_flush_buffer(b );

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

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

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

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

      b->yy_n_chars = 0;

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

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

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

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

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

      yyensure_buffer_stack();

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

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

      /* copied from yy_switch_to_buffer. */
      yy_load_buffer_state( );
      (yy_did_buffer_switch_on_eof) = 1;
}

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

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

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

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

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

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

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

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

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

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

      b = (YY_BUFFER_STATE) yyalloc(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;
}

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

/** Setup the input buffer state to scan the given bytes. The next call to yylex() will
 * scan from a @e copy of @a bytes.
 * @param bytes the byte buffer to scan
 * @param len the number of bytes in the buffer pointed to by @a bytes.
 * 
 * @return the newly allocated buffer state object.
 */
YY_BUFFER_STATE yy_scan_bytes  (yyconst char * bytes, int  len )
{
      YY_BUFFER_STATE b;
      char *buf;
      yy_size_t n;
      int i;
    
      /* Get memory for full buffer, including space for trailing EOB's. */
      n = len + 2;
      buf = (char *) yyalloc(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;
}

#ifndef YY_EXIT_FAILURE
#define YY_EXIT_FAILURE 2
#endif

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

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

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

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

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

/** Get the input stream.
 * 
 */
FILE *yyget_in  (void)
{
        return yyin;
}

/** Get the output stream.
 * 
 */
FILE *yyget_out  (void)
{
        return yyout;
}

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

/** Get the current token.
 * 
 */

char *yyget_text  (void)
{
        return yytext;
}

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

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

void yyset_out (FILE *  out_str )
{
        yyout = out_str ;
}

int yyget_debug  (void)
{
        return yy_flex_debug;
}

void yyset_debug (int  bdebug )
{
        yy_flex_debug = bdebug ;
}

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

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

    yyfree ( (yy_state_buf) );

    return 0;
}

/*
 * Internal utility routines.
 */

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

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

      return n;
}
#endif

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

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

void yyfree (void * ptr )
{
      free( (char *) ptr );   /* see yyrealloc() for (char *) cast */
}

#define YYTABLES_NAME "yytables"

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

#ifdef YY_DECL_IS_OURS
#undef YY_DECL_IS_OURS
#undef YY_DECL
#endif
#line 783 "ncap_lex.l"



/* Begin user functions section */

bool
yywrap(void)
{
  /* Purpose: Routine to replace library-defined yywrap() 
     yywrap() is called when YY_INPUT returns EOF, e.g., at end of script
     Returning false (zero) means there is more to scan, and input has
     been redirected to new source, e.g., yyin points to new file. 
     Returning true (non-zero) means scanning is complete, so scanner terminates and returns 0 to calling function
     Default is to return true (one) when called---this terminates scanner */
  if(dbg_lvl_get() >= 3) (void)fprintf(stderr,"%s: DEBUG yywrap() called with ncap_ncl_dpt_crr = %lu\n",prg_nm_get(),(unsigned long)ncap_ncl_dpt_crr);
  /* comp.compilers thread 20020523 yywrap() should always return 1, even when
     scanning a #include'd file
     return (ncap_ncl_dpt_crr <= 1) ? 1 : 0; */
  return 1;
} /* end yywrap() */

void 
ncap_ntl_scn /* [fnc] Scan command script, construct I/O lists */
(prs_sct * const prs_arg, /* I/O [sct] Global information required in parser routines */
 const char * const spt_arg_cat, /* I [sng] User-specified script */
 nm_id_sct** const xtr_lst_a, /* O [sct] RHS variables present in input file */
 int * const nbr_lst_a, /* O [nbr] Number of distinct RHS variables in input file */
 nm_id_sct** const xtr_lst_b, /* O [sct] LHS variables present in input file */
 int * const nbr_lst_b, /* O [nbr] Number of distinct LHS variables in input file */
 nm_id_sct** const xtr_lst_c, /* O [sct] Parent variables of LHS attributes in input file */
 int * const nbr_lst_c, /* O [nbr] Number of attribute parent variables in input file */
 nm_id_sct** const xtr_lst_d, /* O [sct] LHS dimensions in input file */
 int * const nbr_lst_d) /* O [nbr] Number of LHS dimensions in input file */
{
  /* Purpose: Scan command script, construct I/O lists
     Call routine to learn metadata contents of output file prior to arithmetic processing
     lst_a: RHS variables present in input file
     lst_b: LHS variables present in input file
     lst_c: Parent variables of LHS attributes in input file
     lst_d: Dimensions required by LHS subscripts (casting) */
  
  /* 20020510: ncap_ntl_scn() was in ncap_utl.c but chokes g++ (not gcc)
     g++ complains that since YYSTYPE is defined in ncap_yacc.h,
     it is an error to call external function (yylex()) that uses this type
     Although the error is somewhat bogus, there is some merit to it
     Placing routine in ncap.l gives routine access to yylex() prototype and YYSTYPE
     Since ncap_ntl_scn() does call yylex(), it may reside in ncap.l
     To move routine to other file, #define NCAP_NTL_SCN_NOT_IN_NCAP_L */
#undef NCAP_NTL_SCN_NOT_IN_NCAP_L
#ifdef NCAP_NTL_SCN_NOT_IN_NCAP_L
  /* Get YYSTYPE prior to calling scanner */
#include "ncap_yacc.h" /* ncap_yacc.h (ncap.tab.h) is produced from ncap_yacc.y by parser generator */
  extern FILE *yyin; /* [fl] File handle for script file */
  extern int yylex(YYSTYPE *lval_ptr,prs_sct *prs_arg); /* [fnc] Scanner entrypoint */
/* Following declaration gets rid of implicit declaration compiler warning
   It is a condensation of the lexer declaration from lex.yy.c:
   YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *yy_str )); */
  extern int yy_scan_string(const char *);
#endif /* NCAP_NTL_SCN_NOT_IN_NCAP_L */

  bool mch_flg; /* [flg] Variable is defined in list already */
  
  char *var_nm;  

  int lst_a_nbr=0; /* [nbr] Number of elements in list A */
  int lst_b_nbr=0; /* [nbr] Number of elements in list B */
  int lst_c_nbr=0; /* [nbr] Number of elements in list C */
  int lst_d_nbr=0; /* [nbr] Number of elements in list D */
  int lst_t_nbr=0; /* [nbr] Number of elements in list T */
  int tkn_crr=-1; /* [tkn] Current token, must initialize to non-zero value */
  int var_id;
  int var_idx;

  nm_id_sct *lst_a=NULL_CEWI;
  nm_id_sct *lst_b=NULL_CEWI;
  nm_id_sct *lst_c=NULL_CEWI;
  nm_id_sct *lst_d=NULL_CEWI;
  nm_id_sct *lst_t=NULL_CEWI;  
  
  YYSTYPE lval; /* [tkn] Token */

  if(spt_arg_cat){
    yy_scan_string(spt_arg_cat);
  }else{
    /* Open script file for reading */
    if((yyin=fopen(ncap_fl_spt_glb[ncap_ncl_dpt_crr],"r")) == NULL){
      (void)fprintf(stderr,"%s: ERROR Unable to open script file %s\n",prg_nm_get(),ncap_fl_spt_glb[ncap_ncl_dpt_crr]);
      nco_exit(EXIT_FAILURE);
    } /* endif error */
  } /* endif input from script */
  
  /* While there are more tokens... */
  while(tkn_crr != 0){
    /* ...obtain next token from lexer... */
    tkn_crr=yylex(&lval,prs_arg);
    /* ...determine which variables and attributes exist in input file... */
    switch (tkn_crr){
    case IGNORE: break; /* Do nothing  */
    case SCV: break; /* Do nothing  */
    case EPROVOKE: break; /* Do nothing */
    case VAR: 
      /* Search for RHS variables in input file */
      var_nm=lval.var_nm_RHS;
      if(NC_NOERR == nco_inq_varid_flg(prs_arg->in_id,var_nm,&var_id)){
      mch_flg=False; /* [flg] Variable is defined in list already */
      /* Search RHS variables already known to be in input file... */
      for(var_idx=0;var_idx<lst_a_nbr;var_idx++){
        /* ...if the new variable is found then... */
        if(!strcmp(lst_a[var_idx].nm,var_nm)){
          /* ...set flag and... */
          mch_flg=True; /* [flg] Variable is defined in list already */
          /* ...stop looking through list... */
          break;
        } /* end if */
      } /* end loop over var */
      /* If RHS variable information is already in list we are done */
      if(mch_flg) break;
      /* Otherwise add new RHS variable to list */
      if(lst_a_nbr==0) lst_a=(nm_id_sct *)nco_malloc(sizeof(nm_id_sct)); else lst_a=(nm_id_sct *)nco_realloc(lst_a,((lst_a_nbr+1)*sizeof(nm_id_sct)));
      lst_a[lst_a_nbr].nm=(char *)strdup(var_nm);
      lst_a[lst_a_nbr++].id=var_id;
      } /* endif RHS variable is in input file */
      break; 
    case OUT_VAR: 
      /* Search for LHS variables in input file */
      var_nm=lval.var_nm_LHS;
      if(NC_NOERR == nco_inq_varid_flg(prs_arg->in_id,var_nm,&var_id)){
      mch_flg=False;
      for(var_idx=0;var_idx<lst_b_nbr;var_idx++)
        if(!strcmp(lst_b[var_idx].nm,var_nm)){mch_flg=True; break;}
      if(mch_flg) break;
      if(lst_b_nbr == 0) lst_b=(nm_id_sct *)nco_malloc(sizeof(nm_id_sct));
      else lst_b=(nm_id_sct *)nco_realloc(lst_b,((lst_b_nbr+1)*sizeof(nm_id_sct)));
      lst_b[lst_b_nbr].nm=(char *)strdup(var_nm);
      lst_b[lst_b_nbr++].id=var_id;
      } /* endif LHS variable is in input file */
      break;
    case OUT_ATT:
      /* Search for LHS attribute's parent variable in input file */
      var_nm=lval.aed.var_nm;     
      if(NC_NOERR == nco_inq_varid_flg(prs_arg->in_id,var_nm,&var_id)){
      mch_flg=False;
      for(var_idx=0;var_idx<lst_c_nbr;var_idx++)
        if(!strcmp(lst_c[var_idx].nm,var_nm)){mch_flg=True;break;}
      if(mch_flg) break;
      if(lst_c_nbr == 0) lst_c=(nm_id_sct *)nco_malloc(sizeof(nm_id_sct));
      else lst_c=(nm_id_sct *)nco_realloc(lst_c,((lst_c_nbr+1)*sizeof(nm_id_sct)));
      lst_c[lst_c_nbr].nm=(char *)strdup(var_nm);
      lst_c[lst_c_nbr++].id=var_id;
      } /* endif LHS attribute's parent variable is in input file  */
      break;
    case LHS_SBS:
      /* Add dimensions defined in LHS subscripts */
      lst_t=lst_d;
      lst_t_nbr=lst_t_nbr;
      lst_d=nco_var_lst_add(lst_d,&lst_d_nbr,lval.sbs_lst->lst,lval.sbs_lst->nbr);
      if(lst_t_nbr >0) (void)nco_var_lst_free(lst_t,lst_t_nbr);
      break;
    default: 
      /* Tokens that fall through are perfectly safe and normal
       Tokens values 1--256 are ASCII characters, values > 256 defined in yy.tab.h */
      if(dbg_lvl_get() >= 5)(void)fprintf(stderr,"%s: DEBUG Token type %d not handled in ncap_ntl_scn()\n",prg_nm_get(),tkn_crr);
      break;
    } /* end switch */
  } /* end while */
  
  if(lst_a_nbr > 0){*xtr_lst_a=lst_a;*nbr_lst_a=lst_a_nbr;}
  if(lst_b_nbr > 0){*xtr_lst_b=lst_b;*nbr_lst_b=lst_b_nbr;}
  if(lst_c_nbr > 0){*xtr_lst_c=lst_c;*nbr_lst_c=lst_c_nbr;}
  if(lst_d_nbr > 0){*xtr_lst_d=lst_d;*nbr_lst_d=lst_d_nbr;}
  
} /* end ncap_ntl_scn() */

int /* O [enm] Return code */ 
ncap_ncwa_scn /* [fnc] Scan command script, construct I/O lists */
(prs_sct * const prs_arg, /* I/O [sct] Global information required in parser routines */
 const char * const msk_sng, /* I [sng] User-specified script */
 char **msk_nm, /* O [sng] Masking variable name */
 double *msk_val, /* O [frc] Masking value */ 
 int *op_typ_rlt) /* O [enm] Relational operator type */ 
{   
  /* Get YYSTYPE prior to calling scanner */
  /*
    #include "ncap_yacc.h" 
    extern int yylex(YYSTYPE *lval_ptr,prs_sct *prs_arg); 
    extern int yy_scan_string(const char *);
  */
  
  bool scv_def=False;
  int op_typ=-1;
  int rcd=1;
  char *fnl_sng;
  char *msk_nm_LHS=NULL;
  scv_sct scv_out;
  
  int tkn_crr=-1; /* [tkn] Current token, must initialize to non-zero value */
  
  YYSTYPE lval; /* [tkn] Token */
  
  fnl_sng=(char *)nco_malloc((strlen(msk_sng)+3UL)*sizeof(char));
  
  (void)strcpy(fnl_sng,msk_sng);
  (void)strcat(fnl_sng,";\n");
  
  yy_scan_string(fnl_sng);
  
  /* While there are more tokens... */
  while(tkn_crr != 0){
    /* ...obtain next token from lexer... */
    tkn_crr=yylex(&lval,prs_arg);
    
    /* ...determine which variables and attributes exist in input file... */
    switch(tkn_crr){
    case OUT_VAR:
      msk_nm_LHS=strdup(lval.var_nm_LHS);
      break;
    case COMPARISON:
      op_typ=lval.nco_rlt_opr;
      break;
    case SCV:     
      scv_out=lval.scv;
      scv_def=True;
      break;
    default: 
      /* Tokens that fall through are perfectly safe and normal
       Tokens values 1--256 are ASCII characters, values > 256 defined in yy.tab.h */
      if(dbg_lvl_get() >= 5) (void)fprintf(stderr,"%s: DEBUG Token type %d not handled in ncap_ntl_scn()\n",prg_nm_get(),tkn_crr);
      
      /* Assume single '=' means '==' if op_typ is not defined */
      if(tkn_crr == '=' && op_typ == -1) op_typ=nco_op_eq;
      break;
    } /* end switch */
  } /* end while */
  
  /* Check all three items have been scanned in */
  if(msk_nm_LHS == (char *)NULL){
    (void)fprintf(stderr,"%s: Mask string (%s) does not contain valid variable name\n",prg_nm_get(),msk_sng);
    rcd=0;
  }else{
    *msk_nm=msk_nm_LHS;
  } /* endif */
  if(op_typ == -1){
    (void)fprintf(stderr,"%s: Mask string (%s) does not contain valid comparison operator\n",prg_nm_get(),msk_sng);
    rcd=0;
  }else{
    *op_typ_rlt=op_typ;
  } /* endif */
  if(scv_def == False){
    (void)fprintf(stderr,"%s: Mask string (%s) does not contain valid number\n",prg_nm_get(),msk_sng);
    rcd=0;
  }else{ 
    (void)nco_scv_cnf_typ((nc_type)NC_DOUBLE,&scv_out);
    *msk_val=scv_out.val.d;
  } /* endif */
  
  return rcd;
  
} /* end ncap_ncwa_scn() */

/* End user functions section */


Generated by  Doxygen 1.6.0   Back to index