Commit 8995127b by Aaron Leung

Added '=' and '+' for mixin definition and inclusion, respectively.

parent 205c762a
...@@ -5,6 +5,8 @@ ...@@ -5,6 +5,8 @@
namespace Sass { namespace Sass {
using namespace std; using namespace std;
extern const char plus_equal[] = "+=";
void Document::parse_scss() void Document::parse_scss()
{ {
lex<optional_spaces>(); lex<optional_spaces>();
...@@ -24,7 +26,7 @@ namespace Sass { ...@@ -24,7 +26,7 @@ namespace Sass {
} }
if (!lex< exactly<';'> >()) syntax_error("top-level @import directive must be terminated by ';'"); if (!lex< exactly<';'> >()) syntax_error("top-level @import directive must be terminated by ';'");
} }
else if (peek< mixin >(position)) { else if (peek< mixin >(position) || peek< exactly<'='> >(position)) {
root << parse_mixin_definition(); root << parse_mixin_definition();
} }
else if (peek< include >(position)) { else if (peek< include >(position)) {
...@@ -36,9 +38,14 @@ namespace Sass { ...@@ -36,9 +38,14 @@ namespace Sass {
root << parse_assignment(); root << parse_assignment();
if (!lex< exactly<';'> >()) syntax_error("top-level variable binding must be terminated by ';'"); if (!lex< exactly<';'> >()) syntax_error("top-level variable binding must be terminated by ';'");
} }
else { else if (look_for_selector_group(position)) {
root << parse_ruleset(); root << parse_ruleset();
} }
else if (peek< exactly<'+'> >()) {
root << parse_mixin_call();
root[0].has_expansions = true;
if (!lex< exactly<';'> >()) syntax_error("top-level @include directive must be terminated by ';'");
}
lex<optional_spaces>(); lex<optional_spaces>();
} }
} }
...@@ -73,7 +80,7 @@ namespace Sass { ...@@ -73,7 +80,7 @@ namespace Sass {
Node Document::parse_mixin_definition() Node Document::parse_mixin_definition()
{ {
lex< mixin >(); lex< mixin >() || lex< exactly<'='> >();
if (!lex< identifier >()) syntax_error("invalid name in @mixin directive"); if (!lex< identifier >()) syntax_error("invalid name in @mixin directive");
Node name(Node::identifier, line_number, lexed); Node name(Node::identifier, line_number, lexed);
Node params(parse_mixin_parameters()); Node params(parse_mixin_parameters());
...@@ -118,7 +125,7 @@ namespace Sass { ...@@ -118,7 +125,7 @@ namespace Sass {
Node Document::parse_mixin_call() Node Document::parse_mixin_call()
{ {
lex< include >(); lex< include >() || lex< exactly<'+'> >();
if (!lex< identifier >()) syntax_error("invalid name in @include directive"); if (!lex< identifier >()) syntax_error("invalid name in @include directive");
Node name(Node::identifier, line_number, lexed); Node name(Node::identifier, line_number, lexed);
Node args(parse_arguments()); Node args(parse_arguments());
...@@ -469,6 +476,11 @@ namespace Sass { ...@@ -469,6 +476,11 @@ namespace Sass {
block << parse_ruleset(definition); block << parse_ruleset(definition);
block[0].has_blocks = true; block[0].has_blocks = true;
} }
else if (peek< exactly<'+'> >()) {
block << parse_mixin_call();
block[0].has_expansions = true;
semicolon = true;
}
else if (!peek< exactly<';'> >()) { else if (!peek< exactly<';'> >()) {
block << parse_rule(); block << parse_rule();
block[0].has_statements = true; block[0].has_statements = true;
......
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