From 4ac8d1172483634bb24183b8ad2aaa03435b17a3 Mon Sep 17 00:00:00 2001 From: Kazuki Tsujimoto Date: Sat, 1 Apr 2023 16:28:05 +0900 Subject: `*` in an array pattern should not be parsed as nil in ripper After 6c0925ba7017efde6091e2ec4f1a6be268166696, it was impossible to distinguish between the presence or absence of `*`. # Before the commit Ripper.sexp('0 in []')[1][0][2][1] #=> [:aryptn, nil, nil, nil, nil] Ripper.sexp('0 in [*]')[1][0][2][1] #=> [:aryptn, nil, nil, [:var_field, nil], nil] # After the commit Ripper.sexp('0 in []')[1][0][2][1] #=> [:aryptn, nil, nil, nil, nil] Ripper.sexp('0 in [*]')[1][0][2][1] #=> [:aryptn, nil, nil, nil, nil] This commit reverts it. --- parse.y | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'parse.y') diff --git a/parse.y b/parse.y index 4ff8644c47..f371185ee0 100644 --- a/parse.y +++ b/parse.y @@ -4656,7 +4656,7 @@ p_rest : tSTAR tIDENTIFIER /*%%%*/ $$ = 0; /*% %*/ - /*% ripper: Qnil %*/ + /*% ripper: var_field(p, Qnil) %*/ } ; -- cgit v1.2.3