summaryrefslogtreecommitdiff
path: root/lib/prism/parse_result/errors.rb
diff options
Diffstat (limited to 'lib/prism/parse_result/errors.rb')
-rw-r--r--lib/prism/parse_result/errors.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/prism/parse_result/errors.rb b/lib/prism/parse_result/errors.rb
index 40dda3c264..1eaeebee6e 100644
--- a/lib/prism/parse_result/errors.rb
+++ b/lib/prism/parse_result/errors.rb
@@ -4,13 +4,18 @@ require "stringio"
module Prism
class ParseResult < Result
+ # An object to represent the set of errors on a parse result. This object
+ # can be used to format the errors in a human-readable way.
class Errors
+ # The parse result that contains the errors.
attr_reader :parse_result
+ # Initialize a new set of errors from the given parse result.
def initialize(parse_result)
@parse_result = parse_result
end
+ # Formats the errors in a human-readable way and return them as a string.
def format
error_lines = {}
parse_result.errors.each do |error|