Module: Holistic::Ruby::Parser

Defined in:
lib/holistic/ruby/parser/live_editing/process_file_changed.rb,
lib/holistic/ruby/parser/constant_resolution.rb,
lib/holistic/ruby/parser/table_of_contents.rb,
lib/holistic/ruby/parser/program_visitor.rb,
lib/holistic/ruby/parser/nesting_syntax.rb,
lib/holistic/ruby/parser.rb

Defined Under Namespace

Classes: ConstantResolution, NestingSyntax, ProgramVisitor, TableOfContents

Constant Summary collapse

ParseFile =
->(application:, file:) do
  program = ::SyntaxTree.parse(file.read)

  constant_resolution = ConstantResolution.new(
    scope_repository: application.scopes,
    root_scope: application.root_scope
  )

  visitor = ProgramVisitor.new(application:, constant_resolution:, file:)

  visitor.visit(program)
rescue ::SyntaxTree::Parser::ParseError
  ::Holistic.logger.info("syntax error on file #{file.path}")
end
ParseDirectory =
->(application:, directory_path:) do
  ::Dir.glob("#{directory_path}/**/*.rb").map do |file_path|
    file = ::Holistic::Document::File.new(path: file_path)

    ParseFile[application:, file:]
  end
end