Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mruby
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
mruby
Commits
885a87e4
Unverified
Commit
885a87e4
authored
Nov 10, 2021
by
Yukihiro "Matz" Matsumoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
parse.y: allow `...` in formal arguments without parentheses.
parent
2e0c1b43
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3149 additions
and
3028 deletions
+3149
-3028
mrbgems/mruby-compiler/core/parse.y
mrbgems/mruby-compiler/core/parse.y
+21
-12
mrbgems/mruby-compiler/core/y.tab.c
mrbgems/mruby-compiler/core/y.tab.c
+3128
-3016
No files found.
mrbgems/mruby-compiler/core/parse.y
View file @
885a87e4
...
...
@@ -884,6 +884,17 @@ new_kw_rest_args(parser_state *p, node *a)
return cons((node*)NODE_KW_REST_ARGS, a);
}
static node*
new_args_dots(parser_state *p, node *m)
{
mrb_sym r = intern_op(mul);
mrb_sym k = intern_op(pow);
mrb_sym b = intern_op(and);
local_add_f(p, r);
return new_args(p, m, 0, r, 0,
new_args_tail(p, 0, new_kw_rest_args(p, nsym(k)), b));
}
/* (:block_arg . a) */
static node*
new_block_arg(parser_state *p, node *a)
...
...
@@ -3621,21 +3632,11 @@ f_arglist_paren : '(' f_args rparen
}
| '(' f_arg ',' tBDOT3 rparen
{
mrb_sym r = intern_op(mul);
mrb_sym k = intern_op(pow);
mrb_sym b = intern_op(and);
local_add_f(p, r);
$$ = new_args(p, $2, 0, r, 0,
new_args_tail(p, 0, new_kw_rest_args(p, nsym(k)), b));
$$ = new_args_dots(p, $2);
}
| '(' tBDOT3 rparen
{
mrb_sym r = intern_op(mul);
mrb_sym k = intern_op(pow);
mrb_sym b = intern_op(and);
local_add_f(p, r);
$$ = new_args(p, 0, 0, r, 0,
new_args_tail(p, 0, new_kw_rest_args(p, nsym(k)), b));
$$ = new_args_dots(p, 0);
}
;
...
...
@@ -3644,6 +3645,14 @@ f_arglist : f_arglist_paren
{
$$ = $1;
}
| f_arg ',' tBDOT3 term
{
$$ = new_args_dots(p, $1);
}
| tDOT3 term
{
$$ = new_args_dots(p, 0);
}
;
f_label : tIDENTIFIER tLABEL_TAG
...
...
mrbgems/mruby-compiler/core/y.tab.c
View file @
885a87e4
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment