diff options
author | Nicolas Williams <nico@cryptonector.com> | 2019-03-21 23:58:55 -0500 |
---|---|---|
committer | Nicolas Williams <nico@cryptonector.com> | 2019-03-24 23:19:09 -0500 |
commit | c72ed135e4f1b5a02a8fb3f6cd46f27513ecab2a (patch) | |
tree | 018922dcd6b5ee3671e8a7f710c06f361c3f4378 | |
parent | 3ea0199e031e98e92670a25e4323bd711005b5db (diff) |
Allow keywords in more places (fix #1868)
-rw-r--r-- | src/lexer.c | 774 | ||||
-rw-r--r-- | src/lexer.h | 495 | ||||
-rw-r--r-- | src/parser.c | 1989 | ||||
-rw-r--r-- | src/parser.h | 12 | ||||
-rw-r--r-- | src/parser.y | 26 | ||||
-rw-r--r-- | tests/jq.test | 11 |
6 files changed, 1985 insertions, 1322 deletions
diff --git a/src/lexer.c b/src/lexer.c index b9baf3ab..cd2012f1 100644 --- a/src/lexer.c +++ b/src/lexer.c @@ -9,11 +9,245 @@ #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 #define YY_FLEX_MINOR_VERSION 6 -#define YY_FLEX_SUBMINOR_VERSION 0 +#define YY_FLEX_SUBMINOR_VERSION 4 #if YY_FLEX_SUBMINOR_VERSION > 0 #define FLEX_BETA #endif +#ifdef yy_create_buffer +#define jq_yy_create_buffer_ALREADY_DEFINED +#else +#define yy_create_buffer jq_yy_create_buffer +#endif + +#ifdef yy_delete_buffer +#define jq_yy_delete_buffer_ALREADY_DEFINED +#else +#define yy_delete_buffer jq_yy_delete_buffer +#endif + +#ifdef yy_scan_buffer +#define jq_yy_scan_buffer_ALREADY_DEFINED +#else +#define yy_scan_buffer jq_yy_scan_buffer +#endif + +#ifdef yy_scan_string +#define jq_yy_scan_string_ALREADY_DEFINED +#else +#define yy_scan_string jq_yy_scan_string +#endif + +#ifdef yy_scan_bytes +#define jq_yy_scan_bytes_ALREADY_DEFINED +#else +#define yy_scan_bytes jq_yy_scan_bytes +#endif + +#ifdef yy_init_buffer +#define jq_yy_init_buffer_ALREADY_DEFINED +#else +#define yy_init_buffer jq_yy_init_buffer +#endif + +#ifdef yy_flush_buffer +#define jq_yy_flush_buffer_ALREADY_DEFINED +#else +#define yy_flush_buffer jq_yy_flush_buffer +#endif + +#ifdef yy_load_buffer_state +#define jq_yy_load_buffer_state_ALREADY_DEFINED +#else +#define yy_load_buffer_state jq_yy_load_buffer_state +#endif + +#ifdef yy_switch_to_buffer +#define jq_yy_switch_to_buffer_ALREADY_DEFINED +#else +#define yy_switch_to_buffer jq_yy_switch_to_buffer +#endif + +#ifdef yypush_buffer_state +#define jq_yypush_buffer_state_ALREADY_DEFINED +#else +#define yypush_buffer_state jq_yypush_buffer_state +#endif + +#ifdef yypop_buffer_state +#define jq_yypop_buffer_state_ALREADY_DEFINED +#else +#define yypop_buffer_state jq_yypop_buffer_state +#endif + +#ifdef yyensure_buffer_stack +#define jq_yyensure_buffer_stack_ALREADY_DEFINED +#else +#define yyensure_buffer_stack jq_yyensure_buffer_stack +#endif + +#ifdef yylex +#define jq_yylex_ALREADY_DEFINED +#else +#define yylex jq_yylex +#endif + +#ifdef yyrestart +#define jq_yyrestart_ALREADY_DEFINED +#else +#define yyrestart jq_yyrestart +#endif + +#ifdef yylex_init +#define jq_yylex_init_ALREADY_DEFINED +#else +#define yylex_init jq_yylex_init +#endif + +#ifdef yylex_init_extra +#define jq_yylex_init_extra_ALREADY_DEFINED +#else +#define yylex_init_extra jq_yylex_init_extra +#endif + +#ifdef yylex_destroy +#define jq_yylex_destroy_ALREADY_DEFINED +#else +#define yylex_destroy jq_yylex_destroy +#endif + +#ifdef yyget_debug +#define jq_yyget_debug_ALREADY_DEFINED +#else +#define yyget_debug jq_yyget_debug +#endif + +#ifdef yyset_debug +#define jq_yyset_debug_ALREADY_DEFINED +#else +#define yyset_debug jq_yyset_debug +#endif + +#ifdef yyget_extra +#define jq_yyget_extra_ALREADY_DEFINED +#else +#define yyget_extra jq_yyget_extra +#endif + +#ifdef yyset_extra +#define jq_yyset_extra_ALREADY_DEFINED +#else +#define yyset_extra jq_yyset_extra +#endif + +#ifdef yyget_in +#define jq_yyget_in_ALREADY_DEFINED +#else +#define yyget_in jq_yyget_in +#endif + +#ifdef yyset_in +#define jq_yyset_in_ALREADY_DEFINED +#else +#define yyset_in jq_yyset_in +#endif + +#ifdef yyget_out +#define jq_yyget_out_ALREADY_DEFINED +#else +#define yyget_out jq_yyget_out +#endif + +#ifdef yyset_out +#define jq_yyset_out_ALREADY_DEFINED +#else +#define yyset_out jq_yyset_out +#endif + +#ifdef yyget_leng +#define jq_yyget_leng_ALREADY_DEFINED +#else +#define yyget_leng jq_yyget_leng +#endif + +#ifdef yyget_text +#define jq_yyget_text_ALREADY_DEFINED +#else +#define yyget_text jq_yyget_text +#endif + +#ifdef yyget_lineno +#define jq_yyget_lineno_ALREADY_DEFINED +#else +#define yyget_lineno jq_yyget_lineno +#endif + +#ifdef yyset_lineno +#define jq_yyset_lineno_ALREADY_DEFINED +#else +#define yyset_lineno jq_yyset_lineno +#endif + +#ifdef yyget_column +#define jq_yyget_column_ALREADY_DEFINED +#else +#define yyget_column jq_yyget_column +#endif + +#ifdef yyset_column +#define jq_yyset_column_ALREADY_DEFINED +#else +#define yyset_column jq_yyset_column +#endif + +#ifdef yywrap +#define jq_yywrap_ALREADY_DEFINED +#else +#define yywrap jq_yywrap +#endif + +#ifdef yyget_lval +#define jq_yyget_lval_ALREADY_DEFINED +#else +#define yyget_lval jq_yyget_lval +#endif + +#ifdef yyset_lval +#define jq_yyset_lval_ALREADY_DEFINED +#else +#define yyset_lval jq_yyset_lval +#endif + +#ifdef yyget_lloc +#define jq_yyget_lloc_ALREADY_DEFINED +#else +#define yyget_lloc jq_yyget_lloc +#endif + +#ifdef yyset_lloc +#define jq_yyset_lloc_ALREADY_DEFINED +#else +#define yyset_lloc jq_yyset_lloc +#endif + +#ifdef yyalloc +#define jq_yyalloc_ALREADY_DEFINED +#else +#define yyalloc jq_yyalloc +#endif + +#ifdef yyrealloc +#define jq_yyrealloc_ALREADY_DEFINED +#else +#define yyrealloc jq_yyrealloc +#endif + +#ifdef yyfree +#define jq_yyfree_ALREADY_DEFINED +#else +#define yyfree jq_yyfree +#endif + /* First, we deal with platform-specific or compiler-specific issues. */ /* begin standard C headers. */ @@ -84,40 +318,32 @@ 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 - -/* 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 +/* begin standard C++ headers. */ -#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)) /* An opaque pointer. */ #ifndef YY_TYPEDEF_YY_SCANNER_T @@ -141,20 +367,16 @@ typedef void* yyscan_t; * definition of BEGIN. */ #define BEGIN yyg->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 ((yyg->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 jq_yyrestart(yyin ,yyscanner ) - +#define YY_NEW_FILE yyrestart( yyin , yyscanner ) #define YY_END_OF_BUFFER_CHAR 0 /* Size of default input buffer. */ @@ -187,7 +409,7 @@ typedef size_t yy_size_t; #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) @@ -204,7 +426,6 @@ typedef size_t yy_size_t; YY_DO_BEFORE_ACTION; /* set up yytext again */ \ } \ while ( 0 ) - #define unput(c) yyunput( c, yyg->yytext_ptr , yyscanner ) #ifndef YY_STRUCT_YY_BUFFER_STATE @@ -219,7 +440,7 @@ 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. @@ -247,7 +468,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. */ @@ -264,7 +485,7 @@ struct yy_buffer_state * possible backing-up. * * When we actually see the EOF, we change the status to "new" - * (via jq_yyrestart()), so that the user can continue scanning by + * (via yyrestart()), so that the user can continue scanning by * just pointing yyin at a new input file. */ #define YY_BUFFER_EOF_PENDING 2 @@ -281,87 +502,77 @@ struct yy_buffer_state #define YY_CURRENT_BUFFER ( yyg->yy_buffer_stack \ ? yyg->yy_buffer_stack[yyg->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 yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] -void jq_yyrestart (FILE *input_file ,yyscan_t yyscanner ); -void jq_yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner ); -YY_BUFFER_STATE jq_yy_create_buffer (FILE *file,int size ,yyscan_t yyscanner ); -void jq_yy_delete_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner ); -void jq_yy_flush_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner ); -void jq_yypush_buffer_state (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner ); -void jq_yypop_buffer_state (yyscan_t yyscanner ); - -static void jq_yyensure_buffer_stack (yyscan_t yyscanner ); -static void jq_yy_load_buffer_state (yyscan_t yyscanner ); -static void jq_yy_init_buffer (YY_BUFFER_STATE b,FILE *file ,yyscan_t yyscanner ); +void yyrestart ( FILE *input_file , yyscan_t yyscanner ); +void yy_switch_to_buffer ( YY_BUFFER_STATE new_buffer , yyscan_t yyscanner ); +YY_BUFFER_STATE yy_create_buffer ( FILE *file, int size , yyscan_t yyscanner ); +void yy_delete_buffer ( YY_BUFFER_STATE b , yyscan_t yyscanner ); +void yy_flush_buffer ( YY_BUFFER_STATE b , yyscan_t yyscanner ); +void yypush_buffer_state ( YY_BUFFER_STATE new_buffer , yyscan_t yyscanner ); +void yypop_buffer_state ( yyscan_t yyscanner ); -#define YY_FLUSH_BUFFER jq_yy_flush_buffer(YY_CURRENT_BUFFER ,yyscanner) +static void yyensure_buffer_stack ( yyscan_t yyscanner ); +static void yy_load_buffer_state ( yyscan_t yyscanner ); +static void yy_init_buffer ( YY_BUFFER_STATE b, FILE *file , yyscan_t yyscanner ); +#define YY_FLUSH_BUFFER yy_flush_buffer( YY_CURRENT_BUFFER , yyscanner) -YY_BUFFER_STATE jq_yy_scan_buffer (char *base,yy_size_t size ,yyscan_t yyscanner ); -YY_BUFFER_STATE jq_yy_scan_string (yyconst char *yy_str ,yyscan_t yyscanner ); -YY_BUFFER_STATE jq_yy_scan_bytes (yyconst char *bytes,yy_size_t len ,yyscan_t yyscanner ); +YY_BUFFER_STATE yy_scan_buffer ( char *base, yy_size_t size , yyscan_t yyscanner ); +YY_BUFFER_STATE yy_scan_string ( const char *yy_str , yyscan_t yyscanner ); +YY_BUFFER_STATE yy_scan_bytes ( const char *bytes, int len , yyscan_t yyscanner ); -void *jq_yyalloc (yy_size_t ,yyscan_t yyscanner ); -void *jq_yyrealloc (void *,yy_size_t ,yyscan_t yyscanner ); -void jq_yyfree (void * ,yyscan_t yyscanner ); - -#define yy_new_buffer jq_yy_create_buffer +void *yyalloc ( yy_size_t , yyscan_t yyscanner ); +void *yyrealloc ( void *, yy_size_t , yyscan_t yyscanner ); +void yyfree ( void * , yyscan_t yyscanner ); +#define yy_new_buffer yy_create_buffer #define yy_set_interactive(is_interactive) \ { \ if ( ! YY_CURRENT_BUFFER ){ \ - jq_yyensure_buffer_stack (yyscanner); \ + yyensure_buffer_stack (yyscanner); \ YY_CURRENT_BUFFER_LVALUE = \ - jq_yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \ + yy_create_buffer( yyin, YY_BUF_SIZE , yyscanner); \ } \ YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ } - #define yy_set_bol(at_bol) \ { \ if ( ! YY_CURRENT_BUFFER ){\ - jq_yyensure_buffer_stack (yyscanner); \ + yyensure_buffer_stack (yyscanner); \ YY_CURRENT_BUFFER_LVALUE = \ - jq_yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \ + yy_create_buffer( yyin, YY_BUF_SIZE , yyscanner); \ } \ YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ } - #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) /* Begin user sect3 */ #define jq_yywrap(yyscanner) (/*CONSTCOND*/1) #define YY_SKIP_YYWRAP - -typedef unsigned char YY_CHAR; +typedef flex_uint8_t YY_CHAR; typedef int yy_state_type; #define yytext_ptr yytext_r -static yy_state_type yy_get_previous_state (yyscan_t yyscanner ); -static yy_state_type yy_try_NUL_trans (yy_state_type current_state ,yyscan_t yyscanner); -static int yy_get_next_buffer (yyscan_t yyscanner ); -#if defined(__GNUC__) && __GNUC__ >= 3 -__attribute__((__noreturn__)) -#endif -static void yy_fatal_error (yyconst char msg[] ,yyscan_t yyscanner ); +static yy_state_type yy_get_previous_state ( yyscan_t yyscanner ); +static yy_state_type yy_try_NUL_trans ( yy_state_type current_state , yyscan_t yyscanner); +static int yy_get_next_buffer ( yyscan_t yyscanner ); +static void yynoreturn yy_fatal_error ( const char* msg , yyscan_t yyscanner ); /* Done after the current pattern has been matched and before the * corresponding action - sets up yytext. */ #define YY_DO_BEFORE_ACTION \ yyg->yytext_ptr = yy_bp; \ - yyleng = (size_t) (yy_cp - yy_bp); \ + yyleng = (int) (yy_cp - yy_bp); \ yyg->yy_hold_char = *yy_cp; \ *yy_cp = '\0'; \ yyg->yy_c_buf_p = yy_cp; - #define YY_NUM_RULES 50 #define YY_END_OF_BUFFER 51 /* This struct is not used in this scanner, @@ -371,7 +582,7 @@ struct yy_trans_info flex_int32_t yy_verify; flex_int32_t yy_nxt; }; -static yyconst flex_int16_t yy_accept[157] = +static const flex_int16_t yy_accept[157] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 51, 49, 48, 48, 49, 40, 1, 35, @@ -392,7 +603,7 @@ static yyconst flex_int16_t yy_accept[157] = 7, 16, 23, 17, 6, 0 } ; -static yyconst YY_CHAR yy_ec[256] = +static const YY_CHAR yy_ec[256] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 1, 1, 4, 1, 1, 1, 1, 1, 1, 1, @@ -424,7 +635,7 @@ static yyconst YY_CHAR yy_ec[256] = 1, 1, 1, 1, 1 } ; -static yyconst YY_CHAR yy_meta[54] = +static const YY_CHAR yy_meta[54] = { 0, 1, 1, 2, 2, 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 4, 1, 5, 6, 1, @@ -434,7 +645,7 @@ static yyconst YY_CHAR yy_meta[54] = 1, 1, 1 } ; -static yyconst flex_uint16_t yy_base[170] = +static const flex_int16_t yy_base[170] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 51, 52, 320, 321, 57, 59, 297, 321, 0, 321, @@ -456,7 +667,7 @@ static yyconst flex_uint16_t yy_base[170] = 255, 264, 273, 278, 283, 285, 290, 294, 298 } ; -static yyconst flex_int16_t yy_def[170] = +static const flex_int16_t yy_def[170] = { 0, 156, 1, 1, 1, 1, 1, 1, 1, 1, 1, 157, 157, 156, 156, 156, 156, 156, 156, 158, 156, @@ -478,7 +689,7 @@ static yyconst flex_int16_t yy_def[170] = 156, 156, 156, 156, 156, 156, 156, 156, 156 } ; -static yyconst flex_uint16_t yy_nxt[375] = +static const flex_int16_t yy_nxt[375] = { 0, 14, 15, 16, 14, 17, 18, 19, 20, 21, 22, 23, 24, 25, 20, 26, 27, 28, 29, 20, 20, @@ -523,7 +734,7 @@ static yyconst flex_uint16_t yy_nxt[375] = 156, 156, 156, 156 } ; -static yyconst flex_int16_t yy_chk[375] = +static const flex_int16_t yy_chk[375] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -587,21 +798,19 @@ struct lexer_param; #define YY_USER_ACTION \ do { \ - yylloc->start = jq_yyget_extra(yyscanner); \ + yylloc->start = yyget_extra(yyscanner); \ yylloc->end = yylloc->start + yyleng; \ - jq_yyset_extra(yylloc->end,yyscanner); \ + yyset_extra(yylloc->end, yyscanner); \ } while (0); - - - - +#line 807 "src/lexer.c" #line 25 "src/lexer.l" static int enter(int opening, int state, yyscan_t yyscanner); static int try_exit(int closing, int state, yyscan_t yyscanner); +#line 812 "src/lexer.c" #define YY_NO_INPUT 1 -#line 605 "src/lexer.c" +#line 814 "src/lexer.c" #define INITIAL 0 #define IN_PAREN 1 @@ -634,7 +843,7 @@ struct yyguts_t YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */ char yy_hold_char; int yy_n_chars; - yy_size_t yyleng_r; + int yyleng_r; char *yy_c_buf_p; int yy_init; int yy_start; @@ -658,7 +867,7 @@ struct yyguts_t }; /* end struct yyguts_t */ -static int yy_init_globals (yyscan_t yyscanner ); +static int yy_init_globals ( yyscan_t yyscanner ); /* This must go here because YYSTYPE and YYLTYPE are included * from bison output in section 1.*/ @@ -666,50 +875,50 @@ static int yy_init_globals (yyscan_t yyscanner ); # define yylloc yyg->yylloc_r -int jq_yylex_init (yyscan_t* scanner); +int yylex_init (yyscan_t* scanner); -int jq_yylex_init_extra (YY_EXTRA_TYPE user_defined,yyscan_t* scanner); +int yylex_init_extra ( YY_EXTRA_TYPE user_defined, yyscan_t* scanner); /* Accessor methods to globals. These are made visible to non-reentrant scanners for convenience. */ -int jq_yylex_destroy (yyscan_t yyscanner ); +int yylex_destroy ( yyscan_t yyscanner ); -int jq_yyget_debug (yyscan_t yyscanner ); +int yyget_debug ( yyscan_t yyscanner ); -void jq_yyset_debug (int debug_flag ,yyscan_t yyscanner ); +void yyset_debug ( int debug_flag , yyscan_t yyscanner ); -YY_EXTRA_TYPE jq_yyget_extra (yyscan_t yyscanner ); +YY_EXTRA_TYPE yyget_extra ( yyscan_t yyscanner ); -void jq_yyset_extra (YY_EXTRA_TYPE user_defined ,yyscan_t yyscanner ); +void yyset_extra ( YY_EXTRA_TYPE user_defined , yyscan_t yyscanner ); -FILE *jq_yyget_in (yyscan_t yyscanner ); +FILE *yyget_in ( yyscan_t yyscanner ); -void jq_yyset_in (FILE * _in_str ,yyscan_t yyscanner ); +void yyset_in ( FILE * _in_str , yyscan_t yyscanner ); -FILE *jq_yyget_out (yyscan_t yyscanner ); +FILE *yyget_out ( yyscan_t yyscanner ); -void jq_yyset_out (FILE * _out_str ,yyscan_t yyscanner ); +void yyset_out ( FILE * _out_str , yyscan_t yyscanner ); -yy_size_t jq_yyget_leng (yyscan_t yyscanner ); + int yyget_leng ( yyscan_t yyscanner ); -char *jq_yyget_text (yyscan_t yyscanner ); +char *yyget_text ( yyscan_t yyscanner ); -int jq_yyget_lineno (yyscan_t yyscanner ); +int yyget_lineno ( yyscan_t yyscanner ); -void jq_yyset_lineno (int _line_number ,yyscan_t yyscanner ); +void yyset_lineno ( int _line_number , yyscan_t yyscanner ); -int jq_yyget_column (yyscan_t yyscanner ); +int yyget_column ( yyscan_t yyscanner ); -void jq_yyset_column (int _column_no ,yyscan_t yyscanner ); +void yyset_column ( int _column_no , yyscan_t yyscanner ); -YYSTYPE * jq_yyget_lval (yyscan_t yyscanner ); +YYSTYPE * yyget_lval ( yyscan_t yyscanner ); -void jq_yyset_lval (YYSTYPE * yylval_param ,yyscan_t yyscanner ); +void yyset_lval ( YYSTYPE * yylval_param , yyscan_t yyscanner ); - YYLTYPE *jq_yyget_lloc (yyscan_t yyscanner ); + YYLTYPE *yyget_lloc ( yyscan_t yyscanner ); - void jq_yyset_lloc (YYLTYPE * yylloc_param ,yyscan_t yyscanner ); + void yyset_lloc ( YYLTYPE * yylloc_param , yyscan_t yyscanner ); /* Macros after this point can all be overridden by user definitions in * section 1. @@ -717,9 +926,9 @@ void jq_yyset_lval (YYSTYPE * yylval_param ,yyscan_t yyscanner ); #ifndef YY_SKIP_YYWRAP #ifdef __cplusplus -extern "C" int jq_yywrap (yyscan_t yyscanner ); +extern "C" int yywrap ( yyscan_t yyscanner ); #else -extern int jq_yywrap (yyscan_t yyscanner ); +extern int yywrap ( yyscan_t yyscanner ); #endif #endif @@ -728,28 +937,27 @@ extern int jq_yywrap (yyscan_t yyscanner ); #endif #ifndef yytext_ptr -static void yy_flex_strncpy (char *,yyconst char *,int ,yyscan_t yyscanner); +static void yy_flex_strncpy ( char *, const char *, int , yyscan_t yyscanner); #endif #ifdef YY_NEED_STRLEN -static int yy_flex_strlen (yyconst char * ,yyscan_t yyscanner); +static int yy_flex_strlen ( const char * , yyscan_t yyscanner); #endif #ifndef YY_NO_INPUT - #ifdef __cplusplus -static int yyinput (yyscan_t yyscanner ); +static int yyinput ( yyscan_t yyscanner ); #else -static int input (yyscan_t yyscanner ); +static int input ( yyscan_t yyscanner ); #endif #endif - static void yy_push_state (int _new_state ,yyscan_t yyscanner); + static void yy_push_state ( int _new_state , yyscan_t yyscanner); - static void yy_pop_state (yyscan_t yyscanner ); + static void yy_pop_state ( yyscan_t yyscanner ); - static int yy_top_state (yyscan_t yyscanner ); + static int yy_top_state ( yyscan_t yyscanner ); /* Amount of stuff to slurp up with each read. */ #ifndef YY_READ_BUF_SIZE @@ -766,7 +974,7 @@ static int input (yyscan_t yyscanner ); /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */ -#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0) +#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, @@ -777,7 +985,7 @@ static int input (yyscan_t yyscanner ); if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ { \ int c = '*'; \ - size_t n; \ + int n; \ for ( n = 0; n < max_size && \ (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ buf[n] = (char) c; \ @@ -790,7 +998,7 @@ static int input (yyscan_t yyscanner ); else \ { \ errno=0; \ - while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \ + while ( (result = (int) fread(buf, 1, (yy_size_t) max_size, yyin)) == 0 && ferror(yyin)) \ { \ if( errno != EINTR) \ { \ @@ -831,10 +1039,10 @@ static int input (yyscan_t yyscanner ); #ifndef YY_DECL #define YY_DECL_IS_OURS 1 -extern int jq_yylex \ - (YYSTYPE * yylval_param,YYLTYPE * yylloc_param ,yyscan_t yyscanner); +extern int yylex \ + (YYSTYPE * yylval_param, YYLTYPE * yylloc_param , yyscan_t yyscanner); -#define YY_DECL int jq_yylex \ +#define YY_DECL int yylex \ (YYSTYPE * yylval_param, YYLTYPE * yylloc_param , yyscan_t yyscanner) #endif /* !YY_DECL */ @@ -884,19 +1092,19 @@ YY_DECL yyout = stdout; if ( ! YY_CURRENT_BUFFER ) { - jq_yyensure_buffer_stack (yyscanner); + yyensure_buffer_stack (yyscanner); YY_CURRENT_BUFFER_LVALUE = - jq_yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); + yy_create_buffer( yyin, YY_BUF_SIZE , yyscanner); } - jq_yy_load_buffer_state(yyscanner ); + yy_load_buffer_state( yyscanner ); } { #line 38 "src/lexer.l" -#line 900 "src/lexer.c" +#line 1108 "src/lexer.c" while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */ { @@ -924,9 +1132,9 @@ yy_match: { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 157 ) - 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] != 321 ); @@ -1235,7 +1443,7 @@ YY_RULE_SETUP #line 130 "src/lexer.l" YY_FATAL_ERROR( "flex scanner jammed" ); YY_BREAK -#line 1239 "src/lexer.c" +#line 1447 "src/lexer.c" case YY_STATE_EOF(INITIAL): case YY_STATE_EOF(IN_PAREN): case YY_STATE_EOF(IN_BRACKET): @@ -1258,7 +1466,7 @@ case YY_STATE_EOF(IN_QQSTRING): /* We're scanning a new file or input source. It's * possible that this happened because the user * just pointed yyin at a new source and called - * jq_yylex(). If so, then we have to assure + * 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 @@ -1318,7 +1526,7 @@ case YY_STATE_EOF(IN_QQSTRING): { yyg->yy_did_buffer_switch_on_eof = 0; - if ( jq_yywrap(yyscanner ) ) + if ( yywrap( yyscanner ) ) { /* Note: because we've taken care in * yy_get_next_buffer() to have set up @@ -1372,7 +1580,7 @@ case YY_STATE_EOF(IN_QQSTRING): } /* end of action switch */ } /* end of scanning one token */ } /* end of user's declarations */ -} /* end of jq_yylex */ +} /* end of yylex */ /* yy_get_next_buffer - try to read in a new buffer * @@ -1386,7 +1594,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner) struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; char *source = yyg->yytext_ptr; - yy_size_t number_to_move, i; + int number_to_move, i; int ret_val; if ( yyg->yy_c_buf_p > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] ) @@ -1415,7 +1623,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner) /* Try to read more data. */ /* First move last chars to start of buffer. */ - number_to_move = (yy_size_t) (yyg->yy_c_buf_p - yyg->yytext_ptr) - 1; + number_to_move = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr - 1); for ( i = 0; i < number_to_move; ++i ) *(dest++) = *(source++); @@ -1428,7 +1636,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner) 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 ) @@ -1442,7 +1650,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner) 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; @@ -1451,11 +1659,12 @@ static int yy_get_next_buffer (yyscan_t yyscanner) b->yy_ch_buf = (char *) /* Include room in for 2 EOB chars. */ - jq_yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ,yyscanner ); + yyrealloc( (void *) b->yy_ch_buf, + (yy_size_t) (b->yy_buf_size + 2) , yyscanner ); } 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( @@ -1483,7 +1692,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner) if ( number_to_move == YY_MORE_ADJ ) { ret_val = EOB_ACT_END_OF_FILE; - jq_yyrestart(yyin ,yyscanner); + yyrestart( yyin , yyscanner); } else @@ -1497,12 +1706,15 @@ static int yy_get_next_buffer (yyscan_t yyscanner) else ret_val = EOB_ACT_CONTINUE_SCAN; - if ((int) (yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { + if ((yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { /* Extend the array by 50%, plus the number we really need. */ int new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1); - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) jq_yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ,yyscanner ); + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc( + (void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf, (yy_size_t) new_size , yyscanner ); 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); } yyg->yy_n_chars += number_to_move; @@ -1536,9 +1748,9 @@ static int yy_get_next_buffer (yyscan_t yyscanner) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 157 ) - 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; @@ -1565,9 +1777,9 @@ static int yy_get_next_buffer (yyscan_t yyscanner) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 157 ) - 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 == 156); (void)yyg; @@ -1603,7 +1815,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner) else { /* need more input */ - yy_size_t offset = yyg->yy_c_buf_p - yyg->yytext_ptr; + int offset = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr); ++yyg->yy_c_buf_p; switch ( yy_get_next_buffer( yyscanner ) ) @@ -1620,14 +1832,14 @@ static int yy_get_next_buffer (yyscan_t yyscanner) */ /* Reset buffer status. */ - jq_yyrestart(yyin ,yyscanner); + yyrestart( yyin , yyscanner); /*FALLTHROUGH*/ case EOB_ACT_END_OF_FILE: { - if ( jq_yywrap(yyscanner ) ) - return EOF; + if ( yywrap( yyscanner ) ) + return 0; if ( ! yyg->yy_did_buffer_switch_on_eof ) YY_NEW_FILE; @@ -1658,34 +1870,34 @@ static int yy_get_next_buffer (yyscan_t yyscanner) * @param yyscanner The scanner object. * @note This function does not reset the start condition to @c INITIAL . */ - void jq_yyrestart (FILE * input_file , yyscan_t yyscanner) + void yyrestart (FILE * input_file , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; if ( ! YY_CURRENT_BUFFER ){ - jq_yyensure_buffer_stack (yyscanner); + yyensure_buffer_stack (yyscanner); YY_CURRENT_BUFFER_LVALUE = - jq_yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); + yy_create_buffer( yyin, YY_BUF_SIZE , yyscanner); } - jq_yy_init_buffer(YY_CURRENT_BUFFER,input_file ,yyscanner); - jq_yy_load_buffer_state(yyscanner ); + yy_init_buffer( YY_CURRENT_BUFFER, input_file , yyscanner); + yy_load_buffer_state( yyscanner ); } /** Switch to a different input buffer. * @param new_buffer The new input buffer. * @param yyscanner The scanner object. */ - void jq_yy_switch_to_buffer (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner) + void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* TODO. We should be able to replace this entire function body * with - * jq_yypop_buffer_state(); - * jq_yypush_buffer_state(new_buffer); + * yypop_buffer_state(); + * yypush_buffer_state(new_buffer); */ - jq_yyensure_buffer_stack (yyscanner); + yyensure_buffer_stack (yyscanner); if ( YY_CURRENT_BUFFER == new_buffer ) return; @@ -1698,17 +1910,17 @@ static int yy_get_next_buffer (yyscan_t yyscanner) } YY_CURRENT_BUFFER_LVALUE = new_buffer; - jq_yy_load_buffer_state(yyscanner ); + yy_load_buffer_state( yyscanner ); /* We don't actually know whether we did this switch during - * EOF (jq_yywrap()) processing, but the only time this flag - * is looked at is after jq_yywrap() 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. */ yyg->yy_did_buffer_switch_on_eof = 1; } -static void jq_yy_load_buffer_state (yyscan_t yyscanner) +static void yy_load_buffer_state (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; @@ -1723,35 +1935,35 @@ static void jq_yy_load_buffer_state (yyscan_t yyscanner) * @param yyscanner The scanner object. * @return the allocated buffer state. */ - YY_BUFFER_STATE jq_yy_create_buffer (FILE * file, int size , yyscan_t yyscanner) + YY_BUFFER_STATE yy_create_buffer (FILE * file, int size , yyscan_t yyscanner) { YY_BUFFER_STATE b; - b = (YY_BUFFER_STATE) jq_yyalloc(sizeof( struct yy_buffer_state ) ,yyscanner ); + b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) , yyscanner ); if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in jq_yy_create_buffer()" ); + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); - b->yy_buf_size = (yy_size_t)size; + 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 *) jq_yyalloc(b-> |