lib/parser/ruby-next/lexer.rl in ruby-next-parser-3.1.1.0 vs lib/parser/ruby-next/lexer.rl in ruby-next-parser-3.1.1.1

- old
+ new

@@ -94,11 +94,11 @@ attr_accessor :diagnostics attr_accessor :static_env attr_accessor :force_utf32 - attr_accessor :cond, :cmdarg, :in_kwarg, :context, :command_start + attr_accessor :cond, :cmdarg, :context, :command_start attr_accessor :tokens, :comments attr_reader :paren_nest, :cmdarg_stack, :cond_stack, :lambda_stack @@ -1441,19 +1441,19 @@ expr_endfn := |* label ( any - ':' ) => { emit(:tLABEL, tok(@ts, @te - 2), @ts, @te - 1) fhold; fnext expr_labelarg; fbreak; }; - '...' c_nl + '...' => { - if @version >= 31 - emit(:tBDOT3, '...'.freeze, @ts, @te - 1) - emit(:tNL, "\n".freeze, @te - 1, @te) + if @version >= 31 && @context.in_argdef + emit(:tBDOT3, '...'.freeze) + # emit(:tNL, "\n".freeze, @te - 1, @te) fnext expr_end; fbreak; else - p -= 4; - fhold; fgoto expr_end; + p -= 3; + fgoto expr_end; end }; w_space_comment; @@ -2075,11 +2075,11 @@ # To reject `->(...)` like `->...` emit(:tDOT3, '...'.freeze, @ts, dots_te) else emit(:tBDOT3, '...'.freeze, @ts, dots_te) - if @version >= 31 && followed_by_nl && @context.in_def_open_args? + if @version >= 31 && followed_by_nl && @context.in_argdef emit(:tNL, @te - 1, @te) nl_emitted = true end end elsif @version >= 27 @@ -2160,10 +2160,10 @@ expr_labelarg := |* w_space_comment; w_newline => { - if @in_kwarg + if @context.in_kwarg fhold; fgoto expr_end; else fgoto line_begin; end };