From b8d0ab80bb4890cc81353f9231b4838d024eaa25 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Sun, 10 Sep 2023 21:37:44 +0900 Subject: [PATCH] Declare `k_class` and `k_module` as `ctxt` So that it is not ncessary to specify the type each time. --- parse.y | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/parse.y b/parse.y index 70812f21ea..4d49569542 100644 --- a/parse.y +++ b/parse.y @@ -1617,7 +1617,7 @@ static int looking_at_eol_p(struct parser_params *p); %type f_kwrest f_label f_arg_asgn call_op call_op2 reswords relop dot_or_colon %type p_kwrest p_kwnorest p_any_kwrest p_kw_label %type f_no_kwarg f_any_kwrest args_forward excessed_comma nonlocal_var - %type lex_ctxt /* keep in ripper */ + %type lex_ctxt k_class k_module /* keep in ripper */ %token END_OF_INPUT 0 "end-of-input" %token '.' /* escaped chars, should be ignored otherwise */ @@ -3609,8 +3609,8 @@ primary : literal /*% %*/ /*% ripper: class!($2, $3, $5) %*/ local_pop(p); - p->ctxt.in_class = $1.in_class; - p->ctxt.shareable_constant_value = $1.shareable_constant_value; + p->ctxt.in_class = $1.in_class; + p->ctxt.shareable_constant_value = $1.shareable_constant_value; } | k_class tLSHFT expr { @@ -3630,9 +3630,9 @@ primary : literal /*% %*/ /*% ripper: sclass!($3, $6) %*/ local_pop(p); - p->ctxt.in_def = $1.in_def; - p->ctxt.in_class = $1.in_class; - p->ctxt.shareable_constant_value = $1.shareable_constant_value; + p->ctxt.in_def = $1.in_def; + p->ctxt.in_class = $1.in_class; + p->ctxt.shareable_constant_value = $1.shareable_constant_value; } | k_module cpath { @@ -3654,8 +3654,8 @@ primary : literal /*% %*/ /*% ripper: module!($2, $4) %*/ local_pop(p); - p->ctxt.in_class = $1.in_class; - p->ctxt.shareable_constant_value = $1.shareable_constant_value; + p->ctxt.in_class = $1.in_class; + p->ctxt.shareable_constant_value = $1.shareable_constant_value; } | defn_head f_arglist @@ -3807,7 +3807,7 @@ k_for : keyword_for k_class : keyword_class { token_info_push(p, "class", &@$); - $$ = p->ctxt; + $$ = p->ctxt; /*%%%*/ push_end_expect_token_locations(p, &@1.beg_pos); /*% %*/ @@ -3817,7 +3817,7 @@ k_class : keyword_class k_module : keyword_module { token_info_push(p, "module", &@$); - $$ = p->ctxt; + $$ = p->ctxt; /*%%%*/ push_end_expect_token_locations(p, &@1.beg_pos); /*% %*/