lib/parser/syntax_error.rb in parser-2.0.0.pre1 vs lib/parser/syntax_error.rb in parser-2.0.0.pre2
- old
+ new
@@ -1,3 +1,14 @@
module Parser
- class SyntaxError < StandardError; end
+ ##
+ # {Parser::SyntaxError} is raised whenever parser detects a syntax error
+ # (what a surprise!) similar to the standard SyntaxError class.
+ #
+ class SyntaxError < StandardError
+ attr_reader :diagnostic
+
+ def initialize(diagnostic)
+ @diagnostic = diagnostic
+ super(diagnostic.message)
+ end
+ end
end