parse.y: `mrb_int_read()` returns `mrb_int` not `unsigned long`.

Also, now too big capture group index just gives `nil`, not error.
parent 4803718b
...@@ -6256,10 +6256,10 @@ parser_yylex(parser_state *p) ...@@ -6256,10 +6256,10 @@ parser_yylex(parser_state *p)
if (last_state == EXPR_FNAME) goto gvar; if (last_state == EXPR_FNAME) goto gvar;
tokfix(p); tokfix(p);
{ {
unsigned long n = mrb_int_read(tok(p), NULL, NULL); mrb_int n = mrb_int_read(tok(p), NULL, NULL);
if (n > INT_MAX) { if (n > INT32_MAX) {
yyerror(p, "capture group index must be <= " MRB_STRINGIZE(INT_MAX)); yywarning(p, "capture group index too big; always nil");
return 0; return keyword_nil;
} }
pylval.nd = new_nth_ref(p, (int)n); pylval.nd = new_nth_ref(p, (int)n);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment