Sha256: bf5bb606f556e360df9a4596583f7a22b2df3cec8cfe7a1080eb874f03d651c0

Contents?: true

Size: 636 Bytes

Versions: 6

Compression:

Stored size: 636 Bytes

Contents

# frozen_string_literal: true

module SyntaxTree
  module Translation
    # This visitor is responsible for converting the syntax tree produced by
    # Syntax Tree into the syntax tree produced by the rubocop/rubocop-ast gem.
    class RuboCopAST < Parser
      private

      # This method is effectively the same thing as the parser gem except that
      # it uses the rubocop-ast specializations of the nodes.
      def s(type, children, location)
        ::RuboCop::AST::Builder::NODE_MAP.fetch(type, ::RuboCop::AST::Node).new(
          type,
          children,
          location: location
        )
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
syntax_tree-6.2.0 lib/syntax_tree/translation/rubocop_ast.rb
syntax_tree-6.1.1 lib/syntax_tree/translation/rubocop_ast.rb
syntax_tree-6.1.0 lib/syntax_tree/translation/rubocop_ast.rb
syntax_tree-6.0.2 lib/syntax_tree/translation/rubocop_ast.rb
syntax_tree-6.0.1 lib/syntax_tree/translation/rubocop_ast.rb
syntax_tree-6.0.0 lib/syntax_tree/translation/rubocop_ast.rb