From 66a2cd371a027c221d223cc8a112455b79b8e76c Mon Sep 17 00:00:00 2001 From: Ward Fisher Date: Mon, 7 Dec 2020 14:45:14 -0700 Subject: [PATCH] More tweaking. --- CMakeLists.txt | 8 +- ncgen/ncgenl.c | 973 ++++++++++++------- ncgen/ncgeny.c | 2528 ++++++++++++++++++++++++------------------------ ncgen/ncgeny.h | 225 ++--- 4 files changed, 1982 insertions(+), 1752 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f42f89ac0..6e56db824 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1585,10 +1585,12 @@ ENDIF() MACRO(GEN_m4 filename) +set(dest "${CMAKE_CURRENT_SOURCE_DIR}/${filename}.c") + # If m4 isn't present, and the generated file doesn't exist, # it cannot be generated and an error should be thrown. IF(NOT HAVE_M4) - IF(NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${filename.c}) + IF(NOT EXISTS ${dest}) MESSAGE(FATAL_ERROR "m4 is required to generate ${filename}.c. Please install m4 so that it is on the PATH and try again.") ENDIF() ENDIF(NOT HAVE_M4) @@ -1600,9 +1602,9 @@ MACRO(GEN_m4 filename) ENDIF() ADD_CUSTOM_COMMAND( - OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/${filename}.c + OUTPUT ${dest} COMMAND ${NC_M4} - ARGS ${M4FLAGS} ${CMAKE_CURRENT_SOURCE_DIR}/${filename}.m4 > ${CMAKE_CURRENT_SOURCE_DIR}/${filename}.c + ARGS ${M4FLAGS} ${CMAKE_CURRENT_SOURCE_DIR}/${filename}.m4 > ${dest} VERBATIM ) diff --git a/ncgen/ncgenl.c b/ncgen/ncgenl.c index 178448362..f40869944 100644 --- a/ncgen/ncgenl.c +++ b/ncgen/ncgenl.c @@ -1,5 +1,5 @@ -#line 3 "ncgenl.c" +#line 3 "lex.ncg.c" #define YY_INT_ALIGNED short int @@ -7,11 +7,17 @@ #define yy_create_buffer ncg_create_buffer #define yy_delete_buffer ncg_delete_buffer -#define yy_flex_debug ncg_flex_debug +#define yy_scan_buffer ncg_scan_buffer +#define yy_scan_string ncg_scan_string +#define yy_scan_bytes ncg_scan_bytes #define yy_init_buffer ncg_init_buffer #define yy_flush_buffer ncg_flush_buffer #define yy_load_buffer_state ncg_load_buffer_state #define yy_switch_to_buffer ncg_switch_to_buffer +#define yypush_buffer_state ncgpush_buffer_state +#define yypop_buffer_state ncgpop_buffer_state +#define yyensure_buffer_stack ncgensure_buffer_stack +#define yy_flex_debug ncg_flex_debug #define yyin ncgin #define yyleng ncgleng #define yylex ncglex @@ -26,12 +32,246 @@ #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 -#define YY_FLEX_MINOR_VERSION 5 -#define YY_FLEX_SUBMINOR_VERSION 35 +#define YY_FLEX_MINOR_VERSION 6 +#define YY_FLEX_SUBMINOR_VERSION 4 #if YY_FLEX_SUBMINOR_VERSION > 0 #define FLEX_BETA #endif +#ifdef yy_create_buffer +#define ncg_create_buffer_ALREADY_DEFINED +#else +#define yy_create_buffer ncg_create_buffer +#endif + +#ifdef yy_delete_buffer +#define ncg_delete_buffer_ALREADY_DEFINED +#else +#define yy_delete_buffer ncg_delete_buffer +#endif + +#ifdef yy_scan_buffer +#define ncg_scan_buffer_ALREADY_DEFINED +#else +#define yy_scan_buffer ncg_scan_buffer +#endif + +#ifdef yy_scan_string +#define ncg_scan_string_ALREADY_DEFINED +#else +#define yy_scan_string ncg_scan_string +#endif + +#ifdef yy_scan_bytes +#define ncg_scan_bytes_ALREADY_DEFINED +#else +#define yy_scan_bytes ncg_scan_bytes +#endif + +#ifdef yy_init_buffer +#define ncg_init_buffer_ALREADY_DEFINED +#else +#define yy_init_buffer ncg_init_buffer +#endif + +#ifdef yy_flush_buffer +#define ncg_flush_buffer_ALREADY_DEFINED +#else +#define yy_flush_buffer ncg_flush_buffer +#endif + +#ifdef yy_load_buffer_state +#define ncg_load_buffer_state_ALREADY_DEFINED +#else +#define yy_load_buffer_state ncg_load_buffer_state +#endif + +#ifdef yy_switch_to_buffer +#define ncg_switch_to_buffer_ALREADY_DEFINED +#else +#define yy_switch_to_buffer ncg_switch_to_buffer +#endif + +#ifdef yypush_buffer_state +#define ncgpush_buffer_state_ALREADY_DEFINED +#else +#define yypush_buffer_state ncgpush_buffer_state +#endif + +#ifdef yypop_buffer_state +#define ncgpop_buffer_state_ALREADY_DEFINED +#else +#define yypop_buffer_state ncgpop_buffer_state +#endif + +#ifdef yyensure_buffer_stack +#define ncgensure_buffer_stack_ALREADY_DEFINED +#else +#define yyensure_buffer_stack ncgensure_buffer_stack +#endif + +#ifdef yylex +#define ncglex_ALREADY_DEFINED +#else +#define yylex ncglex +#endif + +#ifdef yyrestart +#define ncgrestart_ALREADY_DEFINED +#else +#define yyrestart ncgrestart +#endif + +#ifdef yylex_init +#define ncglex_init_ALREADY_DEFINED +#else +#define yylex_init ncglex_init +#endif + +#ifdef yylex_init_extra +#define ncglex_init_extra_ALREADY_DEFINED +#else +#define yylex_init_extra ncglex_init_extra +#endif + +#ifdef yylex_destroy +#define ncglex_destroy_ALREADY_DEFINED +#else +#define yylex_destroy ncglex_destroy +#endif + +#ifdef yyget_debug +#define ncgget_debug_ALREADY_DEFINED +#else +#define yyget_debug ncgget_debug +#endif + +#ifdef yyset_debug +#define ncgset_debug_ALREADY_DEFINED +#else +#define yyset_debug ncgset_debug +#endif + +#ifdef yyget_extra +#define ncgget_extra_ALREADY_DEFINED +#else +#define yyget_extra ncgget_extra +#endif + +#ifdef yyset_extra +#define ncgset_extra_ALREADY_DEFINED +#else +#define yyset_extra ncgset_extra +#endif + +#ifdef yyget_in +#define ncgget_in_ALREADY_DEFINED +#else +#define yyget_in ncgget_in +#endif + +#ifdef yyset_in +#define ncgset_in_ALREADY_DEFINED +#else +#define yyset_in ncgset_in +#endif + +#ifdef yyget_out +#define ncgget_out_ALREADY_DEFINED +#else +#define yyget_out ncgget_out +#endif + +#ifdef yyset_out +#define ncgset_out_ALREADY_DEFINED +#else +#define yyset_out ncgset_out +#endif + +#ifdef yyget_leng +#define ncgget_leng_ALREADY_DEFINED +#else +#define yyget_leng ncgget_leng +#endif + +#ifdef yyget_text +#define ncgget_text_ALREADY_DEFINED +#else +#define yyget_text ncgget_text +#endif + +#ifdef yyget_lineno +#define ncgget_lineno_ALREADY_DEFINED +#else +#define yyget_lineno ncgget_lineno +#endif + +#ifdef yyset_lineno +#define ncgset_lineno_ALREADY_DEFINED +#else +#define yyset_lineno ncgset_lineno +#endif + +#ifdef yywrap +#define ncgwrap_ALREADY_DEFINED +#else +#define yywrap ncgwrap +#endif + +#ifdef yyalloc +#define ncgalloc_ALREADY_DEFINED +#else +#define yyalloc ncgalloc +#endif + +#ifdef yyrealloc +#define ncgrealloc_ALREADY_DEFINED +#else +#define yyrealloc ncgrealloc +#endif + +#ifdef yyfree +#define ncgfree_ALREADY_DEFINED +#else +#define yyfree ncgfree +#endif + +#ifdef yytext +#define ncgtext_ALREADY_DEFINED +#else +#define yytext ncgtext +#endif + +#ifdef yyleng +#define ncgleng_ALREADY_DEFINED +#else +#define yyleng ncgleng +#endif + +#ifdef yyin +#define ncgin_ALREADY_DEFINED +#else +#define yyin ncgin +#endif + +#ifdef yyout +#define ncgout_ALREADY_DEFINED +#else +#define yyout ncgout +#endif + +#ifdef yy_flex_debug +#define ncg_flex_debug_ALREADY_DEFINED +#else +#define yy_flex_debug ncg_flex_debug +#endif + +#ifdef yylineno +#define ncglineno_ALREADY_DEFINED +#else +#define yylineno ncglineno +#endif + /* First, we deal with platform-specific or compiler-specific issues. */ /* begin standard C headers. */ @@ -65,7 +305,6 @@ typedef int16_t flex_int16_t; typedef uint16_t flex_uint16_t; typedef int32_t flex_int32_t; typedef uint32_t flex_uint32_t; -typedef uint64_t flex_uint64_t; #else typedef signed char flex_int8_t; typedef short int flex_int16_t; @@ -73,7 +312,6 @@ 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 @@ -104,63 +342,61 @@ typedef unsigned int flex_uint32_t; #define UINT32_MAX (4294967295U) #endif +#ifndef SIZE_MAX +#define SIZE_MAX (~(size_t)0) +#endif + +#endif /* ! C99 */ + #endif /* ! FLEXINT_H */ -#ifdef __cplusplus +/* begin standard C++ headers. */ -/* The "const" storage-class-modifier is valid. */ -#define YY_USE_CONST - -#else /* ! __cplusplus */ - -/* C99 requires __STDC__ to be defined as 1. */ -#if defined (__STDC__) - -#define YY_USE_CONST - -#endif /* defined (__STDC__) */ -#endif /* ! __cplusplus */ - -#ifdef YY_USE_CONST +/* TODO: this is always defined, so inline it */ #define yyconst const + +#if defined(__GNUC__) && __GNUC__ >= 3 +#define yynoreturn __attribute__((__noreturn__)) #else -#define yyconst +#define yynoreturn #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. +/* Promotes a possibly negative, possibly signed char to an + * integer in range [0..255] for use as an array index. */ -#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) +#define YY_SC_TO_UI(c) ((YY_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 ncgrestart(ncgin ) - +#define YY_NEW_FILE yyrestart( yyin ) #define YY_END_OF_BUFFER_CHAR 0 /* Size of default input buffer. */ #ifndef YY_BUF_SIZE +#ifdef __ia64__ +/* On IA-64, the buffer size is 16k, not 8k. + * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. + * Ditto for the __ia64__ case accordingly. + */ +#define YY_BUF_SIZE 32768 +#else #define YY_BUF_SIZE 16384 +#endif /* __ia64__ */ #endif /* The state buf must be large enough to hold one state per character in the main buffer. @@ -177,30 +413,30 @@ typedef struct yy_buffer_state *YY_BUFFER_STATE; typedef size_t yy_size_t; #endif -extern yy_size_t ncgleng; +extern int yyleng; -extern FILE *ncgin, *ncgout; +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) + #define YY_LINENO_REWIND_TO(ptr) /* Return all but the first "n" matched characters back to the input stream. */ #define yyless(n) \ do \ { \ - /* Undo effects of setting up ncgtext. */ \ + /* 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 ncgtext again */ \ + YY_DO_BEFORE_ACTION; /* set up yytext again */ \ } \ while ( 0 ) - #define unput(c) yyunput( c, (yytext_ptr) ) #ifndef YY_STRUCT_YY_BUFFER_STATE @@ -215,12 +451,12 @@ struct yy_buffer_state /* Size of input buffer in bytes, not including room for EOB * characters. */ - yy_size_t yy_buf_size; + int yy_buf_size; /* Number of characters read into yy_ch_buf, not including EOB * characters. */ - yy_size_t yy_n_chars; + 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 @@ -243,7 +479,7 @@ struct yy_buffer_state 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. */ @@ -260,8 +496,8 @@ struct yy_buffer_state * possible backing-up. * * When we actually see the EOF, we change the status to "new" - * (via ncgrestart()), so that the user can continue scanning by - * just pointing ncgin at a new input file. + * (via yyrestart()), so that the user can continue scanning by + * just pointing yyin at a new input file. */ #define YY_BUFFER_EOF_PENDING 2 @@ -271,7 +507,7 @@ 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. */ +static YY_BUFFER_STATE * yy_buffer_stack = NULL; /**< 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 @@ -282,103 +518,98 @@ static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ #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 ncgtext is formed. */ +/* yy_hold_char holds the character lost when yytext is formed. */ static char yy_hold_char; -static yy_size_t yy_n_chars; /* number of characters read into yy_ch_buf */ -yy_size_t ncgleng; +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 char *yy_c_buf_p = NULL; static int yy_init = 0; /* whether we need to initialize */ static int yy_start = 0; /* start state number */ -/* Flag which is used to allow ncgwrap()'s to do buffer switches - * instead of setting up a fresh ncgin. A bit of a hack ... +/* 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 ncgrestart (FILE *input_file ); -void ncg_switch_to_buffer (YY_BUFFER_STATE new_buffer ); -YY_BUFFER_STATE ncg_create_buffer (FILE *file,int size ); -void ncg_delete_buffer (YY_BUFFER_STATE b ); -void ncg_flush_buffer (YY_BUFFER_STATE b ); -void ncgpush_buffer_state (YY_BUFFER_STATE new_buffer ); -void ncgpop_buffer_state (void ); +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 ncgensure_buffer_stack (void ); -static void ncg_load_buffer_state (void ); -static void ncg_init_buffer (YY_BUFFER_STATE b,FILE *file ); +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 ) -#define YY_FLUSH_BUFFER ncg_flush_buffer(YY_CURRENT_BUFFER ) +YY_BUFFER_STATE yy_scan_buffer ( char *base, yy_size_t size ); +YY_BUFFER_STATE yy_scan_string ( const char *yy_str ); +YY_BUFFER_STATE yy_scan_bytes ( const char *bytes, int len ); -YY_BUFFER_STATE ncg_scan_buffer (char *base,yy_size_t size ); -YY_BUFFER_STATE ncg_scan_string (yyconst char *yy_str ); -YY_BUFFER_STATE ncg_scan_bytes (yyconst char *bytes,yy_size_t len ); - -void *ncgalloc (yy_size_t ); -void *ncgrealloc (void *,yy_size_t ); -void ncgfree (void * ); - -#define yy_new_buffer ncg_create_buffer +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 ){ \ - ncgensure_buffer_stack (); \ + yyensure_buffer_stack (); \ YY_CURRENT_BUFFER_LVALUE = \ - ncg_create_buffer(ncgin,YY_BUF_SIZE ); \ + 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 ){\ - ncgensure_buffer_stack (); \ + yyensure_buffer_stack (); \ YY_CURRENT_BUFFER_LVALUE = \ - ncg_create_buffer(ncgin,YY_BUF_SIZE ); \ + 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 flex_uint8_t YY_CHAR; -typedef unsigned char YY_CHAR; - -FILE *ncgin = (FILE *) 0, *ncgout = (FILE *) 0; +FILE *yyin = NULL, *yyout = NULL; typedef int yy_state_type; -extern int ncglineno; +extern int yylineno; +int yylineno = 1; -int ncglineno = 1; +extern char *yytext; +#ifdef yytext_ptr +#undef yytext_ptr +#endif +#define yytext_ptr yytext -extern char *ncgtext; -#define yytext_ptr ncgtext - -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[] ); +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 yynoreturn yy_fatal_error ( const char* msg ); /* Done after the current pattern has been matched and before the - * corresponding action - sets up ncgtext. + * corresponding action - sets up yytext. */ #define YY_DO_BEFORE_ACTION \ (yytext_ptr) = yy_bp; \ - ncgleng = (yy_size_t) (yy_cp - yy_bp); \ + yyleng = (int) (yy_cp - yy_bp); \ (yy_hold_char) = *yy_cp; \ *yy_cp = '\0'; \ (yy_c_buf_p) = yy_cp; - #define YY_NUM_RULES 49 #define YY_END_OF_BUFFER 50 /* This struct is not used in this scanner, @@ -388,7 +619,7 @@ struct yy_trans_info flex_int32_t yy_verify; flex_int32_t yy_nxt; }; -static yyconst flex_int16_t yy_accept[422] = +static const flex_int16_t yy_accept[422] = { 0, 0, 0, 46, 46, 0, 0, 50, 48, 1, 44, 48, 48, 48, 48, 38, 32, 36, 36, 35, 35, @@ -439,7 +670,7 @@ static yyconst flex_int16_t yy_accept[422] = 0 } ; -static yyconst flex_int32_t yy_ec[256] = +static const YY_CHAR yy_ec[256] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 1, 2, 2, 1, 1, 1, 1, 1, 1, 1, @@ -471,7 +702,7 @@ static yyconst flex_int32_t yy_ec[256] = 1, 1, 1, 1, 1 } ; -static yyconst flex_int32_t yy_meta[69] = +static const YY_CHAR yy_meta[69] = { 0, 1, 1, 2, 1, 1, 1, 3, 4, 5, 5, 6, 7, 8, 8, 8, 8, 8, 8, 8, 1, @@ -482,7 +713,7 @@ static yyconst flex_int32_t yy_meta[69] = 11, 11, 11, 14, 1, 11, 11, 11 } ; -static yyconst flex_int16_t yy_base[440] = +static const flex_int16_t yy_base[440] = { 0, 0, 0, 325, 321, 264, 255, 318, 2387, 67, 2387, 64, 269, 61, 62, 95, 77, 136, 259, 51, 61, @@ -534,7 +765,7 @@ static yyconst flex_int16_t yy_base[440] = 2315, 2329, 2339, 2345, 2353, 2355, 2361, 2367, 2373 } ; -static yyconst flex_int16_t yy_def[440] = +static const flex_int16_t yy_def[440] = { 0, 421, 1, 422, 422, 423, 423, 421, 421, 421, 421, 424, 425, 421, 426, 421, 427, 421, 17, 428, 428, @@ -586,7 +817,7 @@ static yyconst flex_int16_t yy_def[440] = 421, 421, 421, 421, 421, 421, 421, 421, 421 } ; -static yyconst flex_int16_t yy_nxt[2456] = +static const flex_int16_t yy_nxt[2456] = { 0, 8, 9, 10, 9, 8, 11, 12, 8, 13, 14, 15, 16, 17, 18, 18, 18, 18, 18, 18, 8, @@ -860,7 +1091,7 @@ static yyconst flex_int16_t yy_nxt[2456] = 421, 421, 421, 421, 421 } ; -static yyconst flex_int16_t yy_chk[2456] = +static const flex_int16_t yy_chk[2456] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -1137,8 +1368,8 @@ static yyconst flex_int16_t yy_chk[2456] = static yy_state_type yy_last_accepting_state; static char *yy_last_accepting_cpos; -extern int ncg_flex_debug; -int ncg_flex_debug = 0; +extern int yy_flex_debug; +int yy_flex_debug = 0; /* The intent behind this definition is that it'll catch * any uses of REJECT which flex missed. @@ -1147,7 +1378,7 @@ int ncg_flex_debug = 0; #define yymore() yymore_used_but_not_detected #define YY_MORE_ADJ 0 #define YY_RESTORE_YY_MORE_OFFSET -char *ncgtext; +char *yytext; #line 1 "ncgen.l" #line 2 "ncgen.l" /********************************************************************* @@ -1320,7 +1551,7 @@ struct KWIDENT { }; static int identorkw(int token); - +#line 1555 "lex.ncg.c" /* The most correct (validating) version of UTF8 character set (Taken from: http://www.w3.org/2005/03/23-lex-U) @@ -1363,7 +1594,7 @@ ID ([A-Za-z_]|{UTF8})([A-Z.@#\[\]a-z_0-9+-]|{UTF8})* /* Note: this definition of string will work for utf8 as well, although it is a very relaxed definition */ -#line 1367 "ncgenl.c" +#line 1598 "lex.ncg.c" #define INITIAL 0 #define ST_C_COMMENT 1 @@ -1381,36 +1612,36 @@ ID ([A-Za-z_]|{UTF8})([A-Z.@#\[\]a-z_0-9+-]|{UTF8})* #define YY_EXTRA_TYPE void * #endif -static int yy_init_globals (void ); +static int yy_init_globals ( void ); /* Accessor methods to globals. These are made visible to non-reentrant scanners for convenience. */ -int ncglex_destroy (void ); +int yylex_destroy ( void ); -int ncgget_debug (void ); +int yyget_debug ( void ); -void ncgset_debug (int debug_flag ); +void yyset_debug ( int debug_flag ); -YY_EXTRA_TYPE ncgget_extra (void ); +YY_EXTRA_TYPE yyget_extra ( void ); -void ncgset_extra (YY_EXTRA_TYPE user_defined ); +void yyset_extra ( YY_EXTRA_TYPE user_defined ); -FILE *ncgget_in (void ); +FILE *yyget_in ( void ); -void ncgset_in (FILE * in_str ); +void yyset_in ( FILE * _in_str ); -FILE *ncgget_out (void ); +FILE *yyget_out ( void ); -void ncgset_out (FILE * out_str ); +void yyset_out ( FILE * _out_str ); -yy_size_t ncgget_leng (void ); + int yyget_leng ( void ); -char *ncgget_text (void ); +char *yyget_text ( void ); -int ncgget_lineno (void ); +int yyget_lineno ( void ); -void ncgset_lineno (int line_number ); +void yyset_lineno ( int _line_number ); /* Macros after this point can all be overridden by user definitions in * section 1. @@ -1418,35 +1649,43 @@ void ncgset_lineno (int line_number ); #ifndef YY_SKIP_YYWRAP #ifdef __cplusplus -extern "C" int ncgwrap (void ); +extern "C" int yywrap ( void ); #else -extern int ncgwrap (void ); +extern int yywrap ( void ); #endif #endif - static void yyunput (int c,char *buf_ptr ); +#ifndef YY_NO_UNPUT + static void yyunput ( int c, char *buf_ptr ); + +#endif + #ifndef yytext_ptr -static void yy_flex_strncpy (char *,yyconst char *,int ); +static void yy_flex_strncpy ( char *, const char *, int ); #endif #ifdef YY_NEED_STRLEN -static int yy_flex_strlen (yyconst char * ); +static int yy_flex_strlen ( const char * ); #endif #ifndef YY_NO_INPUT - #ifdef __cplusplus -static int yyinput (void ); +static int yyinput ( void ); #else -static int input (void ); +static int input ( void ); #endif #endif /* Amount of stuff to slurp up with each read. */ #ifndef YY_READ_BUF_SIZE +#ifdef __ia64__ +/* On IA-64, the buffer size is 16k, not 8k */ +#define YY_READ_BUF_SIZE 16384 +#else #define YY_READ_BUF_SIZE 8192 +#endif /* __ia64__ */ #endif /* Copy whatever the last rule matched to the standard output. */ @@ -1454,7 +1693,7 @@ static int input (void ); /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */ -#define ECHO fwrite( ncgtext, ncgleng, 1, ncgout ) +#define ECHO do { if (fwrite( yytext, (size_t) yyleng, 1, yyout )) {} } while (0) #endif /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, @@ -1465,20 +1704,20 @@ static int input (void ); if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ { \ int c = '*'; \ - yy_size_t n; \ + int n; \ for ( n = 0; n < max_size && \ - (c = getc( ncgin )) != EOF && c != '\n'; ++n ) \ + (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ buf[n] = (char) c; \ if ( c == '\n' ) \ buf[n++] = (char) c; \ - if ( c == EOF && ferror( ncgin ) ) \ + 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, ncgin))==0 && ferror(ncgin)) \ + while ( (result = (int) fread(buf, 1, (yy_size_t) max_size, yyin)) == 0 && ferror(yyin)) \ { \ if( errno != EINTR) \ { \ @@ -1486,7 +1725,7 @@ static int input (void ); break; \ } \ errno=0; \ - clearerr(ncgin); \ + clearerr(yyin); \ } \ }\ \ @@ -1519,12 +1758,12 @@ static int input (void ); #ifndef YY_DECL #define YY_DECL_IS_OURS 1 -extern int ncglex (void); +extern int yylex (void); -#define YY_DECL int ncglex (void) +#define YY_DECL int yylex (void) #endif /* !YY_DECL */ -/* Code executed at the beginning of each rule, after ncgtext and ncgleng +/* Code executed at the beginning of each rule, after yytext and yyleng * have been set up. */ #ifndef YY_USER_ACTION @@ -1533,7 +1772,7 @@ extern int ncglex (void); /* Code executed at the end of each rule. */ #ifndef YY_BREAK -#define YY_BREAK break; +#define YY_BREAK /*LINTED*/break; #endif #define YY_RULE_SETUP \ @@ -1543,14 +1782,10 @@ extern int ncglex (void); */ YY_DECL { - register yy_state_type yy_current_state; - register char *yy_cp, *yy_bp; - register int yy_act; + yy_state_type yy_current_state; + char *yy_cp, *yy_bp; + int yy_act; -#line 251 "ncgen.l" - -#line 1553 "ncgenl.c" - if ( !(yy_init) ) { (yy_init) = 1; @@ -1562,26 +1797,31 @@ YY_DECL if ( ! (yy_start) ) (yy_start) = 1; /* first start state */ - if ( ! ncgin ) - ncgin = stdin; + if ( ! yyin ) + yyin = stdin; - if ( ! ncgout ) - ncgout = stdout; + if ( ! yyout ) + yyout = stdout; if ( ! YY_CURRENT_BUFFER ) { - ncgensure_buffer_stack (); + yyensure_buffer_stack (); YY_CURRENT_BUFFER_LVALUE = - ncg_create_buffer(ncgin,YY_BUF_SIZE ); + yy_create_buffer( yyin, YY_BUF_SIZE ); } - ncg_load_buffer_state( ); + yy_load_buffer_state( ); } - while ( 1 ) /* loops until end-of-file is reached */ + { +#line 251 "ncgen.l" + +#line 1819 "lex.ncg.c" + + while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */ { yy_cp = (yy_c_buf_p); - /* Support of ncgtext. */ + /* Support of yytext. */ *yy_cp = (yy_hold_char); /* yy_bp points to the position in yy_ch_buf of the start of @@ -1593,7 +1833,7 @@ YY_DECL yy_match: do { - register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; + YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ; if ( yy_accept[yy_current_state] ) { (yy_last_accepting_state) = yy_current_state; @@ -1603,9 +1843,9 @@ yy_match: { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 422 ) - yy_c = yy_meta[(unsigned int) yy_c]; + yy_c = yy_meta[yy_c]; } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; ++yy_cp; } while ( yy_base[yy_current_state] != 2387 ); @@ -1654,14 +1894,14 @@ YY_RULE_SETUP /* In netcdf4, this will be used in a variety of places, so only remove escapes */ /* -if(ncgleng > MAXTRST) { +if(yyleng > MAXTRST) { yyerror("string too long, truncated\n"); -ncgtext[MAXTRST-1] = '\0'; +yytext[MAXTRST-1] = '\0'; } */ - len = unescape((char *)ncgtext+1,ncgleng-2,!ISIDENT,&s); + len = unescape((char *)yytext+1,yyleng-2,!ISIDENT,&s); if(len < 0) { - sprintf(errstr,"Illegal character: %s",ncgtext); + sprintf(errstr,"Illegal character: %s",yytext); yyerror(errstr); } bbClear(lextext); @@ -1675,8 +1915,8 @@ case 4: YY_RULE_SETUP #line 281 "ncgen.l" { /* drop leading 0x; pad to even number of chars */ - char* p = ncgtext+2; - int len = ncgleng - 2; + char* p = yytext+2; + int len = yyleng - 2; bbClear(lextext); bbAppendn(lextext,p,len); if((len % 2) == 1) bbAppend(lextext,'0'); @@ -1802,7 +2042,7 @@ case 27: YY_RULE_SETUP #line 322 "ncgen.l" { /* missing value (pre-2.4 backward compatibility) */ - if (ncgtext[0] == '-') { + if (yytext[0] == '-') { double_val = -INFINITY; } else { double_val = INFINITY; @@ -1824,7 +2064,7 @@ case 29: YY_RULE_SETUP #line 337 "ncgen.l" {/* missing value (pre-2.4 backward compatibility)*/ - if (ncgtext[0] == '-') { + if (yytext[0] == '-') { float_val = -INFINITYF; } else { float_val = INFINITYF; @@ -1860,7 +2100,7 @@ YY_RULE_SETUP #line 362 "ncgen.l" { bbClear(lextext); - bbAppendn(lextext,(char*)ncgtext,ncgleng+1); /* include null */ + bbAppendn(lextext,(char*)yytext,yyleng+1); /* include null */ bbNull(lextext); yylval.sym = makepath(bbContents(lextext)); return lexdebug(PATH); @@ -1871,7 +2111,7 @@ YY_RULE_SETUP #line 371 "ncgen.l" {struct Specialtoken* st; bbClear(lextext); - bbAppendn(lextext,(char*)ncgtext,ncgleng+1); /* include null */ + bbAppendn(lextext,(char*)yytext,yyleng+1); /* include null */ bbNull(lextext); for(st=specials;st->name;st++) { if(strcmp(bbContents(lextext),st->name)==0) {return lexdebug(st->token);} @@ -1888,7 +2128,7 @@ YY_RULE_SETUP char* p; char* q; /* copy the trimmed name */ bbClear(lextext); - bbAppendn(lextext,(char*)ncgtext,ncgleng+1); /* include null */ + bbAppendn(lextext,(char*)yytext,yyleng+1); /* include null */ bbNull(lextext); p = bbContents(lextext); q = p; @@ -1904,8 +2144,8 @@ case 35: YY_RULE_SETUP #line 398 "ncgen.l" { char* id = NULL; int len; - len = strlen(ncgtext); - len = unescape(ncgtext,len,ISIDENT,&id); + len = strlen(yytext); + len = unescape(yytext,len,ISIDENT,&id); if(NCSTREQ(id, FILL_STRING)) { efree(id); return lexdebug(FILLMARKER); @@ -2002,21 +2242,21 @@ YY_RULE_SETUP { int c; int token = 0; - int slen = strlen(ncgtext); + int slen = strlen(yytext); char* stag = NULL; int tag = NC_NAT; - char* hex = ncgtext+2; /* point to first true hex digit */ + char* hex = yytext+2; /* point to first true hex digit */ int xlen = (slen - 3); /* true hex length */ - ncgtext[slen-1] = '\0'; + yytext[slen-1] = '\0'; /* capture the tag string */ - tag = collecttag(ncgtext,&stag); + tag = collecttag(yytext,&stag); if(tag == NC_NAT) { sprintf(errstr,"Illegal integer suffix: %s",stag); yyerror(errstr); goto done; } - ncgtext[slen - strlen(stag)] = '\0'; + yytext[slen - strlen(stag)] = '\0'; if(xlen > 16) { /* truncate hi order digits */ hex += (xlen - 16); } @@ -2038,8 +2278,8 @@ YY_RULE_SETUP token = UINT64_CONST; break; default: /* should never happen */ - if (sscanf((char*)ncgtext, "%i", &uint32_val) != 1) { - sprintf(errstr,"bad unsigned int constant: %s",(char*)ncgtext); + if (sscanf((char*)yytext, "%i", &uint32_val) != 1) { + sprintf(errstr,"bad unsigned int constant: %s",(char*)yytext); yyerror(errstr); } token = UINT_CONST; @@ -2051,8 +2291,8 @@ case 38: YY_RULE_SETUP #line 535 "ncgen.l" { - if (sscanf((char*)ncgtext, "%le", &double_val) != 1) { - sprintf(errstr,"bad long or double constant: %s",(char*)ncgtext); + if (sscanf((char*)yytext, "%le", &double_val) != 1) { + sprintf(errstr,"bad long or double constant: %s",(char*)yytext); yyerror(errstr); } return lexdebug(DOUBLE_CONST); @@ -2062,8 +2302,8 @@ case 39: YY_RULE_SETUP #line 542 "ncgen.l" { - if (sscanf((char*)ncgtext, "%e", &float_val) != 1) { - sprintf(errstr,"bad float constant: %s",(char*)ncgtext); + if (sscanf((char*)yytext, "%e", &float_val) != 1) { + sprintf(errstr,"bad float constant: %s",(char*)yytext); yyerror(errstr); } return lexdebug(FLOAT_CONST); @@ -2074,7 +2314,7 @@ case 40: YY_RULE_SETUP #line 549 "ncgen.l" { - (void) sscanf((char*)&ncgtext[1],"%c",&byte_val); + (void) sscanf((char*)&yytext[1],"%c",&byte_val); return lexdebug(BYTE_CONST); } YY_BREAK @@ -2082,9 +2322,9 @@ case 41: YY_RULE_SETUP #line 553 "ncgen.l" { - int oct = unescapeoct(&ncgtext[2]); + int oct = unescapeoct(&yytext[2]); if(oct < 0) { - sprintf(errstr,"bad octal character constant: %s",(char*)ncgtext); + sprintf(errstr,"bad octal character constant: %s",(char*)yytext); yyerror(errstr); } byte_val = (unsigned int)oct; @@ -2095,9 +2335,9 @@ case 42: YY_RULE_SETUP #line 562 "ncgen.l" { - int hex = unescapehex(&ncgtext[3]); + int hex = unescapehex(&yytext[3]); if(byte_val < 0) { - sprintf(errstr,"bad hex character constant: %s",(char*)ncgtext); + sprintf(errstr,"bad hex character constant: %s",(char*)yytext); yyerror(errstr); } byte_val = (unsigned int)hex; @@ -2108,7 +2348,7 @@ case 43: YY_RULE_SETUP #line 571 "ncgen.l" { - switch ((char)ncgtext[2]) { + switch ((char)yytext[2]) { case 'a': byte_val = '\007'; break; /* not everyone under- * stands '\a' yet */ case 'b': byte_val = '\b'; break; @@ -2120,7 +2360,7 @@ YY_RULE_SETUP case '\\': byte_val = '\\'; break; case '?': byte_val = '\177'; break; case '\'': byte_val = '\''; break; - default: byte_val = (char)ncgtext[2]; + default: byte_val = (char)yytext[2]; } return lexdebug(BYTE_CONST); } @@ -2170,7 +2410,7 @@ case 48: YY_RULE_SETUP #line 614 "ncgen.l" {/* Note: this next rule will not work for UTF8 characters */ - return lexdebug(ncgtext[0]) ; + return lexdebug(yytext[0]) ; } YY_BREAK case 49: @@ -2178,7 +2418,7 @@ YY_RULE_SETUP #line 617 "ncgen.l" ECHO; YY_BREAK -#line 2182 "ncgenl.c" +#line 2422 "lex.ncg.c" case YY_STATE_EOF(INITIAL): case YY_STATE_EOF(TEXT): yyterminate(); @@ -2196,15 +2436,15 @@ case YY_STATE_EOF(TEXT): { /* We're scanning a new file or input source. It's * possible that this happened because the user - * just pointed ncgin at a new source and called - * ncglex(). If so, then we have to assure + * 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 = ncgin; + YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; } @@ -2257,11 +2497,11 @@ case YY_STATE_EOF(TEXT): { (yy_did_buffer_switch_on_eof) = 0; - if ( ncgwrap( ) ) + if ( yywrap( ) ) { /* Note: because we've taken care in * yy_get_next_buffer() to have set up - * ncgtext, we can now 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 @@ -2310,7 +2550,8 @@ case YY_STATE_EOF(TEXT): "fatal flex scanner internal error--no action found" ); } /* end of action switch */ } /* end of scanning one token */ -} /* end of ncglex */ + } /* end of user's declarations */ +} /* end of yylex */ /* yy_get_next_buffer - try to read in a new buffer * @@ -2321,9 +2562,9 @@ case YY_STATE_EOF(TEXT): */ 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; + char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; + char *source = (yytext_ptr); + int number_to_move, i; int ret_val; if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) @@ -2352,7 +2593,7 @@ static int yy_get_next_buffer (void) /* Try to read more data. */ /* First move last chars to start of buffer. */ - number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1; + number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr) - 1); for ( i = 0; i < number_to_move; ++i ) *(dest++) = *(source++); @@ -2365,21 +2606,21 @@ static int yy_get_next_buffer (void) else { - yy_size_t num_to_read = + int num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; while ( num_to_read <= 0 ) { /* Not enough room in the buffer - grow it. */ /* just a shorter name for the current buffer */ - YY_BUFFER_STATE b = YY_CURRENT_BUFFER; + YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE; int yy_c_buf_p_offset = (int) ((yy_c_buf_p) - b->yy_ch_buf); if ( b->yy_is_our_buffer ) { - yy_size_t new_size = b->yy_buf_size * 2; + int new_size = b->yy_buf_size * 2; if ( new_size <= 0 ) b->yy_buf_size += b->yy_buf_size / 8; @@ -2388,11 +2629,12 @@ static int yy_get_next_buffer (void) b->yy_ch_buf = (char *) /* Include room in for 2 EOB chars. */ - ncgrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ); + yyrealloc( (void *) b->yy_ch_buf, + (yy_size_t) (b->yy_buf_size + 2) ); } else /* Can't grow it, we don't own it. */ - b->yy_ch_buf = 0; + b->yy_ch_buf = NULL; if ( ! b->yy_ch_buf ) YY_FATAL_ERROR( @@ -2420,7 +2662,7 @@ static int yy_get_next_buffer (void) if ( number_to_move == YY_MORE_ADJ ) { ret_val = EOB_ACT_END_OF_FILE; - ncgrestart(ncgin ); + yyrestart( yyin ); } else @@ -2434,12 +2676,15 @@ static int yy_get_next_buffer (void) else ret_val = EOB_ACT_CONTINUE_SCAN; - if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { + if (((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { /* Extend the array by 50%, plus the number we really need. */ - yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) ncgrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ); + int new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc( + (void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf, (yy_size_t) new_size ); if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); + /* "- 2" to take care of EOB's */ + YY_CURRENT_BUFFER_LVALUE->yy_buf_size = (int) (new_size - 2); } (yy_n_chars) += number_to_move; @@ -2455,14 +2700,14 @@ static int yy_get_next_buffer (void) static yy_state_type yy_get_previous_state (void) { - register yy_state_type yy_current_state; - register char *yy_cp; + yy_state_type yy_current_state; + char *yy_cp; yy_current_state = (yy_start); for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) { - register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); + YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); if ( yy_accept[yy_current_state] ) { (yy_last_accepting_state) = yy_current_state; @@ -2472,9 +2717,9 @@ static int yy_get_next_buffer (void) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 422 ) - yy_c = yy_meta[(unsigned int) yy_c]; + yy_c = yy_meta[yy_c]; } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; } return yy_current_state; @@ -2487,10 +2732,10 @@ static int yy_get_next_buffer (void) */ static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) { - register int yy_is_jam; - register char *yy_cp = (yy_c_buf_p); + int yy_is_jam; + char *yy_cp = (yy_c_buf_p); - register YY_CHAR yy_c = 1; + YY_CHAR yy_c = 1; if ( yy_accept[yy_current_state] ) { (yy_last_accepting_state) = yy_current_state; @@ -2500,30 +2745,32 @@ static int yy_get_next_buffer (void) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 422 ) - yy_c = yy_meta[(unsigned int) yy_c]; + yy_c = yy_meta[yy_c]; } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; yy_is_jam = (yy_current_state == 421); - return yy_is_jam ? 0 : yy_current_state; + return yy_is_jam ? 0 : yy_current_state; } - static void yyunput (int c, register char * yy_bp ) +#ifndef YY_NO_UNPUT + + static void yyunput (int c, char * yy_bp ) { - register char *yy_cp; + char *yy_cp; yy_cp = (yy_c_buf_p); - /* undo effects of setting up ncgtext */ + /* 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 yy_size_t number_to_move = (yy_n_chars) + 2; - register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ + int number_to_move = (yy_n_chars) + 2; + char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; - register char *source = + char *source = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) @@ -2532,7 +2779,7 @@ static int yy_get_next_buffer (void) 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; + (yy_n_chars) = (int) 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" ); @@ -2545,6 +2792,8 @@ static int yy_get_next_buffer (void) (yy_c_buf_p) = yy_cp; } +#endif + #ifndef YY_NO_INPUT #ifdef __cplusplus static int yyinput (void) @@ -2569,7 +2818,7 @@ static int yy_get_next_buffer (void) else { /* need more input */ - yy_size_t offset = (yy_c_buf_p) - (yytext_ptr); + int offset = (int) ((yy_c_buf_p) - (yytext_ptr)); ++(yy_c_buf_p); switch ( yy_get_next_buffer( ) ) @@ -2586,13 +2835,13 @@ static int yy_get_next_buffer (void) */ /* Reset buffer status. */ - ncgrestart(ncgin ); + yyrestart( yyin ); /*FALLTHROUGH*/ case EOB_ACT_END_OF_FILE: { - if ( ncgwrap( ) ) + if ( yywrap( ) ) return 0; if ( ! (yy_did_buffer_switch_on_eof) ) @@ -2612,7 +2861,7 @@ static int yy_get_next_buffer (void) } c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ - *(yy_c_buf_p) = '\0'; /* preserve ncgtext */ + *(yy_c_buf_p) = '\0'; /* preserve yytext */ (yy_hold_char) = *++(yy_c_buf_p); return c; @@ -2624,32 +2873,32 @@ static int yy_get_next_buffer (void) * * @note This function does not reset the start condition to @c INITIAL . */ - void ncgrestart (FILE * input_file ) + void yyrestart (FILE * input_file ) { if ( ! YY_CURRENT_BUFFER ){ - ncgensure_buffer_stack (); + yyensure_buffer_stack (); YY_CURRENT_BUFFER_LVALUE = - ncg_create_buffer(ncgin,YY_BUF_SIZE ); + yy_create_buffer( yyin, YY_BUF_SIZE ); } - ncg_init_buffer(YY_CURRENT_BUFFER,input_file ); - ncg_load_buffer_state( ); + 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 ncg_switch_to_buffer (YY_BUFFER_STATE new_buffer ) + void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ) { /* TODO. We should be able to replace this entire function body * with - * ncgpop_buffer_state(); - * ncgpush_buffer_state(new_buffer); + * yypop_buffer_state(); + * yypush_buffer_state(new_buffer); */ - ncgensure_buffer_stack (); + yyensure_buffer_stack (); if ( YY_CURRENT_BUFFER == new_buffer ) return; @@ -2662,21 +2911,21 @@ static int yy_get_next_buffer (void) } YY_CURRENT_BUFFER_LVALUE = new_buffer; - ncg_load_buffer_state( ); + yy_load_buffer_state( ); /* We don't actually know whether we did this switch during - * EOF (ncgwrap()) processing, but the only time this flag - * is looked at is after ncgwrap() is called, so it's safe + * 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 ncg_load_buffer_state (void) +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; - ncgin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; + yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; (yy_hold_char) = *(yy_c_buf_p); } @@ -2686,35 +2935,35 @@ static void ncg_load_buffer_state (void) * * @return the allocated buffer state. */ - YY_BUFFER_STATE ncg_create_buffer (FILE * file, int size ) + YY_BUFFER_STATE yy_create_buffer (FILE * file, int size ) { YY_BUFFER_STATE b; - b = (YY_BUFFER_STATE) ncgalloc(sizeof( struct yy_buffer_state ) ); + b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) ); if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in ncg_create_buffer()" ); + 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 *) ncgalloc(b->yy_buf_size + 2 ); + b->yy_ch_buf = (char *) yyalloc( (yy_size_t) (b->yy_buf_size + 2) ); if ( ! b->yy_ch_buf ) - YY_FATAL_ERROR( "out of dynamic memory in ncg_create_buffer()" ); + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); b->yy_is_our_buffer = 1; - ncg_init_buffer(b,file ); + yy_init_buffer( b, file ); return b; } /** Destroy the buffer. - * @param b a buffer created with ncg_create_buffer() + * @param b a buffer created with yy_create_buffer() * */ - void ncg_delete_buffer (YY_BUFFER_STATE b ) + void yy_delete_buffer (YY_BUFFER_STATE b ) { if ( ! b ) @@ -2724,31 +2973,27 @@ static void ncg_load_buffer_state (void) YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; if ( b->yy_is_our_buffer ) - ncgfree((void *) b->yy_ch_buf ); + yyfree( (void *) b->yy_ch_buf ); - ncgfree((void *) b ); + 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 ncgrestart() or at EOF. + * such as during a yyrestart() or at EOF. */ - static void ncg_init_buffer (YY_BUFFER_STATE b, FILE * file ) + static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file ) { int oerrno = errno; - ncg_flush_buffer(b ); + yy_flush_buffer( b ); b->yy_input_file = file; b->yy_fill_buffer = 1; - /* If b is the current buffer, then ncg_init_buffer was _probably_ - * called from ncgrestart() or through yy_get_next_buffer. + /* 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){ @@ -2765,7 +3010,7 @@ extern int isatty (int ); * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. * */ - void ncg_flush_buffer (YY_BUFFER_STATE b ) + void yy_flush_buffer (YY_BUFFER_STATE b ) { if ( ! b ) return; @@ -2785,7 +3030,7 @@ extern int isatty (int ); b->yy_buffer_status = YY_BUFFER_NEW; if ( b == YY_CURRENT_BUFFER ) - ncg_load_buffer_state( ); + yy_load_buffer_state( ); } /** Pushes the new state onto the stack. The new state becomes @@ -2794,14 +3039,14 @@ extern int isatty (int ); * @param new_buffer The new state. * */ -void ncgpush_buffer_state (YY_BUFFER_STATE new_buffer ) +void yypush_buffer_state (YY_BUFFER_STATE new_buffer ) { if (new_buffer == NULL) return; - ncgensure_buffer_stack(); + yyensure_buffer_stack(); - /* This block is copied from ncg_switch_to_buffer. */ + /* This block is copied from yy_switch_to_buffer. */ if ( YY_CURRENT_BUFFER ) { /* Flush out information for old buffer. */ @@ -2815,8 +3060,8 @@ void ncgpush_buffer_state (YY_BUFFER_STATE new_buffer ) (yy_buffer_stack_top)++; YY_CURRENT_BUFFER_LVALUE = new_buffer; - /* copied from ncg_switch_to_buffer. */ - ncg_load_buffer_state( ); + /* copied from yy_switch_to_buffer. */ + yy_load_buffer_state( ); (yy_did_buffer_switch_on_eof) = 1; } @@ -2824,18 +3069,18 @@ void ncgpush_buffer_state (YY_BUFFER_STATE new_buffer ) * The next element becomes the new top. * */ -void ncgpop_buffer_state (void) +void yypop_buffer_state (void) { if (!YY_CURRENT_BUFFER) return; - ncg_delete_buffer(YY_CURRENT_BUFFER ); + 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) { - ncg_load_buffer_state( ); + yy_load_buffer_state( ); (yy_did_buffer_switch_on_eof) = 1; } } @@ -2843,7 +3088,7 @@ void ncgpop_buffer_state (void) /* Allocates the stack if it does not exist. * Guarantees space for at least one push. */ -static void ncgensure_buffer_stack (void) +static void yyensure_buffer_stack (void) { yy_size_t num_to_alloc; @@ -2853,15 +3098,15 @@ static void ncgensure_buffer_stack (void) * 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**)ncgalloc + num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */ + (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc (num_to_alloc * sizeof(struct yy_buffer_state*) ); if ( ! (yy_buffer_stack) ) - YY_FATAL_ERROR( "out of dynamic memory in ncgensure_buffer_stack()" ); - + YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); + 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; @@ -2870,15 +3115,15 @@ static void ncgensure_buffer_stack (void) 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 */; + yy_size_t grow_size = 8 /* arbitrary grow size */; num_to_alloc = (yy_buffer_stack_max) + grow_size; - (yy_buffer_stack) = (struct yy_buffer_state**)ncgrealloc + (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc ((yy_buffer_stack), num_to_alloc * sizeof(struct yy_buffer_state*) ); if ( ! (yy_buffer_stack) ) - YY_FATAL_ERROR( "out of dynamic memory in ncgensure_buffer_stack()" ); + YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); /* zero only the new slots.*/ memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); @@ -2890,9 +3135,9 @@ static void ncgensure_buffer_stack (void) * @param base the character buffer * @param size the size in bytes of the character buffer * - * @return the newly allocated buffer state object. + * @return the newly allocated buffer state object. */ -YY_BUFFER_STATE ncg_scan_buffer (char * base, yy_size_t size ) +YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size ) { YY_BUFFER_STATE b; @@ -2900,68 +3145,69 @@ YY_BUFFER_STATE ncg_scan_buffer (char * base, yy_size_t size ) 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; + return NULL; - b = (YY_BUFFER_STATE) ncgalloc(sizeof( struct yy_buffer_state ) ); + b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) ); if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in ncg_scan_buffer()" ); + 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_size = (int) (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_input_file = NULL; 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; - ncg_switch_to_buffer(b ); + yy_switch_to_buffer( b ); return b; } -/** Setup the input buffer state to scan a string. The next call to ncglex() will +/** Setup the input buffer state to scan a string. The next call to yylex() will * scan from a @e copy of @a str. * @param yystr 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 - * ncg_scan_bytes() instead. + * yy_scan_bytes() instead. */ -YY_BUFFER_STATE ncg_scan_string (yyconst char * yystr ) +YY_BUFFER_STATE yy_scan_string (const char * yystr ) { - return ncg_scan_bytes(yystr,strlen(yystr) ); + return yy_scan_bytes( yystr, (int) strlen(yystr) ); } -/** Setup the input buffer state to scan the given bytes. The next call to ncglex() will +/** 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. + * @param yybytes the byte buffer to scan + * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. * * @return the newly allocated buffer state object. */ -YY_BUFFER_STATE ncg_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len ) +YY_BUFFER_STATE yy_scan_bytes (const char * yybytes, int _yybytes_len ) { YY_BUFFER_STATE b; char *buf; - yy_size_t n, i; + yy_size_t n; + int i; /* Get memory for full buffer, including space for trailing EOB's. */ - n = _yybytes_len + 2; - buf = (char *) ncgalloc(n ); + n = (yy_size_t) (_yybytes_len + 2); + buf = (char *) yyalloc( n ); if ( ! buf ) - YY_FATAL_ERROR( "out of dynamic memory in ncg_scan_bytes()" ); + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); for ( i = 0; i < _yybytes_len; ++i ) buf[i] = yybytes[i]; buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; - b = ncg_scan_buffer(buf,n ); + b = yy_scan_buffer( buf, n ); if ( ! b ) - YY_FATAL_ERROR( "bad buffer in ncg_scan_bytes()" ); + 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. @@ -2975,9 +3221,9 @@ YY_BUFFER_STATE ncg_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len #define YY_EXIT_FAILURE 2 #endif -static void yy_fatal_error (yyconst char* msg ) +static void yynoreturn yy_fatal_error (const char* msg ) { - (void) fprintf( stderr, "%s\n", msg ); + fprintf( stderr, "%s\n", msg ); exit( YY_EXIT_FAILURE ); } @@ -2987,14 +3233,14 @@ static void yy_fatal_error (yyconst char* msg ) #define yyless(n) \ do \ { \ - /* Undo effects of setting up ncgtext. */ \ + /* Undo effects of setting up yytext. */ \ int yyless_macro_arg = (n); \ YY_LESS_LINENO(yyless_macro_arg);\ - ncgtext[ncgleng] = (yy_hold_char); \ - (yy_c_buf_p) = ncgtext + 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'; \ - ncgleng = yyless_macro_arg; \ + yyleng = yyless_macro_arg; \ } \ while ( 0 ) @@ -3003,126 +3249,126 @@ static void yy_fatal_error (yyconst char* msg ) /** Get the current line number. * */ -int ncgget_lineno (void) +int yyget_lineno (void) { - - return ncglineno; + + return yylineno; } /** Get the input stream. * */ -FILE *ncgget_in (void) +FILE *yyget_in (void) { - return ncgin; + return yyin; } /** Get the output stream. * */ -FILE *ncgget_out (void) +FILE *yyget_out (void) { - return ncgout; + return yyout; } /** Get the length of the current token. * */ -yy_size_t ncgget_leng (void) +int yyget_leng (void) { - return ncgleng; + return yyleng; } /** Get the current token. * */ -char *ncgget_text (void) +char *yyget_text (void) { - return ncgtext; + return yytext; } /** Set the current line number. - * @param line_number + * @param _line_number line number * */ -void ncgset_lineno (int line_number ) +void yyset_lineno (int _line_number ) { - ncglineno = line_number; + yylineno = _line_number; } /** Set the input stream. This does not discard the current * input buffer. - * @param in_str A readable stream. + * @param _in_str A readable stream. * - * @see ncg_switch_to_buffer + * @see yy_switch_to_buffer */ -void ncgset_in (FILE * in_str ) +void yyset_in (FILE * _in_str ) { - ncgin = in_str ; + yyin = _in_str ; } -void ncgset_out (FILE * out_str ) +void yyset_out (FILE * _out_str ) { - ncgout = out_str ; + yyout = _out_str ; } -int ncgget_debug (void) +int yyget_debug (void) { - return ncg_flex_debug; + return yy_flex_debug; } -void ncgset_debug (int bdebug ) +void yyset_debug (int _bdebug ) { - ncg_flex_debug = bdebug ; + yy_flex_debug = _bdebug ; } static int yy_init_globals (void) { /* Initialization is the same as for the non-reentrant scanner. - * This function is called from ncglex_destroy(), so don't allocate here. + * This function is called from yylex_destroy(), so don't allocate here. */ - (yy_buffer_stack) = 0; + (yy_buffer_stack) = NULL; (yy_buffer_stack_top) = 0; (yy_buffer_stack_max) = 0; - (yy_c_buf_p) = (char *) 0; + (yy_c_buf_p) = NULL; (yy_init) = 0; (yy_start) = 0; /* Defined in main.c */ #ifdef YY_STDINIT - ncgin = stdin; - ncgout = stdout; + yyin = stdin; + yyout = stdout; #else - ncgin = (FILE *) 0; - ncgout = (FILE *) 0; + yyin = NULL; + yyout = NULL; #endif /* For future reference: Set errno on error, since we are called by - * ncglex_init() + * yylex_init() */ return 0; } -/* ncglex_destroy is for both reentrant and non-reentrant scanners. */ -int ncglex_destroy (void) +/* 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){ - ncg_delete_buffer(YY_CURRENT_BUFFER ); + yy_delete_buffer( YY_CURRENT_BUFFER ); YY_CURRENT_BUFFER_LVALUE = NULL; - ncgpop_buffer_state(); + yypop_buffer_state(); } /* Destroy the stack itself. */ - ncgfree((yy_buffer_stack) ); + yyfree((yy_buffer_stack) ); (yy_buffer_stack) = NULL; /* Reset the globals. This is important in a non-reentrant scanner so the next time - * ncglex() is called, initialization will occur. */ + * yylex() is called, initialization will occur. */ yy_init_globals( ); return 0; @@ -3133,18 +3379,19 @@ int ncglex_destroy (void) */ #ifndef yytext_ptr -static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) +static void yy_flex_strncpy (char* s1, const char * s2, int n ) { - register int i; + + 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 ) +static int yy_flex_strlen (const char * s ) { - register int n; + int n; for ( n = 0; s[n]; ++n ) ; @@ -3152,13 +3399,14 @@ static int yy_flex_strlen (yyconst char * s ) } #endif -void *ncgalloc (yy_size_t size ) +void *yyalloc (yy_size_t size ) { - return (void *) malloc( size ); + return malloc(size); } -void *ncgrealloc (void * ptr, yy_size_t 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 @@ -3166,26 +3414,25 @@ void *ncgrealloc (void * ptr, yy_size_t size ) * any pointer type to void*, and deal with argument conversions * as though doing an assignment. */ - return (void *) realloc( (char *) ptr, size ); + return realloc(ptr, size); } -void ncgfree (void * ptr ) +void yyfree (void * ptr ) { - free( (char *) ptr ); /* see ncgrealloc() for (char *) cast */ + free( (char *) ptr ); /* see yyrealloc() for (char *) cast */ } #define YYTABLES_NAME "yytables" #line 617 "ncgen.l" - static int lexdebug(int token) { if(debug >= 2) { - char* text = ncgtext; - text[ncgleng] = 0; + char* text = yytext; + text[yyleng] = 0; fprintf(stderr,"Token=%d |%s| line=%d\n",token,text,lineno); } return token; @@ -3475,7 +3722,7 @@ collecttag(char* text, char** stagp) static int identorkw(int token) { - /* Binary search for ncgtext */ + /* Binary search for yytext */ int n = NKWIDENT; int L = 0; int R = (n - 1); @@ -3500,8 +3747,8 @@ identorkw(int token) /* See if the format applies */ if(p->formats & ((int)1<. */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work @@ -43,11 +41,14 @@ define necessary library symbols; they are noted "INFRINGES ON USER NAME SPACE" below. */ +/* Undocumented macros, especially those whose name start with YY_, + are private implementation details. Do not rely on them. */ + /* Identify Bison output. */ #define YYBISON 1 /* Bison version. */ -#define YYBISON_VERSION "2.3" +#define YYBISON_VERSION "3.5.1" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -55,139 +56,23 @@ /* Pure parsers. */ #define YYPURE 0 -/* Using locations. */ -#define YYLSP_NEEDED 0 +/* Push parsers. */ +#define YYPUSH 0 + +/* Pull parsers. */ +#define YYPULL 1 + /* Substitute the variable and function names. */ -#define yyparse ncgparse -#define yylex ncglex -#define yyerror ncgerror -#define yylval ncglval -#define yychar ncgchar -#define yydebug ncgdebug -#define yynerrs ncgnerrs +#define yyparse ncgparse +#define yylex ncglex +#define yyerror ncgerror +#define yydebug ncgdebug +#define yynerrs ncgnerrs +#define yylval ncglval +#define yychar ncgchar - -/* Tokens. */ -#ifndef YYTOKENTYPE -# define YYTOKENTYPE - /* Put the tokens into the symbol table, so that GDB and other debuggers - know about them. */ - enum yytokentype { - NC_UNLIMITED_K = 258, - CHAR_K = 259, - BYTE_K = 260, - SHORT_K = 261, - INT_K = 262, - FLOAT_K = 263, - DOUBLE_K = 264, - UBYTE_K = 265, - USHORT_K = 266, - UINT_K = 267, - INT64_K = 268, - UINT64_K = 269, - STRING_K = 270, - IDENT = 271, - TERMSTRING = 272, - CHAR_CONST = 273, - BYTE_CONST = 274, - SHORT_CONST = 275, - INT_CONST = 276, - INT64_CONST = 277, - UBYTE_CONST = 278, - USHORT_CONST = 279, - UINT_CONST = 280, - UINT64_CONST = 281, - FLOAT_CONST = 282, - DOUBLE_CONST = 283, - DIMENSIONS = 284, - VARIABLES = 285, - NETCDF = 286, - DATA = 287, - TYPES = 288, - COMPOUND = 289, - ENUM = 290, - OPAQUE_ = 291, - OPAQUESTRING = 292, - GROUP = 293, - PATH = 294, - FILLMARKER = 295, - NIL = 296, - _FILLVALUE = 297, - _FORMAT = 298, - _STORAGE = 299, - _CHUNKSIZES = 300, - _DEFLATELEVEL = 301, - _SHUFFLE = 302, - _ENDIANNESS = 303, - _NOFILL = 304, - _FLETCHER32 = 305, - _NCPROPS = 306, - _ISNETCDF4 = 307, - _SUPERBLOCK = 308, - _FILTER = 309, - DATASETID = 310 - }; -#endif -/* Tokens. */ -#define NC_UNLIMITED_K 258 -#define CHAR_K 259 -#define BYTE_K 260 -#define SHORT_K 261 -#define INT_K 262 -#define FLOAT_K 263 -#define DOUBLE_K 264 -#define UBYTE_K 265 -#define USHORT_K 266 -#define UINT_K 267 -#define INT64_K 268 -#define UINT64_K 269 -#define STRING_K 270 -#define IDENT 271 -#define TERMSTRING 272 -#define CHAR_CONST 273 -#define BYTE_CONST 274 -#define SHORT_CONST 275 -#define INT_CONST 276 -#define INT64_CONST 277 -#define UBYTE_CONST 278 -#define USHORT_CONST 279 -#define UINT_CONST 280 -#define UINT64_CONST 281 -#define FLOAT_CONST 282 -#define DOUBLE_CONST 283 -#define DIMENSIONS 284 -#define VARIABLES 285 -#define NETCDF 286 -#define DATA 287 -#define TYPES 288 -#define COMPOUND 289 -#define ENUM 290 -#define OPAQUE_ 291 -#define OPAQUESTRING 292 -#define GROUP 293 -#define PATH 294 -#define FILLMARKER 295 -#define NIL 296 -#define _FILLVALUE 297 -#define _FORMAT 298 -#define _STORAGE 299 -#define _CHUNKSIZES 300 -#define _DEFLATELEVEL 301 -#define _SHUFFLE 302 -#define _ENDIANNESS 303 -#define _NOFILL 304 -#define _FLETCHER32 305 -#define _NCPROPS 306 -#define _ISNETCDF4 307 -#define _SUPERBLOCK 308 -#define _FILTER 309 -#define DATASETID 310 - - - - -/* Copy the first part of user declarations. */ +/* First part of user prologue. */ #line 11 "ncgen.y" /* @@ -326,11 +211,28 @@ static void yyerror(fmt,va_alist) const char* fmt; va_dcl; extern int lex_init(void); +#line 215 "ncgen.tab.c" -/* Enabling traces. */ -#ifndef YYDEBUG -# define YYDEBUG 1 -#endif +# ifndef YY_CAST +# ifdef __cplusplus +# define YY_CAST(Type, Val) static_cast (Val) +# define YY_REINTERPRET_CAST(Type, Val) reinterpret_cast (Val) +# else +# define YY_CAST(Type, Val) ((Type) (Val)) +# define YY_REINTERPRET_CAST(Type, Val) ((Type) (Val)) +# endif +# endif +# ifndef YY_NULLPTR +# if defined __cplusplus +# if 201103L <= __cplusplus +# define YY_NULLPTR nullptr +# else +# define YY_NULLPTR 0 +# endif +# else +# define YY_NULLPTR ((void*)0) +# endif +# endif /* Enabling verbose error messages. */ #ifdef YYERROR_VERBOSE @@ -340,67 +242,182 @@ extern int lex_init(void); # define YYERROR_VERBOSE 1 #endif -/* Enabling the token table. */ -#ifndef YYTOKEN_TABLE -# define YYTOKEN_TABLE 0 +/* Use api.header.include to #include this header + instead of duplicating it here. */ +#ifndef YY_NCG_NCGEN_TAB_H_INCLUDED +# define YY_NCG_NCGEN_TAB_H_INCLUDED +/* Debug traces. */ +#ifndef YYDEBUG +# define YYDEBUG 1 +#endif +#if YYDEBUG +extern int ncgdebug; #endif +/* Token type. */ +#ifndef YYTOKENTYPE +# define YYTOKENTYPE + enum yytokentype + { + NC_UNLIMITED_K = 258, + CHAR_K = 259, + BYTE_K = 260, + SHORT_K = 261, + INT_K = 262, + FLOAT_K = 263, + DOUBLE_K = 264, + UBYTE_K = 265, + USHORT_K = 266, + UINT_K = 267, + INT64_K = 268, + UINT64_K = 269, + STRING_K = 270, + IDENT = 271, + TERMSTRING = 272, + CHAR_CONST = 273, + BYTE_CONST = 274, + SHORT_CONST = 275, + INT_CONST = 276, + INT64_CONST = 277, + UBYTE_CONST = 278, + USHORT_CONST = 279, + UINT_CONST = 280, + UINT64_CONST = 281, + FLOAT_CONST = 282, + DOUBLE_CONST = 283, + DIMENSIONS = 284, + VARIABLES = 285, + NETCDF = 286, + DATA = 287, + TYPES = 288, + COMPOUND = 289, + ENUM = 290, + OPAQUE_ = 291, + OPAQUESTRING = 292, + GROUP = 293, + PATH = 294, + FILLMARKER = 295, + NIL = 296, + _FILLVALUE = 297, + _FORMAT = 298, + _STORAGE = 299, + _CHUNKSIZES = 300, + _DEFLATELEVEL = 301, + _SHUFFLE = 302, + _ENDIANNESS = 303, + _NOFILL = 304, + _FLETCHER32 = 305, + _NCPROPS = 306, + _ISNETCDF4 = 307, + _SUPERBLOCK = 308, + _FILTER = 309, + DATASETID = 310 + }; +#endif + +/* Value type. */ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED -typedef union YYSTYPE -#line 151 "ncgen.y" +union YYSTYPE { +#line 151 "ncgen.y" + Symbol* sym; unsigned long size; /* allow for zero size to indicate e.g. UNLIMITED*/ long mark; /* track indices into the sequence*/ int nctype; /* for tracking attribute list type*/ Datalist* datalist; NCConstant* constant; -} -/* Line 193 of yacc.c. */ -#line 361 "ncgeny.c" - YYSTYPE; -# define yystype YYSTYPE /* obsolescent; will be withdrawn */ -# define YYSTYPE_IS_DECLARED 1 + +#line 332 "ncgen.tab.c" + +}; +typedef union YYSTYPE YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 +# define YYSTYPE_IS_DECLARED 1 #endif +extern YYSTYPE ncglval; -/* Copy the second part of user declarations. */ +int ncgparse (void); + +#endif /* !YY_NCG_NCGEN_TAB_H_INCLUDED */ -/* Line 216 of yacc.c. */ -#line 374 "ncgeny.c" #ifdef short # undef short #endif -#ifdef YYTYPE_UINT8 -typedef YYTYPE_UINT8 yytype_uint8; -#else -typedef unsigned char yytype_uint8; +/* On compilers that do not define __PTRDIFF_MAX__ etc., make sure + and (if available) are included + so that the code can choose integer types of a good width. */ + +#ifndef __PTRDIFF_MAX__ +# include /* INFRINGES ON USER NAME SPACE */ +# if defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__ +# include /* INFRINGES ON USER NAME SPACE */ +# define YY_STDINT_H +# endif #endif -#ifdef YYTYPE_INT8 -typedef YYTYPE_INT8 yytype_int8; -#elif (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) +/* Narrow types that promote to a signed type and that can represent a + signed or unsigned integer of at least N bits. In tables they can + save space and decrease cache pressure. Promoting to a signed type + helps avoid bugs in integer arithmetic. */ + +#ifdef __INT_LEAST8_MAX__ +typedef __INT_LEAST8_TYPE__ yytype_int8; +#elif defined YY_STDINT_H +typedef int_least8_t yytype_int8; +#else typedef signed char yytype_int8; -#else -typedef short int yytype_int8; #endif -#ifdef YYTYPE_UINT16 -typedef YYTYPE_UINT16 yytype_uint16; +#ifdef __INT_LEAST16_MAX__ +typedef __INT_LEAST16_TYPE__ yytype_int16; +#elif defined YY_STDINT_H +typedef int_least16_t yytype_int16; #else -typedef unsigned short int yytype_uint16; +typedef short yytype_int16; #endif -#ifdef YYTYPE_INT16 -typedef YYTYPE_INT16 yytype_int16; +#if defined __UINT_LEAST8_MAX__ && __UINT_LEAST8_MAX__ <= __INT_MAX__ +typedef __UINT_LEAST8_TYPE__ yytype_uint8; +#elif (!defined __UINT_LEAST8_MAX__ && defined YY_STDINT_H \ + && UINT_LEAST8_MAX <= INT_MAX) +typedef uint_least8_t yytype_uint8; +#elif !defined __UINT_LEAST8_MAX__ && UCHAR_MAX <= INT_MAX +typedef unsigned char yytype_uint8; #else -typedef short int yytype_int16; +typedef short yytype_uint8; +#endif + +#if defined __UINT_LEAST16_MAX__ && __UINT_LEAST16_MAX__ <= __INT_MAX__ +typedef __UINT_LEAST16_TYPE__ yytype_uint16; +#elif (!defined __UINT_LEAST16_MAX__ && defined YY_STDINT_H \ + && UINT_LEAST16_MAX <= INT_MAX) +typedef uint_least16_t yytype_uint16; +#elif !defined __UINT_LEAST16_MAX__ && USHRT_MAX <= INT_MAX +typedef unsigned short yytype_uint16; +#else +typedef int yytype_uint16; +#endif + +#ifndef YYPTRDIFF_T +# if defined __PTRDIFF_TYPE__ && defined __PTRDIFF_MAX__ +# define YYPTRDIFF_T __PTRDIFF_TYPE__ +# define YYPTRDIFF_MAXIMUM __PTRDIFF_MAX__ +# elif defined PTRDIFF_MAX +# ifndef ptrdiff_t +# include /* INFRINGES ON USER NAME SPACE */ +# endif +# define YYPTRDIFF_T ptrdiff_t +# define YYPTRDIFF_MAXIMUM PTRDIFF_MAX +# else +# define YYPTRDIFF_T long +# define YYPTRDIFF_MAXIMUM LONG_MAX +# endif #endif #ifndef YYSIZE_T @@ -408,53 +425,96 @@ typedef short int yytype_int16; # define YYSIZE_T __SIZE_TYPE__ # elif defined size_t # define YYSIZE_T size_t -# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) +# elif defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__ # include /* INFRINGES ON USER NAME SPACE */ # define YYSIZE_T size_t # else -# define YYSIZE_T unsigned int +# define YYSIZE_T unsigned # endif #endif -#define YYSIZE_MAXIMUM ((YYSIZE_T) -1) +#define YYSIZE_MAXIMUM \ + YY_CAST (YYPTRDIFF_T, \ + (YYPTRDIFF_MAXIMUM < YY_CAST (YYSIZE_T, -1) \ + ? YYPTRDIFF_MAXIMUM \ + : YY_CAST (YYSIZE_T, -1))) + +#define YYSIZEOF(X) YY_CAST (YYPTRDIFF_T, sizeof (X)) + +/* Stored state numbers (used for stacks). */ +typedef yytype_int16 yy_state_t; + +/* State numbers in computations. */ +typedef int yy_state_fast_t; #ifndef YY_ # if defined YYENABLE_NLS && YYENABLE_NLS # if ENABLE_NLS # include /* INFRINGES ON USER NAME SPACE */ -# define YY_(msgid) dgettext ("bison-runtime", msgid) +# define YY_(Msgid) dgettext ("bison-runtime", Msgid) # endif # endif # ifndef YY_ -# define YY_(msgid) msgid +# define YY_(Msgid) Msgid +# endif +#endif + +#ifndef YY_ATTRIBUTE_PURE +# if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__) +# define YY_ATTRIBUTE_PURE __attribute__ ((__pure__)) +# else +# define YY_ATTRIBUTE_PURE +# endif +#endif + +#ifndef YY_ATTRIBUTE_UNUSED +# if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__) +# define YY_ATTRIBUTE_UNUSED __attribute__ ((__unused__)) +# else +# define YY_ATTRIBUTE_UNUSED # endif #endif /* Suppress unused-variable warnings by "using" E. */ #if ! defined lint || defined __GNUC__ -# define YYUSE(e) ((void) (e)) +# define YYUSE(E) ((void) (E)) #else -# define YYUSE(e) /* empty */ +# define YYUSE(E) /* empty */ #endif -/* Identity function, used to suppress warnings about constant conditions. */ -#ifndef lint -# define YYID(n) (n) +#if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ +/* Suppress an incorrect diagnostic about yylval being uninitialized. */ +# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ + _Pragma ("GCC diagnostic push") \ + _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") \ + _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") +# define YY_IGNORE_MAYBE_UNINITIALIZED_END \ + _Pragma ("GCC diagnostic pop") #else -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static int -YYID (int i) -#else -static int -YYID (i) - int i; +# define YY_INITIAL_VALUE(Value) Value #endif -{ - return i; -} +#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN +# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN +# define YY_IGNORE_MAYBE_UNINITIALIZED_END #endif +#ifndef YY_INITIAL_VALUE +# define YY_INITIAL_VALUE(Value) /* Nothing. */ +#endif + +#if defined __cplusplus && defined __GNUC__ && ! defined __ICC && 6 <= __GNUC__ +# define YY_IGNORE_USELESS_CAST_BEGIN \ + _Pragma ("GCC diagnostic push") \ + _Pragma ("GCC diagnostic ignored \"-Wuseless-cast\"") +# define YY_IGNORE_USELESS_CAST_END \ + _Pragma ("GCC diagnostic pop") +#endif +#ifndef YY_IGNORE_USELESS_CAST_BEGIN +# define YY_IGNORE_USELESS_CAST_BEGIN +# define YY_IGNORE_USELESS_CAST_END +#endif + + +#define YY_ASSERT(E) ((void) (0 && (E))) #if ! defined yyoverflow || YYERROR_VERBOSE @@ -473,11 +533,11 @@ YYID (i) # define alloca _alloca # else # define YYSTACK_ALLOC alloca -# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) +# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS # include /* INFRINGES ON USER NAME SPACE */ -# ifndef _STDLIB_H -# define _STDLIB_H 1 + /* Use EXIT_SUCCESS as a witness for stdlib.h. */ +# ifndef EXIT_SUCCESS +# define EXIT_SUCCESS 0 # endif # endif # endif @@ -485,8 +545,8 @@ YYID (i) # endif # ifdef YYSTACK_ALLOC - /* Pacify GCC's `empty if-body' warning. */ -# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) + /* Pacify GCC's 'empty if-body' warning. */ +# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) # ifndef YYSTACK_ALLOC_MAXIMUM /* The OS might guarantee only one guard page at the bottom of the stack, and a page size can be as small as 4096 bytes. So we cannot safely @@ -500,25 +560,23 @@ YYID (i) # ifndef YYSTACK_ALLOC_MAXIMUM # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM # endif -# if (defined __cplusplus && ! defined _STDLIB_H \ +# if (defined __cplusplus && ! defined EXIT_SUCCESS \ && ! ((defined YYMALLOC || defined malloc) \ - && (defined YYFREE || defined free))) + && (defined YYFREE || defined free))) # include /* INFRINGES ON USER NAME SPACE */ -# ifndef _STDLIB_H -# define _STDLIB_H 1 +# ifndef EXIT_SUCCESS +# define EXIT_SUCCESS 0 # endif # endif # ifndef YYMALLOC # define YYMALLOC malloc -# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) +# if ! defined malloc && ! defined EXIT_SUCCESS void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ # endif # endif # ifndef YYFREE # define YYFREE free -# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) +# if ! defined free && ! defined EXIT_SUCCESS void free (void *); /* INFRINGES ON USER NAME SPACE */ # endif # endif @@ -528,60 +586,64 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */ #if (! defined yyoverflow \ && (! defined __cplusplus \ - || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) + || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) /* A type that is properly aligned for any stack member. */ union yyalloc { - yytype_int16 yyss; - YYSTYPE yyvs; - }; + yy_state_t yyss_alloc; + YYSTYPE yyvs_alloc; +}; /* The size of the maximum gap between one aligned stack and the next. */ -# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) +# define YYSTACK_GAP_MAXIMUM (YYSIZEOF (union yyalloc) - 1) /* The size of an array large to enough to hold all stacks, each with N elements. */ # define YYSTACK_BYTES(N) \ - ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ + ((N) * (YYSIZEOF (yy_state_t) + YYSIZEOF (YYSTYPE)) \ + YYSTACK_GAP_MAXIMUM) -/* Copy COUNT objects from FROM to TO. The source and destination do - not overlap. */ -# ifndef YYCOPY -# if defined __GNUC__ && 1 < __GNUC__ -# define YYCOPY(To, From, Count) \ - __builtin_memcpy (To, From, (Count) * sizeof (*(From))) -# else -# define YYCOPY(To, From, Count) \ - do \ - { \ - YYSIZE_T yyi; \ - for (yyi = 0; yyi < (Count); yyi++) \ - (To)[yyi] = (From)[yyi]; \ - } \ - while (YYID (0)) -# endif -# endif +# define YYCOPY_NEEDED 1 /* Relocate STACK from its old location to the new one. The local variables YYSIZE and YYSTACKSIZE give the old and new number of elements in the stack, and YYPTR gives the new location of the stack. Advance YYPTR to a properly aligned location for the next stack. */ -# define YYSTACK_RELOCATE(Stack) \ - do \ - { \ - YYSIZE_T yynewbytes; \ - YYCOPY (&yyptr->Stack, Stack, yysize); \ - Stack = &yyptr->Stack; \ - yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ - yyptr += yynewbytes / sizeof (*yyptr); \ - } \ - while (YYID (0)) +# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ + do \ + { \ + YYPTRDIFF_T yynewbytes; \ + YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ + Stack = &yyptr->Stack_alloc; \ + yynewbytes = yystacksize * YYSIZEOF (*Stack) + YYSTACK_GAP_MAXIMUM; \ + yyptr += yynewbytes / YYSIZEOF (*yyptr); \ + } \ + while (0) #endif +#if defined YYCOPY_NEEDED && YYCOPY_NEEDED +/* Copy COUNT objects from SRC to DST. The source and destination do + not overlap. */ +# ifndef YYCOPY +# if defined __GNUC__ && 1 < __GNUC__ +# define YYCOPY(Dst, Src, Count) \ + __builtin_memcpy (Dst, Src, YY_CAST (YYSIZE_T, (Count)) * sizeof (*(Src))) +# else +# define YYCOPY(Dst, Src, Count) \ + do \ + { \ + YYPTRDIFF_T yyi; \ + for (yyi = 0; yyi < (Count); yyi++) \ + (Dst)[yyi] = (Src)[yyi]; \ + } \ + while (0) +# endif +# endif +#endif /* !YYCOPY_NEEDED */ + /* YYFINAL -- State number of the termination state. */ #define YYFINAL 5 /* YYLAST -- Last index in YYTABLE. */ @@ -593,18 +655,21 @@ union yyalloc #define YYNNTS 67 /* YYNRULES -- Number of rules. */ #define YYNRULES 153 -/* YYNRULES -- Number of states. */ +/* YYNSTATES -- Number of states. */ #define YYNSTATES 262 -/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ #define YYUNDEFTOK 2 #define YYMAXUTOK 310 -#define YYTRANSLATE(YYX) \ - ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) -/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ -static const yytype_uint8 yytranslate[] = +/* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM + as returned by yylex, with out-of-bounds checking. */ +#define YYTRANSLATE(YYX) \ + (0 <= (YYX) && (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) + +/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM + as returned by yylex. */ +static const yytype_int8 yytranslate[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, @@ -641,81 +706,8 @@ static const yytype_uint8 yytranslate[] = }; #if YYDEBUG -/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in - YYRHS. */ -static const yytype_uint16 yyprhs[] = -{ - 0, 0, 3, 7, 9, 14, 20, 21, 24, 25, - 26, 36, 37, 39, 42, 44, 47, 49, 51, 54, - 57, 60, 63, 66, 67, 69, 76, 78, 82, 86, - 92, 98, 104, 107, 111, 114, 116, 118, 120, 122, - 124, 126, 128, 130, 132, 134, 136, 138, 139, 141, - 144, 147, 151, 153, 155, 157, 161, 165, 169, 171, - 172, 174, 177, 180, 184, 186, 188, 191, 193, 197, - 200, 201, 205, 207, 211, 213, 215, 219, 222, 223, - 227, 229, 233, 235, 237, 239, 241, 243, 245, 246, - 250, 255, 260, 265, 270, 277, 283, 289, 296, 302, - 308, 314, 320, 326, 332, 338, 344, 349, 351, 353, - 354, 356, 359, 362, 366, 370, 372, 374, 375, 377, - 381, 383, 387, 389, 391, 393, 395, 397, 399, 401, - 406, 408, 412, 414, 416, 418, 420, 422, 424, 426, - 428, 430, 432, 434, 436, 438, 442, 444, 446, 448, - 450, 452, 454, 456 -}; - -/* YYRHS -- A `-1'-separated list of the rules' RHS. */ -static const yytype_int16 yyrhs[] = -{ - 66, 0, -1, 31, 67, 68, -1, 55, -1, 56, - 69, 70, 57, -1, 112, 74, 89, 95, 115, -1, - -1, 70, 71, -1, -1, -1, 38, 131, 56, 72, - 69, 70, 73, 57, 112, -1, -1, 33, -1, 33, - 75, -1, 77, -1, 75, 77, -1, 131, -1, 78, - -1, 113, 58, -1, 80, 79, -1, 85, 79, -1, - 84, 79, -1, 83, 79, -1, -1, 58, -1, 88, - 35, 76, 56, 81, 57, -1, 82, -1, 81, 59, - 82, -1, 131, 60, 128, -1, 36, 61, 21, 62, - 76, -1, 110, 61, 63, 62, 76, -1, 34, 76, - 56, 86, 57, -1, 87, 58, -1, 86, 87, 58, - -1, 110, 104, -1, 4, -1, 5, -1, 6, -1, - 7, -1, 8, -1, 9, -1, 10, -1, 11, -1, - 12, -1, 13, -1, 14, -1, 15, -1, -1, 29, - -1, 29, 90, -1, 91, 58, -1, 90, 91, 58, - -1, 92, -1, 113, -1, 93, -1, 92, 59, 93, - -1, 94, 60, 128, -1, 94, 60, 3, -1, 131, - -1, -1, 30, -1, 30, 96, -1, 97, 58, -1, - 96, 97, 58, -1, 98, -1, 113, -1, 110, 99, - -1, 100, -1, 99, 59, 100, -1, 131, 101, -1, - -1, 61, 102, 62, -1, 103, -1, 102, 59, 103, - -1, 114, -1, 105, -1, 104, 59, 105, -1, 131, - 106, -1, -1, 61, 107, 62, -1, 108, -1, 107, - 59, 108, -1, 25, -1, 21, -1, 111, -1, 111, - -1, 114, -1, 88, -1, -1, 113, 58, 112, -1, - 64, 51, 60, 129, -1, 64, 52, 60, 130, -1, - 64, 53, 60, 128, -1, 64, 131, 60, 118, -1, - 110, 111, 64, 131, 60, 118, -1, 111, 64, 131, - 60, 118, -1, 111, 64, 42, 60, 118, -1, 110, - 111, 64, 42, 60, 118, -1, 111, 64, 44, 60, - 129, -1, 111, 64, 45, 60, 127, -1, 111, 64, - 50, 60, 130, -1, 111, 64, 46, 60, 128, -1, - 111, 64, 47, 60, 130, -1, 111, 64, 48, 60, - 129, -1, 111, 64, 54, 60, 129, -1, 111, 64, - 49, 60, 130, -1, 64, 43, 60, 129, -1, 131, - -1, 39, -1, -1, 32, -1, 32, 116, -1, 117, - 58, -1, 116, 117, 58, -1, 109, 60, 118, -1, - 119, -1, 120, -1, -1, 121, -1, 118, 59, 121, - -1, 122, -1, 56, 118, 57, -1, 126, -1, 37, - -1, 40, -1, 41, -1, 123, -1, 124, -1, 114, - -1, 131, 61, 125, 62, -1, 126, -1, 125, 59, - 126, -1, 18, -1, 19, -1, 20, -1, 21, -1, - 22, -1, 23, -1, 24, -1, 25, -1, 26, -1, - 27, -1, 28, -1, 17, -1, 128, -1, 127, 59, - 128, -1, 21, -1, 25, -1, 22, -1, 26, -1, - 17, -1, 129, -1, 128, -1, 16, -1 -}; - -/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ -static const yytype_uint16 yyrline[] = + /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ +static const yytype_int16 yyrline[] = { 0, 233, 233, 239, 241, 248, 255, 255, 258, 267, 257, 272, 273, 274, 278, 278, 280, 290, 290, 293, @@ -736,7 +728,7 @@ static const yytype_uint16 yyrline[] = }; #endif -#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE +#if YYDEBUG || YYERROR_VERBOSE || 1 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. First, the terminals, then, starting at YYNTOKENS, nonterminals. */ static const char *const yytname[] = @@ -753,7 +745,7 @@ static const char *const yytname[] = "_FLETCHER32", "_NCPROPS", "_ISNETCDF4", "_SUPERBLOCK", "_FILTER", "DATASETID", "'{'", "'}'", "';'", "','", "'='", "'('", "')'", "'*'", "':'", "$accept", "ncdesc", "datasetid", "rootgroup", "groupbody", - "subgrouplist", "namedgroup", "@1", "@2", "typesection", "typedecls", + "subgrouplist", "namedgroup", "$@1", "$@2", "typesection", "typedecls", "typename", "type_or_attr_decl", "typedecl", "optsemicolon", "enumdecl", "enumidlist", "enumid", "opaquedecl", "vlendecl", "compounddecl", "fields", "field", "primtype", "dimsection", "dimdecls", @@ -764,14 +756,14 @@ static const char *const yytname[] = "attrdecllist", "attrdecl", "path", "datasection", "datadecls", "datadecl", "datalist", "datalist0", "datalist1", "dataitem", "constdata", "econstref", "function", "arglist", "simpleconstant", - "intlist", "constint", "conststring", "constbool", "ident", 0 + "intlist", "constint", "conststring", "constbool", "ident", YY_NULLPTR }; #endif # ifdef YYPRINT -/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to - token YYLEX-NUM. */ -static const yytype_uint16 yytoknum[] = +/* YYTOKNUM[NUM] -- (External) token number corresponding to the + (internal) symbol number NUM (which must be that of a token). */ +static const yytype_int16 yytoknum[] = { 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, @@ -783,97 +775,18 @@ static const yytype_uint16 yytoknum[] = }; # endif -/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ -static const yytype_uint8 yyr1[] = -{ - 0, 65, 66, 67, 68, 69, 70, 70, 72, 73, - 71, 74, 74, 74, 75, 75, 76, 77, 77, 78, - 78, 78, 78, 79, 79, 80, 81, 81, 82, 83, - 84, 85, 86, 86, 87, 88, 88, 88, 88, 88, - 88, 88, 88, 88, 88, 88, 88, 89, 89, 89, - 90, 90, 91, 91, 92, 92, 93, 93, 94, 95, - 95, 95, 96, 96, 97, 97, 98, 99, 99, 100, - 101, 101, 102, 102, 103, 104, 104, 105, 106, 106, - 107, 107, 108, 108, 109, 110, 111, 111, 112, 112, - 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, - 113, 113, 113, 113, 113, 113, 113, 114, 114, 115, - 115, 115, 116, 116, 117, 118, 118, 119, 120, 120, - 121, 121, 122, 122, 122, 122, 122, 122, 123, 124, - 125, 125, 126, 126, 126, 126, 126, 126, 126, 126, - 126, 126, 126, 126, 127, 127, 128, 128, 128, 128, - 129, 130, 130, 131 -}; +#define YYPACT_NINF (-145) -/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ -static const yytype_uint8 yyr2[] = -{ - 0, 2, 3, 1, 4, 5, 0, 2, 0, 0, - 9, 0, 1, 2, 1, 2, 1, 1, 2, 2, - 2, 2, 2, 0, 1, 6, 1, 3, 3, 5, - 5, 5, 2, 3, 2, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 0, 1, 2, - 2, 3, 1, 1, 1, 3, 3, 3, 1, 0, - 1, 2, 2, 3, 1, 1, 2, 1, 3, 2, - 0, 3, 1, 3, 1, 1, 3, 2, 0, 3, - 1, 3, 1, 1, 1, 1, 1, 1, 0, 3, - 4, 4, 4, 4, 6, 5, 5, 6, 5, 5, - 5, 5, 5, 5, 5, 5, 4, 1, 1, 0, - 1, 2, 2, 3, 3, 1, 1, 0, 1, 3, - 1, 3, 1, 1, 1, 1, 1, 1, 1, 4, - 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 3, 1, 1, 1, 1, - 1, 1, 1, 1 -}; +#define yypact_value_is_default(Yyn) \ + ((Yyn) == YYPACT_NINF) -/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state - STATE-NUM when YYTABLE doesn't specify something else to do. Zero - means the default is an error. */ -static const yytype_uint8 yydefact[] = -{ - 0, 0, 0, 3, 0, 1, 88, 2, 35, 36, - 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, - 153, 108, 0, 6, 87, 0, 85, 11, 0, 86, - 107, 0, 0, 0, 0, 0, 0, 0, 0, 12, - 47, 88, 0, 0, 0, 0, 117, 0, 4, 7, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 13, 14, 17, 23, 23, 23, 23, - 87, 0, 0, 48, 59, 89, 150, 106, 90, 146, - 148, 147, 149, 152, 151, 91, 92, 143, 132, 133, - 134, 135, 136, 137, 138, 139, 140, 141, 142, 123, - 124, 125, 117, 128, 93, 115, 116, 118, 120, 126, - 127, 122, 107, 0, 0, 0, 117, 0, 0, 0, - 0, 0, 0, 0, 0, 117, 0, 16, 0, 15, - 24, 19, 22, 21, 20, 0, 0, 18, 49, 0, - 52, 54, 0, 53, 107, 60, 109, 0, 0, 0, - 8, 117, 117, 96, 98, 99, 144, 101, 102, 103, - 105, 100, 104, 95, 0, 0, 0, 0, 0, 50, - 0, 0, 61, 0, 64, 0, 65, 110, 5, 121, - 119, 0, 130, 88, 97, 94, 0, 0, 0, 0, - 85, 0, 0, 0, 51, 55, 58, 57, 56, 0, - 62, 66, 67, 70, 0, 84, 111, 0, 0, 129, - 6, 145, 31, 0, 32, 34, 75, 78, 29, 0, - 26, 0, 30, 63, 0, 0, 69, 117, 0, 112, - 131, 9, 33, 0, 0, 77, 25, 0, 0, 68, - 70, 0, 72, 74, 114, 113, 0, 76, 83, 82, - 0, 80, 27, 28, 0, 71, 88, 0, 79, 73, - 10, 81 -}; +#define YYTABLE_NINF (-108) -/* YYDEFGOTO[NTERM-NUM]. */ -static const yytype_int16 yydefgoto[] = -{ - -1, 2, 4, 7, 23, 36, 49, 183, 246, 40, - 63, 126, 64, 65, 131, 66, 219, 220, 67, 68, - 69, 187, 188, 24, 74, 138, 139, 140, 141, 142, - 146, 172, 173, 174, 201, 202, 226, 241, 242, 215, - 216, 235, 250, 251, 204, 25, 26, 27, 28, 29, - 178, 206, 207, 104, 105, 106, 107, 108, 109, 110, - 181, 111, 155, 83, 84, 85, 30 -}; +#define yytable_value_is_error(Yyn) \ + 0 -/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing - STATE-NUM. */ -#define YYPACT_NINF -145 + /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing + STATE-NUM. */ static const yytype_int16 yypact[] = { -10, -19, 54, -145, 12, -145, 219, -145, -145, -145, @@ -905,7 +818,41 @@ static const yytype_int16 yypact[] = -145, -145 }; -/* YYPGOTO[NTERM-NUM]. */ + /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. + Performed when YYTABLE does not specify something else to do. Zero + means the default is an error. */ +static const yytype_uint8 yydefact[] = +{ + 0, 0, 0, 3, 0, 1, 88, 2, 35, 36, + 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, + 153, 108, 0, 6, 87, 0, 85, 11, 0, 86, + 107, 0, 0, 0, 0, 0, 0, 0, 0, 12, + 47, 88, 0, 0, 0, 0, 117, 0, 4, 7, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 13, 14, 17, 23, 23, 23, 23, + 87, 0, 0, 48, 59, 89, 150, 106, 90, 146, + 148, 147, 149, 152, 151, 91, 92, 143, 132, 133, + 134, 135, 136, 137, 138, 139, 140, 141, 142, 123, + 124, 125, 117, 128, 93, 115, 116, 118, 120, 126, + 127, 122, 107, 0, 0, 0, 117, 0, 0, 0, + 0, 0, 0, 0, 0, 117, 0, 16, 0, 15, + 24, 19, 22, 21, 20, 0, 0, 18, 49, 0, + 52, 54, 0, 53, 107, 60, 109, 0, 0, 0, + 8, 117, 117, 96, 98, 99, 144, 101, 102, 103, + 105, 100, 104, 95, 0, 0, 0, 0, 0, 50, + 0, 0, 61, 0, 64, 0, 65, 110, 5, 121, + 119, 0, 130, 88, 97, 94, 0, 0, 0, 0, + 85, 0, 0, 0, 51, 55, 58, 57, 56, 0, + 62, 66, 67, 70, 0, 84, 111, 0, 0, 129, + 6, 145, 31, 0, 32, 34, 75, 78, 29, 0, + 26, 0, 30, 63, 0, 0, 69, 117, 0, 112, + 131, 9, 33, 0, 0, 77, 25, 0, 0, 68, + 70, 0, 72, 74, 114, 113, 0, 76, 83, 82, + 0, 80, 27, 28, 0, 71, 88, 0, 79, 73, + 10, 81 +}; + + /* YYPGOTO[NTERM-NUM]. */ static const yytype_int16 yypgoto[] = { -145, -145, -145, -145, 24, -2, -145, -145, -145, -145, @@ -917,11 +864,21 @@ static const yytype_int16 yypgoto[] = -145, -144, -145, -35, -31, -100, -22 }; -/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If - positive, shift that token. If negative, reduce the rule which - number is the opposite. If zero, do what YYDEFACT says. - If YYTABLE_NINF, syntax error. */ -#define YYTABLE_NINF -108 + /* YYDEFGOTO[NTERM-NUM]. */ +static const yytype_int16 yydefgoto[] = +{ + -1, 2, 4, 7, 23, 36, 49, 183, 246, 40, + 63, 126, 64, 65, 131, 66, 219, 220, 67, 68, + 69, 187, 188, 24, 74, 138, 139, 140, 141, 142, + 146, 172, 173, 174, 201, 202, 226, 241, 242, 215, + 216, 235, 250, 251, 204, 25, 26, 27, 28, 29, + 178, 206, 207, 104, 105, 106, 107, 108, 109, 110, + 181, 111, 155, 83, 84, 85, 30 +}; + + /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If + positive, shift that token. If negative, reduce the rule whose + number is the opposite. If YYTABLE_NINF, syntax error. */ static const yytype_int16 yytable[] = { 35, 75, 103, 147, 37, 182, 72, 166, 20, 71, @@ -1010,8 +967,8 @@ static const yytype_int16 yycheck[] = -1, -1, -1, 39 }; -/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing - symbol of state STATE-NUM. */ + /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing + symbol of state STATE-NUM. */ static const yytype_uint8 yystos[] = { 0, 31, 66, 55, 67, 0, 56, 68, 4, 5, @@ -1043,95 +1000,83 @@ static const yytype_uint8 yystos[] = 112, 108 }; -#define yyerrok (yyerrstatus = 0) -#define yyclearin (yychar = YYEMPTY) -#define YYEMPTY (-2) -#define YYEOF 0 + /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ +static const yytype_uint8 yyr1[] = +{ + 0, 65, 66, 67, 68, 69, 70, 70, 72, 73, + 71, 74, 74, 74, 75, 75, 76, 77, 77, 78, + 78, 78, 78, 79, 79, 80, 81, 81, 82, 83, + 84, 85, 86, 86, 87, 88, 88, 88, 88, 88, + 88, 88, 88, 88, 88, 88, 88, 89, 89, 89, + 90, 90, 91, 91, 92, 92, 93, 93, 94, 95, + 95, 95, 96, 96, 97, 97, 98, 99, 99, 100, + 101, 101, 102, 102, 103, 104, 104, 105, 106, 106, + 107, 107, 108, 108, 109, 110, 111, 111, 112, 112, + 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, + 113, 113, 113, 113, 113, 113, 113, 114, 114, 115, + 115, 115, 116, 116, 117, 118, 118, 119, 120, 120, + 121, 121, 122, 122, 122, 122, 122, 122, 123, 124, + 125, 125, 126, 126, 126, 126, 126, 126, 126, 126, + 126, 126, 126, 126, 127, 127, 128, 128, 128, 128, + 129, 130, 130, 131 +}; -#define YYACCEPT goto yyacceptlab -#define YYABORT goto yyabortlab -#define YYERROR goto yyerrorlab + /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ +static const yytype_int8 yyr2[] = +{ + 0, 2, 3, 1, 4, 5, 0, 2, 0, 0, + 9, 0, 1, 2, 1, 2, 1, 1, 2, 2, + 2, 2, 2, 0, 1, 6, 1, 3, 3, 5, + 5, 5, 2, 3, 2, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 0, 1, 2, + 2, 3, 1, 1, 1, 3, 3, 3, 1, 0, + 1, 2, 2, 3, 1, 1, 2, 1, 3, 2, + 0, 3, 1, 3, 1, 1, 3, 2, 0, 3, + 1, 3, 1, 1, 1, 1, 1, 1, 0, 3, + 4, 4, 4, 4, 6, 5, 5, 6, 5, 5, + 5, 5, 5, 5, 5, 5, 4, 1, 1, 0, + 1, 2, 2, 3, 3, 1, 1, 0, 1, 3, + 1, 3, 1, 1, 1, 1, 1, 1, 1, 4, + 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 3, 1, 1, 1, 1, + 1, 1, 1, 1 +}; -/* Like YYERROR except do call yyerror. This remains here temporarily - to ease the transition to the new meaning of YYERROR, for GCC. - Once GCC version 2 has supplanted version 1, this can go. */ +#define yyerrok (yyerrstatus = 0) +#define yyclearin (yychar = YYEMPTY) +#define YYEMPTY (-2) +#define YYEOF 0 + +#define YYACCEPT goto yyacceptlab +#define YYABORT goto yyabortlab +#define YYERROR goto yyerrorlab -#define YYFAIL goto yyerrlab #define YYRECOVERING() (!!yyerrstatus) -#define YYBACKUP(Token, Value) \ -do \ - if (yychar == YYEMPTY && yylen == 1) \ - { \ - yychar = (Token); \ - yylval = (Value); \ - yytoken = YYTRANSLATE (yychar); \ - YYPOPSTACK (1); \ - goto yybackup; \ - } \ - else \ - { \ - yyerror (YY_("syntax error: cannot back up")); \ - YYERROR; \ - } \ -while (YYID (0)) +#define YYBACKUP(Token, Value) \ + do \ + if (yychar == YYEMPTY) \ + { \ + yychar = (Token); \ + yylval = (Value); \ + YYPOPSTACK (yylen); \ + yystate = *yyssp; \ + goto yybackup; \ + } \ + else \ + { \ + yyerror (YY_("syntax error: cannot back up")); \ + YYERROR; \ + } \ + while (0) + +/* Error token number */ +#define YYTERROR 1 +#define YYERRCODE 256 -#define YYTERROR 1 -#define YYERRCODE 256 - - -/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. - If N is 0, then set CURRENT to the empty location which ends - the previous symbol: RHS[0] (always defined). */ - -#define YYRHSLOC(Rhs, K) ((Rhs)[K]) -#ifndef YYLLOC_DEFAULT -# define YYLLOC_DEFAULT(Current, Rhs, N) \ - do \ - if (YYID (N)) \ - { \ - (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ - (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ - (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ - (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ - } \ - else \ - { \ - (Current).first_line = (Current).last_line = \ - YYRHSLOC (Rhs, 0).last_line; \ - (Current).first_column = (Current).last_column = \ - YYRHSLOC (Rhs, 0).last_column; \ - } \ - while (YYID (0)) -#endif - - -/* YY_LOCATION_PRINT -- Print the location on the stream. - This macro was not mandated originally: define only if we know - we won't break user code: when these are the locations we know. */ - -#ifndef YY_LOCATION_PRINT -# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL -# define YY_LOCATION_PRINT(File, Loc) \ - fprintf (File, "%d.%d-%d.%d", \ - (Loc).first_line, (Loc).first_column, \ - (Loc).last_line, (Loc).last_column) -# else -# define YY_LOCATION_PRINT(File, Loc) ((void) 0) -# endif -#endif - - -/* YYLEX -- calling `yylex' with the right arguments. */ - -#ifdef YYLEX_PARAM -# define YYLEX yylex (YYLEX_PARAM) -#else -# define YYLEX yylex () -#endif /* Enable debugging if requested. */ #if YYDEBUG @@ -1141,80 +1086,63 @@ while (YYID (0)) # define YYFPRINTF fprintf # endif -# define YYDPRINTF(Args) \ -do { \ - if (yydebug) \ - YYFPRINTF Args; \ -} while (YYID (0)) +# define YYDPRINTF(Args) \ +do { \ + if (yydebug) \ + YYFPRINTF Args; \ +} while (0) -# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ -do { \ - if (yydebug) \ - { \ - YYFPRINTF (stderr, "%s ", Title); \ - yy_symbol_print (stderr, \ - Type, Value); \ - YYFPRINTF (stderr, "\n"); \ - } \ -} while (YYID (0)) - - -/*--------------------------------. -| Print this symbol on YYOUTPUT. | -`--------------------------------*/ - -/*ARGSUSED*/ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static void -yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) -#else -static void -yy_symbol_value_print (yyoutput, yytype, yyvaluep) - FILE *yyoutput; - int yytype; - YYSTYPE const * const yyvaluep; +/* This macro is provided for backward compatibility. */ +#ifndef YY_LOCATION_PRINT +# define YY_LOCATION_PRINT(File, Loc) ((void) 0) #endif + + +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ +do { \ + if (yydebug) \ + { \ + YYFPRINTF (stderr, "%s ", Title); \ + yy_symbol_print (stderr, \ + Type, Value); \ + YYFPRINTF (stderr, "\n"); \ + } \ +} while (0) + + +/*-----------------------------------. +| Print this symbol's value on YYO. | +`-----------------------------------*/ + +static void +yy_symbol_value_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep) { + FILE *yyoutput = yyo; + YYUSE (yyoutput); if (!yyvaluep) return; # ifdef YYPRINT if (yytype < YYNTOKENS) - YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); -# else - YYUSE (yyoutput); + YYPRINT (yyo, yytoknum[yytype], *yyvaluep); # endif - switch (yytype) - { - default: - break; - } + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN + YYUSE (yytype); + YY_IGNORE_MAYBE_UNINITIALIZED_END } -/*--------------------------------. -| Print this symbol on YYOUTPUT. | -`--------------------------------*/ +/*---------------------------. +| Print this symbol on YYO. | +`---------------------------*/ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) static void -yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) -#else -static void -yy_symbol_print (yyoutput, yytype, yyvaluep) - FILE *yyoutput; - int yytype; - YYSTYPE const * const yyvaluep; -#endif +yy_symbol_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep) { - if (yytype < YYNTOKENS) - YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); - else - YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); + YYFPRINTF (yyo, "%s %s (", + yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]); - yy_symbol_value_print (yyoutput, yytype, yyvaluep); - YYFPRINTF (yyoutput, ")"); + yy_symbol_value_print (yyo, yytype, yyvaluep); + YYFPRINTF (yyo, ")"); } /*------------------------------------------------------------------. @@ -1222,66 +1150,54 @@ yy_symbol_print (yyoutput, yytype, yyvaluep) | TOP (included). | `------------------------------------------------------------------*/ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) static void -yy_stack_print (yytype_int16 *bottom, yytype_int16 *top) -#else -static void -yy_stack_print (bottom, top) - yytype_int16 *bottom; - yytype_int16 *top; -#endif +yy_stack_print (yy_state_t *yybottom, yy_state_t *yytop) { YYFPRINTF (stderr, "Stack now"); - for (; bottom <= top; ++bottom) - YYFPRINTF (stderr, " %d", *bottom); + for (; yybottom <= yytop; yybottom++) + { + int yybot = *yybottom; + YYFPRINTF (stderr, " %d", yybot); + } YYFPRINTF (stderr, "\n"); } -# define YY_STACK_PRINT(Bottom, Top) \ -do { \ - if (yydebug) \ - yy_stack_print ((Bottom), (Top)); \ -} while (YYID (0)) +# define YY_STACK_PRINT(Bottom, Top) \ +do { \ + if (yydebug) \ + yy_stack_print ((Bottom), (Top)); \ +} while (0) /*------------------------------------------------. | Report that the YYRULE is going to be reduced. | `------------------------------------------------*/ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) static void -yy_reduce_print (YYSTYPE *yyvsp, int yyrule) -#else -static void -yy_reduce_print (yyvsp, yyrule) - YYSTYPE *yyvsp; - int yyrule; -#endif +yy_reduce_print (yy_state_t *yyssp, YYSTYPE *yyvsp, int yyrule) { + int yylno = yyrline[yyrule]; int yynrhs = yyr2[yyrule]; int yyi; - unsigned long int yylno = yyrline[yyrule]; - YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", - yyrule - 1, yylno); + YYFPRINTF (stderr, "Reducing stack by rule %d (line %d):\n", + yyrule - 1, yylno); /* The symbols being reduced. */ for (yyi = 0; yyi < yynrhs; yyi++) { - fprintf (stderr, " $%d = ", yyi + 1); - yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], - &(yyvsp[(yyi + 1) - (yynrhs)]) - ); - fprintf (stderr, "\n"); + YYFPRINTF (stderr, " $%d = ", yyi + 1); + yy_symbol_print (stderr, + yystos[+yyssp[yyi + 1 - yynrhs]], + &yyvsp[(yyi + 1) - (yynrhs)] + ); + YYFPRINTF (stderr, "\n"); } } -# define YY_REDUCE_PRINT(Rule) \ -do { \ - if (yydebug) \ - yy_reduce_print (yyvsp, Rule); \ -} while (YYID (0)) +# define YY_REDUCE_PRINT(Rule) \ +do { \ + if (yydebug) \ + yy_reduce_print (yyssp, yyvsp, Rule); \ +} while (0) /* Nonzero means print parse trace. It is left uninitialized so that multiple parsers can coexist. */ @@ -1295,7 +1211,7 @@ int yydebug; /* YYINITDEPTH -- initial size of the parser's stacks. */ -#ifndef YYINITDEPTH +#ifndef YYINITDEPTH # define YYINITDEPTH 200 #endif @@ -1310,26 +1226,18 @@ int yydebug; # define YYMAXDEPTH 10000 #endif - #if YYERROR_VERBOSE # ifndef yystrlen # if defined __GLIBC__ && defined _STRING_H -# define yystrlen strlen +# define yystrlen(S) (YY_CAST (YYPTRDIFF_T, strlen (S))) # else /* Return the length of YYSTR. */ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static YYSIZE_T +static YYPTRDIFF_T yystrlen (const char *yystr) -#else -static YYSIZE_T -yystrlen (yystr) - const char *yystr; -#endif { - YYSIZE_T yylen; + YYPTRDIFF_T yylen; for (yylen = 0; yystr[yylen]; yylen++) continue; return yylen; @@ -1343,16 +1251,8 @@ yystrlen (yystr) # else /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in YYDEST. */ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) static char * yystpcpy (char *yydest, const char *yysrc) -#else -static char * -yystpcpy (yydest, yysrc) - char *yydest; - const char *yysrc; -#endif { char *yyd = yydest; const char *yys = yysrc; @@ -1373,408 +1273,392 @@ yystpcpy (yydest, yysrc) backslash-backslash). YYSTR is taken from yytname. If YYRES is null, do not copy; instead, return the length of what the result would have been. */ -static YYSIZE_T +static YYPTRDIFF_T yytnamerr (char *yyres, const char *yystr) { if (*yystr == '"') { - YYSIZE_T yyn = 0; + YYPTRDIFF_T yyn = 0; char const *yyp = yystr; for (;;) - switch (*++yyp) - { - case '\'': - case ',': - goto do_not_strip_quotes; + switch (*++yyp) + { + case '\'': + case ',': + goto do_not_strip_quotes; - case '\\': - if (*++yyp != '\\') - goto do_not_strip_quotes; - /* Fall through. */ - default: - if (yyres) - yyres[yyn] = *yyp; - yyn++; - break; + case '\\': + if (*++yyp != '\\') + goto do_not_strip_quotes; + else + goto append; - case '"': - if (yyres) - yyres[yyn] = '\0'; - return yyn; - } + append: + default: + if (yyres) + yyres[yyn] = *yyp; + yyn++; + break; + + case '"': + if (yyres) + yyres[yyn] = '\0'; + return yyn; + } do_not_strip_quotes: ; } - if (! yyres) + if (yyres) + return yystpcpy (yyres, yystr) - yyres; + else return yystrlen (yystr); - - return yystpcpy (yyres, yystr) - yyres; } # endif -/* Copy into YYRESULT an error message about the unexpected token - YYCHAR while in state YYSTATE. Return the number of bytes copied, - including the terminating null byte. If YYRESULT is null, do not - copy anything; just return the number of bytes that would be - copied. As a special case, return 0 if an ordinary "syntax error" - message will do. Return YYSIZE_MAXIMUM if overflow occurs during - size calculation. */ -static YYSIZE_T -yysyntax_error (char *yyresult, int yystate, int yychar) +/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message + about the unexpected token YYTOKEN for the state stack whose top is + YYSSP. + + Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is + not large enough to hold the message. In that case, also set + *YYMSG_ALLOC to the required number of bytes. Return 2 if the + required number of bytes is too large to store. */ +static int +yysyntax_error (YYPTRDIFF_T *yymsg_alloc, char **yymsg, + yy_state_t *yyssp, int yytoken) { - int yyn = yypact[yystate]; + enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; + /* Internationalized format string. */ + const char *yyformat = YY_NULLPTR; + /* Arguments of yyformat: reported tokens (one for the "unexpected", + one per "expected"). */ + char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; + /* Actual size of YYARG. */ + int yycount = 0; + /* Cumulated lengths of YYARG. */ + YYPTRDIFF_T yysize = 0; - if (! (YYPACT_NINF < yyn && yyn <= YYLAST)) - return 0; - else + /* There are many possibilities here to consider: + - If this state is a consistent state with a default action, then + the only way this function was invoked is if the default action + is an error action. In that case, don't check for expected + tokens because there are none. + - The only way there can be no lookahead present (in yychar) is if + this state is a consistent state with a default action. Thus, + detecting the absence of a lookahead is sufficient to determine + that there is no unexpected or expected token to report. In that + case, just report a simple "syntax error". + - Don't assume there isn't a lookahead just because this state is a + consistent state with a default action. There might have been a + previous inconsistent state, consistent state with a non-default + action, or user semantic action that manipulated yychar. + - Of course, the expected token list depends on states to have + correct lookahead information, and it depends on the parser not + to perform extra reductions after fetching a lookahead from the + scanner and before detecting a syntax error. Thus, state merging + (from LALR or IELR) and default reductions corrupt the expected + token list. However, the list is correct for canonical LR with + one exception: it will still contain any token that will not be + accepted due to an error action in a later state. + */ + if (yytoken != YYEMPTY) { - int yytype = YYTRANSLATE (yychar); - YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); - YYSIZE_T yysize = yysize0; - YYSIZE_T yysize1; - int yysize_overflow = 0; - enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; - char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; - int yyx; + int yyn = yypact[+*yyssp]; + YYPTRDIFF_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]); + yysize = yysize0; + yyarg[yycount++] = yytname[yytoken]; + if (!yypact_value_is_default (yyn)) + { + /* Start YYX at -YYN if negative to avoid negative indexes in + YYCHECK. In other words, skip the first -YYN actions for + this state because they are default actions. */ + int yyxbegin = yyn < 0 ? -yyn : 0; + /* Stay within bounds of both yycheck and yytname. */ + int yychecklim = YYLAST - yyn + 1; + int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; + int yyx; -# if 0 - /* This is so xgettext sees the translatable formats that are - constructed on the fly. */ - YY_("syntax error, unexpected %s"); - YY_("syntax error, unexpected %s, expecting %s"); - YY_("syntax error, unexpected %s, expecting %s or %s"); - YY_("syntax error, unexpected %s, expecting %s or %s or %s"); - YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); -# endif - char *yyfmt; - char const *yyf; - static char const yyunexpected[] = "syntax error, unexpected %s"; - static char const yyexpecting[] = ", expecting %s"; - static char const yyor[] = " or %s"; - char yyformat[sizeof yyunexpected - + sizeof yyexpecting - 1 - + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) - * (sizeof yyor - 1))]; - char const *yyprefix = yyexpecting; - - /* Start YYX at -YYN if negative to avoid negative indexes in - YYCHECK. */ - int yyxbegin = yyn < 0 ? -yyn : 0; - - /* Stay within bounds of both yycheck and yytname. */ - int yychecklim = YYLAST - yyn + 1; - int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; - int yycount = 1; - - yyarg[0] = yytname[yytype]; - yyfmt = yystpcpy (yyformat, yyunexpected); - - for (yyx = yyxbegin; yyx < yyxend; ++yyx) - if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) - { - if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) - { - yycount = 1; - yysize = yysize0; - yyformat[sizeof yyunexpected - 1] = '\0'; - break; - } - yyarg[yycount++] = yytname[yyx]; - yysize1 = yysize + yytnamerr (0, yytname[yyx]); - yysize_overflow |= (yysize1 < yysize); - yysize = yysize1; - yyfmt = yystpcpy (yyfmt, yyprefix); - yyprefix = yyor; - } - - yyf = YY_(yyformat); - yysize1 = yysize + yystrlen (yyf); - yysize_overflow |= (yysize1 < yysize); - yysize = yysize1; - - if (yysize_overflow) - return YYSIZE_MAXIMUM; - - if (yyresult) - { - /* Avoid sprintf, as that infringes on the user's name space. - Don't have undefined behavior even if the translation - produced a string with the wrong number of "%s"s. */ - char *yyp = yyresult; - int yyi = 0; - while ((*yyp = *yyf) != '\0') - { - if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) - { - yyp += yytnamerr (yyp, yyarg[yyi++]); - yyf += 2; - } - else - { - yyp++; - yyf++; - } - } - } - return yysize; + for (yyx = yyxbegin; yyx < yyxend; ++yyx) + if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR + && !yytable_value_is_error (yytable[yyx + yyn])) + { + if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) + { + yycount = 1; + yysize = yysize0; + break; + } + yyarg[yycount++] = yytname[yyx]; + { + YYPTRDIFF_T yysize1 + = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]); + if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM) + yysize = yysize1; + else + return 2; + } + } + } } + + switch (yycount) + { +# define YYCASE_(N, S) \ + case N: \ + yyformat = S; \ + break + default: /* Avoid compiler warnings. */ + YYCASE_(0, YY_("syntax error")); + YYCASE_(1, YY_("syntax error, unexpected %s")); + YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); + YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s")); + YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s")); + YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s")); +# undef YYCASE_ + } + + { + /* Don't count the "%s"s in the final size, but reserve room for + the terminator. */ + YYPTRDIFF_T yysize1 = yysize + (yystrlen (yyformat) - 2 * yycount) + 1; + if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM) + yysize = yysize1; + else + return 2; + } + + if (*yymsg_alloc < yysize) + { + *yymsg_alloc = 2 * yysize; + if (! (yysize <= *yymsg_alloc + && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM)) + *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM; + return 1; + } + + /* Avoid sprintf, as that infringes on the user's name space. + Don't have undefined behavior even if the translation + produced a string with the wrong number of "%s"s. */ + { + char *yyp = *yymsg; + int yyi = 0; + while ((*yyp = *yyformat) != '\0') + if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount) + { + yyp += yytnamerr (yyp, yyarg[yyi++]); + yyformat += 2; + } + else + { + ++yyp; + ++yyformat; + } + } + return 0; } #endif /* YYERROR_VERBOSE */ - /*-----------------------------------------------. | Release the memory associated to this symbol. | `-----------------------------------------------*/ -/*ARGSUSED*/ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) static void yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) -#else -static void -yydestruct (yymsg, yytype, yyvaluep) - const char *yymsg; - int yytype; - YYSTYPE *yyvaluep; -#endif { YYUSE (yyvaluep); - if (!yymsg) yymsg = "Deleting"; YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); - switch (yytype) - { - - default: - break; - } + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN + YYUSE (yytype); + YY_IGNORE_MAYBE_UNINITIALIZED_END } - - -/* Prevent warnings from -Wmissing-prototypes. */ - -#ifdef YYPARSE_PARAM -#if defined __STDC__ || defined __cplusplus -int yyparse (void *YYPARSE_PARAM); -#else -int yyparse (); -#endif -#else /* ! YYPARSE_PARAM */ -#if defined __STDC__ || defined __cplusplus -int yyparse (void); -#else -int yyparse (); -#endif -#endif /* ! YYPARSE_PARAM */ -/* The look-ahead symbol. */ + +/* The lookahead symbol. */ int yychar; -/* The semantic value of the look-ahead symbol. */ +/* The semantic value of the lookahead symbol. */ YYSTYPE yylval; - /* Number of syntax errors so far. */ int yynerrs; - /*----------. | yyparse. | `----------*/ -#ifdef YYPARSE_PARAM -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -int -yyparse (void *YYPARSE_PARAM) -#else -int -yyparse (YYPARSE_PARAM) - void *YYPARSE_PARAM; -#endif -#else /* ! YYPARSE_PARAM */ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) int yyparse (void) -#else -int -yyparse () - -#endif -#endif { - - int yystate; + yy_state_fast_t yystate; + /* Number of tokens to shift before error messages enabled. */ + int yyerrstatus; + + /* The stacks and their tools: + 'yyss': related to states. + 'yyvs': related to semantic values. + + Refer to the stacks through separate pointers, to allow yyoverflow + to reallocate them elsewhere. */ + + /* The state stack. */ + yy_state_t yyssa[YYINITDEPTH]; + yy_state_t *yyss; + yy_state_t *yyssp; + + /* The semantic value stack. */ + YYSTYPE yyvsa[YYINITDEPTH]; + YYSTYPE *yyvs; + YYSTYPE *yyvsp; + + YYPTRDIFF_T yystacksize; + int yyn; int yyresult; - /* Number of tokens to shift before error messages enabled. */ - int yyerrstatus; - /* Look-ahead token as an internal (translated) token number. */ + /* Lookahead token as an internal (translated) token number. */ int yytoken = 0; -#if YYERROR_VERBOSE - /* Buffer for error messages, and its allocated size. */ - char yymsgbuf[128]; - char *yymsg = yymsgbuf; - YYSIZE_T yymsg_alloc = sizeof yymsgbuf; -#endif - - /* Three stacks and their tools: - `yyss': related to states, - `yyvs': related to semantic values, - `yyls': related to locations. - - Refer to the stacks thru separate pointers, to allow yyoverflow - to reallocate them elsewhere. */ - - /* The state stack. */ - yytype_int16 yyssa[YYINITDEPTH]; - yytype_int16 *yyss = yyssa; - yytype_int16 *yyssp; - - /* The semantic value stack. */ - YYSTYPE yyvsa[YYINITDEPTH]; - YYSTYPE *yyvs = yyvsa; - YYSTYPE *yyvsp; - - - -#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) - - YYSIZE_T yystacksize = YYINITDEPTH; - /* The variables used to return semantic value and location from the action routines. */ YYSTYPE yyval; +#if YYERROR_VERBOSE + /* Buffer for error messages, and its allocated size. */ + char yymsgbuf[128]; + char *yymsg = yymsgbuf; + YYPTRDIFF_T yymsg_alloc = sizeof yymsgbuf; +#endif + +#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) /* The number of symbols on the RHS of the reduced rule. Keep to zero when no symbol should be popped. */ int yylen = 0; + yyssp = yyss = yyssa; + yyvsp = yyvs = yyvsa; + yystacksize = YYINITDEPTH; + YYDPRINTF ((stderr, "Starting parse\n")); yystate = 0; yyerrstatus = 0; yynerrs = 0; - yychar = YYEMPTY; /* Cause a token to be read. */ - - /* Initialize stack pointers. - Waste one element of value and location stack - so that they stay on the same level as the state stack. - The wasted elements are never initialized. */ - - yyssp = yyss; - yyvsp = yyvs; - + yychar = YYEMPTY; /* Cause a token to be read. */ goto yysetstate; + /*------------------------------------------------------------. -| yynewstate -- Push a new state, which is found in yystate. | +| yynewstate -- push a new state, which is found in yystate. | `------------------------------------------------------------*/ - yynewstate: +yynewstate: /* In all cases, when you get here, the value and location stacks have just been pushed. So pushing a state here evens the stacks. */ yyssp++; - yysetstate: - *yyssp = yystate; + +/*--------------------------------------------------------------------. +| yysetstate -- set current state (the top of the stack) to yystate. | +`--------------------------------------------------------------------*/ +yysetstate: + YYDPRINTF ((stderr, "Entering state %d\n", yystate)); + YY_ASSERT (0 <= yystate && yystate < YYNSTATES); + YY_IGNORE_USELESS_CAST_BEGIN + *yyssp = YY_CAST (yy_state_t, yystate); + YY_IGNORE_USELESS_CAST_END if (yyss + yystacksize - 1 <= yyssp) +#if !defined yyoverflow && !defined YYSTACK_RELOCATE + goto yyexhaustedlab; +#else { /* Get the current used size of the three stacks, in elements. */ - YYSIZE_T yysize = yyssp - yyss + 1; + YYPTRDIFF_T yysize = yyssp - yyss + 1; -#ifdef yyoverflow +# if defined yyoverflow { - /* Give user a chance to reallocate the stack. Use copies of - these so that the &'s don't force the real ones into - memory. */ - YYSTYPE *yyvs1 = yyvs; - yytype_int16 *yyss1 = yyss; + /* Give user a chance to reallocate the stack. Use copies of + these so that the &'s don't force the real ones into + memory. */ + yy_state_t *yyss1 = yyss; + YYSTYPE *yyvs1 = yyvs; - - /* Each stack pointer address is followed by the size of the - data in use in that stack, in bytes. This used to be a - conditional around just the two extra args, but that might - be undefined if yyoverflow is a macro. */ - yyoverflow (YY_("memory exhausted"), - &yyss1, yysize * sizeof (*yyssp), - &yyvs1, yysize * sizeof (*yyvsp), - - &yystacksize); - - yyss = yyss1; - yyvs = yyvs1; + /* Each stack pointer address is followed by the size of the + data in use in that stack, in bytes. This used to be a + conditional around just the two extra args, but that might + be undefined if yyoverflow is a macro. */ + yyoverflow (YY_("memory exhausted"), + &yyss1, yysize * YYSIZEOF (*yyssp), + &yyvs1, yysize * YYSIZEOF (*yyvsp), + &yystacksize); + yyss = yyss1; + yyvs = yyvs1; } -#else /* no yyoverflow */ -# ifndef YYSTACK_RELOCATE - goto yyexhaustedlab; -# else +# else /* defined YYSTACK_RELOCATE */ /* Extend the stack our own way. */ if (YYMAXDEPTH <= yystacksize) - goto yyexhaustedlab; + goto yyexhaustedlab; yystacksize *= 2; if (YYMAXDEPTH < yystacksize) - yystacksize = YYMAXDEPTH; + yystacksize = YYMAXDEPTH; { - yytype_int16 *yyss1 = yyss; - union yyalloc *yyptr = - (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); - if (! yyptr) - goto yyexhaustedlab; - YYSTACK_RELOCATE (yyss); - YYSTACK_RELOCATE (yyvs); - -# undef YYSTACK_RELOCATE - if (yyss1 != yyssa) - YYSTACK_FREE (yyss1); + yy_state_t *yyss1 = yyss; + union yyalloc *yyptr = + YY_CAST (union yyalloc *, + YYSTACK_ALLOC (YY_CAST (YYSIZE_T, YYSTACK_BYTES (yystacksize)))); + if (! yyptr) + goto yyexhaustedlab; + YYSTACK_RELOCATE (yyss_alloc, yyss); + YYSTACK_RELOCATE (yyvs_alloc, yyvs); +# undef YYSTACK_RELOCATE + if (yyss1 != yyssa) + YYSTACK_FREE (yyss1); } # endif -#endif /* no yyoverflow */ yyssp = yyss + yysize - 1; yyvsp = yyvs + yysize - 1; - - YYDPRINTF ((stderr, "Stack size increased to %lu\n", - (unsigned long int) yystacksize)); + YY_IGNORE_USELESS_CAST_BEGIN + YYDPRINTF ((stderr, "Stack size increased to %ld\n", + YY_CAST (long, yystacksize))); + YY_IGNORE_USELESS_CAST_END if (yyss + yystacksize - 1 <= yyssp) - YYABORT; + YYABORT; } +#endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */ - YYDPRINTF ((stderr, "Entering state %d\n", yystate)); + if (yystate == YYFINAL) + YYACCEPT; goto yybackup; + /*-----------. | yybackup. | `-----------*/ yybackup: - /* Do appropriate processing given the current state. Read a - look-ahead token if we need one and don't already have one. */ + lookahead token if we need one and don't already have one. */ - /* First try to decide what to do without reference to look-ahead token. */ + /* First try to decide what to do without reference to lookahead token. */ yyn = yypact[yystate]; - if (yyn == YYPACT_NINF) + if (yypact_value_is_default (yyn)) goto yydefault; - /* Not known => get a look-ahead token if don't already have one. */ + /* Not known => get a lookahead token if don't already have one. */ - /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */ + /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ if (yychar == YYEMPTY) { YYDPRINTF ((stderr, "Reading a token: ")); - yychar = YYLEX; + yychar = yylex (); } if (yychar <= YYEOF) @@ -1796,30 +1680,26 @@ yybackup: yyn = yytable[yyn]; if (yyn <= 0) { - if (yyn == 0 || yyn == YYTABLE_NINF) - goto yyerrlab; + if (yytable_value_is_error (yyn)) + goto yyerrlab; yyn = -yyn; goto yyreduce; } - if (yyn == YYFINAL) - YYACCEPT; - /* Count tokens shifted since error; after three, turn off error status. */ if (yyerrstatus) yyerrstatus--; - /* Shift the look-ahead token. */ + /* Shift the lookahead token. */ YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); - - /* Discard the shifted token unless it is eof. */ - if (yychar != YYEOF) - yychar = YYEMPTY; - yystate = yyn; + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN *++yyvsp = yylval; + YY_IGNORE_MAYBE_UNINITIALIZED_END + /* Discard the shifted token. */ + yychar = YYEMPTY; goto yynewstate; @@ -1834,14 +1714,14 @@ yydefault: /*-----------------------------. -| yyreduce -- Do a reduction. | +| yyreduce -- do a reduction. | `-----------------------------*/ yyreduce: /* yyn is the number of a rule to reduce with. */ yylen = yyr2[yyn]; /* If YYLEN is nonzero, implement the default value of the action: - `$$ = $1'. + '$$ = $1'. Otherwise, the following line sets YYVAL to garbage. This behavior is undocumented and Bison @@ -1854,76 +1734,85 @@ yyreduce: YY_REDUCE_PRINT (yyn); switch (yyn) { - case 2: + case 2: #line 236 "ncgen.y" - {if (error_count > 0) YYABORT;;} + {if (error_count > 0) YYABORT;} +#line 1741 "ncgen.tab.c" break; case 3: #line 239 "ncgen.y" - {createrootgroup(datasetname);;} + {createrootgroup(datasetname);} +#line 1747 "ncgen.tab.c" break; case 8: #line 258 "ncgen.y" - { - Symbol* id = (yyvsp[(2) - (3)].sym); + { + Symbol* id = (yyvsp[-1].sym); markcdf4("Group specification"); if(creategroup(id) == NULL) yyerror("duplicate group declaration within parent group for %s", id->name); - ;} + } +#line 1759 "ncgen.tab.c" break; case 9: #line 267 "ncgen.y" - {listpop(groupstack);;} + {listpop(groupstack);} +#line 1765 "ncgen.tab.c" break; case 12: #line 273 "ncgen.y" - {;} + {} +#line 1771 "ncgen.tab.c" break; case 13: #line 275 "ncgen.y" - {markcdf4("Type specification");;} + {markcdf4("Type specification");} +#line 1777 "ncgen.tab.c" break; case 16: #line 281 "ncgen.y" - { /* Use when defining a type */ - (yyvsp[(1) - (1)].sym)->objectclass = NC_TYPE; - if(dupobjectcheck(NC_TYPE,(yyvsp[(1) - (1)].sym))) + { /* Use when defining a type */ + (yyvsp[0].sym)->objectclass = NC_TYPE; + if(dupobjectcheck(NC_TYPE,(yyvsp[0].sym))) yyerror("duplicate type declaration for %s", - (yyvsp[(1) - (1)].sym)->name); - listpush(typdefs,(void*)(yyvsp[(1) - (1)].sym)); - ;} + (yyvsp[0].sym)->name); + listpush(typdefs,(void*)(yyvsp[0].sym)); + } +#line 1789 "ncgen.tab.c" break; case 17: #line 290 "ncgen.y" - {;} + {} +#line 1795 "ncgen.tab.c" break; case 18: #line 290 "ncgen.y" - {;} + {} +#line 1801 "ncgen.tab.c" break; case 25: #line 304 "ncgen.y" - { + { int i; - addtogroup((yyvsp[(3) - (6)].sym)); /* sets prefix*/ - (yyvsp[(3) - (6)].sym)->objectclass=NC_TYPE; - (yyvsp[(3) - (6)].sym)->subclass=NC_ENUM; - (yyvsp[(3) - (6)].sym)->typ.basetype=(yyvsp[(1) - (6)].sym); - (yyvsp[(3) - (6)].sym)->typ.size = (yyvsp[(1) - (6)].sym)->typ.size; - (yyvsp[(3) - (6)].sym)->typ.alignment = (yyvsp[(1) - (6)].sym)->typ.alignment; - stackbase=(yyvsp[(5) - (6)].mark); + addtogroup((yyvsp[-3].sym)); /* sets prefix*/ + (yyvsp[-3].sym)->objectclass=NC_TYPE; + (yyvsp[-3].sym)->subclass=NC_ENUM; + (yyvsp[-3].sym)->typ.basetype=(yyvsp[-5].sym); + (yyvsp[-3].sym)->typ.size = (yyvsp[-5].sym)->typ.size; + (yyvsp[-3].sym)->typ.alignment = (yyvsp[-5].sym)->typ.alignment; + stackbase=(yyvsp[-1].mark); stacklen=listlength(stack); - (yyvsp[(3) - (6)].sym)->subnodes = listnew(); + (yyvsp[-3].sym)->subnodes = listnew(); /* Variety of field fixups*/ /* 1. add in the enum values*/ /* 2. make this type be their container*/ @@ -1933,83 +1822,89 @@ yyreduce: Symbol* eid = (Symbol*)listget(stack,i); assert(eid->subclass == NC_ECONST); addtogroup(eid); - listpush((yyvsp[(3) - (6)].sym)->subnodes,(void*)eid); - eid->container = (yyvsp[(3) - (6)].sym); - eid->typ.basetype = (yyvsp[(3) - (6)].sym)->typ.basetype; + listpush((yyvsp[-3].sym)->subnodes,(void*)eid); + eid->container = (yyvsp[-3].sym); + eid->typ.basetype = (yyvsp[-3].sym)->typ.basetype; } listsetlength(stack,stackbase);/* remove stack nodes*/ - ;} + } +#line 1832 "ncgen.tab.c" break; case 26: #line 333 "ncgen.y" - {(yyval.mark)=listlength(stack); listpush(stack,(void*)(yyvsp[(1) - (1)].sym));;} + {(yyval.mark)=listlength(stack); listpush(stack,(void*)(yyvsp[0].sym));} +#line 1838 "ncgen.tab.c" break; case 27: #line 335 "ncgen.y" - { + { int i; - (yyval.mark)=(yyvsp[(1) - (3)].mark); + (yyval.mark)=(yyvsp[-2].mark); /* check for duplicates*/ - stackbase=(yyvsp[(1) - (3)].mark); + stackbase=(yyvsp[-2].mark); stacklen=listlength(stack); for(i=stackbase;iname,elem->name)==0) + if(strcmp((yyvsp[0].sym)->name,elem->name)==0) yyerror("duplicate enum declaration for %s", elem->name); } - listpush(stack,(void*)(yyvsp[(3) - (3)].sym)); - ;} + listpush(stack,(void*)(yyvsp[0].sym)); + } +#line 1857 "ncgen.tab.c" break; case 28: #line 352 "ncgen.y" - { - (yyvsp[(1) - (3)].sym)->objectclass=NC_TYPE; - (yyvsp[(1) - (3)].sym)->subclass=NC_ECONST; - (yyvsp[(1) - (3)].sym)->typ.econst=(yyvsp[(3) - (3)].constant); - (yyval.sym)=(yyvsp[(1) - (3)].sym); - ;} + { + (yyvsp[-2].sym)->objectclass=NC_TYPE; + (yyvsp[-2].sym)->subclass=NC_ECONST; + (yyvsp[-2].sym)->typ.econst=(yyvsp[0].constant); + (yyval.sym)=(yyvsp[-2].sym); + } +#line 1868 "ncgen.tab.c" break; case 29: #line 361 "ncgen.y" - { + { vercheck(NC_OPAQUE); - addtogroup((yyvsp[(5) - (5)].sym)); /*sets prefix*/ - (yyvsp[(5) - (5)].sym)->objectclass=NC_TYPE; - (yyvsp[(5) - (5)].sym)->subclass=NC_OPAQUE; - (yyvsp[(5) - (5)].sym)->typ.typecode=NC_OPAQUE; - (yyvsp[(5) - (5)].sym)->typ.size=int32_val; - (yyvsp[(5) - (5)].sym)->typ.alignment=ncaux_class_alignment(NC_OPAQUE); - ;} + addtogroup((yyvsp[0].sym)); /*sets prefix*/ + (yyvsp[0].sym)->objectclass=NC_TYPE; + (yyvsp[0].sym)->subclass=NC_OPAQUE; + (yyvsp[0].sym)->typ.typecode=NC_OPAQUE; + (yyvsp[0].sym)->typ.size=int32_val; + (yyvsp[0].sym)->typ.alignment=ncaux_class_alignment(NC_OPAQUE); + } +#line 1882 "ncgen.tab.c" break; case 30: #line 373 "ncgen.y" - { - Symbol* basetype = (yyvsp[(1) - (5)].sym); + { + Symbol* basetype = (yyvsp[-4].sym); vercheck(NC_VLEN); - addtogroup((yyvsp[(5) - (5)].sym)); /*sets prefix*/ - (yyvsp[(5) - (5)].sym)->objectclass=NC_TYPE; - (yyvsp[(5) - (5)].sym)->subclass=NC_VLEN; - (yyvsp[(5) - (5)].sym)->typ.basetype=basetype; - (yyvsp[(5) - (5)].sym)->typ.typecode=NC_VLEN; - (yyvsp[(5) - (5)].sym)->typ.size=VLENSIZE; - (yyvsp[(5) - (5)].sym)->typ.alignment=ncaux_class_alignment(NC_VLEN); - ;} + addtogroup((yyvsp[0].sym)); /*sets prefix*/ + (yyvsp[0].sym)->objectclass=NC_TYPE; + (yyvsp[0].sym)->subclass=NC_VLEN; + (yyvsp[0].sym)->typ.basetype=basetype; + (yyvsp[0].sym)->typ.typecode=NC_VLEN; + (yyvsp[0].sym)->typ.size=VLENSIZE; + (yyvsp[0].sym)->typ.alignment=ncaux_class_alignment(NC_VLEN); + } +#line 1898 "ncgen.tab.c" break; case 31: #line 387 "ncgen.y" - { + { int i,j; vercheck(NC_COMPOUND); - addtogroup((yyvsp[(2) - (5)].sym)); + addtogroup((yyvsp[-3].sym)); /* check for duplicate field names*/ - stackbase=(yyvsp[(4) - (5)].mark); + stackbase=(yyvsp[-1].mark); stacklen=listlength(stack); for(i=stackbase;iobjectclass=NC_TYPE; - (yyvsp[(2) - (5)].sym)->subclass=NC_COMPOUND; - (yyvsp[(2) - (5)].sym)->typ.basetype=NULL; - (yyvsp[(2) - (5)].sym)->typ.typecode=NC_COMPOUND; - (yyvsp[(2) - (5)].sym)->subnodes = listnew(); + (yyvsp[-3].sym)->objectclass=NC_TYPE; + (yyvsp[-3].sym)->subclass=NC_COMPOUND; + (yyvsp[-3].sym)->typ.basetype=NULL; + (yyvsp[-3].sym)->typ.typecode=NC_COMPOUND; + (yyvsp[-3].sym)->subnodes = listnew(); /* Add in the fields*/ for(i=stackbase;icontainer = (yyvsp[(2) - (5)].sym); - listpush((yyvsp[(2) - (5)].sym)->subnodes,(void*)fsym); + fsym->container = (yyvsp[-3].sym); + listpush((yyvsp[-3].sym)->subnodes,(void*)fsym); } listsetlength(stack,stackbase);/* remove stack nodes*/ - ;} + } +#line 1932 "ncgen.tab.c" break; case 32: #line 419 "ncgen.y" - {(yyval.mark)=(yyvsp[(1) - (2)].mark);;} + {(yyval.mark)=(yyvsp[-1].mark);} +#line 1938 "ncgen.tab.c" break; case 33: #line 420 "ncgen.y" - {(yyval.mark)=(yyvsp[(1) - (3)].mark);;} + {(yyval.mark)=(yyvsp[-2].mark);} +#line 1944 "ncgen.tab.c" break; case 34: #line 424 "ncgen.y" - { + { int i; - (yyval.mark)=(yyvsp[(2) - (2)].mark); - stackbase=(yyvsp[(2) - (2)].mark); + (yyval.mark)=(yyvsp[0].mark); + stackbase=(yyvsp[0].mark); stacklen=listlength(stack); /* process each field in the fieldlist*/ for(i=stackbase;ityp.basetype = (yyvsp[(1) - (2)].sym); + f->typ.basetype = (yyvsp[-1].sym); } - ;} + } +#line 1960 "ncgen.tab.c" break; case 35: #line 437 "ncgen.y" - { (yyval.sym) = primsymbols[NC_CHAR]; ;} + { (yyval.sym) = primsymbols[NC_CHAR]; } +#line 1966 "ncgen.tab.c" break; case 36: #line 438 "ncgen.y" - { (yyval.sym) = primsymbols[NC_BYTE]; ;} + { (yyval.sym) = primsymbols[NC_BYTE]; } +#line 1972 "ncgen.tab.c" break; case 37: #line 439 "ncgen.y" - { (yyval.sym) = primsymbols[NC_SHORT]; ;} + { (yyval.sym) = primsymbols[NC_SHORT]; } +#line 1978 "ncgen.tab.c" break; case 38: #line 440 "ncgen.y" - { (yyval.sym) = primsymbols[NC_INT]; ;} + { (yyval.sym) = primsymbols[NC_INT]; } +#line 1984 "ncgen.tab.c" break; case 39: #line 441 "ncgen.y" - { (yyval.sym) = primsymbols[NC_FLOAT]; ;} + { (yyval.sym) = primsymbols[NC_FLOAT]; } +#line 1990 "ncgen.tab.c" break; case 40: #line 442 "ncgen.y" - { (yyval.sym) = primsymbols[NC_DOUBLE]; ;} + { (yyval.sym) = primsymbols[NC_DOUBLE]; } +#line 1996 "ncgen.tab.c" break; case 41: #line 443 "ncgen.y" - { vercheck(NC_UBYTE); (yyval.sym) = primsymbols[NC_UBYTE]; ;} + { vercheck(NC_UBYTE); (yyval.sym) = primsymbols[NC_UBYTE]; } +#line 2002 "ncgen.tab.c" break; case 42: #line 444 "ncgen.y" - { vercheck(NC_USHORT); (yyval.sym) = primsymbols[NC_USHORT]; ;} + { vercheck(NC_USHORT); (yyval.sym) = primsymbols[NC_USHORT]; } +#line 2008 "ncgen.tab.c" break; case 43: #line 445 "ncgen.y" - { vercheck(NC_UINT); (yyval.sym) = primsymbols[NC_UINT]; ;} + { vercheck(NC_UINT); (yyval.sym) = primsymbols[NC_UINT]; } +#line 2014 "ncgen.tab.c" break; case 44: #line 446 "ncgen.y" - { vercheck(NC_INT64); (yyval.sym) = primsymbols[NC_INT64]; ;} + { vercheck(NC_INT64); (yyval.sym) = primsymbols[NC_INT64]; } +#line 2020 "ncgen.tab.c" break; case 45: #line 447 "ncgen.y" - { vercheck(NC_UINT64); (yyval.sym) = primsymbols[NC_UINT64]; ;} + { vercheck(NC_UINT64); (yyval.sym) = primsymbols[NC_UINT64]; } +#line 2026 "ncgen.tab.c" break; case 46: #line 448 "ncgen.y" - { vercheck(NC_STRING); (yyval.sym) = primsymbols[NC_STRING]; ;} + { vercheck(NC_STRING); (yyval.sym) = primsymbols[NC_STRING]; } +#line 2032 "ncgen.tab.c" break; case 48: #line 452 "ncgen.y" - {;} + {} +#line 2038 "ncgen.tab.c" break; case 49: #line 453 "ncgen.y" - {;} + {} +#line 2044 "ncgen.tab.c" break; case 52: #line 460 "ncgen.y" - {;} + {} +#line 2050 "ncgen.tab.c" break; case 53: #line 460 "ncgen.y" - {;} + {} +#line 2056 "ncgen.tab.c" break; case 56: #line 468 "ncgen.y" - { - (yyvsp[(1) - (3)].sym)->dim.declsize = (size_t)extractint((yyvsp[(3) - (3)].constant)); + { + (yyvsp[-2].sym)->dim.declsize = (size_t)extractint((yyvsp[0].constant)); #ifdef GENDEBUG1 -fprintf(stderr,"dimension: %s = %llu\n",(yyvsp[(1) - (3)].sym)->name,(unsigned long long)(yyvsp[(1) - (3)].sym)->dim.declsize); +fprintf(stderr,"dimension: %s = %llu\n",(yyvsp[-2].sym)->name,(unsigned long long)(yyvsp[-2].sym)->dim.declsize); #endif - reclaimconstant((yyvsp[(3) - (3)].constant)); - ;} + reclaimconstant((yyvsp[0].constant)); + } +#line 2068 "ncgen.tab.c" break; case 57: #line 476 "ncgen.y" - { - (yyvsp[(1) - (3)].sym)->dim.declsize = NC_UNLIMITED; - (yyvsp[(1) - (3)].sym)->dim.isunlimited = 1; + { + (yyvsp[-2].sym)->dim.declsize = NC_UNLIMITED; + (yyvsp[-2].sym)->dim.isunlimited = 1; #ifdef GENDEBUG1 -fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[(1) - (3)].sym)->name); +fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[-2].sym)->name); #endif - ;} + } +#line 2080 "ncgen.tab.c" break; case 58: #line 486 "ncgen.y" - { - (yyvsp[(1) - (1)].sym)->objectclass=NC_DIM; - if(dupobjectcheck(NC_DIM,(yyvsp[(1) - (1)].sym))) + { + (yyvsp[0].sym)->objectclass=NC_DIM; + if(dupobjectcheck(NC_DIM,(yyvsp[0].sym))) yyerror( "Duplicate dimension declaration for %s", - (yyvsp[(1) - (1)].sym)->name); - addtogroup((yyvsp[(1) - (1)].sym)); - (yyval.sym)=(yyvsp[(1) - (1)].sym); - listpush(dimdefs,(void*)(yyvsp[(1) - (1)].sym)); - ;} + (yyvsp[0].sym)->name); + addtogroup((yyvsp[0].sym)); + (yyval.sym)=(yyvsp[0].sym); + listpush(dimdefs,(void*)(yyvsp[0].sym)); + } +#line 2094 "ncgen.tab.c" break; case 60: #line 498 "ncgen.y" - {;} + {} +#line 2100 "ncgen.tab.c" break; case 61: #line 499 "ncgen.y" - {;} + {} +#line 2106 "ncgen.tab.c" break; case 64: #line 506 "ncgen.y" - {;} + {} +#line 2112 "ncgen.tab.c" break; case 65: #line 506 "ncgen.y" - {;} + {} +#line 2118 "ncgen.tab.c" break; case 66: #line 509 "ncgen.y" - { + { int i; - stackbase=(yyvsp[(2) - (2)].mark); + stackbase=(yyvsp[0].mark); stacklen=listlength(stack); /* process each variable in the varlist*/ for(i=stackbase;iname); yyerror("Duplicate variable declaration for %s", sym->name); } else { - sym->typ.basetype = (yyvsp[(1) - (2)].sym); + sym->typ.basetype = (yyvsp[-1].sym); addtogroup(sym); listpush(vardefs,(void*)sym); } } listsetlength(stack,stackbase);/* remove stack nodes*/ - ;} + } +#line 2142 "ncgen.tab.c" break; case 67: #line 531 "ncgen.y" - {(yyval.mark)=listlength(stack); - listpush(stack,(void*)(yyvsp[(1) - (1)].sym)); - ;} + {(yyval.mark)=listlength(stack); + listpush(stack,(void*)(yyvsp[0].sym)); + } +#line 2150 "ncgen.tab.c" break; case 68: #line 535 "ncgen.y" - {(yyval.mark)=(yyvsp[(1) - (3)].mark); listpush(stack,(void*)(yyvsp[(3) - (3)].sym));;} + {(yyval.mark)=(yyvsp[-2].mark); listpush(stack,(void*)(yyvsp[0].sym));} +#line 2156 "ncgen.tab.c" break; case 69: #line 539 "ncgen.y" - { + { int i; Dimset dimset; - Symbol* var = (yyvsp[(1) - (2)].sym); /* for debugging */ + Symbol* var = (yyvsp[-1].sym); /* for debugging */ stacklen=listlength(stack); - stackbase=(yyvsp[(2) - (2)].mark); + stackbase=(yyvsp[0].mark); count = stacklen - stackbase; if(count >= NC_MAX_VAR_DIMS) { - yyerror("%s has too many dimensions",(yyvsp[(1) - (2)].sym)->name); + yyerror("%s has too many dimensions",(yyvsp[-1].sym)->name); count = NC_MAX_VAR_DIMS - 1; stacklen = stackbase + count; } @@ -2257,65 +2182,73 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[(1) - (3)].sym)->name); var->objectclass=NC_VAR; listsetlength(stack,stackbase);/* remove stack nodes*/ (yyval.sym) = var; - ;} + } +#line 2187 "ncgen.tab.c" break; case 70: #line 567 "ncgen.y" - {(yyval.mark)=listlength(stack);;} + {(yyval.mark)=listlength(stack);} +#line 2193 "ncgen.tab.c" break; case 71: #line 568 "ncgen.y" - {(yyval.mark)=(yyvsp[(2) - (3)].mark);;} + {(yyval.mark)=(yyvsp[-1].mark);} +#line 2199 "ncgen.tab.c" break; case 72: #line 571 "ncgen.y" - {(yyval.mark)=listlength(stack); listpush(stack,(void*)(yyvsp[(1) - (1)].sym));;} + {(yyval.mark)=listlength(stack); listpush(stack,(void*)(yyvsp[0].sym));} +#line 2205 "ncgen.tab.c" break; case 73: #line 573 "ncgen.y" - {(yyval.mark)=(yyvsp[(1) - (3)].mark); listpush(stack,(void*)(yyvsp[(3) - (3)].sym));;} + {(yyval.mark)=(yyvsp[-2].mark); listpush(stack,(void*)(yyvsp[0].sym));} +#line 2211 "ncgen.tab.c" break; case 74: #line 577 "ncgen.y" - {Symbol* dimsym = (yyvsp[(1) - (1)].sym); + {Symbol* dimsym = (yyvsp[0].sym); dimsym->objectclass = NC_DIM; /* Find the actual dimension*/ dimsym = locate(dimsym); if(dimsym == NULL) { - derror("Undefined or forward referenced dimension: %s",(yyvsp[(1) - (1)].sym)->name); + derror("Undefined or forward referenced dimension: %s",(yyvsp[0].sym)->name); YYABORT; } (yyval.sym)=dimsym; - ;} + } +#line 2226 "ncgen.tab.c" break; case 75: #line 591 "ncgen.y" - {(yyval.mark)=listlength(stack); - listpush(stack,(void*)(yyvsp[(1) - (1)].sym)); - ;} + {(yyval.mark)=listlength(stack); + listpush(stack,(void*)(yyvsp[0].sym)); + } +#line 2234 "ncgen.tab.c" break; case 76: #line 595 "ncgen.y" - {(yyval.mark)=(yyvsp[(1) - (3)].mark); listpush(stack,(void*)(yyvsp[(3) - (3)].sym));;} + {(yyval.mark)=(yyvsp[-2].mark); listpush(stack,(void*)(yyvsp[0].sym));} +#line 2240 "ncgen.tab.c" break; case 77: #line 600 "ncgen.y" - { + { int i; Dimset dimset; - stackbase=(yyvsp[(2) - (2)].mark); + stackbase=(yyvsp[0].mark); stacklen=listlength(stack); count = stacklen - stackbase; if(count >= NC_MAX_VAR_DIMS) { - yyerror("%s has too many dimensions",(yyvsp[(1) - (2)].sym)->name); + yyerror("%s has too many dimensions",(yyvsp[-1].sym)->name); count = NC_MAX_VAR_DIMS - 1; stacklen = stackbase + count; } @@ -2326,39 +2259,44 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[(1) - (3)].sym)->name); Symbol* dsym = (Symbol*)listget(stack,stackbase+i); dimset.dimsyms[i] = dsym; } - (yyvsp[(1) - (2)].sym)->typ.dimset = dimset; + (yyvsp[-1].sym)->typ.dimset = dimset; } - (yyvsp[(1) - (2)].sym)->typ.basetype = NULL; /* not yet known*/ - (yyvsp[(1) - (2)].sym)->objectclass=NC_TYPE; - (yyvsp[(1) - (2)].sym)->subclass=NC_FIELD; + (yyvsp[-1].sym)->typ.basetype = NULL; /* not yet known*/ + (yyvsp[-1].sym)->objectclass=NC_TYPE; + (yyvsp[-1].sym)->subclass=NC_FIELD; listsetlength(stack,stackbase);/* remove stack nodes*/ - (yyval.sym) = (yyvsp[(1) - (2)].sym); - ;} + (yyval.sym) = (yyvsp[-1].sym); + } +#line 2271 "ncgen.tab.c" break; case 78: #line 628 "ncgen.y" - {(yyval.mark)=listlength(stack);;} + {(yyval.mark)=listlength(stack);} +#line 2277 "ncgen.tab.c" break; case 79: #line 629 "ncgen.y" - {(yyval.mark)=(yyvsp[(2) - (3)].mark);;} + {(yyval.mark)=(yyvsp[-1].mark);} +#line 2283 "ncgen.tab.c" break; case 80: #line 633 "ncgen.y" - {(yyval.mark)=listlength(stack); listpush(stack,(void*)(yyvsp[(1) - (1)].sym));;} + {(yyval.mark)=listlength(stack); listpush(stack,(void*)(yyvsp[0].sym));} +#line 2289 "ncgen.tab.c" break; case 81: #line 635 "ncgen.y" - {(yyval.mark)=(yyvsp[(1) - (3)].mark); listpush(stack,(void*)(yyvsp[(3) - (3)].sym));;} + {(yyval.mark)=(yyvsp[-2].mark); listpush(stack,(void*)(yyvsp[0].sym));} +#line 2295 "ncgen.tab.c" break; case 82: #line 640 "ncgen.y" - { /* Anonymous integer dimension. + { /* Anonymous integer dimension. Can only occur in type definitions*/ char anon[32]; sprintf(anon,"const%u",uint32_val); @@ -2366,12 +2304,13 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[(1) - (3)].sym)->name); (yyval.sym)->objectclass = NC_DIM; (yyval.sym)->dim.isconstant = 1; (yyval.sym)->dim.declsize = uint32_val; - ;} + } +#line 2309 "ncgen.tab.c" break; case 83: #line 650 "ncgen.y" - { /* Anonymous integer dimension. + { /* Anonymous integer dimension. Can only occur in type definitions*/ char anon[32]; if(int32_val <= 0) { @@ -2383,34 +2322,37 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[(1) - (3)].sym)->name); (yyval.sym)->objectclass = NC_DIM; (yyval.sym)->dim.isconstant = 1; (yyval.sym)->dim.declsize = int32_val; - ;} + } +#line 2327 "ncgen.tab.c" break; case 84: #line 670 "ncgen.y" - {Symbol* vsym = (yyvsp[(1) - (1)].sym); + {Symbol* vsym = (yyvsp[0].sym); if(vsym->objectclass != NC_VAR) { derror("Undefined or forward referenced variable: %s",vsym->name); YYABORT; } (yyval.sym)=vsym; - ;} + } +#line 2339 "ncgen.tab.c" break; case 85: #line 681 "ncgen.y" - {Symbol* tsym = (yyvsp[(1) - (1)].sym); + {Symbol* tsym = (yyvsp[0].sym); if(tsym->objectclass != NC_TYPE) { derror("Undefined or forward referenced type: %s",tsym->name); YYABORT; } (yyval.sym)=tsym; - ;} + } +#line 2351 "ncgen.tab.c" break; case 86: #line 692 "ncgen.y" - {Symbol* tvsym = (yyvsp[(1) - (1)].sym); Symbol* sym; + {Symbol* tvsym = (yyvsp[0].sym); Symbol* sym; /* disambiguate*/ tvsym->objectclass = NC_VAR; sym = locate(tvsym); @@ -2418,364 +2360,439 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[(1) - (3)].sym)->name); tvsym->objectclass = NC_TYPE; sym = locate(tvsym); if(tvsym == NULL) { - derror("Undefined or forward referenced name: %s",(yyvsp[(1) - (1)].sym)->name); + derror("Undefined or forward referenced name: %s",(yyvsp[0].sym)->name); YYABORT; } else tvsym = sym; } else tvsym = sym; if(tvsym == NULL) { - derror("Undefined name (line %d): %s",(yyvsp[(1) - (1)].sym)->lineno,(yyvsp[(1) - (1)].sym)->name); + derror("Undefined name (line %d): %s",(yyvsp[0].sym)->lineno,(yyvsp[0].sym)->name); YYABORT; } (yyval.sym)=tvsym; - ;} + } +#line 2374 "ncgen.tab.c" break; case 87: #line 710 "ncgen.y" - {(yyval.sym)=(yyvsp[(1) - (1)].sym);;} + {(yyval.sym)=(yyvsp[0].sym);} +#line 2380 "ncgen.tab.c" break; case 88: #line 717 "ncgen.y" - {;} + {} +#line 2386 "ncgen.tab.c" break; case 89: #line 717 "ncgen.y" - {;} + {} +#line 2392 "ncgen.tab.c" break; case 90: #line 721 "ncgen.y" - {(yyval.sym) = makespecial(_NCPROPS_FLAG,NULL,NULL,(void*)(yyvsp[(4) - (4)].constant),ISCONST);;} + {(yyval.sym) = makespecial(_NCPROPS_FLAG,NULL,NULL,(void*)(yyvsp[0].constant),ISCONST);} +#line 2398 "ncgen.tab.c" break; case 91: #line 723 "ncgen.y" - {(yyval.sym) = makespecial(_ISNETCDF4_FLAG,NULL,NULL,(void*)(yyvsp[(4) - (4)].constant),ISCONST);;} + {(yyval.sym) = makespecial(_ISNETCDF4_FLAG,NULL,NULL,(void*)(yyvsp[0].constant),ISCONST);} +#line 2404 "ncgen.tab.c" break; case 92: #line 725 "ncgen.y" - {(yyval.sym) = makespecial(_SUPERBLOCK_FLAG,NULL,NULL,(void*)(yyvsp[(4) - (4)].constant),ISCONST);;} + {(yyval.sym) = makespecial(_SUPERBLOCK_FLAG,NULL,NULL,(void*)(yyvsp[0].constant),ISCONST);} +#line 2410 "ncgen.tab.c" break; case 93: #line 727 "ncgen.y" - { (yyval.sym)=makeattribute((yyvsp[(2) - (4)].sym),NULL,NULL,(yyvsp[(4) - (4)].datalist),ATTRGLOBAL);;} + { (yyval.sym)=makeattribute((yyvsp[-2].sym),NULL,NULL,(yyvsp[0].datalist),ATTRGLOBAL);} +#line 2416 "ncgen.tab.c" break; case 94: #line 729 "ncgen.y" - {Symbol* tsym = (yyvsp[(1) - (6)].sym); Symbol* vsym = (yyvsp[(2) - (6)].sym); Symbol* asym = (yyvsp[(4) - (6)].sym); + {Symbol* tsym = (yyvsp[-5].sym); Symbol* vsym = (yyvsp[-4].sym); Symbol* asym = (yyvsp[-2].sym); if(vsym->objectclass == NC_VAR) { - (yyval.sym)=makeattribute(asym,vsym,tsym,(yyvsp[(6) - (6)].datalist),ATTRVAR); + (yyval.sym)=makeattribute(asym,vsym,tsym,(yyvsp[0].datalist),ATTRVAR); } else { derror("Doubly typed attribute: %s",asym->name); YYABORT; } - ;} + } +#line 2429 "ncgen.tab.c" break; case 95: #line 738 "ncgen.y" - {Symbol* sym = (yyvsp[(1) - (5)].sym); Symbol* asym = (yyvsp[(3) - (5)].sym); + {Symbol* sym = (yyvsp[-4].sym); Symbol* asym = (yyvsp[-2].sym); if(sym->objectclass == NC_VAR) { - (yyval.sym)=makeattribute(asym,sym,NULL,(yyvsp[(5) - (5)].datalist),ATTRVAR); + (yyval.sym)=makeattribute(asym,sym,NULL,(yyvsp[0].datalist),ATTRVAR); } else if(sym->objectclass == NC_TYPE) { - (yyval.sym)=makeattribute(asym,NULL,sym,(yyvsp[(5) - (5)].datalist),ATTRGLOBAL); + (yyval.sym)=makeattribute(asym,NULL,sym,(yyvsp[0].datalist),ATTRGLOBAL); } else { derror("Attribute prefix not a variable or type: %s",asym->name); YYABORT; } - ;} + } +#line 2444 "ncgen.tab.c" break; case 96: #line 749 "ncgen.y" - {(yyval.sym) = makespecial(_FILLVALUE_FLAG,(yyvsp[(1) - (5)].sym),NULL,(void*)(yyvsp[(5) - (5)].datalist),ISLIST);;} + {(yyval.sym) = makespecial(_FILLVALUE_FLAG,(yyvsp[-4].sym),NULL,(void*)(yyvsp[0].datalist),ISLIST);} +#line 2450 "ncgen.tab.c" break; case 97: #line 751 "ncgen.y" - {(yyval.sym) = makespecial(_FILLVALUE_FLAG,(yyvsp[(2) - (6)].sym),(yyvsp[(1) - (6)].sym),(void*)(yyvsp[(6) - (6)].datalist),ISLIST);;} + {(yyval.sym) = makespecial(_FILLVALUE_FLAG,(yyvsp[-4].sym),(yyvsp[-5].sym),(void*)(yyvsp[0].datalist),ISLIST);} +#line 2456 "ncgen.tab.c" break; case 98: #line 753 "ncgen.y" - {(yyval.sym) = makespecial(_STORAGE_FLAG,(yyvsp[(1) - (5)].sym),NULL,(void*)(yyvsp[(5) - (5)].constant),ISCONST);;} + {(yyval.sym) = makespecial(_STORAGE_FLAG,(yyvsp[-4].sym),NULL,(void*)(yyvsp[0].constant),ISCONST);} +#line 2462 "ncgen.tab.c" break; case 99: #line 755 "ncgen.y" - {(yyval.sym) = makespecial(_CHUNKSIZES_FLAG,(yyvsp[(1) - (5)].sym),NULL,(void*)(yyvsp[(5) - (5)].datalist),ISLIST);;} + {(yyval.sym) = makespecial(_CHUNKSIZES_FLAG,(yyvsp[-4].sym),NULL,(void*)(yyvsp[0].datalist),ISLIST);} +#line 2468 "ncgen.tab.c" break; case 100: #line 757 "ncgen.y" - {(yyval.sym) = makespecial(_FLETCHER32_FLAG,(yyvsp[(1) - (5)].sym),NULL,(void*)(yyvsp[(5) - (5)].constant),ISCONST);;} + {(yyval.sym) = makespecial(_FLETCHER32_FLAG,(yyvsp[-4].sym),NULL,(void*)(yyvsp[0].constant),ISCONST);} +#line 2474 "ncgen.tab.c" break; case 101: #line 759 "ncgen.y" - {(yyval.sym) = makespecial(_DEFLATE_FLAG,(yyvsp[(1) - (5)].sym),NULL,(void*)(yyvsp[(5) - (5)].constant),ISCONST);;} + {(yyval.sym) = makespecial(_DEFLATE_FLAG,(yyvsp[-4].sym),NULL,(void*)(yyvsp[0].constant),ISCONST);} +#line 2480 "ncgen.tab.c" break; case 102: #line 761 "ncgen.y" - {(yyval.sym) = makespecial(_SHUFFLE_FLAG,(yyvsp[(1) - (5)].sym),NULL,(void*)(yyvsp[(5) - (5)].constant),ISCONST);;} + {(yyval.sym) = makespecial(_SHUFFLE_FLAG,(yyvsp[-4].sym),NULL,(void*)(yyvsp[0].constant),ISCONST);} +#line 2486 "ncgen.tab.c" break; case 103: #line 763 "ncgen.y" - {(yyval.sym) = makespecial(_ENDIAN_FLAG,(yyvsp[(1) - (5)].sym),NULL,(void*)(yyvsp[(5) - (5)].constant),ISCONST);;} + {(yyval.sym) = makespecial(_ENDIAN_FLAG,(yyvsp[-4].sym),NULL,(void*)(yyvsp[0].constant),ISCONST);} +#line 2492 "ncgen.tab.c" break; case 104: #line 765 "ncgen.y" - {(yyval.sym) = makespecial(_FILTER_FLAG,(yyvsp[(1) - (5)].sym),NULL,(void*)(yyvsp[(5) - (5)].constant),ISCONST);;} + {(yyval.sym) = makespecial(_FILTER_FLAG,(yyvsp[-4].sym),NULL,(void*)(yyvsp[0].constant),ISCONST);} +#line 2498 "ncgen.tab.c" break; case 105: #line 767 "ncgen.y" - {(yyval.sym) = makespecial(_NOFILL_FLAG,(yyvsp[(1) - (5)].sym),NULL,(void*)(yyvsp[(5) - (5)].constant),ISCONST);;} + {(yyval.sym) = makespecial(_NOFILL_FLAG,(yyvsp[-4].sym),NULL,(void*)(yyvsp[0].constant),ISCONST);} +#line 2504 "ncgen.tab.c" break; case 106: #line 769 "ncgen.y" - {(yyval.sym) = makespecial(_FORMAT_FLAG,NULL,NULL,(void*)(yyvsp[(4) - (4)].constant),ISCONST);;} + {(yyval.sym) = makespecial(_FORMAT_FLAG,NULL,NULL,(void*)(yyvsp[0].constant),ISCONST);} +#line 2510 "ncgen.tab.c" break; case 107: #line 774 "ncgen.y" - { - (yyval.sym)=(yyvsp[(1) - (1)].sym); - (yyvsp[(1) - (1)].sym)->ref.is_ref=1; - (yyvsp[(1) - (1)].sym)->is_prefixed=0; - setpathcurrent((yyvsp[(1) - (1)].sym)); - ;} + { + (yyval.sym)=(yyvsp[0].sym); + (yyvsp[0].sym)->ref.is_ref=1; + (yyvsp[0].sym)->is_prefixed=0; + setpathcurrent((yyvsp[0].sym)); + } +#line 2521 "ncgen.tab.c" break; case 108: #line 781 "ncgen.y" - { - (yyval.sym)=(yyvsp[(1) - (1)].sym); - (yyvsp[(1) - (1)].sym)->ref.is_ref=1; - (yyvsp[(1) - (1)].sym)->is_prefixed=1; + { + (yyval.sym)=(yyvsp[0].sym); + (yyvsp[0].sym)->ref.is_ref=1; + (yyvsp[0].sym)->is_prefixed=1; /* path is set in ncgen.l*/ - ;} + } +#line 2532 "ncgen.tab.c" break; case 110: #line 790 "ncgen.y" - {;} + {} +#line 2538 "ncgen.tab.c" break; case 111: #line 791 "ncgen.y" - {;} + {} +#line 2544 "ncgen.tab.c" break; case 114: #line 799 "ncgen.y" - {(yyvsp[(1) - (3)].sym)->data = (yyvsp[(3) - (3)].datalist);;} + {(yyvsp[-2].sym)->data = (yyvsp[0].datalist);} +#line 2550 "ncgen.tab.c" break; case 115: #line 802 "ncgen.y" - {(yyval.datalist) = (yyvsp[(1) - (1)].datalist);;} + {(yyval.datalist) = (yyvsp[0].datalist);} +#line 2556 "ncgen.tab.c" break; case 116: #line 803 "ncgen.y" - {(yyval.datalist) = (yyvsp[(1) - (1)].datalist);;} + {(yyval.datalist) = (yyvsp[0].datalist);} +#line 2562 "ncgen.tab.c" break; case 117: #line 807 "ncgen.y" - {(yyval.datalist) = builddatalist(0);;} + {(yyval.datalist) = builddatalist(0);} +#line 2568 "ncgen.tab.c" break; case 118: #line 811 "ncgen.y" - {(yyval.datalist) = const2list((yyvsp[(1) - (1)].constant));;} + {(yyval.datalist) = const2list((yyvsp[0].constant));} +#line 2574 "ncgen.tab.c" break; case 119: #line 813 "ncgen.y" - {dlappend((yyvsp[(1) - (3)].datalist),((yyvsp[(3) - (3)].constant))); (yyval.datalist)=(yyvsp[(1) - (3)].datalist); ;} + {dlappend((yyvsp[-2].datalist),((yyvsp[0].constant))); (yyval.datalist)=(yyvsp[-2].datalist); } +#line 2580 "ncgen.tab.c" break; case 120: #line 817 "ncgen.y" - {(yyval.constant)=(yyvsp[(1) - (1)].constant);;} + {(yyval.constant)=(yyvsp[0].constant);} +#line 2586 "ncgen.tab.c" break; case 121: #line 818 "ncgen.y" - {(yyval.constant)=builddatasublist((yyvsp[(2) - (3)].datalist));;} + {(yyval.constant)=builddatasublist((yyvsp[-1].datalist));} +#line 2592 "ncgen.tab.c" break; case 122: #line 822 "ncgen.y" - {(yyval.constant)=(yyvsp[(1) - (1)].constant);;} + {(yyval.constant)=(yyvsp[0].constant);} +#line 2598 "ncgen.tab.c" break; case 123: #line 823 "ncgen.y" - {(yyval.constant)=makeconstdata(NC_OPAQUE);;} + {(yyval.constant)=makeconstdata(NC_OPAQUE);} +#line 2604 "ncgen.tab.c" break; case 124: #line 824 "ncgen.y" - {(yyval.constant)=makeconstdata(NC_FILLVALUE);;} + {(yyval.constant)=makeconstdata(NC_FILLVALUE);} +#line 2610 "ncgen.tab.c" break; case 125: #line 825 "ncgen.y" - {(yyval.constant)=makeconstdata(NC_NIL);;} + {(yyval.constant)=makeconstdata(NC_NIL);} +#line 2616 "ncgen.tab.c" break; case 126: #line 826 "ncgen.y" - {(yyval.constant)=(yyvsp[(1) - (1)].constant);;} + {(yyval.constant)=(yyvsp[0].constant);} +#line 2622 "ncgen.tab.c" break; case 128: #line 831 "ncgen.y" - {(yyval.constant) = makeenumconstref((yyvsp[(1) - (1)].sym));;} + {(yyval.constant) = makeenumconstref((yyvsp[0].sym));} +#line 2628 "ncgen.tab.c" break; case 129: #line 835 "ncgen.y" - {(yyval.constant)=evaluate((yyvsp[(1) - (4)].sym),(yyvsp[(3) - (4)].datalist));;} + {(yyval.constant)=evaluate((yyvsp[-3].sym),(yyvsp[-1].datalist));} +#line 2634 "ncgen.tab.c" break; case 130: #line 840 "ncgen.y" - {(yyval.datalist) = const2list((yyvsp[(1) - (1)].constant));;} + {(yyval.datalist) = const2list((yyvsp[0].constant));} +#line 2640 "ncgen.tab.c" break; case 131: #line 842 "ncgen.y" - {dlappend((yyvsp[(1) - (3)].datalist),((yyvsp[(3) - (3)].constant))); (yyval.datalist)=(yyvsp[(1) - (3)].datalist);;} + {dlappend((yyvsp[-2].datalist),((yyvsp[0].constant))); (yyval.datalist)=(yyvsp[-2].datalist);} +#line 2646 "ncgen.tab.c" break; case 132: #line 846 "ncgen.y" - {(yyval.constant)=makeconstdata(NC_CHAR);;} + {(yyval.constant)=makeconstdata(NC_CHAR);} +#line 2652 "ncgen.tab.c" break; case 133: #line 847 "ncgen.y" - {(yyval.constant)=makeconstdata(NC_BYTE);;} + {(yyval.constant)=makeconstdata(NC_BYTE);} +#line 2658 "ncgen.tab.c" break; case 134: #line 848 "ncgen.y" - {(yyval.constant)=makeconstdata(NC_SHORT);;} + {(yyval.constant)=makeconstdata(NC_SHORT);} +#line 2664 "ncgen.tab.c" break; case 135: #line 849 "ncgen.y" - {(yyval.constant)=makeconstdata(NC_INT);;} + {(yyval.constant)=makeconstdata(NC_INT);} +#line 2670 "ncgen.tab.c" break; case 136: #line 850 "ncgen.y" - {(yyval.constant)=makeconstdata(NC_INT64);;} + {(yyval.constant)=makeconstdata(NC_INT64);} +#line 2676 "ncgen.tab.c" break; case 137: #line 851 "ncgen.y" - {(yyval.constant)=makeconstdata(NC_UBYTE);;} + {(yyval.constant)=makeconstdata(NC_UBYTE);} +#line 2682 "ncgen.tab.c" break; case 138: #line 852 "ncgen.y" - {(yyval.constant)=makeconstdata(NC_USHORT);;} + {(yyval.constant)=makeconstdata(NC_USHORT);} +#line 2688 "ncgen.tab.c" break; case 139: #line 853 "ncgen.y" - {(yyval.constant)=makeconstdata(NC_UINT);;} + {(yyval.constant)=makeconstdata(NC_UINT);} +#line 2694 "ncgen.tab.c" break; case 140: #line 854 "ncgen.y" - {(yyval.constant)=makeconstdata(NC_UINT64);;} + {(yyval.constant)=makeconstdata(NC_UINT64);} +#line 2700 "ncgen.tab.c" break; case 141: #line 855 "ncgen.y" - {(yyval.constant)=makeconstdata(NC_FLOAT);;} + {(yyval.constant)=makeconstdata(NC_FLOAT);} +#line 2706 "ncgen.tab.c" break; case 142: #line 856 "ncgen.y" - {(yyval.constant)=makeconstdata(NC_DOUBLE);;} + {(yyval.constant)=makeconstdata(NC_DOUBLE);} +#line 2712 "ncgen.tab.c" break; case 143: #line 857 "ncgen.y" - {(yyval.constant)=makeconstdata(NC_STRING);;} + {(yyval.constant)=makeconstdata(NC_STRING);} +#line 2718 "ncgen.tab.c" break; case 144: #line 861 "ncgen.y" - {(yyval.datalist) = const2list((yyvsp[(1) - (1)].constant));;} + {(yyval.datalist) = const2list((yyvsp[0].constant));} +#line 2724 "ncgen.tab.c" break; case 145: #line 862 "ncgen.y" - {(yyval.datalist)=(yyvsp[(1) - (3)].datalist); dlappend((yyvsp[(1) - (3)].datalist),((yyvsp[(3) - (3)].constant)));;} + {(yyval.datalist)=(yyvsp[-2].datalist); dlappend((yyvsp[-2].datalist),((yyvsp[0].constant)));} +#line 2730 "ncgen.tab.c" break; case 146: #line 867 "ncgen.y" - {(yyval.constant)=makeconstdata(NC_INT);;} + {(yyval.constant)=makeconstdata(NC_INT);} +#line 2736 "ncgen.tab.c" break; case 147: #line 869 "ncgen.y" - {(yyval.constant)=makeconstdata(NC_UINT);;} + {(yyval.constant)=makeconstdata(NC_UINT);} +#line 2742 "ncgen.tab.c" break; case 148: #line 871 "ncgen.y" - {(yyval.constant)=makeconstdata(NC_INT64);;} + {(yyval.constant)=makeconstdata(NC_INT64);} +#line 2748 "ncgen.tab.c" break; case 149: #line 873 "ncgen.y" - {(yyval.constant)=makeconstdata(NC_UINT64);;} + {(yyval.constant)=makeconstdata(NC_UINT64);} +#line 2754 "ncgen.tab.c" break; case 150: #line 877 "ncgen.y" - {(yyval.constant)=makeconstdata(NC_STRING);;} + {(yyval.constant)=makeconstdata(NC_STRING);} +#line 2760 "ncgen.tab.c" break; case 151: #line 881 "ncgen.y" - {(yyval.constant)=(yyvsp[(1) - (1)].constant);;} + {(yyval.constant)=(yyvsp[0].constant);} +#line 2766 "ncgen.tab.c" break; case 152: #line 882 "ncgen.y" - {(yyval.constant)=(yyvsp[(1) - (1)].constant);;} + {(yyval.constant)=(yyvsp[0].constant);} +#line 2772 "ncgen.tab.c" break; case 153: #line 888 "ncgen.y" - {(yyval.sym)=(yyvsp[(1) - (1)].sym);;} + {(yyval.sym)=(yyvsp[0].sym);} +#line 2778 "ncgen.tab.c" break; -/* Line 1267 of yacc.c. */ -#line 2777 "ncgeny.c" +#line 2782 "ncgen.tab.c" + default: break; } + /* User semantic actions sometimes alter yychar, and that requires + that yytoken be updated with the new translation. We take the + approach of translating immediately before every use of yytoken. + One alternative is translating here after every semantic action, + but that translation would be missed if the semantic action invokes + YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or + if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an + incorrect destructor might then be invoked immediately. In the + case of YYERROR or YYBACKUP, subsequent parser actions might lead + to an incorrect destructor call or verbose syntax error message + before the lookahead is translated. */ YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); YYPOPSTACK (yylen); @@ -2784,26 +2801,28 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[(1) - (3)].sym)->name); *++yyvsp = yyval; - - /* Now `shift' the result of the reduction. Determine what state + /* Now 'shift' the result of the reduction. Determine what state that goes to, based on the state we popped back to and the rule number reduced by. */ - - yyn = yyr1[yyn]; - - yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; - if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) - yystate = yytable[yystate]; - else - yystate = yydefgoto[yyn - YYNTOKENS]; + { + const int yylhs = yyr1[yyn] - YYNTOKENS; + const int yyi = yypgoto[yylhs] + *yyssp; + yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp + ? yytable[yyi] + : yydefgoto[yylhs]); + } goto yynewstate; -/*------------------------------------. -| yyerrlab -- here on detecting error | -`------------------------------------*/ +/*--------------------------------------. +| yyerrlab -- here on detecting error. | +`--------------------------------------*/ yyerrlab: + /* Make sure we have latest lookahead translation. See comments at + user semantic actions for why this is necessary. */ + yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar); + /* If not already recovering from an error, report this error. */ if (!yyerrstatus) { @@ -2811,37 +2830,36 @@ yyerrlab: #if ! YYERROR_VERBOSE yyerror (YY_("syntax error")); #else +# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \ + yyssp, yytoken) { - YYSIZE_T yysize = yysyntax_error (0, yystate, yychar); - if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM) - { - YYSIZE_T yyalloc = 2 * yysize; - if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM)) - yyalloc = YYSTACK_ALLOC_MAXIMUM; - if (yymsg != yymsgbuf) - YYSTACK_FREE (yymsg); - yymsg = (char *) YYSTACK_ALLOC (yyalloc); - if (yymsg) - yymsg_alloc = yyalloc; - else - { - yymsg = yymsgbuf; - yymsg_alloc = sizeof yymsgbuf; - } - } - - if (0 < yysize && yysize <= yymsg_alloc) - { - (void) yysyntax_error (yymsg, yystate, yychar); - yyerror (yymsg); - } - else - { - yyerror (YY_("syntax error")); - if (yysize != 0) - goto yyexhaustedlab; - } + char const *yymsgp = YY_("syntax error"); + int yysyntax_error_status; + yysyntax_error_status = YYSYNTAX_ERROR; + if (yysyntax_error_status == 0) + yymsgp = yymsg; + else if (yysyntax_error_status == 1) + { + if (yymsg != yymsgbuf) + YYSTACK_FREE (yymsg); + yymsg = YY_CAST (char *, YYSTACK_ALLOC (YY_CAST (YYSIZE_T, yymsg_alloc))); + if (!yymsg) + { + yymsg = yymsgbuf; + yymsg_alloc = sizeof yymsgbuf; + yysyntax_error_status = 2; + } + else + { + yysyntax_error_status = YYSYNTAX_ERROR; + yymsgp = yymsg; + } + } + yyerror (yymsgp); + if (yysyntax_error_status == 2) + goto yyexhaustedlab; } +# undef YYSYNTAX_ERROR #endif } @@ -2849,24 +2867,24 @@ yyerrlab: if (yyerrstatus == 3) { - /* If just tried and failed to reuse look-ahead token after an - error, discard it. */ + /* If just tried and failed to reuse lookahead token after an + error, discard it. */ if (yychar <= YYEOF) - { - /* Return failure if at end of input. */ - if (yychar == YYEOF) - YYABORT; - } + { + /* Return failure if at end of input. */ + if (yychar == YYEOF) + YYABORT; + } else - { - yydestruct ("Error: discarding", - yytoken, &yylval); - yychar = YYEMPTY; - } + { + yydestruct ("Error: discarding", + yytoken, &yylval); + yychar = YYEMPTY; + } } - /* Else will try to reuse look-ahead token after shifting the error + /* Else will try to reuse lookahead token after shifting the error token. */ goto yyerrlab1; @@ -2875,14 +2893,12 @@ yyerrlab: | yyerrorlab -- error raised explicitly by YYERROR. | `---------------------------------------------------*/ yyerrorlab: + /* Pacify compilers when the user code never invokes YYERROR and the + label yyerrorlab therefore never appears in user code. */ + if (0) + YYERROR; - /* Pacify compilers like GCC when the user code never invokes - YYERROR and the label yyerrorlab therefore never appears in user - code. */ - if (/*CONSTCOND*/ 0) - goto yyerrorlab; - - /* Do not reclaim the symbols of the rule which action triggered + /* Do not reclaim the symbols of the rule whose action triggered this YYERROR. */ YYPOPSTACK (yylen); yylen = 0; @@ -2895,38 +2911,37 @@ yyerrorlab: | yyerrlab1 -- common code for both syntax error and YYERROR. | `-------------------------------------------------------------*/ yyerrlab1: - yyerrstatus = 3; /* Each real token shifted decrements this. */ + yyerrstatus = 3; /* Each real token shifted decrements this. */ for (;;) { yyn = yypact[yystate]; - if (yyn != YYPACT_NINF) - { - yyn += YYTERROR; - if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) - { - yyn = yytable[yyn]; - if (0 < yyn) - break; - } - } + if (!yypact_value_is_default (yyn)) + { + yyn += YYTERROR; + if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) + { + yyn = yytable[yyn]; + if (0 < yyn) + break; + } + } /* Pop the current state because it cannot handle the error token. */ if (yyssp == yyss) - YYABORT; + YYABORT; yydestruct ("Error: popping", - yystos[yystate], yyvsp); + yystos[yystate], yyvsp); YYPOPSTACK (1); yystate = *yyssp; YY_STACK_PRINT (yyss, yyssp); } - if (yyn == YYFINAL) - YYACCEPT; - + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN *++yyvsp = yylval; + YY_IGNORE_MAYBE_UNINITIALIZED_END /* Shift the error token. */ @@ -2943,6 +2958,7 @@ yyacceptlab: yyresult = 0; goto yyreturn; + /*-----------------------------------. | yyabortlab -- YYABORT comes here. | `-----------------------------------*/ @@ -2950,7 +2966,8 @@ yyabortlab: yyresult = 1; goto yyreturn; -#ifndef yyoverflow + +#if !defined yyoverflow || YYERROR_VERBOSE /*-------------------------------------------------. | yyexhaustedlab -- memory exhaustion comes here. | `-------------------------------------------------*/ @@ -2960,18 +2977,27 @@ yyexhaustedlab: /* Fall through. */ #endif + +/*-----------------------------------------------------. +| yyreturn -- parsing is finished, return the result. | +`-----------------------------------------------------*/ yyreturn: - if (yychar != YYEOF && yychar != YYEMPTY) - yydestruct ("Cleanup: discarding lookahead", - yytoken, &yylval); - /* Do not reclaim the symbols of the rule which action triggered + if (yychar != YYEMPTY) + { + /* Make sure we have latest lookahead translation. See comments at + user semantic actions for why this is necessary. */ + yytoken = YYTRANSLATE (yychar); + yydestruct ("Cleanup: discarding lookahead", + yytoken, &yylval); + } + /* Do not reclaim the symbols of the rule whose action triggered this YYABORT or YYACCEPT. */ YYPOPSTACK (yylen); YY_STACK_PRINT (yyss, yyssp); while (yyssp != yyss) { yydestruct ("Cleanup: popping", - yystos[*yyssp], yyvsp); + yystos[+*yyssp], yyvsp); YYPOPSTACK (1); } #ifndef yyoverflow @@ -2982,11 +3008,8 @@ yyreturn: if (yymsg != yymsgbuf) YYSTACK_FREE (yymsg); #endif - /* Make sure YYID is used. */ - return YYID (yyresult); + return yyresult; } - - #line 891 "ncgen.y" @@ -3694,4 +3717,3 @@ printfilters(int nfilters, NC_Filterspec** filters) fflush(stderr); } #endif - diff --git a/ncgen/ncgeny.h b/ncgen/ncgeny.h index 9f092f330..c88770ec9 100644 --- a/ncgen/ncgeny.h +++ b/ncgen/ncgeny.h @@ -1,14 +1,14 @@ -/* A Bison parser, made by GNU Bison 2.3. */ +/* A Bison parser, made by GNU Bison 3.5.1. */ -/* Skeleton interface for Bison's Yacc-like parsers in C +/* Bison interface for Yacc-like parsers in C - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 - Free Software Foundation, Inc. + Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2020 Free Software Foundation, + Inc. - This program is free software; you can redistribute it and/or modify + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -16,9 +16,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. */ + along with this program. If not, see . */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work @@ -33,143 +31,104 @@ This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ -/* Tokens. */ +/* Undocumented macros, especially those whose name start with YY_, + are private implementation details. Do not rely on them. */ + +#ifndef YY_NCG_NCGEN_TAB_H_INCLUDED +# define YY_NCG_NCGEN_TAB_H_INCLUDED +/* Debug traces. */ +#ifndef YYDEBUG +# define YYDEBUG 1 +#endif +#if YYDEBUG +extern int ncgdebug; +#endif + +/* Token type. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE - /* Put the tokens into the symbol table, so that GDB and other debuggers - know about them. */ - enum yytokentype { - NC_UNLIMITED_K = 258, - CHAR_K = 259, - BYTE_K = 260, - SHORT_K = 261, - INT_K = 262, - FLOAT_K = 263, - DOUBLE_K = 264, - UBYTE_K = 265, - USHORT_K = 266, - UINT_K = 267, - INT64_K = 268, - UINT64_K = 269, - STRING_K = 270, - IDENT = 271, - TERMSTRING = 272, - CHAR_CONST = 273, - BYTE_CONST = 274, - SHORT_CONST = 275, - INT_CONST = 276, - INT64_CONST = 277, - UBYTE_CONST = 278, - USHORT_CONST = 279, - UINT_CONST = 280, - UINT64_CONST = 281, - FLOAT_CONST = 282, - DOUBLE_CONST = 283, - DIMENSIONS = 284, - VARIABLES = 285, - NETCDF = 286, - DATA = 287, - TYPES = 288, - COMPOUND = 289, - ENUM = 290, - OPAQUE_ = 291, - OPAQUESTRING = 292, - GROUP = 293, - PATH = 294, - FILLMARKER = 295, - NIL = 296, - _FILLVALUE = 297, - _FORMAT = 298, - _STORAGE = 299, - _CHUNKSIZES = 300, - _DEFLATELEVEL = 301, - _SHUFFLE = 302, - _ENDIANNESS = 303, - _NOFILL = 304, - _FLETCHER32 = 305, - _NCPROPS = 306, - _ISNETCDF4 = 307, - _SUPERBLOCK = 308, - _FILTER = 309, - DATASETID = 310 - }; + enum yytokentype + { + NC_UNLIMITED_K = 258, + CHAR_K = 259, + BYTE_K = 260, + SHORT_K = 261, + INT_K = 262, + FLOAT_K = 263, + DOUBLE_K = 264, + UBYTE_K = 265, + USHORT_K = 266, + UINT_K = 267, + INT64_K = 268, + UINT64_K = 269, + STRING_K = 270, + IDENT = 271, + TERMSTRING = 272, + CHAR_CONST = 273, + BYTE_CONST = 274, + SHORT_CONST = 275, + INT_CONST = 276, + INT64_CONST = 277, + UBYTE_CONST = 278, + USHORT_CONST = 279, + UINT_CONST = 280, + UINT64_CONST = 281, + FLOAT_CONST = 282, + DOUBLE_CONST = 283, + DIMENSIONS = 284, + VARIABLES = 285, + NETCDF = 286, + DATA = 287, + TYPES = 288, + COMPOUND = 289, + ENUM = 290, + OPAQUE_ = 291, + OPAQUESTRING = 292, + GROUP = 293, + PATH = 294, + FILLMARKER = 295, + NIL = 296, + _FILLVALUE = 297, + _FORMAT = 298, + _STORAGE = 299, + _CHUNKSIZES = 300, + _DEFLATELEVEL = 301, + _SHUFFLE = 302, + _ENDIANNESS = 303, + _NOFILL = 304, + _FLETCHER32 = 305, + _NCPROPS = 306, + _ISNETCDF4 = 307, + _SUPERBLOCK = 308, + _FILTER = 309, + DATASETID = 310 + }; #endif -/* Tokens. */ -#define NC_UNLIMITED_K 258 -#define CHAR_K 259 -#define BYTE_K 260 -#define SHORT_K 261 -#define INT_K 262 -#define FLOAT_K 263 -#define DOUBLE_K 264 -#define UBYTE_K 265 -#define USHORT_K 266 -#define UINT_K 267 -#define INT64_K 268 -#define UINT64_K 269 -#define STRING_K 270 -#define IDENT 271 -#define TERMSTRING 272 -#define CHAR_CONST 273 -#define BYTE_CONST 274 -#define SHORT_CONST 275 -#define INT_CONST 276 -#define INT64_CONST 277 -#define UBYTE_CONST 278 -#define USHORT_CONST 279 -#define UINT_CONST 280 -#define UINT64_CONST 281 -#define FLOAT_CONST 282 -#define DOUBLE_CONST 283 -#define DIMENSIONS 284 -#define VARIABLES 285 -#define NETCDF 286 -#define DATA 287 -#define TYPES 288 -#define COMPOUND 289 -#define ENUM 290 -#define OPAQUE_ 291 -#define OPAQUESTRING 292 -#define GROUP 293 -#define PATH 294 -#define FILLMARKER 295 -#define NIL 296 -#define _FILLVALUE 297 -#define _FORMAT 298 -#define _STORAGE 299 -#define _CHUNKSIZES 300 -#define _DEFLATELEVEL 301 -#define _SHUFFLE 302 -#define _ENDIANNESS 303 -#define _NOFILL 304 -#define _FLETCHER32 305 -#define _NCPROPS 306 -#define _ISNETCDF4 307 -#define _SUPERBLOCK 308 -#define _FILTER 309 -#define DATASETID 310 - - - +/* Value type. */ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED -typedef union YYSTYPE -#line 151 "ncgen.y" +union YYSTYPE { +#line 151 "ncgen.y" + Symbol* sym; unsigned long size; /* allow for zero size to indicate e.g. UNLIMITED*/ long mark; /* track indices into the sequence*/ int nctype; /* for tracking attribute list type*/ Datalist* datalist; NCConstant* constant; -} -/* Line 1529 of yacc.c. */ -#line 168 "ncgeny.h" - YYSTYPE; -# define yystype YYSTYPE /* obsolescent; will be withdrawn */ -# define YYSTYPE_IS_DECLARED 1 + +#line 122 "ncgen.tab.h" + +}; +typedef union YYSTYPE YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 +# define YYSTYPE_IS_DECLARED 1 #endif + extern YYSTYPE ncglval; +int ncgparse (void); + +#endif /* !YY_NCG_NCGEN_TAB_H_INCLUDED */