summaryrefslogtreecommitdiffhomepage
path: root/mrbgems/mruby-compiler/core
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2021-07-26 11:13:24 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2021-07-26 11:20:59 +0900
commit984161e6bb0344a8fe6faed5be189de13c9e1d23 (patch)
treeaee1067fa5b8144aac354188a1ab98735ce7b79b /mrbgems/mruby-compiler/core
parent4803718b14bef490418368d3003b97e09c30d685 (diff)
downloadmruby-984161e6bb0344a8fe6faed5be189de13c9e1d23.tar.gz
mruby-984161e6bb0344a8fe6faed5be189de13c9e1d23.zip
parse.y: `mrb_int_read()` returns `mrb_int` not `unsigned long`.
Also, now too big capture group index just gives `nil`, not error.
Diffstat (limited to 'mrbgems/mruby-compiler/core')
-rw-r--r--mrbgems/mruby-compiler/core/parse.y8
1 files changed, 4 insertions, 4 deletions
diff --git a/mrbgems/mruby-compiler/core/parse.y b/mrbgems/mruby-compiler/core/parse.y
index c7f044a30..0bda39dca 100644
--- a/mrbgems/mruby-compiler/core/parse.y
+++ b/mrbgems/mruby-compiler/core/parse.y
@@ -6256,10 +6256,10 @@ parser_yylex(parser_state *p)
if (last_state == EXPR_FNAME) goto gvar;
tokfix(p);
{
- unsigned long n = mrb_int_read(tok(p), NULL, NULL);
- if (n > INT_MAX) {
- yyerror(p, "capture group index must be <= " MRB_STRINGIZE(INT_MAX));
- return 0;
+ mrb_int n = mrb_int_read(tok(p), NULL, NULL);
+ if (n > INT32_MAX) {
+ yywarning(p, "capture group index too big; always nil");
+ return keyword_nil;
}
pylval.nd = new_nth_ref(p, (int)n);
}