Sha256: cadb6ff8d34757d5fcc92294cf918d58c7a43edf6154267f143e1c5527001435

Contents?: true

Size: 1017 Bytes

Versions: 6

Compression:

Stored size: 1017 Bytes

Contents

# frozen_string_literal: true

module SyntaxTree
  # This module is responsible for translating the Syntax Tree syntax tree into
  # other representations.
  module Translation
    # This method translates the given node into the representation defined by
    # the whitequark/parser gem. We don't explicitly list it as a dependency
    # because it's not required for the core functionality of Syntax Tree.
    def self.to_parser(node, buffer)
      require "parser"
      require_relative "translation/parser"

      node.accept(Parser.new(buffer))
    end

    # This method translates the given node into the representation defined by
    # the rubocop/rubocop-ast gem. We don't explicitly list it as a dependency
    # because it's not required for the core functionality of Syntax Tree.
    def self.to_rubocop_ast(node, buffer)
      require "rubocop/ast"
      require_relative "translation/parser"
      require_relative "translation/rubocop_ast"

      node.accept(RuboCopAST.new(buffer))
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

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