11# frozen_string_literal: true
22
3- require "set"
43require "strscan"
54require_relative "../../polyfill/append_as_bytes"
65
@@ -11,7 +10,7 @@ class Parser
1110 # format for the parser gem.
1211 class Lexer
1312 # These tokens are always skipped
14- TYPES_ALWAYS_SKIP = %i[ IGNORED_NEWLINE __END__ EOF ] . to_set
13+ TYPES_ALWAYS_SKIP = Set . new ( %i[ IGNORED_NEWLINE __END__ EOF ] )
1514 private_constant :TYPES_ALWAYS_SKIP
1615
1716 # The direct translating of types between the two lexers.
@@ -196,18 +195,18 @@ class Lexer
196195 #
197196 # NOTE: In edge cases like `-> (foo = -> (bar) {}) do end`, please note that `kDO` is still returned
198197 # instead of `kDO_LAMBDA`, which is expected: https://github.com/ruby/prism/pull/3046
199- LAMBDA_TOKEN_TYPES = [ :kDO_LAMBDA , :tLAMBDA , :tLAMBEG ] . to_set
198+ LAMBDA_TOKEN_TYPES = Set . new ( [ :kDO_LAMBDA , :tLAMBDA , :tLAMBEG ] )
200199
201200 # The `PARENTHESIS_LEFT` token in Prism is classified as either `tLPAREN` or `tLPAREN2` in the Parser gem.
202201 # The following token types are listed as those classified as `tLPAREN`.
203- LPAREN_CONVERSION_TOKEN_TYPES = [
202+ LPAREN_CONVERSION_TOKEN_TYPES = Set . new ( [
204203 :kBREAK , :kCASE , :tDIVIDE , :kFOR , :kIF , :kNEXT , :kRETURN , :kUNTIL , :kWHILE , :tAMPER , :tANDOP , :tBANG , :tCOMMA , :tDOT2 , :tDOT3 ,
205204 :tEQL , :tLPAREN , :tLPAREN2 , :tLPAREN_ARG , :tLSHFT , :tNL , :tOP_ASGN , :tOROP , :tPIPE , :tSEMI , :tSTRING_DBEG , :tUMINUS , :tUPLUS
206- ] . to_set
205+ ] )
207206
208207 # Types of tokens that are allowed to continue a method call with comments in-between.
209208 # For these, the parser gem doesn't emit a newline token after the last comment.
210- COMMENT_CONTINUATION_TYPES = [ :COMMENT , :AMPERSAND_DOT , :DOT ] . to_set
209+ COMMENT_CONTINUATION_TYPES = Set . new ( [ :COMMENT , :AMPERSAND_DOT , :DOT ] )
211210 private_constant :COMMENT_CONTINUATION_TYPES
212211
213212 # Heredocs are complex and require us to keep track of a bit of info to refer to later
0 commit comments