Commit ddbc68b5 by Aaron Leung

Should be catching all syntax errors now.

parent 1b886695
...@@ -459,10 +459,9 @@ namespace Sass { ...@@ -459,10 +459,9 @@ namespace Sass {
Node Document::parse_rule() { Node Document::parse_rule() {
Node rule(Node::rule, line_number, 2); Node rule(Node::rule, line_number, 2);
lex< identifier >(); if (!lex< identifier >()) syntax_error("invalid property name");
rule << Node(Node::property, line_number, lexed); rule << Node(Node::property, line_number, lexed);
lex< exactly<':'> >(); if (!lex< exactly<':'> >()) syntax_error("property \"" + lexed.to_string() + "\" must be followed by a ':'");
// rule << parse_values();
rule << parse_list(); rule << parse_list();
return rule; return rule;
} }
...@@ -477,9 +476,8 @@ namespace Sass { ...@@ -477,9 +476,8 @@ namespace Sass {
if (peek< exactly<';'> >(position) || if (peek< exactly<';'> >(position) ||
peek< exactly<'}'> >(position) || peek< exactly<'}'> >(position) ||
peek< exactly<'{'> >(position) || peek< exactly<'{'> >(position) ||
peek< exactly<')'> >(position)) { peek< exactly<')'> >(position))
return Node(Node::nil, line_number); // TO DO: maybe use Node::none? { return Node(Node::nil, line_number); }
}
Node list1(parse_space_list()); Node list1(parse_space_list());
// if it's a singleton, return it directly; don't wrap it // if it's a singleton, return it directly; don't wrap it
if (!peek< exactly<','> >(position)) return list1; if (!peek< exactly<','> >(position)) return list1;
...@@ -649,7 +647,7 @@ namespace Sass { ...@@ -649,7 +647,7 @@ namespace Sass {
if (value.type == Node::comma_list || value.type == Node::space_list) { if (value.type == Node::comma_list || value.type == Node::space_list) {
value[0].eval_me = true; value[0].eval_me = true;
} }
lex< exactly<')'> >(); if (!lex< exactly<')'> >()) syntax_error("unclosed parenthesis");
return value; return value;
} }
else { else {
......
...@@ -20,5 +20,6 @@ div[hux ~= "hello"] { ...@@ -20,5 +20,6 @@ div[hux ~= "hello"] {
hux: blux; hux: blux;
foo: boo; foo: boo;
@include moogoo; @include moogoo;
dux: mux dux: mux;
color: foo($x: );
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment