From 2abedba0d654ee7753a7cd7639652a283638a4b7 Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Tue, 9 Dec 2008 12:24:22 -0800 Subject: [PATCH] Better general error message for sass parsing. --- lib/sass/script/lexer.rb | 2 +- test/sass/engine_test.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/sass/script/lexer.rb b/lib/sass/script/lexer.rb index 6942644b..895e3464 100644 --- a/lib/sass/script/lexer.rb +++ b/lib/sass/script/lexer.rb @@ -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 diff --git a/test/sass/engine_test.rb b/test/sass/engine_test.rb index b1467ed5..82871832 100755 --- a/test/sass/engine_test.rb +++ b/test/sass/engine_test.rb @@ -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.",