Skip to content

Commit

Permalink
define ALL_PARSERS constant
Browse files Browse the repository at this point in the history
  • Loading branch information
flyerhzm committed Jun 16, 2024
1 parent 007602a commit df8c510
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions lib/synvert/core.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,5 @@ module Synvert
PARSER_PARSER = 'parser'
SYNTAX_TREE_PARSER = 'syntax_tree'
PRISM_PARSER = 'prism'
ALL_PARSERS = [PARSER_PARSER, SYNTAX_TREE_PARSER, PRISM_PARSER].freeze
end
2 changes: 1 addition & 1 deletion lib/synvert/core/rewriter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ def reset
# @option strategy [String] 'allow_insert_at_same_position'
def configure(options)
@options = @options.merge(options)
if options[:parser] && ![Synvert::PARSER_PARSER, Synvert::SYNTAX_TREE_PARSER, Synvert::PRISM_PARSER].include?(options[:parser])
if options[:parser] && !Synvert::ALL_PARSERS.include?(options[:parser])
raise Errors::ParserNotSupported.new("Parser #{options[:parser]} not supported")
end
end
Expand Down

0 comments on commit df8c510

Please sign in to comment.