diff --git a/lib/sass/engine.rb b/lib/sass/engine.rb index a547ad38..708555c3 100755 --- a/lib/sass/engine.rb +++ b/lib/sass/engine.rb @@ -147,7 +147,7 @@ module Sass if tabs # if line isn't blank if tabs - old_tabs > 1 - raise SyntaxError.new("Illegal Indentation: Only two space characters are allowed as tabulation.", @line) + raise SyntaxError.new("#{tabs * 2} spaces were used for indentation. Sass must be indented using two spaces.", @line) end @lines << [line.strip, tabs] @@ -162,18 +162,20 @@ module Sass # Counts the tabulation of a line. def count_tabs(line) - spaces = line.index(/[^ ]/) - if spaces - if spaces % 2 == 1 || line[spaces] == ?\t - # Make sure a line with just tabs isn't an error - return nil if line.strip.empty? + return nil if line.strip.empty? + return nil unless spaces = line.index(/[^ ]/) - raise SyntaxError.new("Illegal Indentation: Only two space characters are allowed as tabulation.", @line) - end - spaces / 2 - else - nil + if spaces % 2 == 1 + raise SyntaxError.new(< 'Invalid constant: "!a"', "! a" => 'Invalid constant: "! a"', "!a b" => 'Invalid constant: "!a b"', - "a\n\t:b c" => "Illegal Indentation: Only two space characters are allowed as tabulation.", - "a\n :b c" => "Illegal Indentation: Only two space characters are allowed as tabulation.", - "a\n :b c" => "Illegal Indentation: Only two space characters are allowed as tabulation.", + "a\n\t:b c" => < "1 space was used for indentation. Sass must be indented using two spaces.", + "a\n :b c" => "4 spaces were used for indentation. Sass must be indented using two spaces.", "a\n :b c\n !d = 3" => "Constants may only be declared at the root of a document.", "!a = 1b + 2c" => "Incompatible units: b and c", "& a\n :b c" => "Base-level rules cannot contain the parent-selector-referencing character '&'",