Better general error message for sass parsing.

This commit is contained in:
Chris Eppstein 2008-12-09 12:24:22 -08:00
parent 17fdd86be8
commit 2abedba0d6
2 changed files with 2 additions and 2 deletions

View File

@ -56,7 +56,7 @@ module Sass
value = variable || string || number || color || bool || op || ident
unless value
raise SyntaxError.new("Syntax error in '#{@scanner.string}' at '#{@scanner.rest}'.")
raise SyntaxError.new("Syntax error in '#{@scanner.string}' at character #{current_position}.")
end
Token.new(value.first, value.last, @line, last_match_position)
end

View File

@ -50,7 +50,7 @@ class SassEngineTest < Test::Unit::TestCase
"@import foo.sass" => "File to import not found or unreadable: foo.sass.",
"@import templates/basic\n foo" => "Illegal nesting: Nothing may be nested beneath import directives.",
"foo\n @import templates/basic" => "Import directives may only be used at the root of a document.",
"!foo = bar baz !" => "Syntax error in 'bar baz !' at '!'.",
"!foo = bar baz !" => "Syntax error in 'bar baz !' at character 8.",
"=foo\n :color red\n.bar\n +bang" => "Undefined mixin 'bang'.",
".bar\n =foo\n :color red\n" => ["Mixins may only be defined at the root of a document.", 2],
"=foo\n :color red\n.bar\n +foo\n :color red" => "Illegal nesting: Nothing may be nested beneath mixin directives.",