lib/parser/ruby-next/lexer.rl in ruby-next-parser-3.0.0.1 vs lib/parser/ruby-next/lexer.rl in ruby-next-parser-3.0.0.2

- old
+ new

@@ -98,10 +98,12 @@ attr_accessor :cond, :cmdarg, :in_kwarg, :context, :command_start attr_accessor :tokens, :comments + attr_reader :paren_nest, :cmdarg_stack, :cond_stack, :lambda_stack + def initialize(version) @version = version @static_env = nil @context = nil @@ -1543,11 +1545,15 @@ | '<<' ) => { if tok(tm, tm + 1) == '/'.freeze # Ambiguous regexp literal. - diagnostic :warning, :ambiguous_literal, nil, range(tm, tm + 1) + if @version < 30 + diagnostic :warning, :ambiguous_literal, nil, range(tm, tm + 1) + else + diagnostic :warning, :ambiguous_regexp, nil, range(tm, tm + 1) + end end p = tm - 1 fgoto expr_beg; }; @@ -2029,11 +2035,11 @@ fnext expr_beg; fbreak; }; '...' => { - if @version >= 28 + if @version >= 30 if @lambda_stack.any? && @lambda_stack.last + 1 == @paren_nest # To reject `->(...)` like `->...` emit(:tDOT3) else emit(:tBDOT3) @@ -2401,10 +2407,10 @@ # '*' | '=>' => { emit_table(PUNCTUATION) - fgoto expr_value; + fnext expr_value; fbreak; }; # When '|', '~', '!', '=>' are used as operators # they do not accept any symbols (or quoted labels) after. # Other binary operators accept it.