don't print the confusing indentation numbers when raising ParseErrors for indentation

This commit is contained in:
Jeremy Ashkenas
2009-12-30 21:57:03 -05:00
parent ec60205014
commit 942572d081

View File

@@ -13,7 +13,8 @@ module CoffeeScript
line = @value.respond_to?(:line) ? @value.line : "END"
line_part = "line #{line}:"
id_part = @token_id != @value.inspect ? ", unexpected #{@token_id.downcase}" : ""
"#{line_part} syntax error for '#{@value.to_s}'#{id_part}"
val_part = ['INDENT', 'OUTDENT'].include?(@token_id) ? '' : " for '#{@value.to_s}'"
"#{line_part} syntax error#{val_part}#{id_part}"
end
alias_method :inspect, :message