Allow dot3 in defs singleton
This commit is contained in:
parent
8f678d6989
commit
b9e225fcbf
Notes:
git
2024-09-28 13:38:02 +00:00
9
parse.y
9
parse.y
@ -3426,7 +3426,6 @@ defn_head : k_def def_name
|
||||
defs_head : k_def singleton dot_or_colon
|
||||
{
|
||||
SET_LEX_STATE(EXPR_FNAME);
|
||||
p->ctxt.in_argdef = 1;
|
||||
}
|
||||
def_name
|
||||
{
|
||||
@ -6746,8 +6745,14 @@ singleton : var_ref
|
||||
value_expr($1);
|
||||
$$ = $1;
|
||||
}
|
||||
| '(' {SET_LEX_STATE(EXPR_BEG);} expr rparen
|
||||
| '('
|
||||
{
|
||||
SET_LEX_STATE(EXPR_BEG);
|
||||
p->ctxt.in_argdef = 0;
|
||||
}
|
||||
expr rparen
|
||||
{
|
||||
p->ctxt.in_argdef = 1;
|
||||
NODE *expr = last_expr_node($3);
|
||||
switch (nd_type(expr)) {
|
||||
case NODE_STR:
|
||||
|
@ -1968,6 +1968,8 @@ eom
|
||||
assert_valid_syntax("def foo b = 1, ...; bar(...); end")
|
||||
assert_valid_syntax("(def foo ...\n bar(...)\nend)")
|
||||
assert_valid_syntax("(def foo ...; bar(...); end)")
|
||||
assert_valid_syntax("def (1...).foo ...; bar(...); end")
|
||||
assert_valid_syntax("def (tap{1...}).foo ...; bar(...); end")
|
||||
assert_valid_syntax('def ==(...) end')
|
||||
assert_valid_syntax('def [](...) end')
|
||||
assert_valid_syntax('def nil(...) end')
|
||||
|
Loading…
x
Reference in New Issue
Block a user