Method: Parser::Base.parse_file_with_comments

Defined in:
lib/parser/base.rb

.parse_file_with_comments(filename) ⇒ Array

Parses Ruby source code by reading it from a file and returns the AST and comments. If the source cannot be parsed, SyntaxError is raised and a diagnostic is printed to stderr.

Parameters:

  • filename (String)

    Path to the file to parse.

Returns:

  • (Array)

See Also:

[View source] [View on GitHub]

77
78
79
# File 'lib/parser/base.rb', line 77

def self.parse_file_with_comments(filename)
  parse_with_comments(File.read(filename), filename)
end