summaryrefslogtreecommitdiff
path: root/lib/prism/parse_result/errors.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/prism/parse_result/errors.rb')
-rw-r--r--lib/prism/parse_result/errors.rb11
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/prism/parse_result/errors.rb b/lib/prism/parse_result/errors.rb
index 847a8442fe..388309d23d 100644
--- a/lib/prism/parse_result/errors.rb
+++ b/lib/prism/parse_result/errors.rb
@@ -1,4 +1,7 @@
# frozen_string_literal: true
+# :markup: markdown
+#--
+# rbs_inline: enabled
require "stringio"
@@ -8,16 +11,20 @@ module Prism
# 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
+ attr_reader :parse_result #: ParseResult
# Initialize a new set of errors from the given parse result.
+ #--
+ #: (ParseResult parse_result) -> void
def initialize(parse_result)
@parse_result = parse_result
end
# Formats the errors in a human-readable way and return them as a string.
+ #--
+ #: () -> String
def format
- error_lines = {}
+ error_lines = {} #: Hash[Integer, Array[ParseError]]
parse_result.errors.each do |error|
location = error.location
(location.start_line..location.end_line).each do |line|