summaryrefslogtreecommitdiff
path: root/lib/rdoc
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rdoc')
-rw-r--r--lib/rdoc/parsers/parse_rb.rb18
1 files changed, 17 insertions, 1 deletions
diff --git a/lib/rdoc/parsers/parse_rb.rb b/lib/rdoc/parsers/parse_rb.rb
index 43c9d26579..bd3b1ec4df 100644
--- a/lib/rdoc/parsers/parse_rb.rb
+++ b/lib/rdoc/parsers/parse_rb.rb
@@ -1393,7 +1393,23 @@ module RDoc
@unget_read = []
@read = []
catch(:eof) do
- parse_statements(@top_level)
+ begin
+ parse_statements(@top_level)
+ rescue Exception => e
+ $stderr.puts "\n\n"
+ $stderr.puts "RDoc failure in #@input_file_name at or around " +
+ "line #{@scanner.line_no} column #{@scanner.char_no}"
+ $stderr.puts
+ $stderr.puts "Before reporting this, could you check that the file"
+ $stderr.puts "you're documenting compiles cleanly--RDoc is not a"
+ $stderr.puts "full Ruby parser, and gets confused easily if fed"
+ $stderr.puts "invalid programs."
+ $stderr.puts
+ $stderr.puts "The internal error was:\n\n"
+
+ e.set_backtrace(e.backtrace[0,4])
+ raise
+ end
end
@top_level
end