@@ -26,7 +26,7 @@ namespace Sass {
2626 else root += importee;
2727 if (!lex< exactly<' ;' > >()) throw_syntax_error (" top-level @import directive must be terminated by ';'" );
2828 }
29- else if (peek< mixin >() || peek< exactly<' =' > >()) {
29+ else if (peek< mixin >() /* || peek< exactly<'='> >() */ ) {
3030 root << parse_mixin_definition ();
3131 }
3232 else if (peek< function >()) {
@@ -42,9 +42,10 @@ namespace Sass {
4242 else if ((lookahead_result = lookahead_for_selector (position)).found ) {
4343 root << parse_ruleset (lookahead_result);
4444 }
45- else if (peek< include >() || peek< exactly<' +' > >()) {
46- root << parse_mixin_call ();
47- if (!lex< exactly<' ;' > >()) throw_syntax_error (" top-level @include directive must be terminated by ';'" );
45+ else if (peek< include >() /* || peek< exactly<'+'> >() */ ) {
46+ Node mixin_call (parse_mixin_call ());
47+ root << mixin_call;
48+ if (mixin_call.size () < 3 && !lex< exactly<' ;' > >()) throw_syntax_error (" top-level @include directive must be terminated by ';'" );
4849 }
4950 else if (peek< if_directive >()) {
5051 root << parse_if_directive (Node (), Node::none);
@@ -138,7 +139,7 @@ namespace Sass {
138139
139140 Node Document::parse_mixin_definition ()
140141 {
141- lex< mixin >() || lex< exactly<' =' > >();
142+ lex< mixin >() /* || lex< exactly<'='> >() */ ;
142143 if (!lex< identifier >()) throw_syntax_error (" invalid name in @mixin directive" );
143144 Node name (context.new_Node (Node::identifier, path, line, lexed));
144145 Node params (parse_parameters ());
@@ -210,14 +211,21 @@ namespace Sass {
210211 return var;
211212 }
212213
213- Node Document::parse_mixin_call ()
214+ Node Document::parse_mixin_call (Node::Type inside_of )
214215 {
215- lex< include >() || lex< exactly<' +' > >();
216+ lex< include >() /* || lex< exactly<'+'> >() */ ;
216217 if (!lex< identifier >()) throw_syntax_error (" invalid name in @include directive" );
217218 Node name (context.new_Node (Node::identifier, path, line, lexed));
218219 Node args (parse_arguments ());
219- Node the_call (context.new_Node (Node::mixin_call, path, line, 2 ));
220+ Node content;
221+ bool has_content = false ;
222+ if (peek< exactly<' {' > >()) {
223+ content = parse_block (Node (), inside_of);
224+ has_content = true ;
225+ }
226+ Node the_call (context.new_Node (Node::mixin_call, path, line, has_content ? 3 : 2 ));
220227 the_call << name << args;
228+ if (has_content) the_call << content;
221229 return the_call;
222230 }
223231
@@ -596,16 +604,25 @@ namespace Sass {
596604 block << parse_mixin_call ();
597605 semicolon = true ;
598606 }
607+ else if (peek< content >(position)) {
608+ if (inside_of != Node::mixin) {
609+ throw_syntax_error (" @content may only be used within a mixin" );
610+ }
611+ block << context.new_Node (Node::mixin_content, path, line, Token::make ()); // just a stub
612+ semicolon = true ;
613+ }
599614 else if (peek< sequence< identifier, optional_spaces, exactly<' :' >, optional_spaces, exactly<' {' > > >(position)) {
600615 block << parse_propset ();
601616 }
602617 else if ((lookahead_result = lookahead_for_selector (position)).found ) {
603618 block << parse_ruleset (lookahead_result, inside_of);
604619 }
620+ /*
605621 else if (peek< exactly<'+'> >()) {
606622 block << parse_mixin_call();
607623 semicolon = true;
608624 }
625+ */
609626 else if (lex< extend >()) {
610627 Node request (context.new_Node (Node::extend_directive, path, line, 1 ));
611628 Selector_Lookahead lookahead = lookahead_for_extension_target (position);
0 commit comments