diff --git a/docs/content/manual/dev/manual.yml b/docs/content/manual/dev/manual.yml index 895deab9e5..9da4463624 100644 --- a/docs/content/manual/dev/manual.yml +++ b/docs/content/manual/dev/manual.yml @@ -2195,6 +2195,13 @@ sections: Note that the slashes, question mark, etc. in the URL are not escaped, as they were part of the string literal. + You can also define custom string formats using "def" syntax, + just like defining functions. + + def @foo: gsub("a+"; "."); + + Unlike functions, string formats cannot take arguments. + examples: - program: '@html' input: '"This works if x < y"' @@ -2212,6 +2219,10 @@ sections: input: '"VGhpcyBpcyBhIG1lc3NhZ2U="' output: ['"This is a message"'] + - program: 'def @foo: gsub("a+"; "."); @foo, @foo "a \(.) \(. + .) a"' + input: '"aba"' + output: ['".b."', '"a .b. .b.b. a"'] + - title: "Dates" body: | diff --git a/jq.1.prebuilt b/jq.1.prebuilt index 1a2c3cbc82..1674e2ecd3 100644 --- a/jq.1.prebuilt +++ b/jq.1.prebuilt @@ -1,5 +1,5 @@ . -.TH "JQ" "1" "November 2024" "" "" +.TH "JQ" "1" "January 2025" "" "" . .SH "NAME" \fBjq\fR \- Command\-line JSON processor @@ -2394,6 +2394,22 @@ will produce the following output for the input \fB{"search":"what is jq?"}\fR: .P Note that the slashes, question mark, etc\. in the URL are not escaped, as they were part of the string literal\. . +.P +You can also define custom string formats using "def" syntax, just like defining functions\. +. +.IP "" 4 +. +.nf + +def @foo: gsub("a+"; "\."); +. +.fi +. +.IP "" 0 +. +.P +Unlike functions, string formats cannot take arguments\. +. .IP "" 4 . .nf @@ -2413,6 +2429,10 @@ jq \'@base64\' jq \'@base64d\' "VGhpcyBpcyBhIG1lc3NhZ2U=" => "This is a message" + +jq \'def @foo: gsub("a+"; "\."); @foo, @foo "a \e(\.) \e(\. + \.) a"\' + "aba" +=> "\.b\.", "a \.b\. \.b\.b\. a" . .fi . diff --git a/src/builtin.c b/src/builtin.c index d9dfdf427c..fda34f65d5 100644 --- a/src/builtin.c +++ b/src/builtin.c @@ -569,40 +569,149 @@ static jv escape_string(jv input, const char* escapings) { } -static jv f_format(jq_state *jq, jv input, jv fmt) { - if (jv_get_kind(fmt) != JV_KIND_STRING) { - jv_free(input); - return type_error(fmt, "is not a valid format"); +static jv f_html_fmt(jq_state *jq, jv input) { + input = f_tostring(jq, input); + return escape_string(input, "&&\0<<\0>>\0''\0\""\0"); +} + +static jv f_uri_fmt(jq_state *jq, jv input) { + input = f_tostring(jq, input); + int unreserved[128] = {0}; + const char* p = CHARS_ALPHANUM "-_.~"; + while (*p) unreserved[(int)*p++] = 1; + + jv line = jv_string(""); + const char* s = jv_string_value(input); + for (int i=0; i> 7 & 1 && unicode[0] >> (7-b) & 1)) { + if (*(s++) != '%') { + jv_free(line); + return type_error(input, errmsg); + } + for (int i=0; i<2; i++) { + unicode[b] <<= 4; + char c = *(s++); + if ('0' <= c && c <= '9') unicode[b] |= c - '0'; + else if ('a' <= c && c <= 'f') unicode[b] |= c - 'a' + 10; + else if ('A' <= c && c <= 'F') unicode[b] |= c - 'A' + 10; + else { + jv_free(line); + return type_error(input, errmsg); + } + } + b++; + } + if (!jvp_utf8_is_valid((const char *)unicode, (const char *)unicode+b)) { + jv_free(line); + return type_error(input, errmsg); + } + line = jv_string_append_buf(line, (const char *)unicode, b); + } + } + jv_free(input); + return line; +} + +static jv f_base64_fmt(jq_state *jq, jv input) { + input = f_tostring(jq, input); + jv line = jv_string(""); + const unsigned char* data = (const unsigned char*)jv_string_value(input); + int len = jv_string_length_bytes(jv_copy(input)); + for (int i=0; i= 3 ? 3 : len-i; + for (int j=0; j<3; j++) { + code <<= 8; + code |= j < n ? (unsigned)data[i+j] : 0; + } + char buf[4]; + for (int j=0; j<4; j++) { + buf[j] = BASE64_ENCODE_TABLE[(code >> (18 - j*6)) & 0x3f]; + } + if (n < 3) buf[3] = '='; + if (n < 2) buf[2] = '='; + line = jv_string_append_buf(line, buf, sizeof(buf)); + } + jv_free(input); + return line; +} + +static jv f_base64d_fmt(jq_state *jq, jv input) { + input = f_tostring(jq, input); + const unsigned char* data = (const unsigned char*)jv_string_value(input); + int len = jv_string_length_bytes(jv_copy(input)); + size_t decoded_len = (3 * (size_t)len) / 4; // 3 usable bytes for every 4 bytes of input + char *result = jv_mem_calloc(decoded_len, sizeof(char)); + memset(result, 0, decoded_len * sizeof(char)); + uint32_t ri = 0; + int input_bytes_read=0; + uint32_t code = 0; + for (int i=0; i> 16) & 0xFF; + result[ri++] = (code >> 8) & 0xFF; + result[ri++] = code & 0xFF; + input_bytes_read = 0; + code = 0; + } + } + if (input_bytes_read == 3) { + result[ri++] = (code >> 10) & 0xFF; + result[ri++] = (code >> 2) & 0xFF; + } else if (input_bytes_read == 2) { + result[ri++] = (code >> 4) & 0xFF; + } else if (input_bytes_read == 1) { + free(result); + return type_error(input, "trailing base64 byte found"); + } + + jv line = jv_string_sized(result, ri); + jv_free(input); + free(result); + return line; +} + +static jv f_csv_fmt(jq_state *jq, jv input) { + if (jv_get_kind(input) != JV_KIND_ARRAY) + return type_error(input, "cannot be csv-formatted, only array"); + jv line = jv_string(""); + jv_array_foreach(input, i, x) { + if (i) line = jv_string_append_str(line, ","); + switch (jv_get_kind(x)) { case JV_KIND_NULL: /* null rendered as empty string */ jv_free(x); @@ -612,193 +721,90 @@ static jv f_format(jq_state *jq, jv input, jv fmt) { line = jv_string_concat(line, jv_dump_string(x, 0)); break; case JV_KIND_NUMBER: - if (jv_number_value(x) != jv_number_value(x)) { + if (jvp_number_is_nan(x)) { /* NaN, render as empty string */ jv_free(x); } else { line = jv_string_concat(line, jv_dump_string(x, 0)); } break; - case JV_KIND_STRING: { - line = jv_string_append_str(line, quotes); - line = jv_string_concat(line, escape_string(x, escapings)); - line = jv_string_append_str(line, quotes); + case JV_KIND_STRING: + line = jv_string_append_str(line, "\""); + line = jv_string_concat(line, escape_string(x, "\"\"\"\0")); + line = jv_string_append_str(line, "\""); break; - } default: jv_free(input); jv_free(line); return type_error(x, "is not valid in a csv row"); - } } - jv_free(input); - return line; - } else if (!strcmp(fmt_s, "html")) { - jv_free(fmt); - return escape_string(f_tostring(jq, input), "&&\0<<\0>>\0''\0\""\0"); - } else if (!strcmp(fmt_s, "uri")) { - jv_free(fmt); - input = f_tostring(jq, input); - - int unreserved[128] = {0}; - const char* p = CHARS_ALPHANUM "-_.~"; - while (*p) unreserved[(int)*p++] = 1; - - jv line = jv_string(""); - const char* s = jv_string_value(input); - for (int i=0; i> 7 & 1 && unicode[0] >> (7-b) & 1)) { - if (*(s++) != '%') { - jv_free(line); - return type_error(input, errmsg); - } - for (int i=0; i<2; i++) { - unicode[b] <<= 4; - char c = *(s++); - if ('0' <= c && c <= '9') unicode[b] |= c - '0'; - else if ('a' <= c && c <= 'f') unicode[b] |= c - 'a' + 10; - else if ('A' <= c && c <= 'F') unicode[b] |= c - 'A' + 10; - else { - jv_free(line); - return type_error(input, errmsg); - } - } - b++; - } - if (!jvp_utf8_is_valid((const char *)unicode, (const char *)unicode+b)) { - jv_free(line); - return type_error(input, errmsg); + } + jv_free(input); + return line; +} + +static jv f_tsv_fmt(jq_state *jq, jv input) { + if (jv_get_kind(input) != JV_KIND_ARRAY) + return type_error(input, "cannot be tsv-formatted, only array"); + jv line = jv_string(""); + jv_array_foreach(input, i, x) { + if (i) line = jv_string_append_str(line, "\t"); + switch (jv_get_kind(x)) { + case JV_KIND_NULL: + /* null rendered as empty string */ + jv_free(x); + break; + case JV_KIND_TRUE: + case JV_KIND_FALSE: + line = jv_string_concat(line, jv_dump_string(x, 0)); + break; + case JV_KIND_NUMBER: + if (jvp_number_is_nan(x)) { + /* NaN, render as empty string */ + jv_free(x); + } else { + line = jv_string_concat(line, jv_dump_string(x, 0)); } - line = jv_string_append_buf(line, (const char *)unicode, b); - } + break; + case JV_KIND_STRING: + line = jv_string_concat(line, escape_string(x, "\t\\t\0\r\\r\0\n\\n\0\\\\\\\0")); + break; + default: + jv_free(input); + jv_free(line); + return type_error(x, "is not valid in a tsv row"); } - jv_free(input); - return line; - } else if (!strcmp(fmt_s, "sh")) { - jv_free(fmt); - if (jv_get_kind(input) != JV_KIND_ARRAY) - input = jv_array_set(jv_array(), 0, input); - jv line = jv_string(""); - jv_array_foreach(input, i, x) { - if (i) line = jv_string_append_str(line, " "); - switch (jv_get_kind(x)) { + } + jv_free(input); + return line; +} + +static jv f_sh_fmt(jq_state *jq, jv input) { + if (jv_get_kind(input) != JV_KIND_ARRAY) + input = jv_array_set(jv_array(), 0, input); + jv line = jv_string(""); + jv_array_foreach(input, i, x) { + if (i) line = jv_string_append_str(line, " "); + switch (jv_get_kind(x)) { case JV_KIND_NULL: case JV_KIND_TRUE: case JV_KIND_FALSE: case JV_KIND_NUMBER: line = jv_string_concat(line, jv_dump_string(x, 0)); break; - - case JV_KIND_STRING: { + case JV_KIND_STRING: line = jv_string_append_str(line, "'"); line = jv_string_concat(line, escape_string(x, "''\\''\0")); line = jv_string_append_str(line, "'"); break; - } - default: jv_free(input); jv_free(line); return type_error(x, "can not be escaped for shell"); - } - } - jv_free(input); - return line; - } else if (!strcmp(fmt_s, "base64")) { - jv_free(fmt); - input = f_tostring(jq, input); - jv line = jv_string(""); - const unsigned char* data = (const unsigned char*)jv_string_value(input); - int len = jv_string_length_bytes(jv_copy(input)); - for (int i=0; i= 3 ? 3 : len-i; - for (int j=0; j<3; j++) { - code <<= 8; - code |= j < n ? (unsigned)data[i+j] : 0; - } - char buf[4]; - for (int j=0; j<4; j++) { - buf[j] = BASE64_ENCODE_TABLE[(code >> (18 - j*6)) & 0x3f]; - } - if (n < 3) buf[3] = '='; - if (n < 2) buf[2] = '='; - line = jv_string_append_buf(line, buf, sizeof(buf)); - } - jv_free(input); - return line; - } else if (!strcmp(fmt_s, "base64d")) { - jv_free(fmt); - input = f_tostring(jq, input); - const unsigned char* data = (const unsigned char*)jv_string_value(input); - int len = jv_string_length_bytes(jv_copy(input)); - size_t decoded_len = (3 * (size_t)len) / 4; // 3 usable bytes for every 4 bytes of input - char *result = jv_mem_calloc(decoded_len, sizeof(char)); - memset(result, 0, decoded_len * sizeof(char)); - uint32_t ri = 0; - int input_bytes_read=0; - uint32_t code = 0; - for (int i=0; i> 16) & 0xFF; - result[ri++] = (code >> 8) & 0xFF; - result[ri++] = code & 0xFF; - input_bytes_read = 0; - code = 0; - } - } - if (input_bytes_read == 3) { - result[ri++] = (code >> 10) & 0xFF; - result[ri++] = (code >> 2) & 0xFF; - } else if (input_bytes_read == 2) { - result[ri++] = (code >> 4) & 0xFF; - } else if (input_bytes_read == 1) { - free(result); - return type_error(input, "trailing base64 byte found"); } - - jv line = jv_string_sized(result, ri); - jv_free(input); - free(result); - return line; - } else { - jv_free(input); - return jv_invalid_with_msg(jv_string_concat(fmt, jv_string(" is not a valid format"))); } + jv_free(input); + return line; } static jv f_keys(jq_state *jq, jv input) { @@ -1849,7 +1855,16 @@ BINOPS CFUNC(f_min_by_impl, "_min_by_impl", 2), CFUNC(f_max_by_impl, "_max_by_impl", 2), CFUNC(f_error, "error", 1), - CFUNC(f_format, "format", 2), + CFUNC(f_tostring, "@text", 1), + CFUNC(f_dump, "@json", 1), + CFUNC(f_html_fmt, "@html", 1), + CFUNC(f_uri_fmt, "@uri", 1), + CFUNC(f_urid_fmt, "@urid", 1), + CFUNC(f_base64_fmt, "@base64", 1), + CFUNC(f_base64d_fmt, "@base64d", 1), + CFUNC(f_csv_fmt, "@csv", 1), + CFUNC(f_tsv_fmt, "@tsv", 1), + CFUNC(f_sh_fmt, "@sh", 1), CFUNC(f_env, "env", 1), CFUNC(f_halt, "halt", 1), CFUNC(f_halt_error, "halt_error", 2), diff --git a/src/compile.c b/src/compile.c index 0c208cad1d..eb798d980a 100644 --- a/src/compile.c +++ b/src/compile.c @@ -503,7 +503,8 @@ jv block_list_funcs(block body, int omit_underscores) { for (inst *pos = body.first; pos != NULL; pos = pos->next) { if (pos->op == CLOSURE_CREATE || pos->op == CLOSURE_CREATE_C) { if (pos->symbol != NULL && (!omit_underscores || pos->symbol[0] != '_')) { - funcs = jv_object_set(funcs, jv_string_fmt("%s/%i", pos->symbol, pos->nformals), jv_null()); + funcs = jv_object_set(funcs, pos->symbol[0] == '@' ? jv_string_fmt("%s", pos->symbol) + : jv_string_fmt("%s/%i", pos->symbol, pos->nformals), jv_null()); } } } @@ -577,7 +578,7 @@ block gen_param(const char* name) { } block gen_lambda(block body) { - return gen_function("@lambda", gen_noop(), body); + return gen_function("#lambda", gen_noop(), body); } block gen_call(const char* name, block args) { @@ -1156,6 +1157,8 @@ static int expand_call_arglist(block* b, jv args, jv *env) { } else if (!curr->bound_by) { if (curr->symbol[0] == '*' && curr->symbol[1] >= '1' && curr->symbol[1] <= '3' && curr->symbol[2] == '\0') locfile_locate(curr->locfile, curr->source, "jq: error: break used outside labeled control structure"); + else if (curr->symbol[0] == '@') + locfile_locate(curr->locfile, curr->source, "jq: error: %s is not a defined format", curr->symbol); else if (curr->op == LOADV) locfile_locate(curr->locfile, curr->source, "jq: error: $%s is not defined", curr->symbol); else diff --git a/src/lexer.c b/src/lexer.c index 72d211e072..01ce03d370 100644 --- a/src/lexer.c +++ b/src/lexer.c @@ -281,6 +281,7 @@ 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; @@ -445,7 +446,7 @@ struct yy_buffer_state /* Number of characters read into yy_ch_buf, not including EOB * characters. */ - int yy_n_chars; + yy_size_t 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 @@ -522,7 +523,7 @@ static void yy_init_buffer ( YY_BUFFER_STATE b, FILE *file , 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 ); +YY_BUFFER_STATE yy_scan_bytes ( const char *bytes, yy_size_t len , yyscan_t yyscanner ); void *yyalloc ( yy_size_t , yyscan_t yyscanner ); void *yyrealloc ( void *, yy_size_t , yyscan_t yyscanner ); @@ -569,7 +570,7 @@ static void yynoreturn yy_fatal_error ( const char* msg , yyscan_t yyscanner ); */ #define YY_DO_BEFORE_ACTION \ yyg->yytext_ptr = yy_bp; \ - yyleng = (int) (yy_cp - yy_bp); \ + yyleng = (yy_size_t) (yy_cp - yy_bp); \ yyg->yy_hold_char = *yy_cp; \ *yy_cp = '\0'; \ yyg->yy_c_buf_p = yy_cp; @@ -810,14 +811,14 @@ struct lexer_param; yyset_extra(yylloc->end, yyscanner); \ } while (0); -#line 813 "src/lexer.c" +#line 814 "src/lexer.c" #line 26 "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 818 "src/lexer.c" +#line 819 "src/lexer.c" #define YY_NO_INPUT 1 -#line 820 "src/lexer.c" +#line 821 "src/lexer.c" #define INITIAL 0 #define IN_PAREN 1 @@ -850,8 +851,8 @@ struct yyguts_t size_t yy_buffer_stack_max; /**< capacity of stack. */ YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */ char yy_hold_char; - int yy_n_chars; - int yyleng_r; + yy_size_t yy_n_chars; + yy_size_t yyleng_r; char *yy_c_buf_p; int yy_init; int yy_start; @@ -908,7 +909,7 @@ FILE *yyget_out ( yyscan_t yyscanner ); void yyset_out ( FILE * _out_str , yyscan_t yyscanner ); - int yyget_leng ( yyscan_t yyscanner ); + yy_size_t yyget_leng ( yyscan_t yyscanner ); char *yyget_text ( yyscan_t yyscanner ); @@ -993,7 +994,7 @@ static int input ( yyscan_t yyscanner ); if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ { \ int c = '*'; \ - int n; \ + yy_size_t n; \ for ( n = 0; n < max_size && \ (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ buf[n] = (char) c; \ @@ -1112,7 +1113,7 @@ YY_DECL #line 39 "src/lexer.l" -#line 1115 "src/lexer.c" +#line 1116 "src/lexer.c" while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */ { @@ -1380,7 +1381,7 @@ case 40: YY_RULE_SETUP #line 91 "src/lexer.l" { - yylval->literal = jv_string_sized(yytext + 1, yyleng - 1); return FORMAT; + yylval->literal = jv_string(yytext); return FORMAT; } YY_BREAK case 41: @@ -1474,7 +1475,7 @@ YY_RULE_SETUP #line 137 "src/lexer.l" YY_FATAL_ERROR( "flex scanner jammed" ); YY_BREAK -#line 1477 "src/lexer.c" +#line 1478 "src/lexer.c" case YY_STATE_EOF(INITIAL): case YY_STATE_EOF(IN_PAREN): case YY_STATE_EOF(IN_BRACKET): @@ -1667,7 +1668,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner) else { - int num_to_read = + yy_size_t num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; while ( num_to_read <= 0 ) @@ -1681,7 +1682,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner) if ( b->yy_is_our_buffer ) { - int new_size = b->yy_buf_size * 2; + yy_size_t new_size = b->yy_buf_size * 2; if ( new_size <= 0 ) b->yy_buf_size += b->yy_buf_size / 8; @@ -1739,7 +1740,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner) 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_size_t new_size = yyg->yy_n_chars + number_to_move + (yyg->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 , yyscanner ); if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) @@ -1846,7 +1847,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner) else { /* need more input */ - int offset = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr); + yy_size_t offset = yyg->yy_c_buf_p - yyg->yytext_ptr; ++yyg->yy_c_buf_p; switch ( yy_get_next_buffer( yyscanner ) ) @@ -2224,12 +2225,12 @@ YY_BUFFER_STATE yy_scan_string (const char * yystr , yyscan_t yyscanner) * @param yyscanner The scanner object. * @return the newly allocated buffer state object. */ -YY_BUFFER_STATE yy_scan_bytes (const char * yybytes, int _yybytes_len , yyscan_t yyscanner) +YY_BUFFER_STATE yy_scan_bytes (const char * yybytes, yy_size_t _yybytes_len , yyscan_t yyscanner) { YY_BUFFER_STATE b; char *buf; yy_size_t n; - int i; + yy_size_t i; /* Get memory for full buffer, including space for trailing EOB's. */ n = (yy_size_t) (_yybytes_len + 2); @@ -2314,7 +2315,7 @@ static void yynoreturn yy_fatal_error (const char* msg , yyscan_t yyscanner) do \ { \ /* Undo effects of setting up yytext. */ \ - int yyless_macro_arg = (n); \ + yy_size_t yyless_macro_arg = (n); \ YY_LESS_LINENO(yyless_macro_arg);\ yytext[yyleng] = yyg->yy_hold_char; \ yyg->yy_c_buf_p = yytext + yyless_macro_arg; \ @@ -2382,7 +2383,7 @@ FILE *yyget_out (yyscan_t yyscanner) /** Get the length of the current token. * @param yyscanner The scanner object. */ -int yyget_leng (yyscan_t yyscanner) +yy_size_t yyget_leng (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; return yyleng; diff --git a/src/lexer.h b/src/lexer.h index d204f4f9b5..9f9b74d5a0 100644 --- a/src/lexer.h +++ b/src/lexer.h @@ -285,6 +285,7 @@ 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; @@ -398,7 +399,7 @@ struct yy_buffer_state /* Number of characters read into yy_ch_buf, not including EOB * characters. */ - int yy_n_chars; + yy_size_t 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 @@ -442,7 +443,7 @@ void yypop_buffer_state ( 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 ); +YY_BUFFER_STATE yy_scan_bytes ( const char *bytes, yy_size_t len , yyscan_t yyscanner ); void *yyalloc ( yy_size_t , yyscan_t yyscanner ); void *yyrealloc ( void *, yy_size_t , yyscan_t yyscanner ); @@ -501,7 +502,7 @@ FILE *yyget_out ( yyscan_t yyscanner ); void yyset_out ( FILE * _out_str , yyscan_t yyscanner ); - int yyget_leng ( yyscan_t yyscanner ); + yy_size_t yyget_leng ( yyscan_t yyscanner ); char *yyget_text ( yyscan_t yyscanner ); @@ -735,6 +736,6 @@ extern int yylex \ #line 137 "src/lexer.l" -#line 738 "src/lexer.h" +#line 739 "src/lexer.h" #undef jq_yyIN_HEADER #endif /* jq_yyHEADER_H */ diff --git a/src/lexer.l b/src/lexer.l index 70e015dda3..161226212e 100644 --- a/src/lexer.l +++ b/src/lexer.l @@ -89,7 +89,7 @@ struct lexer_param; } "@"[a-zA-Z0-9_]+ { - yylval->literal = jv_string_sized(yytext + 1, yyleng - 1); return FORMAT; + yylval->literal = jv_string(yytext); return FORMAT; } ([0-9]+(\.[0-9]*)?|\.[0-9]+)([eE][+-]?[0-9]+)? { diff --git a/src/parser.c b/src/parser.c index 0599db7f4d..16b47dd298 100644 --- a/src/parser.c +++ b/src/parser.c @@ -520,10 +520,6 @@ static block gen_binop(block a, block b, int op) { return gen_call(funcname, BLOCK(gen_lambda(a), gen_lambda(b))); } -static block gen_format(block a, jv fmt) { - return BLOCK(a, gen_call("format", gen_lambda(gen_const(fmt)))); -} - static block gen_definedor_assign(block object, block val) { block tmp = gen_op_var_fresh(STOREV, "tmp"); return BLOCK(gen_op_simple(DUP), @@ -550,7 +546,7 @@ static block gen_loc_object(location *loc, struct locfile *locations) { } -#line 554 "src/parser.c" +#line 550 "src/parser.c" #ifdef short @@ -877,16 +873,16 @@ union yyalloc /* YYFINAL -- State number of the termination state. */ #define YYFINAL 30 /* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 2051 +#define YYLAST 2059 /* YYNTOKENS -- Number of terminals. */ #define YYNTOKENS 70 /* YYNNTS -- Number of nonterminals. */ #define YYNNTS 29 /* YYNRULES -- Number of rules. */ -#define YYNRULES 169 +#define YYNRULES 170 /* YYNSTATES -- Number of states. */ -#define YYNSTATES 315 +#define YYNSTATES 319 /* YYMAXUTOK -- Last valid token kind. */ #define YYMAXUTOK 303 @@ -940,23 +936,24 @@ static const yytype_int8 yytranslate[] = /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ static const yytype_int16 yyrline[] = { - 0, 290, 290, 293, 298, 301, 316, 319, 324, 327, - 332, 336, 339, 343, 347, 351, 354, 359, 362, 365, - 370, 377, 381, 385, 389, 393, 397, 401, 405, 409, - 413, 417, 421, 425, 429, 433, 437, 441, 445, 449, - 453, 457, 461, 465, 469, 473, 477, 481, 486, 489, - 506, 515, 522, 530, 541, 546, 552, 555, 560, 564, - 571, 574, 580, 587, 590, 593, 599, 602, 605, 610, - 613, 616, 622, 625, 628, 636, 640, 643, 646, 649, - 652, 655, 658, 661, 664, 668, 674, 677, 680, 683, - 686, 689, 692, 695, 698, 701, 704, 707, 710, 713, - 716, 719, 722, 725, 728, 731, 734, 756, 760, 764, - 767, 779, 784, 785, 786, 787, 790, 793, 798, 803, - 806, 811, 814, 819, 823, 826, 831, 834, 839, 842, - 847, 850, 853, 856, 859, 862, 870, 876, 879, 882, - 885, 888, 891, 894, 897, 900, 903, 906, 909, 912, - 915, 918, 921, 924, 927, 932, 935, 936, 937, 940, - 943, 946, 949, 953, 958, 962, 966, 970, 974, 982 + 0, 286, 286, 289, 294, 297, 312, 315, 320, 323, + 328, 332, 335, 339, 343, 347, 350, 355, 358, 361, + 366, 373, 377, 381, 385, 389, 393, 397, 401, 405, + 409, 413, 417, 421, 425, 429, 433, 437, 441, 445, + 449, 453, 457, 461, 465, 469, 473, 477, 482, 485, + 502, 511, 518, 526, 537, 541, 545, 551, 554, 559, + 563, 570, 573, 579, 586, 589, 592, 599, 602, 605, + 610, 613, 616, 622, 625, 628, 636, 640, 643, 646, + 649, 652, 655, 658, 661, 664, 668, 674, 677, 680, + 683, 686, 689, 692, 695, 698, 701, 704, 707, 710, + 713, 716, 719, 722, 727, 730, 733, 736, 758, 762, + 766, 769, 781, 786, 787, 788, 789, 792, 795, 800, + 805, 808, 813, 816, 821, 825, 828, 833, 836, 841, + 844, 849, 852, 855, 858, 861, 864, 872, 878, 881, + 884, 887, 890, 893, 896, 899, 902, 905, 908, 911, + 914, 917, 920, 923, 926, 929, 934, 937, 938, 939, + 942, 945, 948, 951, 955, 960, 964, 968, 972, 976, + 984 }; #endif @@ -997,12 +994,12 @@ yysymbol_name (yysymbol_kind_t yysymbol) } #endif -#define YYPACT_NINF (-157) +#define YYPACT_NINF (-160) #define yypact_value_is_default(Yyn) \ ((Yyn) == YYPACT_NINF) -#define YYTABLE_NINF (-156) +#define YYTABLE_NINF (-157) #define yytable_value_is_error(Yyn) \ ((Yyn) == YYTABLE_NINF) @@ -1011,38 +1008,38 @@ yysymbol_name (yysymbol_kind_t yysymbol) STATE-NUM. */ static const yytype_int16 yypact[] = { - -14, 881, 15, 62, -33, -23, -157, -157, -9, -157, - 37, 881, 912, 912, 881, 40, 2, -157, -157, 881, - 193, 282, 415, 595, -18, 1400, 881, -157, -157, 12, - -157, 1, 1, 881, 62, 683, 881, -157, -157, -11, - 1756, 17, 49, 26, 10, -157, -157, 14, 21, 1230, - -157, 74, -9, 53, 51, -157, 1041, -26, 63, 64, - -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, - -157, -157, -157, -157, -157, -157, -157, -157, -157, 881, - 65, 69, 70, 82, 67, 881, 881, 881, 881, 881, - 881, 881, 881, 881, 881, 881, 881, 881, 881, 881, - 881, 881, 881, 881, 881, 881, 881, 881, 881, -157, - -157, 1924, 13, 87, -5, -4, 348, 127, -157, -157, - -157, 1924, 881, -157, -157, 1451, 1924, 56, -157, 68, - 881, 482, -5, -5, 533, 881, -157, -157, -157, -157, - -157, -157, 651, 513, -157, 513, 513, 1264, 513, 513, - -157, 651, 144, 1992, 113, 113, 1958, 594, 913, 1992, - 1992, 1992, 1992, 1992, 1992, 113, 113, 1924, 1958, 1992, - 113, 113, 14, 14, 98, 98, 98, -157, 881, -157, - -157, -157, -5, 974, 117, 111, 119, 749, 102, 96, - 881, 104, 1007, 116, -157, -157, 881, -157, -157, -157, - 61, -157, 1502, -157, 1706, 110, 112, -157, -157, 1924, - -10, -157, 513, 126, 0, 126, 126, 115, 126, 126, - -157, -157, 1790, -157, -37, 118, 120, 121, 881, 122, - -38, -157, 124, -5, 881, 123, 1075, -157, -157, 1109, - -157, 815, 131, -157, -157, -157, 68, 128, -157, 881, - 881, -157, -157, 881, 881, -157, 513, 513, -157, -5, - -157, -5, -5, -5, 1298, -5, 974, -157, -5, 134, - 1924, -157, 133, 137, 145, 1143, -157, -157, 881, 1840, - 1890, 1553, 1604, 126, 126, -157, -157, -157, -157, 130, - -157, -157, -157, -157, -157, -157, 146, 1655, -157, 881, - 881, 881, -5, -157, -157, 1706, 1332, 1177, -157, -157, - -157, 881, -157, 1366, -157 + 22, 869, 15, 43, -16, -9, -160, -160, 24, -160, + 36, 869, 450, 450, 869, 71, 27, -160, -160, 869, + 419, 286, 352, 583, 44, 1357, 869, -160, -160, 17, + -160, 1, 1, 869, 43, 671, 869, -160, -160, -4, + 49, 1764, 53, 58, 90, 73, -160, -160, -8, 62, + 1187, -160, 124, 24, 67, 61, -160, 998, -22, 65, + 66, -160, -160, -160, -160, -160, -160, -160, -160, -160, + -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, + 869, 75, 77, 80, 84, 74, 869, 869, 869, 869, + 869, 869, 869, 869, 869, 869, 869, 869, 869, 869, + 869, 869, 869, 869, 869, 869, 869, 869, 869, 869, + -160, -160, 1932, 9, 93, -3, 0, 153, 120, -160, + -160, -160, 1932, 869, -160, -160, 1408, 1932, 13, -160, + 50, 869, 869, 470, -3, -3, 521, 869, -160, -160, + -160, -160, -160, -160, 639, 197, -160, 197, 197, 1221, + 197, 197, -160, 639, 149, 2000, 582, 582, 1966, 785, + 220, 2000, 2000, 2000, 2000, 2000, 2000, 582, 582, 1932, + 1966, 2000, 582, 582, -8, -8, 104, 104, 104, -160, + 869, -160, -160, -160, -3, 931, 123, 117, 125, 737, + 108, 103, 869, 111, 964, 70, -160, -160, 869, -160, + -160, -160, 18, -160, 1459, 1510, -160, 1714, 110, 112, + -160, -160, 1932, -26, -160, 197, 126, 6, 126, 126, + 119, 126, 126, -160, -160, 1798, -160, -37, 129, 130, + 131, 869, 133, -32, -160, 135, -3, 869, 116, 1032, + -160, -160, 1066, -160, 803, 121, -160, -160, -160, 50, + 136, -160, -160, 869, 869, -160, -160, 869, 869, -160, + 197, 197, -160, -3, -160, -3, -3, -3, 1255, -3, + 931, -160, -3, 145, 1932, -160, 128, 141, 151, 1100, + -160, -160, 869, 1848, 1898, 1561, 1612, 126, 126, -160, + -160, -160, -160, 148, -160, -160, -160, -160, -160, -160, + 154, 1663, -160, 869, 869, 869, -3, -160, -160, 1714, + 1289, 1134, -160, -160, -160, 869, -160, 1323, -160 }; /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. @@ -1050,54 +1047,54 @@ static const yytype_int16 yypact[] = means the default is an error. */ static const yytype_uint8 yydefact[] = { - 4, 0, 0, 6, 110, 81, 108, 100, 102, 73, - 0, 0, 0, 0, 0, 0, 0, 109, 61, 0, - 0, 0, 0, 0, 0, 0, 0, 63, 101, 47, - 1, 0, 0, 8, 6, 0, 0, 77, 60, 0, - 0, 0, 0, 18, 0, 75, 74, 32, 0, 0, - 84, 0, 0, 83, 0, 105, 0, 0, 165, 164, - 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, - 147, 148, 149, 150, 151, 152, 153, 154, 166, 0, - 162, 167, 0, 156, 0, 0, 0, 0, 0, 0, + 4, 0, 0, 6, 111, 82, 109, 101, 103, 74, + 0, 0, 0, 0, 0, 0, 0, 110, 62, 0, + 0, 0, 0, 0, 0, 0, 0, 64, 102, 47, + 1, 0, 0, 8, 6, 0, 0, 78, 61, 0, + 0, 0, 0, 0, 18, 0, 76, 75, 32, 0, + 0, 85, 0, 0, 84, 0, 106, 0, 0, 166, + 165, 138, 139, 140, 141, 142, 143, 144, 145, 146, + 147, 148, 149, 150, 151, 152, 153, 154, 155, 167, + 0, 163, 168, 0, 157, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 21, - 5, 10, 0, 80, 0, 0, 0, 0, 53, 52, - 3, 2, 8, 7, 48, 0, 118, 0, 116, 0, - 0, 0, 0, 0, 0, 0, 112, 103, 85, 79, - 113, 104, 0, 0, 115, 0, 0, 0, 0, 0, - 106, 0, 0, 40, 41, 42, 25, 24, 23, 27, - 31, 34, 36, 39, 26, 45, 46, 28, 29, 22, - 43, 44, 30, 33, 35, 37, 38, 64, 0, 62, - 76, 123, 0, 0, 0, 0, 122, 0, 82, 0, - 0, 91, 0, 0, 9, 49, 0, 111, 59, 58, - 0, 56, 0, 16, 0, 0, 0, 19, 17, 20, - 0, 158, 0, 169, 71, 159, 163, 0, 161, 160, - 157, 107, 0, 126, 0, 0, 0, 130, 0, 0, - 0, 128, 0, 0, 0, 93, 0, 78, 114, 0, - 90, 0, 87, 51, 50, 117, 0, 0, 54, 0, - 0, 68, 15, 0, 0, 70, 0, 0, 65, 0, - 124, 0, 0, 0, 0, 0, 0, 125, 0, 121, - 11, 92, 89, 99, 98, 0, 86, 57, 0, 0, - 0, 0, 0, 69, 168, 127, 136, 132, 131, 0, - 134, 129, 133, 88, 96, 95, 97, 0, 67, 0, - 0, 0, 0, 94, 55, 0, 0, 0, 135, 66, - 12, 0, 14, 0, 13 + 21, 5, 10, 0, 81, 0, 0, 0, 0, 53, + 52, 3, 2, 8, 7, 48, 0, 119, 0, 117, + 0, 0, 0, 0, 0, 0, 0, 0, 113, 104, + 86, 80, 114, 105, 0, 0, 116, 0, 0, 0, + 0, 0, 107, 0, 0, 40, 41, 42, 25, 24, + 23, 27, 31, 34, 36, 39, 26, 45, 46, 28, + 29, 22, 43, 44, 30, 33, 35, 37, 38, 65, + 0, 63, 77, 124, 0, 0, 0, 0, 123, 0, + 83, 0, 0, 92, 0, 0, 9, 49, 0, 112, + 60, 59, 0, 57, 0, 0, 16, 0, 0, 0, + 19, 17, 20, 0, 159, 0, 170, 72, 160, 164, + 0, 162, 161, 158, 108, 0, 127, 0, 0, 0, + 131, 0, 0, 0, 129, 0, 0, 0, 94, 0, + 79, 115, 0, 91, 0, 88, 51, 50, 118, 0, + 0, 54, 56, 0, 0, 69, 15, 0, 0, 71, + 0, 0, 66, 0, 125, 0, 0, 0, 0, 0, + 0, 126, 0, 122, 11, 93, 90, 100, 99, 0, + 87, 58, 0, 0, 0, 0, 0, 70, 169, 128, + 137, 133, 132, 0, 135, 130, 134, 89, 97, 96, + 98, 0, 68, 0, 0, 0, 0, 95, 55, 0, + 0, 0, 136, 67, 12, 0, 14, 0, 13 }; /* YYPGOTO[NTERM-NUM]. */ static const yytype_int16 yypgoto[] = { - -157, -157, -157, 169, 57, -1, -157, -157, 148, -13, - -157, -39, -157, -7, -157, -96, -101, -6, -157, 18, - -157, -66, -114, -157, -157, -56, -156, -102, -157 + -160, -160, -160, 155, 85, -1, -160, -160, 180, -13, + -160, -34, -160, -7, -160, -88, -146, -6, -160, 25, + -160, -51, -116, -160, -160, -46, -159, -114, -160 }; /* YYDEFGOTO[NTERM-NUM]. */ -static const yytype_uint8 yydefgoto[] = +static const yytype_int16 yydefgoto[] = { - 0, 2, 3, 33, 120, 111, 34, 35, 117, 26, - 200, 201, 27, 28, 112, 252, 213, 29, 127, 128, - 184, 185, 186, 224, 230, 231, 81, 82, 83 + 0, 2, 3, 33, 121, 112, 34, 35, 118, 26, + 202, 203, 27, 28, 113, 256, 216, 29, 128, 129, + 186, 187, 188, 227, 233, 234, 82, 83, 84 }; /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If @@ -1105,360 +1102,371 @@ static const yytype_uint8 yydefgoto[] = number is the opposite. If YYTABLE_NINF, syntax error. */ static const yytype_int16 yytable[] = { - 25, 181, 1, 45, 52, 113, 41, 42, 46, 52, - 40, 266, 259, 43, 53, 30, 80, 113, 47, 49, - 122, 56, 113, 142, 118, 118, 114, 232, 36, 260, - 267, 132, 121, 38, 125, 126, 37, 143, 18, 142, - 211, 39, 144, 18, 215, 216, 44, 218, 219, 220, - 129, 84, 130, 143, 113, 134, 177, 178, 135, 179, - 182, 187, 183, 133, 115, 116, 205, 206, 223, 106, - 107, 108, 198, 109, 199, 138, 115, 116, 147, 31, - 32, 115, 116, 136, 153, 154, 155, 156, 157, 158, - 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, - 169, 170, 171, 172, 173, 174, 175, 176, 188, 122, - 232, 255, 139, 115, 116, 192, 196, 140, 197, 269, - 243, 246, 244, 247, -156, -156, 145, 146, 148, 202, - 204, 151, 149, 208, 209, 80, 152, 214, 150, 214, - 214, 193, 214, 214, 80, 285, 180, 286, 287, 288, - 221, 290, -156, -156, 292, 283, 284, 109, 233, 234, - -120, 237, 238, 240, -156, -156, 104, 105, 106, 107, - 108, 253, 109, 254, 256, -119, 229, 222, 257, 194, - 119, 261, 271, 262, 263, 265, 236, 268, 308, 239, - 276, 278, 293, 302, 48, 126, 294, 4, 5, 6, - 7, 8, 9, 123, 295, 303, 214, 277, 10, 309, - 291, 0, 11, 0, 245, 0, 12, 13, 0, 0, - 0, 14, 0, 15, 16, 17, 0, 264, 0, 0, - 0, 0, 0, 270, 0, 18, 0, 0, 0, 0, - 275, 0, 0, 0, 0, 0, 0, 19, 279, 280, - 214, 214, 281, 282, 20, 0, 0, 21, 22, 229, - 23, 0, 24, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 297, 0, 0, - 0, 0, -72, 50, 0, 0, 51, -72, 0, 0, - 52, 0, -72, -72, -72, -72, -72, 0, 305, 306, - 307, 0, -72, -72, -72, 0, 0, -72, -72, -72, - 313, -72, 0, 0, 0, -72, -72, -72, -72, -72, - -72, -72, -72, 0, 18, 0, 0, -72, 0, 0, - -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, - 0, -72, -72, 0, -72, -72, -72, -72, -72, 189, - -72, 0, 4, 5, 6, 7, 8, 9, 0, 0, - 0, 0, 0, 10, 0, 0, 0, 11, 0, 0, - 0, 12, 13, 0, 0, 0, 14, 0, 15, 16, - 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 19, 0, 0, 0, 0, 0, 0, 20, - 0, 190, 21, 22, 191, 23, 54, 24, 0, 4, - 5, 6, 7, 8, 9, 0, 0, 0, 0, 0, - 10, 0, 0, 0, 11, 0, 0, 0, 12, 13, - 0, 0, 0, 14, 0, 15, 16, 17, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 18, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 19, - 0, 0, 0, 0, 0, 0, 20, 0, 0, 21, - 22, 55, 23, 203, 24, 0, 4, 5, 6, 7, + 25, 218, 219, 183, 221, 222, 42, 43, 53, 53, + 41, 114, 263, 44, 54, 30, 81, 270, 48, 50, + 123, 57, 114, 144, 119, 119, 235, 144, 46, 264, + 214, 115, 122, 47, 126, 127, 271, 145, 1, 223, + 39, 145, 18, 18, 40, 36, 146, 107, 108, 109, + 37, 110, 179, 180, 200, 181, 201, 130, 114, 131, + 31, 32, 184, 114, 185, 189, 38, 134, 226, 259, + 116, 117, 135, 198, 246, 199, 247, 45, 249, 149, + 250, 116, 117, 208, 209, 155, 156, 157, 158, 159, + 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, + 170, 171, 172, 173, 174, 175, 176, 177, 178, 190, + 123, 235, 132, 85, 287, 288, 194, 116, 117, 136, + 273, 137, 116, 117, 138, 140, 141, 142, 147, 148, + 204, 205, 207, 153, 195, 211, 212, 81, 150, 217, + 151, 217, 217, 154, 217, 217, 81, 289, 152, 290, + 291, 292, 182, 294, 191, 224, 296, 4, 5, 6, + 7, 8, 9, 110, 236, 237, -121, 240, 10, 241, + 243, 257, 11, 258, 260, 275, 12, 13, 232, 225, + 280, 14, 261, 15, 16, 17, -120, 297, 239, 124, + 312, 242, 265, 266, 267, 18, 269, 127, 272, 282, + 298, 4, 5, 6, 7, 8, 9, 19, 196, 217, + 299, 306, 120, 307, 20, 281, 192, 21, 22, 193, + 23, 313, 24, 248, 295, 0, 0, 0, 16, 17, + 268, 87, 88, 0, 0, 0, 274, 0, 0, 18, + 0, 0, 0, 279, 0, 0, 90, 0, 0, 0, + 0, 215, 283, 284, 217, 217, 285, 286, 20, 98, + 99, 21, 22, 232, 23, 0, 24, 0, 0, 0, + 0, 103, 104, 105, 106, 107, 108, 109, 0, 110, + 0, 301, 0, 0, 0, 0, -73, 51, 0, 0, + 52, -73, 0, 0, 53, 0, -73, -73, -73, -73, + -73, 0, 309, 310, 311, 0, -73, -73, -73, 0, + 0, -73, -73, -73, 317, -73, 0, 0, 0, -73, + -73, -73, -73, -73, -73, -73, -73, 0, 18, 0, + 0, -73, 0, 0, -73, -73, -73, -73, -73, -73, + -73, -73, -73, -73, 0, -73, -73, 0, -73, -73, + -73, -73, -73, 55, -73, 0, 4, 5, 6, 7, 8, 9, 0, 0, 0, 0, 0, 10, 0, 0, 0, 11, 0, 0, 0, 12, 13, 0, 0, 0, - 14, 0, 15, 16, 17, 0, 0, 4, 5, 6, - 7, 8, 9, 0, 18, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 207, 0, 19, 4, 5, 6, - 7, 8, 9, 20, 16, 17, 21, 22, 10, 23, - 0, 24, 11, 0, 0, 18, 12, 13, 0, 0, - 0, 14, 0, 15, 16, 17, 0, 212, 0, 0, - 0, 0, 0, 0, 20, 18, 0, 21, 22, 0, - 23, 0, 24, 0, 0, 0, 0, 19, 0, 0, - 0, 0, 0, 0, 20, 0, 57, 21, 22, 58, - 23, 59, 24, 52, 0, 86, 87, 0, 0, 60, - 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, - 71, 72, 73, 74, 75, 76, 77, 78, 0, 0, - 0, 0, 0, 97, 98, 0, 0, 18, 0, 0, - 0, 0, 0, 0, 0, 102, 103, 104, 105, 106, - 107, 108, 210, 109, 0, 58, 79, 59, 0, 52, - 0, 0, 0, -155, 0, 60, 61, 62, 63, 64, - 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, - 75, 76, 77, 78, 0, 0, 0, 4, 5, 6, - 7, 8, 9, 18, 0, 0, 0, 0, 10, 0, - 0, 0, 11, 0, 0, 0, 12, 13, 0, 0, - 0, 14, 79, 15, 16, 17, 0, 0, 0, -155, - 0, 0, 0, 0, 0, 18, 0, 0, 0, 0, + 14, 0, 15, 16, 17, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 18, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 19, 0, 0, 0, + 0, 0, 0, 20, 0, 0, 21, 22, 56, 23, + 49, 24, 0, 4, 5, 6, 7, 8, 9, 0, + 0, 0, 0, 0, 10, 0, 0, 0, 11, 0, + 0, 0, 12, 13, 0, 0, 0, 14, 0, 15, + 16, 17, 0, 0, 4, 5, 6, 7, 8, 9, + 0, 18, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 206, 0, 19, 4, 5, 6, 7, 8, 9, + 20, 16, 17, 21, 22, 10, 23, 0, 24, 11, + 0, 0, 18, 12, 13, 0, 0, 0, 14, 0, + 15, 16, 17, 0, 0, 0, 0, 0, 0, 0, + 0, 20, 18, 0, 21, 22, 0, 23, 0, 24, + 0, 0, 210, 0, 19, 4, 5, 6, 7, 8, + 9, 20, 0, 0, 21, 22, 10, 23, 0, 24, + 11, 0, 0, 0, 12, 13, 0, 0, 0, 14, + 0, 15, 16, 17, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 18, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 19, 0, 0, 0, 0, + 0, 0, 20, 0, 58, 21, 22, 59, 23, 60, + 24, 53, 0, -157, -157, 0, 0, 61, 62, 63, + 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, + 74, 75, 76, 77, 78, 79, 0, 0, 0, 0, + 0, -157, -157, 0, 0, 18, 0, 0, 0, 0, + 0, 0, 0, -157, -157, 105, 106, 107, 108, 109, + 213, 110, 0, 59, 80, 60, 0, 53, 0, 0, + 0, -156, 0, 61, 62, 63, 64, 65, 66, 67, + 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, + 78, 79, 0, 0, 0, 4, 5, 6, 7, 8, + 9, 18, 0, 0, 0, 0, 10, 0, 0, 0, + 11, 0, 0, 0, 12, 13, 0, 0, 0, 14, + 80, 15, 16, 17, 0, 0, 0, -156, 0, 0, + 0, 0, 0, 18, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 19, 0, 0, 0, 0, + 0, 125, 20, 0, 0, 21, 22, 0, 23, 0, + 24, 4, 5, 6, 7, 8, 9, 0, 0, 0, + 0, 0, 10, 0, 0, 0, 11, 0, 0, 0, + 12, 13, 0, 0, 0, 14, 0, 15, 16, 17, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 18, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 19, 0, 0, 0, 0, 87, 88, 20, 0, + 0, 21, 22, 238, 23, 0, 24, 4, 5, 6, + 7, 8, 9, 0, 0, 0, 0, 0, 10, 0, + 0, 0, 11, 0, 98, 99, 12, 13, 0, 0, + 0, 14, 0, 15, 16, 17, 103, 104, 105, 106, + 107, 108, 109, 0, 110, 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 19, 0, 0, - 0, 0, 0, 124, 20, 0, 0, 21, 22, 0, + 0, 0, 0, 0, 20, 0, 0, 21, 22, 278, 23, 0, 24, 4, 5, 6, 7, 8, 9, 0, 0, 0, 0, 0, 10, 0, 0, 0, 11, 0, 0, 0, 12, 13, 0, 0, 0, 14, 0, 15, 16, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 19, 0, 0, 0, 0, 0, 0, - 20, 0, 0, 21, 22, 235, 23, 0, 24, 4, - 5, 6, 7, 8, 9, 0, 0, 0, 0, 0, - 10, 0, 0, 0, 11, 0, 0, 0, 12, 13, - 0, 0, 0, 14, 0, 15, 16, 17, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 18, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 19, - 0, 0, 0, 0, 0, 0, 20, 0, 0, 21, - 22, 274, 23, 0, 24, 4, 5, 6, 7, 8, - 9, 0, 0, 0, 0, 0, 10, 0, 0, 0, - 11, 0, 0, 0, 12, 13, 0, 0, 0, 14, - 0, 15, 16, 17, 0, 0, 4, 5, 6, 7, - 8, 9, 0, 18, 86, 87, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 19, 0, 0, 0, 89, - 0, 0, 20, 16, 17, 21, 22, 0, 23, 0, - 24, 0, 97, 98, 18, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 102, 103, 104, 105, 106, 107, - 108, 0, 109, 20, 0, 225, 21, 22, 226, 23, - 227, 24, 52, 0, 0, 0, 0, 0, 60, 61, - 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, - 72, 73, 74, 75, 76, 77, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 18, 85, 86, 87, - 88, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 89, 90, 228, 0, 0, 0, 0, - 91, 92, 93, 94, 95, 96, 97, 98, 0, 0, - 0, 85, 86, 87, 88, 99, 100, 101, 102, 103, - 104, 105, 106, 107, 108, 0, 109, 89, 90, 0, - 241, 0, 0, 242, 91, 92, 93, 94, 95, 96, - 97, 98, 0, 0, 0, 85, 86, 87, 88, 99, - 100, 101, 102, 103, 104, 105, 106, 107, 108, 0, - 109, 89, 90, 0, 0, 0, 0, 141, 91, 92, - 93, 94, 95, 96, 97, 98, 0, 0, 0, 85, - 86, 87, 88, 99, 100, 101, 102, 103, 104, 105, - 106, 107, 108, 0, 109, 89, 90, 0, 0, 0, - 0, 272, 91, 92, 93, 94, 95, 96, 97, 98, - 0, 0, 0, 85, 86, 87, 88, 99, 100, 101, - 102, 103, 104, 105, 106, 107, 108, 0, 109, 89, - 90, 0, 0, 0, 0, 273, 91, 92, 93, 94, - 95, 96, 97, 98, 0, 0, 0, 85, 86, 87, - 88, 99, 100, 101, 102, 103, 104, 105, 106, 107, - 108, 0, 109, 89, 90, 0, 0, 0, 0, 296, - 91, 92, 93, 94, 95, 96, 97, 98, 0, 0, - 0, 0, 0, 0, 0, 99, 100, 101, 102, 103, - 104, 105, 106, 107, 108, 0, 109, 311, 0, 312, - 85, 86, 87, 88, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 89, 90, 0, 0, - 0, 0, 0, 91, 92, 93, 94, 95, 96, 97, - 98, 0, 0, 0, 85, 86, 87, 88, 99, 100, - 101, 102, 103, 104, 105, 106, 107, 108, 0, 109, - 89, 90, 137, 0, 0, 0, 0, 91, 92, 93, - 94, 95, 96, 97, 98, 0, 0, 0, 85, 86, - 87, 88, 99, 100, 101, 102, 103, 104, 105, 106, - 107, 108, 0, 109, 89, 90, 217, 0, 0, 0, - 0, 91, 92, 93, 94, 95, 96, 97, 98, 0, - 0, 0, 85, 86, 87, 88, 99, 100, 101, 102, - 103, 104, 105, 106, 107, 108, 0, 109, 89, 90, - 289, 0, 0, 0, 0, 91, 92, 93, 94, 95, - 96, 97, 98, 0, 0, 0, 85, 86, 87, 88, - 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, - 0, 109, 89, 90, 310, 0, 0, 0, 0, 91, - 92, 93, 94, 95, 96, 97, 98, 0, 0, 0, - 85, 86, 87, 88, 99, 100, 101, 102, 103, 104, - 105, 106, 107, 108, 0, 109, 89, 90, 314, 0, - 0, 0, 0, 91, 92, 93, 94, 95, 96, 97, - 98, 0, 0, 0, 0, 0, 0, 0, 99, 100, - 101, 102, 103, 104, 105, 106, 107, 108, 0, 109, - 110, 85, 86, 87, 88, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 89, 90, 0, - 0, 0, 0, 0, 91, 92, 93, 94, 95, 96, - 97, 98, 0, 0, 0, 0, 0, 0, 0, 99, - 100, 101, 102, 103, 104, 105, 106, 107, 108, 0, - 109, 195, 85, 86, 87, 88, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 89, 90, - 0, 0, 0, 0, 0, 91, 92, 93, 94, 95, - 96, 97, 98, 0, 0, 0, 0, 0, 0, 0, - 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, - 0, 109, 248, 85, 86, 87, 88, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 89, - 90, 0, 0, 0, 0, 0, 91, 92, 93, 94, - 95, 96, 97, 98, 0, 0, 0, 0, 0, 0, - 0, 99, 100, 101, 102, 103, 104, 105, 106, 107, - 108, 0, 109, 300, 85, 86, 87, 88, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 89, 90, 0, 0, 0, 0, 0, 91, 92, 93, - 94, 95, 96, 97, 98, 0, 0, 0, 0, 0, - 0, 0, 99, 100, 101, 102, 103, 104, 105, 106, - 107, 108, 0, 109, 301, 85, 86, 87, 88, 0, + 20, 0, 228, 21, 22, 229, 23, 230, 24, 53, + 0, 0, 0, 0, 0, 61, 62, 63, 64, 65, + 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, + 76, 77, 78, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 18, 86, 87, 88, 89, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 89, 90, 0, 0, 0, 0, 0, 91, 92, - 93, 94, 95, 96, 97, 98, 0, 0, 0, 0, - 0, 0, 0, 99, 100, 101, 102, 103, 104, 105, - 106, 107, 108, 0, 109, 304, 85, 86, 87, 88, - 0, 0, 0, 0, 0, 0, 0, 249, 250, 0, - 0, 251, 89, 90, 0, 0, 0, 0, 0, 91, - 92, 93, 94, 95, 96, 97, 98, 0, 0, 0, - 0, 0, 0, 0, 99, 100, 101, 102, 103, 104, - 105, 106, 107, 108, 0, 109, 85, 86, 87, 88, - 0, 0, 0, 0, 0, 0, 131, 0, 0, 0, - 0, 0, 89, 90, 0, 0, 0, 0, 0, 91, - 92, 93, 94, 95, 96, 97, 98, 0, 0, 0, - 85, 86, 87, 88, 99, 100, 101, 102, 103, 104, - 105, 106, 107, 108, 0, 109, 89, 90, 0, 0, - 0, 0, 0, 91, 92, 93, 94, 95, 96, 97, - 98, 0, 0, 0, 0, 258, 0, 0, 99, 100, - 101, 102, 103, 104, 105, 106, 107, 108, 0, 109, - 85, 86, 87, 88, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 298, 89, 90, 0, 0, - 0, 0, 0, 91, 92, 93, 94, 95, 96, 97, - 98, 0, 0, 0, 0, 0, 0, 0, 99, 100, - 101, 102, 103, 104, 105, 106, 107, 108, 0, 109, - 85, 86, 87, 88, 0, 0, 0, 0, 0, 0, - 299, 0, 0, 0, 0, 0, 89, 90, 0, 0, - 0, 0, 0, 91, 92, 93, 94, 95, 96, 97, - 98, 0, 0, 0, 85, 86, 87, 88, 99, 100, - 101, 102, 103, 104, 105, 106, 107, 108, 0, 109, - 89, 90, 0, 0, 0, 0, 0, 91, 92, 93, - 94, 95, 96, 97, 98, 0, 0, 0, 85, 86, - 87, 88, 99, 100, 101, 102, 103, 104, 105, 106, - 107, 108, 0, 109, 89, 90, 0, 0, 0, 0, - 0, 91, 92, 93, 94, 95, 96, 97, 98, 0, - 0, 0, -156, 86, 87, 0, 0, 0, 101, 102, - 103, 104, 105, 106, 107, 108, 0, 109, 89, 90, - 0, 0, 0, 0, 0, -156, -156, -156, -156, -156, - -156, 97, 98, 0, 0, 0, 0, 0, 0, 0, - 0, 0, -156, 102, 103, 104, 105, 106, 107, 108, - 0, 109 + 90, 91, 231, 0, 0, 0, 0, 92, 93, 94, + 95, 96, 97, 98, 99, 0, 0, 0, 86, 87, + 88, 89, 100, 101, 102, 103, 104, 105, 106, 107, + 108, 109, 0, 110, 90, 91, 0, 244, 0, 0, + 245, 92, 93, 94, 95, 96, 97, 98, 99, 0, + 0, 0, 86, 87, 88, 89, 100, 101, 102, 103, + 104, 105, 106, 107, 108, 109, 0, 110, 90, 91, + 0, 0, 0, 0, 143, 92, 93, 94, 95, 96, + 97, 98, 99, 0, 0, 0, 86, 87, 88, 89, + 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, + 0, 110, 90, 91, 0, 0, 0, 0, 276, 92, + 93, 94, 95, 96, 97, 98, 99, 0, 0, 0, + 86, 87, 88, 89, 100, 101, 102, 103, 104, 105, + 106, 107, 108, 109, 0, 110, 90, 91, 0, 0, + 0, 0, 277, 92, 93, 94, 95, 96, 97, 98, + 99, 0, 0, 0, 86, 87, 88, 89, 100, 101, + 102, 103, 104, 105, 106, 107, 108, 109, 0, 110, + 90, 91, 0, 0, 0, 0, 300, 92, 93, 94, + 95, 96, 97, 98, 99, 0, 0, 0, 0, 0, + 0, 0, 100, 101, 102, 103, 104, 105, 106, 107, + 108, 109, 0, 110, 315, 0, 316, 86, 87, 88, + 89, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 90, 91, 0, 0, 0, 0, 0, + 92, 93, 94, 95, 96, 97, 98, 99, 0, 0, + 0, 86, 87, 88, 89, 100, 101, 102, 103, 104, + 105, 106, 107, 108, 109, 0, 110, 90, 91, 139, + 0, 0, 0, 0, 92, 93, 94, 95, 96, 97, + 98, 99, 0, 0, 0, 86, 87, 88, 89, 100, + 101, 102, 103, 104, 105, 106, 107, 108, 109, 0, + 110, 90, 91, 220, 0, 0, 0, 0, 92, 93, + 94, 95, 96, 97, 98, 99, 0, 0, 0, 86, + 87, 88, 89, 100, 101, 102, 103, 104, 105, 106, + 107, 108, 109, 0, 110, 90, 91, 293, 0, 0, + 0, 0, 92, 93, 94, 95, 96, 97, 98, 99, + 0, 0, 0, 86, 87, 88, 89, 100, 101, 102, + 103, 104, 105, 106, 107, 108, 109, 0, 110, 90, + 91, 314, 0, 0, 0, 0, 92, 93, 94, 95, + 96, 97, 98, 99, 0, 0, 0, 86, 87, 88, + 89, 100, 101, 102, 103, 104, 105, 106, 107, 108, + 109, 0, 110, 90, 91, 318, 0, 0, 0, 0, + 92, 93, 94, 95, 96, 97, 98, 99, 0, 0, + 0, 0, 0, 0, 0, 100, 101, 102, 103, 104, + 105, 106, 107, 108, 109, 0, 110, 111, 86, 87, + 88, 89, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 90, 91, 0, 0, 0, 0, + 0, 92, 93, 94, 95, 96, 97, 98, 99, 0, + 0, 0, 0, 0, 0, 0, 100, 101, 102, 103, + 104, 105, 106, 107, 108, 109, 0, 110, 197, 86, + 87, 88, 89, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 90, 91, 0, 0, 0, + 0, 0, 92, 93, 94, 95, 96, 97, 98, 99, + 0, 0, 0, 0, 0, 0, 0, 100, 101, 102, + 103, 104, 105, 106, 107, 108, 109, 0, 110, 251, + 86, 87, 88, 89, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 90, 91, 0, 0, + 0, 0, 0, 92, 93, 94, 95, 96, 97, 98, + 99, 0, 0, 0, 0, 0, 0, 0, 100, 101, + 102, 103, 104, 105, 106, 107, 108, 109, 0, 110, + 252, 86, 87, 88, 89, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 90, 91, 0, + 0, 0, 0, 0, 92, 93, 94, 95, 96, 97, + 98, 99, 0, 0, 0, 0, 0, 0, 0, 100, + 101, 102, 103, 104, 105, 106, 107, 108, 109, 0, + 110, 304, 86, 87, 88, 89, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 90, 91, + 0, 0, 0, 0, 0, 92, 93, 94, 95, 96, + 97, 98, 99, 0, 0, 0, 0, 0, 0, 0, + 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, + 0, 110, 305, 86, 87, 88, 89, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 90, + 91, 0, 0, 0, 0, 0, 92, 93, 94, 95, + 96, 97, 98, 99, 0, 0, 0, 0, 0, 0, + 0, 100, 101, 102, 103, 104, 105, 106, 107, 108, + 109, 0, 110, 308, 86, 87, 88, 89, 0, 0, + 0, 0, 0, 0, 0, 253, 254, 0, 0, 255, + 90, 91, 0, 0, 0, 0, 0, 92, 93, 94, + 95, 96, 97, 98, 99, 0, 0, 0, 0, 0, + 0, 0, 100, 101, 102, 103, 104, 105, 106, 107, + 108, 109, 0, 110, 86, 87, 88, 89, 0, 0, + 0, 0, 0, 0, 133, 0, 0, 0, 0, 0, + 90, 91, 0, 0, 0, 0, 0, 92, 93, 94, + 95, 96, 97, 98, 99, 0, 0, 0, 86, 87, + 88, 89, 100, 101, 102, 103, 104, 105, 106, 107, + 108, 109, 0, 110, 90, 91, 0, 0, 0, 0, + 0, 92, 93, 94, 95, 96, 97, 98, 99, 0, + 0, 0, 0, 262, 0, 0, 100, 101, 102, 103, + 104, 105, 106, 107, 108, 109, 0, 110, 86, 87, + 88, 89, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 302, 90, 91, 0, 0, 0, 0, + 0, 92, 93, 94, 95, 96, 97, 98, 99, 0, + 0, 0, 0, 0, 0, 0, 100, 101, 102, 103, + 104, 105, 106, 107, 108, 109, 0, 110, 86, 87, + 88, 89, 0, 0, 0, 0, 0, 0, 303, 0, + 0, 0, 0, 0, 90, 91, 0, 0, 0, 0, + 0, 92, 93, 94, 95, 96, 97, 98, 99, 0, + 0, 0, 86, 87, 88, 89, 100, 101, 102, 103, + 104, 105, 106, 107, 108, 109, 0, 110, 90, 91, + 0, 0, 0, 0, 0, 92, 93, 94, 95, 96, + 97, 98, 99, 0, 0, 0, 86, 87, 88, 89, + 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, + 0, 110, 90, 91, 0, 0, 0, 0, 0, 92, + 93, 94, 95, 96, 97, 98, 99, 0, 0, 0, + -157, 87, 88, 0, 0, 0, 102, 103, 104, 105, + 106, 107, 108, 109, 0, 110, 90, 91, 0, 0, + 0, 0, 0, -157, -157, -157, -157, -157, -157, 98, + 99, 0, 0, 0, 0, 0, 0, 0, 0, 0, + -157, 103, 104, 105, 106, 107, 108, 109, 0, 110 }; static const yytype_int16 yycheck[] = { - 1, 6, 16, 1, 8, 5, 12, 13, 6, 8, - 11, 49, 49, 14, 21, 0, 23, 5, 19, 20, - 33, 22, 5, 49, 31, 32, 14, 183, 61, 66, - 68, 14, 33, 42, 35, 36, 59, 63, 42, 49, - 142, 4, 68, 42, 145, 146, 6, 148, 149, 151, - 61, 69, 63, 63, 5, 29, 43, 44, 48, 46, - 65, 65, 67, 14, 64, 65, 132, 133, 182, 55, - 56, 57, 4, 59, 6, 1, 64, 65, 79, 17, - 18, 64, 65, 62, 85, 86, 87, 88, 89, 90, + 1, 147, 148, 6, 150, 151, 12, 13, 8, 8, + 11, 5, 49, 14, 21, 0, 23, 49, 19, 20, + 33, 22, 5, 49, 31, 32, 185, 49, 1, 66, + 144, 14, 33, 6, 35, 36, 68, 63, 16, 153, + 4, 63, 42, 42, 8, 61, 68, 55, 56, 57, + 59, 59, 43, 44, 4, 46, 6, 61, 5, 63, + 17, 18, 65, 5, 67, 65, 42, 14, 184, 215, + 64, 65, 14, 60, 4, 62, 6, 6, 60, 80, + 62, 64, 65, 134, 135, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, - 101, 102, 103, 104, 105, 106, 107, 108, 115, 122, - 266, 212, 59, 64, 65, 116, 60, 66, 62, 233, - 4, 60, 6, 62, 11, 12, 63, 63, 63, 130, - 131, 49, 63, 134, 135, 142, 69, 143, 68, 145, - 146, 14, 148, 149, 151, 259, 59, 261, 262, 263, - 6, 265, 39, 40, 268, 256, 257, 59, 41, 48, - 41, 59, 66, 59, 51, 52, 53, 54, 55, 56, - 57, 61, 59, 61, 48, 41, 183, 178, 63, 122, - 32, 63, 59, 63, 63, 63, 187, 63, 302, 190, - 59, 63, 59, 63, 1, 196, 59, 4, 5, 6, - 7, 8, 9, 34, 59, 59, 212, 246, 15, 305, - 266, -1, 19, -1, 196, -1, 23, 24, -1, -1, - -1, 28, -1, 30, 31, 32, -1, 228, -1, -1, - -1, -1, -1, 234, -1, 42, -1, -1, -1, -1, - 241, -1, -1, -1, -1, -1, -1, 54, 249, 250, - 256, 257, 253, 254, 61, -1, -1, 64, 65, 266, - 67, -1, 69, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 278, -1, -1, - -1, -1, 0, 1, -1, -1, 4, 5, -1, -1, - 8, -1, 10, 11, 12, 13, 14, -1, 299, 300, - 301, -1, 20, 21, 22, -1, -1, 25, 26, 27, - 311, 29, -1, -1, -1, 33, 34, 35, 36, 37, - 38, 39, 40, -1, 42, -1, -1, 45, -1, -1, - 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, - -1, 59, 60, -1, 62, 63, 64, 65, 66, 1, - 68, -1, 4, 5, 6, 7, 8, 9, -1, -1, - -1, -1, -1, 15, -1, -1, -1, 19, -1, -1, - -1, 23, 24, -1, -1, -1, 28, -1, 30, 31, - 32, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 42, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 54, -1, -1, -1, -1, -1, -1, 61, - -1, 63, 64, 65, 66, 67, 1, 69, -1, 4, - 5, 6, 7, 8, 9, -1, -1, -1, -1, -1, - 15, -1, -1, -1, 19, -1, -1, -1, 23, 24, - -1, -1, -1, 28, -1, 30, 31, 32, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 42, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 54, - -1, -1, -1, -1, -1, -1, 61, -1, -1, 64, - 65, 66, 67, 1, 69, -1, 4, 5, 6, 7, + 101, 102, 103, 104, 105, 106, 107, 108, 109, 116, + 123, 270, 63, 69, 260, 261, 117, 64, 65, 29, + 236, 48, 64, 65, 62, 1, 59, 66, 63, 63, + 131, 132, 133, 49, 14, 136, 137, 144, 63, 145, + 63, 147, 148, 69, 150, 151, 153, 263, 68, 265, + 266, 267, 59, 269, 1, 6, 272, 4, 5, 6, + 7, 8, 9, 59, 41, 48, 41, 59, 15, 66, + 59, 61, 19, 61, 48, 59, 23, 24, 185, 180, + 59, 28, 63, 30, 31, 32, 41, 59, 189, 34, + 306, 192, 63, 63, 63, 42, 63, 198, 63, 63, + 59, 4, 5, 6, 7, 8, 9, 54, 123, 215, + 59, 63, 32, 59, 61, 249, 63, 64, 65, 66, + 67, 309, 69, 198, 270, -1, -1, -1, 31, 32, + 231, 11, 12, -1, -1, -1, 237, -1, -1, 42, + -1, -1, -1, 244, -1, -1, 26, -1, -1, -1, + -1, 54, 253, 254, 260, 261, 257, 258, 61, 39, + 40, 64, 65, 270, 67, -1, 69, -1, -1, -1, + -1, 51, 52, 53, 54, 55, 56, 57, -1, 59, + -1, 282, -1, -1, -1, -1, 0, 1, -1, -1, + 4, 5, -1, -1, 8, -1, 10, 11, 12, 13, + 14, -1, 303, 304, 305, -1, 20, 21, 22, -1, + -1, 25, 26, 27, 315, 29, -1, -1, -1, 33, + 34, 35, 36, 37, 38, 39, 40, -1, 42, -1, + -1, 45, -1, -1, 48, 49, 50, 51, 52, 53, + 54, 55, 56, 57, -1, 59, 60, -1, 62, 63, + 64, 65, 66, 1, 68, -1, 4, 5, 6, 7, 8, 9, -1, -1, -1, -1, -1, 15, -1, -1, -1, 19, -1, -1, -1, 23, 24, -1, -1, -1, - 28, -1, 30, 31, 32, -1, -1, 4, 5, 6, - 7, 8, 9, -1, 42, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 1, -1, 54, 4, 5, 6, - 7, 8, 9, 61, 31, 32, 64, 65, 15, 67, - -1, 69, 19, -1, -1, 42, 23, 24, -1, -1, - -1, 28, -1, 30, 31, 32, -1, 54, -1, -1, - -1, -1, -1, -1, 61, 42, -1, 64, 65, -1, - 67, -1, 69, -1, -1, -1, -1, 54, -1, -1, - -1, -1, -1, -1, 61, -1, 1, 64, 65, 4, - 67, 6, 69, 8, -1, 11, 12, -1, -1, 14, - 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, - 25, 26, 27, 28, 29, 30, 31, 32, -1, -1, - -1, -1, -1, 39, 40, -1, -1, 42, -1, -1, - -1, -1, -1, -1, -1, 51, 52, 53, 54, 55, - 56, 57, 1, 59, -1, 4, 61, 6, -1, 8, - -1, -1, -1, 68, -1, 14, 15, 16, 17, 18, - 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, - 29, 30, 31, 32, -1, -1, -1, 4, 5, 6, - 7, 8, 9, 42, -1, -1, -1, -1, 15, -1, - -1, -1, 19, -1, -1, -1, 23, 24, -1, -1, - -1, 28, 61, 30, 31, 32, -1, -1, -1, 68, - -1, -1, -1, -1, -1, 42, -1, -1, -1, -1, + 28, -1, 30, 31, 32, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 42, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 54, -1, -1, -1, + -1, -1, -1, 61, -1, -1, 64, 65, 66, 67, + 1, 69, -1, 4, 5, 6, 7, 8, 9, -1, + -1, -1, -1, -1, 15, -1, -1, -1, 19, -1, + -1, -1, 23, 24, -1, -1, -1, 28, -1, 30, + 31, 32, -1, -1, 4, 5, 6, 7, 8, 9, + -1, 42, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 1, -1, 54, 4, 5, 6, 7, 8, 9, + 61, 31, 32, 64, 65, 15, 67, -1, 69, 19, + -1, -1, 42, 23, 24, -1, -1, -1, 28, -1, + 30, 31, 32, -1, -1, -1, -1, -1, -1, -1, + -1, 61, 42, -1, 64, 65, -1, 67, -1, 69, + -1, -1, 1, -1, 54, 4, 5, 6, 7, 8, + 9, 61, -1, -1, 64, 65, 15, 67, -1, 69, + 19, -1, -1, -1, 23, 24, -1, -1, -1, 28, + -1, 30, 31, 32, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 42, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 54, -1, -1, -1, -1, + -1, -1, 61, -1, 1, 64, 65, 4, 67, 6, + 69, 8, -1, 11, 12, -1, -1, 14, 15, 16, + 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, + 27, 28, 29, 30, 31, 32, -1, -1, -1, -1, + -1, 39, 40, -1, -1, 42, -1, -1, -1, -1, + -1, -1, -1, 51, 52, 53, 54, 55, 56, 57, + 1, 59, -1, 4, 61, 6, -1, 8, -1, -1, + -1, 68, -1, 14, 15, 16, 17, 18, 19, 20, + 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, + 31, 32, -1, -1, -1, 4, 5, 6, 7, 8, + 9, 42, -1, -1, -1, -1, 15, -1, -1, -1, + 19, -1, -1, -1, 23, 24, -1, -1, -1, 28, + 61, 30, 31, 32, -1, -1, -1, 68, -1, -1, + -1, -1, -1, 42, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 54, -1, -1, -1, -1, + -1, 60, 61, -1, -1, 64, 65, -1, 67, -1, + 69, 4, 5, 6, 7, 8, 9, -1, -1, -1, + -1, -1, 15, -1, -1, -1, 19, -1, -1, -1, + 23, 24, -1, -1, -1, 28, -1, 30, 31, 32, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 42, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 54, -1, -1, -1, -1, 11, 12, 61, -1, + -1, 64, 65, 66, 67, -1, 69, 4, 5, 6, + 7, 8, 9, -1, -1, -1, -1, -1, 15, -1, + -1, -1, 19, -1, 39, 40, 23, 24, -1, -1, + -1, 28, -1, 30, 31, 32, 51, 52, 53, 54, + 55, 56, 57, -1, 59, 42, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 54, -1, -1, - -1, -1, -1, 60, 61, -1, -1, 64, 65, -1, + -1, -1, -1, -1, 61, -1, -1, 64, 65, 66, 67, -1, 69, 4, 5, 6, 7, 8, 9, -1, -1, -1, -1, -1, 15, -1, -1, -1, 19, -1, -1, -1, 23, 24, -1, -1, -1, 28, -1, 30, 31, 32, -1, -1, -1, -1, -1, -1, -1, -1, -1, 42, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 54, -1, -1, -1, -1, -1, -1, - 61, -1, -1, 64, 65, 66, 67, -1, 69, 4, - 5, 6, 7, 8, 9, -1, -1, -1, -1, -1, - 15, -1, -1, -1, 19, -1, -1, -1, 23, 24, - -1, -1, -1, 28, -1, 30, 31, 32, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 42, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 54, - -1, -1, -1, -1, -1, -1, 61, -1, -1, 64, - 65, 66, 67, -1, 69, 4, 5, 6, 7, 8, - 9, -1, -1, -1, -1, -1, 15, -1, -1, -1, - 19, -1, -1, -1, 23, 24, -1, -1, -1, 28, - -1, 30, 31, 32, -1, -1, 4, 5, 6, 7, - 8, 9, -1, 42, 11, 12, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 54, -1, -1, -1, 26, - -1, -1, 61, 31, 32, 64, 65, -1, 67, -1, - 69, -1, 39, 40, 42, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 51, 52, 53, 54, 55, 56, - 57, -1, 59, 61, -1, 1, 64, 65, 4, 67, - 6, 69, 8, -1, -1, -1, -1, -1, 14, 15, - 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, - 26, 27, 28, 29, 30, 31, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 42, 10, 11, 12, + 61, -1, 1, 64, 65, 4, 67, 6, 69, 8, + -1, -1, -1, -1, -1, 14, 15, 16, 17, 18, + 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, + 29, 30, 31, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 42, 10, 11, 12, 13, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 26, 27, 61, -1, -1, -1, -1, 33, 34, 35, + 36, 37, 38, 39, 40, -1, -1, -1, 10, 11, + 12, 13, 48, 49, 50, 51, 52, 53, 54, 55, + 56, 57, -1, 59, 26, 27, -1, 63, -1, -1, + 66, 33, 34, 35, 36, 37, 38, 39, 40, -1, + -1, -1, 10, 11, 12, 13, 48, 49, 50, 51, + 52, 53, 54, 55, 56, 57, -1, 59, 26, 27, + -1, -1, -1, -1, 66, 33, 34, 35, 36, 37, + 38, 39, 40, -1, -1, -1, 10, 11, 12, 13, + 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, + -1, 59, 26, 27, -1, -1, -1, -1, 66, 33, + 34, 35, 36, 37, 38, 39, 40, -1, -1, -1, + 10, 11, 12, 13, 48, 49, 50, 51, 52, 53, + 54, 55, 56, 57, -1, 59, 26, 27, -1, -1, + -1, -1, 66, 33, 34, 35, 36, 37, 38, 39, + 40, -1, -1, -1, 10, 11, 12, 13, 48, 49, + 50, 51, 52, 53, 54, 55, 56, 57, -1, 59, + 26, 27, -1, -1, -1, -1, 66, 33, 34, 35, + 36, 37, 38, 39, 40, -1, -1, -1, -1, -1, + -1, -1, 48, 49, 50, 51, 52, 53, 54, 55, + 56, 57, -1, 59, 60, -1, 62, 10, 11, 12, 13, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 26, 27, 61, -1, -1, -1, -1, + -1, -1, -1, 26, 27, -1, -1, -1, -1, -1, 33, 34, 35, 36, 37, 38, 39, 40, -1, -1, -1, 10, 11, 12, 13, 48, 49, 50, 51, 52, - 53, 54, 55, 56, 57, -1, 59, 26, 27, -1, - 63, -1, -1, 66, 33, 34, 35, 36, 37, 38, + 53, 54, 55, 56, 57, -1, 59, 26, 27, 62, + -1, -1, -1, -1, 33, 34, 35, 36, 37, 38, 39, 40, -1, -1, -1, 10, 11, 12, 13, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, -1, - 59, 26, 27, -1, -1, -1, -1, 66, 33, 34, + 59, 26, 27, 62, -1, -1, -1, -1, 33, 34, 35, 36, 37, 38, 39, 40, -1, -1, -1, 10, 11, 12, 13, 48, 49, 50, 51, 52, 53, 54, - 55, 56, 57, -1, 59, 26, 27, -1, -1, -1, - -1, 66, 33, 34, 35, 36, 37, 38, 39, 40, + 55, 56, 57, -1, 59, 26, 27, 62, -1, -1, + -1, -1, 33, 34, 35, 36, 37, 38, 39, 40, -1, -1, -1, 10, 11, 12, 13, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, -1, 59, 26, - 27, -1, -1, -1, -1, 66, 33, 34, 35, 36, + 27, 62, -1, -1, -1, -1, 33, 34, 35, 36, 37, 38, 39, 40, -1, -1, -1, 10, 11, 12, 13, 48, 49, 50, 51, 52, 53, 54, 55, 56, - 57, -1, 59, 26, 27, -1, -1, -1, -1, 66, + 57, -1, 59, 26, 27, 62, -1, -1, -1, -1, 33, 34, 35, 36, 37, 38, 39, 40, -1, -1, -1, -1, -1, -1, -1, 48, 49, 50, 51, 52, - 53, 54, 55, 56, 57, -1, 59, 60, -1, 62, + 53, 54, 55, 56, 57, -1, 59, 60, 10, 11, + 12, 13, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 26, 27, -1, -1, -1, -1, + -1, 33, 34, 35, 36, 37, 38, 39, 40, -1, + -1, -1, -1, -1, -1, -1, 48, 49, 50, 51, + 52, 53, 54, 55, 56, 57, -1, 59, 60, 10, + 11, 12, 13, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 26, 27, -1, -1, -1, + -1, -1, 33, 34, 35, 36, 37, 38, 39, 40, + -1, -1, -1, -1, -1, -1, -1, 48, 49, 50, + 51, 52, 53, 54, 55, 56, 57, -1, 59, 60, 10, 11, 12, 13, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 26, 27, -1, -1, -1, -1, -1, 33, 34, 35, 36, 37, 38, 39, - 40, -1, -1, -1, 10, 11, 12, 13, 48, 49, - 50, 51, 52, 53, 54, 55, 56, 57, -1, 59, - 26, 27, 62, -1, -1, -1, -1, 33, 34, 35, - 36, 37, 38, 39, 40, -1, -1, -1, 10, 11, - 12, 13, 48, 49, 50, 51, 52, 53, 54, 55, - 56, 57, -1, 59, 26, 27, 62, -1, -1, -1, - -1, 33, 34, 35, 36, 37, 38, 39, 40, -1, - -1, -1, 10, 11, 12, 13, 48, 49, 50, 51, - 52, 53, 54, 55, 56, 57, -1, 59, 26, 27, - 62, -1, -1, -1, -1, 33, 34, 35, 36, 37, - 38, 39, 40, -1, -1, -1, 10, 11, 12, 13, - 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, - -1, 59, 26, 27, 62, -1, -1, -1, -1, 33, - 34, 35, 36, 37, 38, 39, 40, -1, -1, -1, - 10, 11, 12, 13, 48, 49, 50, 51, 52, 53, - 54, 55, 56, 57, -1, 59, 26, 27, 62, -1, - -1, -1, -1, 33, 34, 35, 36, 37, 38, 39, 40, -1, -1, -1, -1, -1, -1, -1, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, -1, 59, 60, 10, 11, 12, 13, -1, -1, -1, -1, -1, @@ -1477,50 +1485,39 @@ static const yytype_int16 yycheck[] = 37, 38, 39, 40, -1, -1, -1, -1, -1, -1, -1, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, -1, 59, 60, 10, 11, 12, 13, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 21, 22, -1, -1, 25, 26, 27, -1, -1, -1, -1, -1, 33, 34, 35, 36, 37, 38, 39, 40, -1, -1, -1, -1, -1, -1, -1, 48, 49, 50, 51, 52, 53, 54, 55, - 56, 57, -1, 59, 60, 10, 11, 12, 13, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 26, 27, -1, -1, -1, -1, -1, 33, 34, - 35, 36, 37, 38, 39, 40, -1, -1, -1, -1, - -1, -1, -1, 48, 49, 50, 51, 52, 53, 54, - 55, 56, 57, -1, 59, 60, 10, 11, 12, 13, - -1, -1, -1, -1, -1, -1, -1, 21, 22, -1, - -1, 25, 26, 27, -1, -1, -1, -1, -1, 33, - 34, 35, 36, 37, 38, 39, 40, -1, -1, -1, - -1, -1, -1, -1, 48, 49, 50, 51, 52, 53, - 54, 55, 56, 57, -1, 59, 10, 11, 12, 13, - -1, -1, -1, -1, -1, -1, 20, -1, -1, -1, - -1, -1, 26, 27, -1, -1, -1, -1, -1, 33, - 34, 35, 36, 37, 38, 39, 40, -1, -1, -1, - 10, 11, 12, 13, 48, 49, 50, 51, 52, 53, - 54, 55, 56, 57, -1, 59, 26, 27, -1, -1, - -1, -1, -1, 33, 34, 35, 36, 37, 38, 39, - 40, -1, -1, -1, -1, 45, -1, -1, 48, 49, - 50, 51, 52, 53, 54, 55, 56, 57, -1, 59, - 10, 11, 12, 13, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 25, 26, 27, -1, -1, - -1, -1, -1, 33, 34, 35, 36, 37, 38, 39, - 40, -1, -1, -1, -1, -1, -1, -1, 48, 49, - 50, 51, 52, 53, 54, 55, 56, 57, -1, 59, - 10, 11, 12, 13, -1, -1, -1, -1, -1, -1, - 20, -1, -1, -1, -1, -1, 26, 27, -1, -1, - -1, -1, -1, 33, 34, 35, 36, 37, 38, 39, - 40, -1, -1, -1, 10, 11, 12, 13, 48, 49, - 50, 51, 52, 53, 54, 55, 56, 57, -1, 59, + 56, 57, -1, 59, 10, 11, 12, 13, -1, -1, + -1, -1, -1, -1, 20, -1, -1, -1, -1, -1, 26, 27, -1, -1, -1, -1, -1, 33, 34, 35, 36, 37, 38, 39, 40, -1, -1, -1, 10, 11, 12, 13, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, -1, 59, 26, 27, -1, -1, -1, -1, -1, 33, 34, 35, 36, 37, 38, 39, 40, -1, - -1, -1, 10, 11, 12, -1, -1, -1, 50, 51, + -1, -1, -1, 45, -1, -1, 48, 49, 50, 51, + 52, 53, 54, 55, 56, 57, -1, 59, 10, 11, + 12, 13, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 25, 26, 27, -1, -1, -1, -1, + -1, 33, 34, 35, 36, 37, 38, 39, 40, -1, + -1, -1, -1, -1, -1, -1, 48, 49, 50, 51, + 52, 53, 54, 55, 56, 57, -1, 59, 10, 11, + 12, 13, -1, -1, -1, -1, -1, -1, 20, -1, + -1, -1, -1, -1, 26, 27, -1, -1, -1, -1, + -1, 33, 34, 35, 36, 37, 38, 39, 40, -1, + -1, -1, 10, 11, 12, 13, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, -1, 59, 26, 27, -1, -1, -1, -1, -1, 33, 34, 35, 36, 37, - 38, 39, 40, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 50, 51, 52, 53, 54, 55, 56, 57, - -1, 59 + 38, 39, 40, -1, -1, -1, 10, 11, 12, 13, + 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, + -1, 59, 26, 27, -1, -1, -1, -1, -1, 33, + 34, 35, 36, 37, 38, 39, 40, -1, -1, -1, + 10, 11, 12, -1, -1, -1, 50, 51, 52, 53, + 54, 55, 56, 57, -1, 59, 26, 27, -1, -1, + -1, -1, -1, 33, 34, 35, 36, 37, 38, 39, + 40, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 50, 51, 52, 53, 54, 55, 56, 57, -1, 59 }; /* YYSTOS[STATE-NUM] -- The symbol kind of the accessing symbol of @@ -1531,34 +1528,34 @@ static const yytype_int8 yystos[] = 15, 19, 23, 24, 28, 30, 31, 32, 42, 54, 61, 64, 65, 67, 69, 75, 79, 82, 83, 87, 0, 17, 18, 73, 76, 77, 61, 59, 42, 4, - 75, 87, 87, 75, 6, 1, 6, 75, 1, 75, - 1, 4, 8, 83, 1, 66, 75, 1, 4, 6, - 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, - 24, 25, 26, 27, 28, 29, 30, 31, 32, 61, - 83, 96, 97, 98, 69, 10, 11, 12, 13, 26, - 27, 33, 34, 35, 36, 37, 38, 39, 40, 48, - 49, 50, 51, 52, 53, 54, 55, 56, 57, 59, - 60, 75, 84, 5, 14, 64, 65, 78, 83, 78, - 74, 75, 79, 73, 60, 75, 75, 88, 89, 61, - 63, 20, 14, 14, 29, 48, 62, 62, 1, 59, - 66, 66, 49, 63, 68, 63, 63, 75, 63, 63, - 68, 49, 69, 75, 75, 75, 75, 75, 75, 75, + 8, 75, 87, 87, 75, 6, 1, 6, 75, 1, + 75, 1, 4, 8, 83, 1, 66, 75, 1, 4, + 6, 14, 15, 16, 17, 18, 19, 20, 21, 22, + 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, + 61, 83, 96, 97, 98, 69, 10, 11, 12, 13, + 26, 27, 33, 34, 35, 36, 37, 38, 39, 40, + 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, + 59, 60, 75, 84, 5, 14, 64, 65, 78, 83, + 78, 74, 75, 79, 73, 60, 75, 75, 88, 89, + 61, 63, 63, 20, 14, 14, 29, 48, 62, 62, + 1, 59, 66, 66, 49, 63, 68, 63, 63, 75, + 63, 63, 68, 49, 69, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, - 75, 75, 75, 75, 75, 75, 75, 43, 44, 46, - 59, 6, 65, 67, 90, 91, 92, 65, 83, 1, - 63, 66, 75, 14, 74, 60, 60, 62, 4, 6, - 80, 81, 75, 1, 75, 91, 91, 1, 75, 75, - 1, 97, 54, 86, 87, 86, 86, 62, 86, 86, - 97, 6, 75, 92, 93, 1, 4, 6, 61, 83, - 94, 95, 96, 41, 48, 66, 75, 59, 66, 75, - 59, 63, 66, 4, 6, 89, 60, 62, 60, 21, - 22, 25, 85, 61, 61, 86, 48, 63, 45, 49, - 66, 63, 63, 63, 75, 63, 49, 68, 63, 92, - 75, 59, 66, 66, 66, 75, 59, 81, 63, 75, - 75, 75, 75, 86, 86, 92, 92, 92, 92, 62, - 92, 95, 92, 59, 59, 59, 66, 75, 25, 20, - 60, 60, 63, 59, 60, 75, 75, 75, 92, 85, - 62, 60, 62, 75, 62 + 75, 75, 75, 75, 75, 75, 75, 75, 75, 43, + 44, 46, 59, 6, 65, 67, 90, 91, 92, 65, + 83, 1, 63, 66, 75, 14, 74, 60, 60, 62, + 4, 6, 80, 81, 75, 75, 1, 75, 91, 91, + 1, 75, 75, 1, 97, 54, 86, 87, 86, 86, + 62, 86, 86, 97, 6, 75, 92, 93, 1, 4, + 6, 61, 83, 94, 95, 96, 41, 48, 66, 75, + 59, 66, 75, 59, 63, 66, 4, 6, 89, 60, + 62, 60, 60, 21, 22, 25, 85, 61, 61, 86, + 48, 63, 45, 49, 66, 63, 63, 63, 75, 63, + 49, 68, 63, 92, 75, 59, 66, 66, 66, 75, + 59, 81, 63, 75, 75, 75, 75, 86, 86, 92, + 92, 92, 92, 62, 92, 95, 92, 59, 59, 59, + 66, 75, 25, 20, 60, 60, 63, 59, 60, 75, + 75, 75, 92, 85, 62, 60, 62, 75, 62 }; /* YYR1[RULE-NUM] -- Symbol kind of the left-hand side of rule RULE-NUM. */ @@ -1569,18 +1566,19 @@ static const yytype_int8 yyr1[] = 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 76, 76, - 77, 77, 77, 78, 79, 79, 80, 80, 81, 81, - 82, 82, 83, 84, 84, 84, 85, 85, 85, 86, - 86, 86, 87, 87, 87, 87, 87, 87, 87, 87, + 77, 77, 77, 78, 79, 79, 79, 80, 80, 81, + 81, 82, 82, 83, 84, 84, 84, 85, 85, 85, + 86, 86, 86, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, - 87, 87, 87, 87, 87, 87, 88, 88, 89, 90, - 90, 91, 91, 92, 92, 92, 93, 93, 94, 94, - 95, 95, 95, 95, 95, 95, 95, 96, 96, 96, + 87, 87, 87, 87, 87, 87, 87, 88, 88, 89, + 90, 90, 91, 91, 92, 92, 92, 93, 93, 94, + 94, 95, 95, 95, 95, 95, 95, 95, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, - 96, 96, 96, 96, 96, 97, 97, 97, 97, 98, - 98, 98, 98, 98, 98, 98, 98, 98, 98, 98 + 96, 96, 96, 96, 96, 96, 97, 97, 97, 97, + 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, + 98 }; /* YYR2[RULE-NUM] -- Number of symbols on the right-hand side of rule RULE-NUM. */ @@ -1591,18 +1589,19 @@ static const yytype_int8 yyr2[] = 4, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 1, 2, 3, - 4, 4, 2, 1, 5, 8, 1, 3, 1, 1, - 2, 1, 3, 0, 2, 4, 5, 3, 1, 3, - 2, 1, 1, 1, 2, 2, 3, 2, 4, 3, - 2, 1, 3, 2, 2, 3, 5, 4, 6, 5, - 4, 3, 5, 4, 7, 6, 6, 6, 5, 5, - 1, 1, 1, 3, 3, 2, 3, 4, 1, 1, - 1, 4, 3, 3, 4, 3, 1, 3, 1, 3, - 1, 3, 1, 1, 3, 3, 1, 3, 1, 3, - 1, 3, 3, 3, 3, 5, 3, 1, 1, 1, + 4, 4, 2, 1, 5, 8, 5, 1, 3, 1, + 1, 2, 1, 3, 0, 2, 4, 5, 3, 1, + 3, 2, 1, 1, 1, 2, 2, 3, 2, 4, + 3, 2, 1, 3, 2, 2, 3, 5, 4, 6, + 5, 4, 3, 5, 4, 7, 6, 6, 6, 5, + 5, 1, 1, 1, 3, 3, 2, 3, 4, 1, + 1, 1, 4, 3, 3, 4, 3, 1, 3, 1, + 3, 1, 3, 1, 1, 3, 3, 1, 3, 1, + 3, 1, 3, 3, 3, 3, 5, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 0, 1, 3, 3, 3, - 3, 3, 1, 3, 1, 1, 1, 1, 5, 3 + 1, 1, 1, 1, 1, 1, 0, 1, 3, 3, + 3, 3, 3, 1, 3, 1, 1, 1, 1, 5, + 3 }; @@ -2172,199 +2171,199 @@ yydestruct (const char *yymsg, case YYSYMBOL_IDENT: /* IDENT */ #line 37 "src/parser.y" { jv_free(((*yyvaluep).literal)); } -#line 2176 "src/parser.c" +#line 2175 "src/parser.c" break; case YYSYMBOL_FIELD: /* FIELD */ #line 37 "src/parser.y" { jv_free(((*yyvaluep).literal)); } -#line 2182 "src/parser.c" +#line 2181 "src/parser.c" break; case YYSYMBOL_BINDING: /* BINDING */ #line 37 "src/parser.y" { jv_free(((*yyvaluep).literal)); } -#line 2188 "src/parser.c" +#line 2187 "src/parser.c" break; case YYSYMBOL_LITERAL: /* LITERAL */ #line 37 "src/parser.y" { jv_free(((*yyvaluep).literal)); } -#line 2194 "src/parser.c" +#line 2193 "src/parser.c" break; case YYSYMBOL_FORMAT: /* FORMAT */ #line 37 "src/parser.y" { jv_free(((*yyvaluep).literal)); } -#line 2200 "src/parser.c" +#line 2199 "src/parser.c" break; case YYSYMBOL_QQSTRING_TEXT: /* QQSTRING_TEXT */ #line 37 "src/parser.y" { jv_free(((*yyvaluep).literal)); } -#line 2206 "src/parser.c" +#line 2205 "src/parser.c" break; case YYSYMBOL_Module: /* Module */ #line 38 "src/parser.y" { block_free(((*yyvaluep).blk)); } -#line 2212 "src/parser.c" +#line 2211 "src/parser.c" break; case YYSYMBOL_Imports: /* Imports */ #line 38 "src/parser.y" { block_free(((*yyvaluep).blk)); } -#line 2218 "src/parser.c" +#line 2217 "src/parser.c" break; case YYSYMBOL_FuncDefs: /* FuncDefs */ #line 38 "src/parser.y" { block_free(((*yyvaluep).blk)); } -#line 2224 "src/parser.c" +#line 2223 "src/parser.c" break; case YYSYMBOL_Exp: /* Exp */ #line 38 "src/parser.y" { block_free(((*yyvaluep).blk)); } -#line 2230 "src/parser.c" +#line 2229 "src/parser.c" break; case YYSYMBOL_Import: /* Import */ #line 38 "src/parser.y" { block_free(((*yyvaluep).blk)); } -#line 2236 "src/parser.c" +#line 2235 "src/parser.c" break; case YYSYMBOL_ImportWhat: /* ImportWhat */ #line 38 "src/parser.y" { block_free(((*yyvaluep).blk)); } -#line 2242 "src/parser.c" +#line 2241 "src/parser.c" break; case YYSYMBOL_ImportFrom: /* ImportFrom */ #line 38 "src/parser.y" { block_free(((*yyvaluep).blk)); } -#line 2248 "src/parser.c" +#line 2247 "src/parser.c" break; case YYSYMBOL_FuncDef: /* FuncDef */ #line 38 "src/parser.y" { block_free(((*yyvaluep).blk)); } -#line 2254 "src/parser.c" +#line 2253 "src/parser.c" break; case YYSYMBOL_Params: /* Params */ #line 38 "src/parser.y" { block_free(((*yyvaluep).blk)); } -#line 2260 "src/parser.c" +#line 2259 "src/parser.c" break; case YYSYMBOL_Param: /* Param */ #line 38 "src/parser.y" { block_free(((*yyvaluep).blk)); } -#line 2266 "src/parser.c" +#line 2265 "src/parser.c" break; case YYSYMBOL_StringStart: /* StringStart */ #line 37 "src/parser.y" { jv_free(((*yyvaluep).literal)); } -#line 2272 "src/parser.c" +#line 2271 "src/parser.c" break; case YYSYMBOL_String: /* String */ #line 38 "src/parser.y" { block_free(((*yyvaluep).blk)); } -#line 2278 "src/parser.c" +#line 2277 "src/parser.c" break; case YYSYMBOL_QQString: /* QQString */ #line 38 "src/parser.y" { block_free(((*yyvaluep).blk)); } -#line 2284 "src/parser.c" +#line 2283 "src/parser.c" break; case YYSYMBOL_ElseBody: /* ElseBody */ #line 38 "src/parser.y" { block_free(((*yyvaluep).blk)); } -#line 2290 "src/parser.c" +#line 2289 "src/parser.c" break; case YYSYMBOL_ExpD: /* ExpD */ #line 38 "src/parser.y" { block_free(((*yyvaluep).blk)); } -#line 2296 "src/parser.c" +#line 2295 "src/parser.c" break; case YYSYMBOL_Term: /* Term */ #line 38 "src/parser.y" { block_free(((*yyvaluep).blk)); } -#line 2302 "src/parser.c" +#line 2301 "src/parser.c" break; case YYSYMBOL_Args: /* Args */ #line 38 "src/parser.y" { block_free(((*yyvaluep).blk)); } -#line 2308 "src/parser.c" +#line 2307 "src/parser.c" break; case YYSYMBOL_Arg: /* Arg */ #line 38 "src/parser.y" { block_free(((*yyvaluep).blk)); } -#line 2314 "src/parser.c" +#line 2313 "src/parser.c" break; case YYSYMBOL_RepPatterns: /* RepPatterns */ #line 38 "src/parser.y" { block_free(((*yyvaluep).blk)); } -#line 2320 "src/parser.c" +#line 2319 "src/parser.c" break; case YYSYMBOL_Patterns: /* Patterns */ #line 38 "src/parser.y" { block_free(((*yyvaluep).blk)); } -#line 2326 "src/parser.c" +#line 2325 "src/parser.c" break; case YYSYMBOL_Pattern: /* Pattern */ #line 38 "src/parser.y" { block_free(((*yyvaluep).blk)); } -#line 2332 "src/parser.c" +#line 2331 "src/parser.c" break; case YYSYMBOL_ArrayPats: /* ArrayPats */ #line 38 "src/parser.y" { block_free(((*yyvaluep).blk)); } -#line 2338 "src/parser.c" +#line 2337 "src/parser.c" break; case YYSYMBOL_ObjPats: /* ObjPats */ #line 38 "src/parser.y" { block_free(((*yyvaluep).blk)); } -#line 2344 "src/parser.c" +#line 2343 "src/parser.c" break; case YYSYMBOL_ObjPat: /* ObjPat */ #line 38 "src/parser.y" { block_free(((*yyvaluep).blk)); } -#line 2350 "src/parser.c" +#line 2349 "src/parser.c" break; case YYSYMBOL_Keyword: /* Keyword */ #line 37 "src/parser.y" { jv_free(((*yyvaluep).literal)); } -#line 2356 "src/parser.c" +#line 2355 "src/parser.c" break; case YYSYMBOL_MkDict: /* MkDict */ #line 38 "src/parser.y" { block_free(((*yyvaluep).blk)); } -#line 2362 "src/parser.c" +#line 2361 "src/parser.c" break; case YYSYMBOL_MkDictPair: /* MkDictPair */ #line 38 "src/parser.y" { block_free(((*yyvaluep).blk)); } -#line 2368 "src/parser.c" +#line 2367 "src/parser.c" break; default: @@ -2668,31 +2667,31 @@ YYLTYPE yylloc = yyloc_default; switch (yyn) { case 2: /* TopLevel: Module Imports Exp */ -#line 290 "src/parser.y" +#line 286 "src/parser.y" { *answer = BLOCK((yyvsp[-2].blk), (yyvsp[-1].blk), gen_op_simple(TOP), (yyvsp[0].blk)); } -#line 2676 "src/parser.c" +#line 2675 "src/parser.c" break; case 3: /* TopLevel: Module Imports FuncDefs */ -#line 293 "src/parser.y" +#line 289 "src/parser.y" { *answer = BLOCK((yyvsp[-2].blk), (yyvsp[-1].blk), (yyvsp[0].blk)); } -#line 2684 "src/parser.c" +#line 2683 "src/parser.c" break; case 4: /* Module: %empty */ -#line 298 "src/parser.y" +#line 294 "src/parser.y" { (yyval.blk) = gen_noop(); } -#line 2692 "src/parser.c" +#line 2691 "src/parser.c" break; case 5: /* Module: "module" Exp ';' */ -#line 301 "src/parser.y" +#line 297 "src/parser.y" { if (!block_is_const((yyvsp[-1].blk))) { FAIL((yyloc), "Module metadata must be constant"); @@ -2706,360 +2705,360 @@ YYLTYPE yylloc = yyloc_default; (yyval.blk) = gen_module((yyvsp[-1].blk)); } } -#line 2710 "src/parser.c" +#line 2709 "src/parser.c" break; case 6: /* Imports: %empty */ -#line 316 "src/parser.y" +#line 312 "src/parser.y" { (yyval.blk) = gen_noop(); } -#line 2718 "src/parser.c" +#line 2717 "src/parser.c" break; case 7: /* Imports: Import Imports */ -#line 319 "src/parser.y" +#line 315 "src/parser.y" { (yyval.blk) = BLOCK((yyvsp[-1].blk), (yyvsp[0].blk)); } -#line 2726 "src/parser.c" +#line 2725 "src/parser.c" break; case 8: /* FuncDefs: %empty */ -#line 324 "src/parser.y" +#line 320 "src/parser.y" { (yyval.blk) = gen_noop(); } -#line 2734 "src/parser.c" +#line 2733 "src/parser.c" break; case 9: /* FuncDefs: FuncDef FuncDefs */ -#line 327 "src/parser.y" +#line 323 "src/parser.y" { (yyval.blk) = block_join((yyvsp[-1].blk), (yyvsp[0].blk)); } -#line 2742 "src/parser.c" +#line 2741 "src/parser.c" break; case 10: /* Exp: FuncDef Exp */ -#line 332 "src/parser.y" +#line 328 "src/parser.y" { (yyval.blk) = block_bind_referenced((yyvsp[-1].blk), (yyvsp[0].blk), OP_IS_CALL_PSEUDO); } -#line 2750 "src/parser.c" +#line 2749 "src/parser.c" break; case 11: /* Exp: Term "as" Patterns '|' Exp */ -#line 336 "src/parser.y" +#line 332 "src/parser.y" { (yyval.blk) = gen_destructure((yyvsp[-4].blk), (yyvsp[-2].blk), (yyvsp[0].blk)); } -#line 2758 "src/parser.c" +#line 2757 "src/parser.c" break; case 12: /* Exp: "reduce" Term "as" Patterns '(' Exp ';' Exp ')' */ -#line 339 "src/parser.y" +#line 335 "src/parser.y" { (yyval.blk) = gen_reduce((yyvsp[-7].blk), (yyvsp[-5].blk), (yyvsp[-3].blk), (yyvsp[-1].blk)); } -#line 2766 "src/parser.c" +#line 2765 "src/parser.c" break; case 13: /* Exp: "foreach" Term "as" Patterns '(' Exp ';' Exp ';' Exp ')' */ -#line 343 "src/parser.y" +#line 339 "src/parser.y" { (yyval.blk) = gen_foreach((yyvsp[-9].blk), (yyvsp[-7].blk), (yyvsp[-5].blk), (yyvsp[-3].blk), (yyvsp[-1].blk)); } -#line 2774 "src/parser.c" +#line 2773 "src/parser.c" break; case 14: /* Exp: "foreach" Term "as" Patterns '(' Exp ';' Exp ')' */ -#line 347 "src/parser.y" +#line 343 "src/parser.y" { (yyval.blk) = gen_foreach((yyvsp[-7].blk), (yyvsp[-5].blk), (yyvsp[-3].blk), (yyvsp[-1].blk), gen_noop()); } -#line 2782 "src/parser.c" +#line 2781 "src/parser.c" break; case 15: /* Exp: "if" Exp "then" Exp ElseBody */ -#line 351 "src/parser.y" +#line 347 "src/parser.y" { (yyval.blk) = gen_cond((yyvsp[-3].blk), (yyvsp[-1].blk), (yyvsp[0].blk)); } -#line 2790 "src/parser.c" +#line 2789 "src/parser.c" break; case 16: /* Exp: "if" Exp "then" error */ -#line 354 "src/parser.y" +#line 350 "src/parser.y" { FAIL((yyloc), "Possibly unterminated 'if' statement"); (yyval.blk) = (yyvsp[-2].blk); } -#line 2799 "src/parser.c" +#line 2798 "src/parser.c" break; case 17: /* Exp: "try" Exp "catch" Exp */ -#line 359 "src/parser.y" +#line 355 "src/parser.y" { (yyval.blk) = gen_try((yyvsp[-2].blk), (yyvsp[0].blk)); } -#line 2807 "src/parser.c" +#line 2806 "src/parser.c" break; case 18: /* Exp: "try" Exp */ -#line 362 "src/parser.y" +#line 358 "src/parser.y" { (yyval.blk) = gen_try((yyvsp[0].blk), gen_op_simple(BACKTRACK)); } -#line 2815 "src/parser.c" +#line 2814 "src/parser.c" break; case 19: /* Exp: "try" Exp "catch" error */ -#line 365 "src/parser.y" +#line 361 "src/parser.y" { FAIL((yyloc), "Possibly unterminated 'try' statement"); (yyval.blk) = (yyvsp[-2].blk); } -#line 2824 "src/parser.c" +#line 2823 "src/parser.c" break; case 20: /* Exp: "label" BINDING '|' Exp */ -#line 370 "src/parser.y" +#line 366 "src/parser.y" { jv v = jv_string_fmt("*label-%s", jv_string_value((yyvsp[-2].literal))); (yyval.blk) = gen_location((yyloc), locations, gen_label(jv_string_value(v), (yyvsp[0].blk))); jv_free((yyvsp[-2].literal)); jv_free(v); } -#line 2835 "src/parser.c" +#line 2834 "src/parser.c" break; case 21: /* Exp: Exp '?' */ -#line 377 "src/parser.y" +#line 373 "src/parser.y" { (yyval.blk) = gen_try((yyvsp[-1].blk), gen_op_simple(BACKTRACK)); } -#line 2843 "src/parser.c" +#line 2842 "src/parser.c" break; case 22: /* Exp: Exp '=' Exp */ -#line 381 "src/parser.y" +#line 377 "src/parser.y" { (yyval.blk) = gen_call("_assign", BLOCK(gen_lambda((yyvsp[-2].blk)), gen_lambda((yyvsp[0].blk)))); } -#line 2851 "src/parser.c" +#line 2850 "src/parser.c" break; case 23: /* Exp: Exp "or" Exp */ -#line 385 "src/parser.y" +#line 381 "src/parser.y" { (yyval.blk) = gen_or((yyvsp[-2].blk), (yyvsp[0].blk)); } -#line 2859 "src/parser.c" +#line 2858 "src/parser.c" break; case 24: /* Exp: Exp "and" Exp */ -#line 389 "src/parser.y" +#line 385 "src/parser.y" { (yyval.blk) = gen_and((yyvsp[-2].blk), (yyvsp[0].blk)); } -#line 2867 "src/parser.c" +#line 2866 "src/parser.c" break; case 25: /* Exp: Exp "//" Exp */ -#line 393 "src/parser.y" +#line 389 "src/parser.y" { (yyval.blk) = gen_definedor((yyvsp[-2].blk), (yyvsp[0].blk)); } -#line 2875 "src/parser.c" +#line 2874 "src/parser.c" break; case 26: /* Exp: Exp "//=" Exp */ -#line 397 "src/parser.y" +#line 393 "src/parser.y" { (yyval.blk) = gen_definedor_assign((yyvsp[-2].blk), (yyvsp[0].blk)); } -#line 2883 "src/parser.c" +#line 2882 "src/parser.c" break; case 27: /* Exp: Exp "|=" Exp */ -#line 401 "src/parser.y" +#line 397 "src/parser.y" { (yyval.blk) = gen_call("_modify", BLOCK(gen_lambda((yyvsp[-2].blk)), gen_lambda((yyvsp[0].blk)))); } -#line 2891 "src/parser.c" +#line 2890 "src/parser.c" break; case 28: /* Exp: Exp '|' Exp */ -#line 405 "src/parser.y" +#line 401 "src/parser.y" { (yyval.blk) = block_join((yyvsp[-2].blk), (yyvsp[0].blk)); } -#line 2899 "src/parser.c" +#line 2898 "src/parser.c" break; case 29: /* Exp: Exp ',' Exp */ -#line 409 "src/parser.y" +#line 405 "src/parser.y" { (yyval.blk) = gen_both((yyvsp[-2].blk), (yyvsp[0].blk)); } -#line 2907 "src/parser.c" +#line 2906 "src/parser.c" break; case 30: /* Exp: Exp '+' Exp */ -#line 413 "src/parser.y" +#line 409 "src/parser.y" { (yyval.blk) = gen_binop((yyvsp[-2].blk), (yyvsp[0].blk), '+'); } -#line 2915 "src/parser.c" +#line 2914 "src/parser.c" break; case 31: /* Exp: Exp "+=" Exp */ -#line 417 "src/parser.y" +#line 413 "src/parser.y" { (yyval.blk) = gen_update((yyvsp[-2].blk), (yyvsp[0].blk), '+'); } -#line 2923 "src/parser.c" +#line 2922 "src/parser.c" break; case 32: /* Exp: '-' Exp */ -#line 421 "src/parser.y" +#line 417 "src/parser.y" { (yyval.blk) = BLOCK((yyvsp[0].blk), gen_call("_negate", gen_noop())); } -#line 2931 "src/parser.c" +#line 2930 "src/parser.c" break; case 33: /* Exp: Exp '-' Exp */ -#line 425 "src/parser.y" +#line 421 "src/parser.y" { (yyval.blk) = gen_binop((yyvsp[-2].blk), (yyvsp[0].blk), '-'); } -#line 2939 "src/parser.c" +#line 2938 "src/parser.c" break; case 34: /* Exp: Exp "-=" Exp */ -#line 429 "src/parser.y" +#line 425 "src/parser.y" { (yyval.blk) = gen_update((yyvsp[-2].blk), (yyvsp[0].blk), '-'); } -#line 2947 "src/parser.c" +#line 2946 "src/parser.c" break; case 35: /* Exp: Exp '*' Exp */ -#line 433 "src/parser.y" +#line 429 "src/parser.y" { (yyval.blk) = gen_binop((yyvsp[-2].blk), (yyvsp[0].blk), '*'); } -#line 2955 "src/parser.c" +#line 2954 "src/parser.c" break; case 36: /* Exp: Exp "*=" Exp */ -#line 437 "src/parser.y" +#line 433 "src/parser.y" { (yyval.blk) = gen_update((yyvsp[-2].blk), (yyvsp[0].blk), '*'); } -#line 2963 "src/parser.c" +#line 2962 "src/parser.c" break; case 37: /* Exp: Exp '/' Exp */ -#line 441 "src/parser.y" +#line 437 "src/parser.y" { (yyval.blk) = gen_binop((yyvsp[-2].blk), (yyvsp[0].blk), '/'); } -#line 2971 "src/parser.c" +#line 2970 "src/parser.c" break; case 38: /* Exp: Exp '%' Exp */ -#line 445 "src/parser.y" +#line 441 "src/parser.y" { (yyval.blk) = gen_binop((yyvsp[-2].blk), (yyvsp[0].blk), '%'); } -#line 2979 "src/parser.c" +#line 2978 "src/parser.c" break; case 39: /* Exp: Exp "/=" Exp */ -#line 449 "src/parser.y" +#line 445 "src/parser.y" { (yyval.blk) = gen_update((yyvsp[-2].blk), (yyvsp[0].blk), '/'); } -#line 2987 "src/parser.c" +#line 2986 "src/parser.c" break; case 40: /* Exp: Exp "%=" Exp */ -#line 453 "src/parser.y" +#line 449 "src/parser.y" { (yyval.blk) = gen_update((yyvsp[-2].blk), (yyvsp[0].blk), '%'); } -#line 2995 "src/parser.c" +#line 2994 "src/parser.c" break; case 41: /* Exp: Exp "==" Exp */ -#line 457 "src/parser.y" +#line 453 "src/parser.y" { (yyval.blk) = gen_binop((yyvsp[-2].blk), (yyvsp[0].blk), EQ); } -#line 3003 "src/parser.c" +#line 3002 "src/parser.c" break; case 42: /* Exp: Exp "!=" Exp */ -#line 461 "src/parser.y" +#line 457 "src/parser.y" { (yyval.blk) = gen_binop((yyvsp[-2].blk), (yyvsp[0].blk), NEQ); } -#line 3011 "src/parser.c" +#line 3010 "src/parser.c" break; case 43: /* Exp: Exp '<' Exp */ -#line 465 "src/parser.y" +#line 461 "src/parser.y" { (yyval.blk) = gen_binop((yyvsp[-2].blk), (yyvsp[0].blk), '<'); } -#line 3019 "src/parser.c" +#line 3018 "src/parser.c" break; case 44: /* Exp: Exp '>' Exp */ -#line 469 "src/parser.y" +#line 465 "src/parser.y" { (yyval.blk) = gen_binop((yyvsp[-2].blk), (yyvsp[0].blk), '>'); } -#line 3027 "src/parser.c" +#line 3026 "src/parser.c" break; case 45: /* Exp: Exp "<=" Exp */ -#line 473 "src/parser.y" +#line 469 "src/parser.y" { (yyval.blk) = gen_binop((yyvsp[-2].blk), (yyvsp[0].blk), LESSEQ); } -#line 3035 "src/parser.c" +#line 3034 "src/parser.c" break; case 46: /* Exp: Exp ">=" Exp */ -#line 477 "src/parser.y" +#line 473 "src/parser.y" { (yyval.blk) = gen_binop((yyvsp[-2].blk), (yyvsp[0].blk), GREATEREQ); } -#line 3043 "src/parser.c" +#line 3042 "src/parser.c" break; case 47: /* Exp: Term */ -#line 481 "src/parser.y" +#line 477 "src/parser.y" { (yyval.blk) = (yyvsp[0].blk); } -#line 3051 "src/parser.c" +#line 3050 "src/parser.c" break; case 48: /* Import: ImportWhat ';' */ -#line 486 "src/parser.y" +#line 482 "src/parser.y" { (yyval.blk) = (yyvsp[-1].blk); } -#line 3059 "src/parser.c" +#line 3058 "src/parser.c" break; case 49: /* Import: ImportWhat Exp ';' */ -#line 489 "src/parser.y" +#line 485 "src/parser.y" { if (!block_is_const((yyvsp[-1].blk))) { FAIL((yyloc), "Module metadata must be constant"); @@ -3075,11 +3074,11 @@ YYLTYPE yylloc = yyloc_default; (yyval.blk) = gen_import_meta((yyvsp[-2].blk), (yyvsp[-1].blk)); } } -#line 3079 "src/parser.c" +#line 3078 "src/parser.c" break; case 50: /* ImportWhat: "import" ImportFrom "as" BINDING */ -#line 506 "src/parser.y" +#line 502 "src/parser.y" { jv v = block_const((yyvsp[-2].blk)); // XXX Make gen_import take only blocks and the int is_data so we @@ -3089,11 +3088,11 @@ YYLTYPE yylloc = yyloc_default; jv_free((yyvsp[0].literal)); jv_free(v); } -#line 3093 "src/parser.c" +#line 3092 "src/parser.c" break; case 51: /* ImportWhat: "import" ImportFrom "as" IDENT */ -#line 515 "src/parser.y" +#line 511 "src/parser.y" { jv v = block_const((yyvsp[-2].blk)); (yyval.blk) = gen_import(jv_string_value(v), jv_string_value((yyvsp[0].literal)), 0); @@ -3101,22 +3100,22 @@ YYLTYPE yylloc = yyloc_default; jv_free((yyvsp[0].literal)); jv_free(v); } -#line 3105 "src/parser.c" +#line 3104 "src/parser.c" break; case 52: /* ImportWhat: "include" ImportFrom */ -#line 522 "src/parser.y" +#line 518 "src/parser.y" { jv v = block_const((yyvsp[0].blk)); (yyval.blk) = gen_import(jv_string_value(v), NULL, 0); block_free((yyvsp[0].blk)); jv_free(v); } -#line 3116 "src/parser.c" +#line 3115 "src/parser.c" break; case 53: /* ImportFrom: String */ -#line 530 "src/parser.y" +#line 526 "src/parser.y" { if (!block_is_const((yyvsp[0].blk))) { FAIL((yyloc), "Import path must be constant"); @@ -3126,175 +3125,185 @@ YYLTYPE yylloc = yyloc_default; (yyval.blk) = (yyvsp[0].blk); } } -#line 3130 "src/parser.c" +#line 3129 "src/parser.c" break; case 54: /* FuncDef: "def" IDENT ':' Exp ';' */ -#line 541 "src/parser.y" +#line 537 "src/parser.y" { (yyval.blk) = gen_function(jv_string_value((yyvsp[-3].literal)), gen_noop(), (yyvsp[-1].blk)); jv_free((yyvsp[-3].literal)); } -#line 3139 "src/parser.c" +#line 3138 "src/parser.c" break; case 55: /* FuncDef: "def" IDENT '(' Params ')' ':' Exp ';' */ -#line 546 "src/parser.y" +#line 541 "src/parser.y" { (yyval.blk) = gen_function(jv_string_value((yyvsp[-6].literal)), (yyvsp[-4].blk), (yyvsp[-1].blk)); jv_free((yyvsp[-6].literal)); } -#line 3148 "src/parser.c" +#line 3147 "src/parser.c" break; - case 56: /* Params: Param */ -#line 552 "src/parser.y" + case 56: /* FuncDef: "def" FORMAT ':' Exp ';' */ +#line 545 "src/parser.y" + { + (yyval.blk) = gen_function(jv_string_value((yyvsp[-3].literal)), gen_noop(), (yyvsp[-1].blk)); + jv_free((yyvsp[-3].literal)); +} +#line 3156 "src/parser.c" + break; + + case 57: /* Params: Param */ +#line 551 "src/parser.y" { (yyval.blk) = (yyvsp[0].blk); } -#line 3156 "src/parser.c" +#line 3164 "src/parser.c" break; - case 57: /* Params: Params ';' Param */ -#line 555 "src/parser.y" + case 58: /* Params: Params ';' Param */ +#line 554 "src/parser.y" { (yyval.blk) = BLOCK((yyvsp[-2].blk), (yyvsp[0].blk)); } -#line 3164 "src/parser.c" +#line 3172 "src/parser.c" break; - case 58: /* Param: BINDING */ -#line 560 "src/parser.y" + case 59: /* Param: BINDING */ +#line 559 "src/parser.y" { (yyval.blk) = gen_param_regular(jv_string_value((yyvsp[0].literal))); jv_free((yyvsp[0].literal)); } -#line 3173 "src/parser.c" +#line 3181 "src/parser.c" break; - case 59: /* Param: IDENT */ -#line 564 "src/parser.y" + case 60: /* Param: IDENT */ +#line 563 "src/parser.y" { (yyval.blk) = gen_param(jv_string_value((yyvsp[0].literal))); jv_free((yyvsp[0].literal)); } -#line 3182 "src/parser.c" +#line 3190 "src/parser.c" break; - case 60: /* StringStart: FORMAT QQSTRING_START */ -#line 571 "src/parser.y" + case 61: /* StringStart: FORMAT QQSTRING_START */ +#line 570 "src/parser.y" { (yyval.literal) = (yyvsp[-1].literal); } -#line 3190 "src/parser.c" +#line 3198 "src/parser.c" break; - case 61: /* StringStart: QQSTRING_START */ -#line 574 "src/parser.y" + case 62: /* StringStart: QQSTRING_START */ +#line 573 "src/parser.y" { - (yyval.literal) = jv_string("text"); + (yyval.literal) = jv_string("@text"); } -#line 3198 "src/parser.c" +#line 3206 "src/parser.c" break; - case 62: /* String: StringStart QQString QQSTRING_END */ -#line 580 "src/parser.y" + case 63: /* String: StringStart QQString QQSTRING_END */ +#line 579 "src/parser.y" { (yyval.blk) = (yyvsp[-1].blk); jv_free((yyvsp[-2].literal)); } -#line 3207 "src/parser.c" +#line 3215 "src/parser.c" break; - case 63: /* QQString: %empty */ -#line 587 "src/parser.y" + case 64: /* QQString: %empty */ +#line 586 "src/parser.y" { (yyval.blk) = gen_const(jv_string("")); } -#line 3215 "src/parser.c" +#line 3223 "src/parser.c" break; - case 64: /* QQString: QQString QQSTRING_TEXT */ -#line 590 "src/parser.y" + case 65: /* QQString: QQString QQSTRING_TEXT */ +#line 589 "src/parser.y" { (yyval.blk) = gen_binop((yyvsp[-1].blk), gen_const((yyvsp[0].literal)), '+'); } -#line 3223 "src/parser.c" +#line 3231 "src/parser.c" break; - case 65: /* QQString: QQString QQSTRING_INTERP_START Exp QQSTRING_INTERP_END */ -#line 593 "src/parser.y" + case 66: /* QQString: QQString QQSTRING_INTERP_START Exp QQSTRING_INTERP_END */ +#line 592 "src/parser.y" { - (yyval.blk) = gen_binop((yyvsp[-3].blk), gen_format((yyvsp[-1].blk), jv_copy((yyvsp[-4].literal))), '+'); + const char *s = jv_string_value((yyvsp[-4].literal)); + (yyval.blk) = gen_binop((yyvsp[-3].blk), BLOCK((yyvsp[-1].blk), gen_location((yyloc), locations, gen_call(s, gen_noop()))), '+'); } -#line 3231 "src/parser.c" +#line 3240 "src/parser.c" break; - case 66: /* ElseBody: "elif" Exp "then" Exp ElseBody */ + case 67: /* ElseBody: "elif" Exp "then" Exp ElseBody */ #line 599 "src/parser.y" { (yyval.blk) = gen_cond((yyvsp[-3].blk), (yyvsp[-1].blk), (yyvsp[0].blk)); } -#line 3239 "src/parser.c" +#line 3248 "src/parser.c" break; - case 67: /* ElseBody: "else" Exp "end" */ + case 68: /* ElseBody: "else" Exp "end" */ #line 602 "src/parser.y" { (yyval.blk) = (yyvsp[-1].blk); } -#line 3247 "src/parser.c" +#line 3256 "src/parser.c" break; - case 68: /* ElseBody: "end" */ + case 69: /* ElseBody: "end" */ #line 605 "src/parser.y" { (yyval.blk) = gen_noop(); } -#line 3255 "src/parser.c" +#line 3264 "src/parser.c" break; - case 69: /* ExpD: ExpD '|' ExpD */ + case 70: /* ExpD: ExpD '|' ExpD */ #line 610 "src/parser.y" { (yyval.blk) = block_join((yyvsp[-2].blk), (yyvsp[0].blk)); } -#line 3263 "src/parser.c" +#line 3272 "src/parser.c" break; - case 70: /* ExpD: '-' ExpD */ + case 71: /* ExpD: '-' ExpD */ #line 613 "src/parser.y" { (yyval.blk) = BLOCK((yyvsp[0].blk), gen_call("_negate", gen_noop())); } -#line 3271 "src/parser.c" +#line 3280 "src/parser.c" break; - case 71: /* ExpD: Term */ + case 72: /* ExpD: Term */ #line 616 "src/parser.y" { (yyval.blk) = (yyvsp[0].blk); } -#line 3279 "src/parser.c" +#line 3288 "src/parser.c" break; - case 72: /* Term: '.' */ + case 73: /* Term: '.' */ #line 622 "src/parser.y" { (yyval.blk) = gen_noop(); } -#line 3287 "src/parser.c" +#line 3296 "src/parser.c" break; - case 73: /* Term: ".." */ + case 74: /* Term: ".." */ #line 625 "src/parser.y" { (yyval.blk) = gen_call("recurse", gen_noop()); } -#line 3295 "src/parser.c" +#line 3304 "src/parser.c" break; - case 74: /* Term: "break" BINDING */ + case 75: /* Term: "break" BINDING */ #line 628 "src/parser.y" { jv v = jv_string_fmt("*label-%s", jv_string_value((yyvsp[0].literal))); // impossible symbol @@ -3304,263 +3313,265 @@ YYLTYPE yylloc = yyloc_default; jv_free(v); jv_free((yyvsp[0].literal)); } -#line 3308 "src/parser.c" +#line 3317 "src/parser.c" break; - case 75: /* Term: "break" error */ + case 76: /* Term: "break" error */ #line 636 "src/parser.y" { FAIL((yyloc), "break requires a label to break to"); (yyval.blk) = gen_noop(); } -#line 3317 "src/parser.c" +#line 3326 "src/parser.c" break; - case 76: /* Term: Term FIELD '?' */ + case 77: /* Term: Term FIELD '?' */ #line 640 "src/parser.y" { (yyval.blk) = gen_index_opt((yyvsp[-2].blk), gen_const((yyvsp[-1].literal))); } -#line 3325 "src/parser.c" +#line 3334 "src/parser.c" break; - case 77: /* Term: FIELD '?' */ + case 78: /* Term: FIELD '?' */ #line 643 "src/parser.y" { (yyval.blk) = gen_index_opt(gen_noop(), gen_const((yyvsp[-1].literal))); } -#line 3333 "src/parser.c" +#line 3342 "src/parser.c" break; - case 78: /* Term: Term '.' String '?' */ + case 79: /* Term: Term '.' String '?' */ #line 646 "src/parser.y" { (yyval.blk) = gen_index_opt((yyvsp[-3].blk), (yyvsp[-1].blk)); } -#line 3341 "src/parser.c" +#line 3350 "src/parser.c" break; - case 79: /* Term: '.' String '?' */ + case 80: /* Term: '.' String '?' */ #line 649 "src/parser.y" { (yyval.blk) = gen_index_opt(gen_noop(), (yyvsp[-1].blk)); } -#line 3349 "src/parser.c" +#line 3358 "src/parser.c" break; - case 80: /* Term: Term FIELD */ + case 81: /* Term: Term FIELD */ #line 652 "src/parser.y" { (yyval.blk) = gen_index((yyvsp[-1].blk), gen_const((yyvsp[0].literal))); } -#line 3357 "src/parser.c" +#line 3366 "src/parser.c" break; - case 81: /* Term: FIELD */ + case 82: /* Term: FIELD */ #line 655 "src/parser.y" { (yyval.blk) = gen_index(gen_noop(), gen_const((yyvsp[0].literal))); } -#line 3365 "src/parser.c" +#line 3374 "src/parser.c" break; - case 82: /* Term: Term '.' String */ + case 83: /* Term: Term '.' String */ #line 658 "src/parser.y" { (yyval.blk) = gen_index((yyvsp[-2].blk), (yyvsp[0].blk)); } -#line 3373 "src/parser.c" +#line 3382 "src/parser.c" break; - case 83: /* Term: '.' String */ + case 84: /* Term: '.' String */ #line 661 "src/parser.y" { (yyval.blk) = gen_index(gen_noop(), (yyvsp[0].blk)); } -#line 3381 "src/parser.c" +#line 3390 "src/parser.c" break; - case 84: /* Term: '.' error */ + case 85: /* Term: '.' error */ #line 664 "src/parser.y" { FAIL((yyloc), "try .[\"field\"] instead of .field for unusually named fields"); (yyval.blk) = gen_noop(); } -#line 3390 "src/parser.c" +#line 3399 "src/parser.c" break; - case 85: /* Term: '.' IDENT error */ + case 86: /* Term: '.' IDENT error */ #line 668 "src/parser.y" { jv_free((yyvsp[-1].literal)); FAIL((yyloc), "try .[\"field\"] instead of .field for unusually named fields"); (yyval.blk) = gen_noop(); } -#line 3400 "src/parser.c" +#line 3409 "src/parser.c" break; - case 86: /* Term: Term '[' Exp ']' '?' */ + case 87: /* Term: Term '[' Exp ']' '?' */ #line 674 "src/parser.y" { (yyval.blk) = gen_index_opt((yyvsp[-4].blk), (yyvsp[-2].blk)); } -#line 3408 "src/parser.c" +#line 3417 "src/parser.c" break; - case 87: /* Term: Term '[' Exp ']' */ + case 88: /* Term: Term '[' Exp ']' */ #line 677 "src/parser.y" { (yyval.blk) = gen_index((yyvsp[-3].blk), (yyvsp[-1].blk)); } -#line 3416 "src/parser.c" +#line 3425 "src/parser.c" break; - case 88: /* Term: Term '.' '[' Exp ']' '?' */ + case 89: /* Term: Term '.' '[' Exp ']' '?' */ #line 680 "src/parser.y" { (yyval.blk) = gen_index_opt((yyvsp[-5].blk), (yyvsp[-2].blk)); } -#line 3424 "src/parser.c" +#line 3433 "src/parser.c" break; - case 89: /* Term: Term '.' '[' Exp ']' */ + case 90: /* Term: Term '.' '[' Exp ']' */ #line 683 "src/parser.y" { (yyval.blk) = gen_index((yyvsp[-4].blk), (yyvsp[-1].blk)); } -#line 3432 "src/parser.c" +#line 3441 "src/parser.c" break; - case 90: /* Term: Term '[' ']' '?' */ + case 91: /* Term: Term '[' ']' '?' */ #line 686 "src/parser.y" { (yyval.blk) = block_join((yyvsp[-3].blk), gen_op_simple(EACH_OPT)); } -#line 3440 "src/parser.c" +#line 3449 "src/parser.c" break; - case 91: /* Term: Term '[' ']' */ + case 92: /* Term: Term '[' ']' */ #line 689 "src/parser.y" { (yyval.blk) = block_join((yyvsp[-2].blk), gen_op_simple(EACH)); } -#line 3448 "src/parser.c" +#line 3457 "src/parser.c" break; - case 92: /* Term: Term '.' '[' ']' '?' */ + case 93: /* Term: Term '.' '[' ']' '?' */ #line 692 "src/parser.y" { (yyval.blk) = block_join((yyvsp[-4].blk), gen_op_simple(EACH_OPT)); } -#line 3456 "src/parser.c" +#line 3465 "src/parser.c" break; - case 93: /* Term: Term '.' '[' ']' */ + case 94: /* Term: Term '.' '[' ']' */ #line 695 "src/parser.y" { (yyval.blk) = block_join((yyvsp[-3].blk), gen_op_simple(EACH)); } -#line 3464 "src/parser.c" +#line 3473 "src/parser.c" break; - case 94: /* Term: Term '[' Exp ':' Exp ']' '?' */ + case 95: /* Term: Term '[' Exp ':' Exp ']' '?' */ #line 698 "src/parser.y" { (yyval.blk) = gen_slice_index((yyvsp[-6].blk), (yyvsp[-4].blk), (yyvsp[-2].blk), INDEX_OPT); } -#line 3472 "src/parser.c" +#line 3481 "src/parser.c" break; - case 95: /* Term: Term '[' Exp ':' ']' '?' */ + case 96: /* Term: Term '[' Exp ':' ']' '?' */ #line 701 "src/parser.y" { (yyval.blk) = gen_slice_index((yyvsp[-5].blk), (yyvsp[-3].blk), gen_const(jv_null()), INDEX_OPT); } -#line 3480 "src/parser.c" +#line 3489 "src/parser.c" break; - case 96: /* Term: Term '[' ':' Exp ']' '?' */ + case 97: /* Term: Term '[' ':' Exp ']' '?' */ #line 704 "src/parser.y" { (yyval.blk) = gen_slice_index((yyvsp[-5].blk), gen_const(jv_null()), (yyvsp[-2].blk), INDEX_OPT); } -#line 3488 "src/parser.c" +#line 3497 "src/parser.c" break; - case 97: /* Term: Term '[' Exp ':' Exp ']' */ + case 98: /* Term: Term '[' Exp ':' Exp ']' */ #line 707 "src/parser.y" { (yyval.blk) = gen_slice_index((yyvsp[-5].blk), (yyvsp[-3].blk), (yyvsp[-1].blk), INDEX); } -#line 3496 "src/parser.c" +#line 3505 "src/parser.c" break; - case 98: /* Term: Term '[' Exp ':' ']' */ + case 99: /* Term: Term '[' Exp ':' ']' */ #line 710 "src/parser.y" { (yyval.blk) = gen_slice_index((yyvsp[-4].blk), (yyvsp[-2].blk), gen_const(jv_null()), INDEX); } -#line 3504 "src/parser.c" +#line 3513 "src/parser.c" break; - case 99: /* Term: Term '[' ':' Exp ']' */ + case 100: /* Term: Term '[' ':' Exp ']' */ #line 713 "src/parser.y" { (yyval.blk) = gen_slice_index((yyvsp[-4].blk), gen_const(jv_null()), (yyvsp[-1].blk), INDEX); } -#line 3512 "src/parser.c" +#line 3521 "src/parser.c" break; - case 100: /* Term: LITERAL */ + case 101: /* Term: LITERAL */ #line 716 "src/parser.y" { (yyval.blk) = gen_const((yyvsp[0].literal)); } -#line 3520 "src/parser.c" +#line 3529 "src/parser.c" break; - case 101: /* Term: String */ + case 102: /* Term: String */ #line 719 "src/parser.y" { (yyval.blk) = (yyvsp[0].blk); } -#line 3528 "src/parser.c" +#line 3537 "src/parser.c" break; - case 102: /* Term: FORMAT */ + case 103: /* Term: FORMAT */ #line 722 "src/parser.y" { - (yyval.blk) = gen_format(gen_noop(), (yyvsp[0].literal)); + const char *s = jv_string_value((yyvsp[0].literal)); + (yyval.blk) = gen_location((yyloc), locations, gen_call(s, gen_noop())); + jv_free((yyvsp[0].literal)); } -#line 3536 "src/parser.c" +#line 3547 "src/parser.c" break; - case 103: /* Term: '(' Exp ')' */ -#line 725 "src/parser.y" + case 104: /* Term: '(' Exp ')' */ +#line 727 "src/parser.y" { (yyval.blk) = (yyvsp[-1].blk); } -#line 3544 "src/parser.c" +#line 3555 "src/parser.c" break; - case 104: /* Term: '[' Exp ']' */ -#line 728 "src/parser.y" + case 105: /* Term: '[' Exp ']' */ +#line 730 "src/parser.y" { (yyval.blk) = gen_collect((yyvsp[-1].blk)); } -#line 3552 "src/parser.c" +#line 3563 "src/parser.c" break; - case 105: /* Term: '[' ']' */ -#line 731 "src/parser.y" + case 106: /* Term: '[' ']' */ +#line 733 "src/parser.y" { (yyval.blk) = gen_const(jv_array()); } -#line 3560 "src/parser.c" +#line 3571 "src/parser.c" break; - case 106: /* Term: '{' MkDict '}' */ -#line 734 "src/parser.y" + case 107: /* Term: '{' MkDict '}' */ +#line 736 "src/parser.y" { block o = gen_const_object((yyvsp[-1].blk)); if (o.first != NULL) @@ -3568,37 +3579,37 @@ YYLTYPE yylloc = yyloc_default; else (yyval.blk) = BLOCK(gen_subexp(gen_const(jv_object())), (yyvsp[-1].blk), gen_op_simple(POP)); } -#line 3572 "src/parser.c" +#line 3583 "src/parser.c" break; - case 107: /* Term: '$' '$' '$' BINDING */ -#line 756 "src/parser.y" + case 108: /* Term: '$' '$' '$' BINDING */ +#line 758 "src/parser.y" { (yyval.blk) = gen_location((yyloc), locations, gen_op_unbound(LOADVN, jv_string_value((yyvsp[0].literal)))); jv_free((yyvsp[0].literal)); } -#line 3581 "src/parser.c" +#line 3592 "src/parser.c" break; - case 108: /* Term: BINDING */ -#line 760 "src/parser.y" + case 109: /* Term: BINDING */ +#line 762 "src/parser.y" { (yyval.blk) = gen_location((yyloc), locations, gen_op_unbound(LOADV, jv_string_value((yyvsp[0].literal)))); jv_free((yyvsp[0].literal)); } -#line 3590 "src/parser.c" +#line 3601 "src/parser.c" break; - case 109: /* Term: "$__loc__" */ -#line 764 "src/parser.y" + case 110: /* Term: "$__loc__" */ +#line 766 "src/parser.y" { (yyval.blk) = gen_loc_object(&(yyloc), locations); } -#line 3598 "src/parser.c" +#line 3609 "src/parser.c" break; - case 110: /* Term: IDENT */ -#line 767 "src/parser.y" + case 111: /* Term: IDENT */ +#line 769 "src/parser.y" { const char *s = jv_string_value((yyvsp[0].literal)); if (strcmp(s, "false") == 0) @@ -3611,198 +3622,198 @@ YYLTYPE yylloc = yyloc_default; (yyval.blk) = gen_location((yyloc), locations, gen_call(s, gen_noop())); jv_free((yyvsp[0].literal)); } -#line 3615 "src/parser.c" +#line 3626 "src/parser.c" break; - case 111: /* Term: IDENT '(' Args ')' */ -#line 779 "src/parser.y" + case 112: /* Term: IDENT '(' Args ')' */ +#line 781 "src/parser.y" { (yyval.blk) = gen_call(jv_string_value((yyvsp[-3].literal)), (yyvsp[-1].blk)); (yyval.blk) = gen_location((yylsp[-3]), locations, (yyval.blk)); jv_free((yyvsp[-3].literal)); } -#line 3625 "src/parser.c" +#line 3636 "src/parser.c" break; - case 112: /* Term: '(' error ')' */ -#line 784 "src/parser.y" + case 113: /* Term: '(' error ')' */ +#line 786 "src/parser.y" { (yyval.blk) = gen_noop(); } -#line 3631 "src/parser.c" +#line 3642 "src/parser.c" break; - case 113: /* Term: '[' error ']' */ -#line 785 "src/parser.y" + case 114: /* Term: '[' error ']' */ +#line 787 "src/parser.y" { (yyval.blk) = gen_noop(); } -#line 3637 "src/parser.c" +#line 3648 "src/parser.c" break; - case 114: /* Term: Term '[' error ']' */ -#line 786 "src/parser.y" + case 115: /* Term: Term '[' error ']' */ +#line 788 "src/parser.y" { (yyval.blk) = (yyvsp[-3].blk); } -#line 3643 "src/parser.c" +#line 3654 "src/parser.c" break; - case 115: /* Term: '{' error '}' */ -#line 787 "src/parser.y" + case 116: /* Term: '{' error '}' */ +#line 789 "src/parser.y" { (yyval.blk) = gen_noop(); } -#line 3649 "src/parser.c" +#line 3660 "src/parser.c" break; - case 116: /* Args: Arg */ -#line 790 "src/parser.y" + case 117: /* Args: Arg */ +#line 792 "src/parser.y" { (yyval.blk) = (yyvsp[0].blk); } -#line 3657 "src/parser.c" +#line 3668 "src/parser.c" break; - case 117: /* Args: Args ';' Arg */ -#line 793 "src/parser.y" + case 118: /* Args: Args ';' Arg */ +#line 795 "src/parser.y" { (yyval.blk) = BLOCK((yyvsp[-2].blk), (yyvsp[0].blk)); } -#line 3665 "src/parser.c" +#line 3676 "src/parser.c" break; - case 118: /* Arg: Exp */ -#line 798 "src/parser.y" + case 119: /* Arg: Exp */ +#line 800 "src/parser.y" { (yyval.blk) = gen_lambda((yyvsp[0].blk)); } -#line 3673 "src/parser.c" +#line 3684 "src/parser.c" break; - case 119: /* RepPatterns: RepPatterns "?//" Pattern */ -#line 803 "src/parser.y" + case 120: /* RepPatterns: RepPatterns "?//" Pattern */ +#line 805 "src/parser.y" { (yyval.blk) = BLOCK((yyvsp[-2].blk), gen_destructure_alt((yyvsp[0].blk))); } -#line 3681 "src/parser.c" +#line 3692 "src/parser.c" break; - case 120: /* RepPatterns: Pattern */ -#line 806 "src/parser.y" + case 121: /* RepPatterns: Pattern */ +#line 808 "src/parser.y" { (yyval.blk) = gen_destructure_alt((yyvsp[0].blk)); } -#line 3689 "src/parser.c" +#line 3700 "src/parser.c" break; - case 121: /* Patterns: RepPatterns "?//" Pattern */ -#line 811 "src/parser.y" + case 122: /* Patterns: RepPatterns "?//" Pattern */ +#line 813 "src/parser.y" { (yyval.blk) = BLOCK((yyvsp[-2].blk), (yyvsp[0].blk)); } -#line 3697 "src/parser.c" +#line 3708 "src/parser.c" break; - case 122: /* Patterns: Pattern */ -#line 814 "src/parser.y" + case 123: /* Patterns: Pattern */ +#line 816 "src/parser.y" { (yyval.blk) = (yyvsp[0].blk); } -#line 3705 "src/parser.c" +#line 3716 "src/parser.c" break; - case 123: /* Pattern: BINDING */ -#line 819 "src/parser.y" + case 124: /* Pattern: BINDING */ +#line 821 "src/parser.y" { (yyval.blk) = gen_op_unbound(STOREV, jv_string_value((yyvsp[0].literal))); jv_free((yyvsp[0].literal)); } -#line 3714 "src/parser.c" +#line 3725 "src/parser.c" break; - case 124: /* Pattern: '[' ArrayPats ']' */ -#line 823 "src/parser.y" + case 125: /* Pattern: '[' ArrayPats ']' */ +#line 825 "src/parser.y" { (yyval.blk) = BLOCK((yyvsp[-1].blk), gen_op_simple(POP)); } -#line 3722 "src/parser.c" +#line 3733 "src/parser.c" break; - case 125: /* Pattern: '{' ObjPats '}' */ -#line 826 "src/parser.y" + case 126: /* Pattern: '{' ObjPats '}' */ +#line 828 "src/parser.y" { (yyval.blk) = BLOCK((yyvsp[-1].blk), gen_op_simple(POP)); } -#line 3730 "src/parser.c" +#line 3741 "src/parser.c" break; - case 126: /* ArrayPats: Pattern */ -#line 831 "src/parser.y" + case 127: /* ArrayPats: Pattern */ +#line 833 "src/parser.y" { (yyval.blk) = gen_array_matcher(gen_noop(), (yyvsp[0].blk)); } -#line 3738 "src/parser.c" +#line 3749 "src/parser.c" break; - case 127: /* ArrayPats: ArrayPats ',' Pattern */ -#line 834 "src/parser.y" + case 128: /* ArrayPats: ArrayPats ',' Pattern */ +#line 836 "src/parser.y" { (yyval.blk) = gen_array_matcher((yyvsp[-2].blk), (yyvsp[0].blk)); } -#line 3746 "src/parser.c" +#line 3757 "src/parser.c" break; - case 128: /* ObjPats: ObjPat */ -#line 839 "src/parser.y" + case 129: /* ObjPats: ObjPat */ +#line 841 "src/parser.y" { (yyval.blk) = (yyvsp[0].blk); } -#line 3754 "src/parser.c" +#line 3765 "src/parser.c" break; - case 129: /* ObjPats: ObjPats ',' ObjPat */ -#line 842 "src/parser.y" + case 130: /* ObjPats: ObjPats ',' ObjPat */ +#line 844 "src/parser.y" { (yyval.blk) = BLOCK((yyvsp[-2].blk), (yyvsp[0].blk)); } -#line 3762 "src/parser.c" +#line 3773 "src/parser.c" break; - case 130: /* ObjPat: BINDING */ -#line 847 "src/parser.y" + case 131: /* ObjPat: BINDING */ +#line 849 "src/parser.y" { (yyval.blk) = gen_object_matcher(gen_const((yyvsp[0].literal)), gen_op_unbound(STOREV, jv_string_value((yyvsp[0].literal)))); } -#line 3770 "src/parser.c" +#line 3781 "src/parser.c" break; - case 131: /* ObjPat: BINDING ':' Pattern */ -#line 850 "src/parser.y" + case 132: /* ObjPat: BINDING ':' Pattern */ +#line 852 "src/parser.y" { (yyval.blk) = gen_object_matcher(gen_const((yyvsp[-2].literal)), BLOCK(gen_op_simple(DUP), gen_op_unbound(STOREV, jv_string_value((yyvsp[-2].literal))), (yyvsp[0].blk))); } -#line 3778 "src/parser.c" +#line 3789 "src/parser.c" break; - case 132: /* ObjPat: IDENT ':' Pattern */ -#line 853 "src/parser.y" + case 133: /* ObjPat: IDENT ':' Pattern */ +#line 855 "src/parser.y" { (yyval.blk) = gen_object_matcher(gen_const((yyvsp[-2].literal)), (yyvsp[0].blk)); } -#line 3786 "src/parser.c" +#line 3797 "src/parser.c" break; - case 133: /* ObjPat: Keyword ':' Pattern */ -#line 856 "src/parser.y" + case 134: /* ObjPat: Keyword ':' Pattern */ +#line 858 "src/parser.y" { (yyval.blk) = gen_object_matcher(gen_const((yyvsp[-2].literal)), (yyvsp[0].blk)); } -#line 3794 "src/parser.c" +#line 3805 "src/parser.c" break; - case 134: /* ObjPat: String ':' Pattern */ -#line 859 "src/parser.y" + case 135: /* ObjPat: String ':' Pattern */ +#line 861 "src/parser.y" { (yyval.blk) = gen_object_matcher((yyvsp[-2].blk), (yyvsp[0].blk)); } -#line 3802 "src/parser.c" +#line 3813 "src/parser.c" break; - case 135: /* ObjPat: '(' Exp ')' ':' Pattern */ -#line 862 "src/parser.y" + case 136: /* ObjPat: '(' Exp ')' ':' Pattern */ +#line 864 "src/parser.y" { jv msg = check_object_key((yyvsp[-3].blk)); if (jv_is_valid(msg)) { @@ -3811,269 +3822,269 @@ YYLTYPE yylloc = yyloc_default; jv_free(msg); (yyval.blk) = gen_object_matcher((yyvsp[-3].blk), (yyvsp[0].blk)); } -#line 3815 "src/parser.c" +#line 3826 "src/parser.c" break; - case 136: /* ObjPat: error ':' Pattern */ -#line 870 "src/parser.y" + case 137: /* ObjPat: error ':' Pattern */ +#line 872 "src/parser.y" { FAIL((yyloc), "May need parentheses around object key expression"); (yyval.blk) = (yyvsp[0].blk); } -#line 3824 "src/parser.c" +#line 3835 "src/parser.c" break; - case 137: /* Keyword: "as" */ -#line 876 "src/parser.y" + case 138: /* Keyword: "as" */ +#line 878 "src/parser.y" { (yyval.literal) = jv_string("as"); } -#line 3832 "src/parser.c" +#line 3843 "src/parser.c" break; - case 138: /* Keyword: "def" */ -#line 879 "src/parser.y" + case 139: /* Keyword: "def" */ +#line 881 "src/parser.y" { (yyval.literal) = jv_string("def"); } -#line 3840 "src/parser.c" +#line 3851 "src/parser.c" break; - case 139: /* Keyword: "module" */ -#line 882 "src/parser.y" + case 140: /* Keyword: "module" */ +#line 884 "src/parser.y" { (yyval.literal) = jv_string("module"); } -#line 3848 "src/parser.c" +#line 3859 "src/parser.c" break; - case 140: /* Keyword: "import" */ -#line 885 "src/parser.y" + case 141: /* Keyword: "import" */ +#line 887 "src/parser.y" { (yyval.literal) = jv_string("import"); } -#line 3856 "src/parser.c" +#line 3867 "src/parser.c" break; - case 141: /* Keyword: "include" */ -#line 888 "src/parser.y" + case 142: /* Keyword: "include" */ +#line 890 "src/parser.y" { (yyval.literal) = jv_string("include"); } -#line 3864 "src/parser.c" +#line 3875 "src/parser.c" break; - case 142: /* Keyword: "if" */ -#line 891 "src/parser.y" + case 143: /* Keyword: "if" */ +#line 893 "src/parser.y" { (yyval.literal) = jv_string("if"); } -#line 3872 "src/parser.c" +#line 3883 "src/parser.c" break; - case 143: /* Keyword: "then" */ -#line 894 "src/parser.y" + case 144: /* Keyword: "then" */ +#line 896 "src/parser.y" { (yyval.literal) = jv_string("then"); } -#line 3880 "src/parser.c" +#line 3891 "src/parser.c" break; - case 144: /* Keyword: "else" */ -#line 897 "src/parser.y" + case 145: /* Keyword: "else" */ +#line 899 "src/parser.y" { (yyval.literal) = jv_string("else"); } -#line 3888 "src/parser.c" +#line 3899 "src/parser.c" break; - case 145: /* Keyword: "elif" */ -#line 900 "src/parser.y" + case 146: /* Keyword: "elif" */ +#line 902 "src/parser.y" { (yyval.literal) = jv_string("elif"); } -#line 3896 "src/parser.c" +#line 3907 "src/parser.c" break; - case 146: /* Keyword: "reduce" */ -#line 903 "src/parser.y" + case 147: /* Keyword: "reduce" */ +#line 905 "src/parser.y" { (yyval.literal) = jv_string("reduce"); } -#line 3904 "src/parser.c" +#line 3915 "src/parser.c" break; - case 147: /* Keyword: "foreach" */ -#line 906 "src/parser.y" + case 148: /* Keyword: "foreach" */ +#line 908 "src/parser.y" { (yyval.literal) = jv_string("foreach"); } -#line 3912 "src/parser.c" +#line 3923 "src/parser.c" break; - case 148: /* Keyword: "end" */ -#line 909 "src/parser.y" + case 149: /* Keyword: "end" */ +#line 911 "src/parser.y" { (yyval.literal) = jv_string("end"); } -#line 3920 "src/parser.c" +#line 3931 "src/parser.c" break; - case 149: /* Keyword: "and" */ -#line 912 "src/parser.y" + case 150: /* Keyword: "and" */ +#line 914 "src/parser.y" { (yyval.literal) = jv_string("and"); } -#line 3928 "src/parser.c" +#line 3939 "src/parser.c" break; - case 150: /* Keyword: "or" */ -#line 915 "src/parser.y" + case 151: /* Keyword: "or" */ +#line 917 "src/parser.y" { (yyval.literal) = jv_string("or"); } -#line 3936 "src/parser.c" +#line 3947 "src/parser.c" break; - case 151: /* Keyword: "try" */ -#line 918 "src/parser.y" + case 152: /* Keyword: "try" */ +#line 920 "src/parser.y" { (yyval.literal) = jv_string("try"); } -#line 3944 "src/parser.c" +#line 3955 "src/parser.c" break; - case 152: /* Keyword: "catch" */ -#line 921 "src/parser.y" + case 153: /* Keyword: "catch" */ +#line 923 "src/parser.y" { (yyval.literal) = jv_string("catch"); } -#line 3952 "src/parser.c" +#line 3963 "src/parser.c" break; - case 153: /* Keyword: "label" */ -#line 924 "src/parser.y" + case 154: /* Keyword: "label" */ +#line 926 "src/parser.y" { (yyval.literal) = jv_string("label"); } -#line 3960 "src/parser.c" +#line 3971 "src/parser.c" break; - case 154: /* Keyword: "break" */ -#line 927 "src/parser.y" + case 155: /* Keyword: "break" */ +#line 929 "src/parser.y" { (yyval.literal) = jv_string("break"); } -#line 3968 "src/parser.c" +#line 3979 "src/parser.c" break; - case 155: /* MkDict: %empty */ -#line 932 "src/parser.y" + case 156: /* MkDict: %empty */ +#line 934 "src/parser.y" { (yyval.blk)=gen_noop(); } -#line 3976 "src/parser.c" +#line 3987 "src/parser.c" break; - case 156: /* MkDict: MkDictPair */ -#line 935 "src/parser.y" + case 157: /* MkDict: MkDictPair */ +#line 937 "src/parser.y" { (yyval.blk) = (yyvsp[0].blk); } -#line 3982 "src/parser.c" +#line 3993 "src/parser.c" break; - case 157: /* MkDict: MkDictPair ',' MkDict */ -#line 936 "src/parser.y" + case 158: /* MkDict: MkDictPair ',' MkDict */ +#line 938 "src/parser.y" { (yyval.blk)=block_join((yyvsp[-2].blk), (yyvsp[0].blk)); } -#line 3988 "src/parser.c" +#line 3999 "src/parser.c" break; - case 158: /* MkDict: error ',' MkDict */ -#line 937 "src/parser.y" + case 159: /* MkDict: error ',' MkDict */ +#line 939 "src/parser.y" { (yyval.blk) = (yyvsp[0].blk); } -#line 3994 "src/parser.c" +#line 4005 "src/parser.c" break; - case 159: /* MkDictPair: IDENT ':' ExpD */ -#line 940 "src/parser.y" + case 160: /* MkDictPair: IDENT ':' ExpD */ +#line 942 "src/parser.y" { (yyval.blk) = gen_dictpair(gen_const((yyvsp[-2].literal)), (yyvsp[0].blk)); } -#line 4002 "src/parser.c" +#line 4013 "src/parser.c" break; - case 160: /* MkDictPair: Keyword ':' ExpD */ -#line 943 "src/parser.y" + case 161: /* MkDictPair: Keyword ':' ExpD */ +#line 945 "src/parser.y" { (yyval.blk) = gen_dictpair(gen_const((yyvsp[-2].literal)), (yyvsp[0].blk)); } -#line 4010 "src/parser.c" +#line 4021 "src/parser.c" break; - case 161: /* MkDictPair: String ':' ExpD */ -#line 946 "src/parser.y" + case 162: /* MkDictPair: String ':' ExpD */ +#line 948 "src/parser.y" { (yyval.blk) = gen_dictpair((yyvsp[-2].blk), (yyvsp[0].blk)); } -#line 4018 "src/parser.c" +#line 4029 "src/parser.c" break; - case 162: /* MkDictPair: String */ -#line 949 "src/parser.y" + case 163: /* MkDictPair: String */ +#line 951 "src/parser.y" { (yyval.blk) = gen_dictpair((yyvsp[0].blk), BLOCK(gen_op_simple(POP), gen_op_simple(DUP2), gen_op_simple(DUP2), gen_op_simple(INDEX))); } -#line 4027 "src/parser.c" +#line 4038 "src/parser.c" break; - case 163: /* MkDictPair: BINDING ':' ExpD */ -#line 953 "src/parser.y" + case 164: /* MkDictPair: BINDING ':' ExpD */ +#line 955 "src/parser.y" { (yyval.blk) = gen_dictpair(gen_location((yyloc), locations, gen_op_unbound(LOADV, jv_string_value((yyvsp[-2].literal)))), (yyvsp[0].blk)); jv_free((yyvsp[-2].literal)); } -#line 4037 "src/parser.c" +#line 4048 "src/parser.c" break; - case 164: /* MkDictPair: BINDING */ -#line 958 "src/parser.y" + case 165: /* MkDictPair: BINDING */ +#line 960 "src/parser.y" { (yyval.blk) = gen_dictpair(gen_const((yyvsp[0].literal)), gen_location((yyloc), locations, gen_op_unbound(LOADV, jv_string_value((yyvsp[0].literal))))); } -#line 4046 "src/parser.c" +#line 4057 "src/parser.c" break; - case 165: /* MkDictPair: IDENT */ -#line 962 "src/parser.y" + case 166: /* MkDictPair: IDENT */ +#line 964 "src/parser.y" { (yyval.blk) = gen_dictpair(gen_const(jv_copy((yyvsp[0].literal))), gen_index(gen_noop(), gen_const((yyvsp[0].literal)))); } -#line 4055 "src/parser.c" +#line 4066 "src/parser.c" break; - case 166: /* MkDictPair: "$__loc__" */ -#line 966 "src/parser.y" + case 167: /* MkDictPair: "$__loc__" */ +#line 968 "src/parser.y" { (yyval.blk) = gen_dictpair(gen_const(jv_string("__loc__")), gen_loc_object(&(yyloc), locations)); } -#line 4064 "src/parser.c" +#line 4075 "src/parser.c" break; - case 167: /* MkDictPair: Keyword */ -#line 970 "src/parser.y" + case 168: /* MkDictPair: Keyword */ +#line 972 "src/parser.y" { (yyval.blk) = gen_dictpair(gen_const(jv_copy((yyvsp[0].literal))), gen_index(gen_noop(), gen_const((yyvsp[0].literal)))); } -#line 4073 "src/parser.c" +#line 4084 "src/parser.c" break; - case 168: /* MkDictPair: '(' Exp ')' ':' ExpD */ -#line 974 "src/parser.y" + case 169: /* MkDictPair: '(' Exp ')' ':' ExpD */ +#line 976 "src/parser.y" { jv msg = check_object_key((yyvsp[-3].blk)); if (jv_is_valid(msg)) { @@ -4082,20 +4093,20 @@ YYLTYPE yylloc = yyloc_default; jv_free(msg); (yyval.blk) = gen_dictpair((yyvsp[-3].blk), (yyvsp[0].blk)); } -#line 4086 "src/parser.c" +#line 4097 "src/parser.c" break; - case 169: /* MkDictPair: error ':' ExpD */ -#line 982 "src/parser.y" + case 170: /* MkDictPair: error ':' ExpD */ +#line 984 "src/parser.y" { FAIL((yyloc), "May need parentheses around object key expression"); (yyval.blk) = (yyvsp[0].blk); } -#line 4095 "src/parser.c" +#line 4106 "src/parser.c" break; -#line 4099 "src/parser.c" +#line 4110 "src/parser.c" default: break; } @@ -4324,7 +4335,7 @@ YYLTYPE yylloc = yyloc_default; return yyresult; } -#line 986 "src/parser.y" +#line 988 "src/parser.y" int jq_parse(struct locfile* locations, block* answer) { diff --git a/src/parser.y b/src/parser.y index 3d24689552..4a36cdae2e 100644 --- a/src/parser.y +++ b/src/parser.y @@ -254,10 +254,6 @@ static block gen_binop(block a, block b, int op) { return gen_call(funcname, BLOCK(gen_lambda(a), gen_lambda(b))); } -static block gen_format(block a, jv fmt) { - return BLOCK(a, gen_call("format", gen_lambda(gen_const(fmt)))); -} - static block gen_definedor_assign(block object, block val) { block tmp = gen_op_var_fresh(STOREV, "tmp"); return BLOCK(gen_op_simple(DUP), @@ -542,10 +538,13 @@ FuncDef: $$ = gen_function(jv_string_value($2), gen_noop(), $4); jv_free($2); } | - "def" IDENT '(' Params ')' ':' Exp ';' { $$ = gen_function(jv_string_value($2), $4, $7); jv_free($2); +} | +"def" FORMAT ':' Exp ';' { + $$ = gen_function(jv_string_value($2), gen_noop(), $4); + jv_free($2); } Params: @@ -572,7 +571,7 @@ FORMAT QQSTRING_START { $$ = $1; } | QQSTRING_START { - $$ = jv_string("text"); + $$ = jv_string("@text"); } @@ -591,7 +590,8 @@ QQString QQSTRING_TEXT { $$ = gen_binop($1, gen_const($2), '+'); } | QQString QQSTRING_INTERP_START Exp QQSTRING_INTERP_END { - $$ = gen_binop($1, gen_format($3, jv_copy($0)), '+'); + const char *s = jv_string_value($0); + $$ = gen_binop($1, BLOCK($3, gen_location(@$, locations, gen_call(s, gen_noop()))), '+'); } @@ -720,7 +720,9 @@ String { $$ = $1; } | FORMAT { - $$ = gen_format(gen_noop(), $1); + const char *s = jv_string_value($1); + $$ = gen_location(@$, locations, gen_call(s, gen_noop())); + jv_free($1); } | '(' Exp ')' { $$ = $2; diff --git a/tests/jq.test b/tests/jq.test index b430348ab2..65cfccb1a5 100644 --- a/tests/jq.test +++ b/tests/jq.test @@ -74,6 +74,12 @@ null "ISgpPD4mJyIJ" "!()<>&'\"\t" +[0,nan,null,false,true,"",0] | @csv, @tsv, @sh +null +"0,,,false,true,\"\",0" +"0\t\t\tfalse\ttrue\t\t0" +"0 null null false true '' 0" + # regression test for #436 @base64 "foĆ³bar\n" @@ -95,6 +101,14 @@ null "" "<script>hax</script>" +%%FAIL +@unknown +jq: error: @unknown is not a defined format at , line 1: + +%%FAIL +@unknown "\(.)" +jq: error: @unknown is not a defined format at , line 1: + [.[]|tojson|fromjson] ["foo", 1, ["a", 1, "b", 2, {"foo":"bar"}]] ["foo",1,["a",1,"b",2,{"foo":"bar"}]] @@ -1917,7 +1931,7 @@ true null false -all(builtins[] / "/"; .[1]|tonumber >= 0) +all(builtins[] / "/"; .[1]|tonumber? >= 0) null true @@ -1925,6 +1939,10 @@ builtins|any(.[:1] == "_") null false +"@json"|IN(builtins[]) +null +true + ## Test ability to use keywords (uncomment after eval is pushed) #(.[] as $kw | "\"{\($kw)} as $\($kw) | $\($kw) | {$\($kw)} | {\($kw):.\($kw)}\""|eval|empty),null #["as","def","module","import","include","if","then","else","elif","end","reduce","foreach","and","or","try","catch","label","break","__loc__"] diff --git a/tests/manonig.test b/tests/manonig.test index 11c33fb3bb..e60dafc1df 100644 --- a/tests/manonig.test +++ b/tests/manonig.test @@ -6,6 +6,11 @@ walk( if type == "object" then with_entries( .key |= sub( "^_+"; "") ) else . en [ { "_a": { "__b": 2 } } ] [{"a":{"b":2}}] +def @foo: gsub("a+"; "."); @foo, @foo "a \(.) \(. + .) a" +"aba" +".b." +"a .b. .b.b. a" + test("foo") "foo" true