Commit 038c77f9 by Aaron Leung

Allowing interpolants in function names.

parent cd6042d5
......@@ -820,7 +820,10 @@ namespace Sass {
lex< exactly<')'> >();
return result;
}
if (peek< functional >())
{ return parse_function_call(); }
if (lex< value_schema >())
{ return Document::make_from_token(context, lexed, path, line).parse_value_schema(); }
......@@ -829,10 +832,7 @@ namespace Sass {
if (lex< sequence< false_kwd, negate< identifier > > >())
{ return context.new_Node(Node::boolean, path, line, false); }
if (peek< functional >())
{ return parse_function_call(); }
if (lex< important >())
{ return context.new_Node(Node::important, path, line, lexed); }
......@@ -947,7 +947,7 @@ namespace Sass {
}
Node Document::parse_identifier_schema()
{
{
lex< sequence< optional< exactly<'*'> >, identifier_schema > >();
Token id(lexed);
const char* i = id.begin;
......@@ -988,8 +988,15 @@ namespace Sass {
Node Document::parse_function_call()
{
lex< identifier >();
Node name(context.new_Node(Node::identifier, path, line, lexed));
Node name;
if (lex< identifier_schema >()) {
name = parse_identifier_schema();
}
else {
lex< identifier >();
name = context.new_Node(Node::identifier, path, line, lexed);
}
Node args(parse_arguments());
Node call(context.new_Node(Node::function_call, path, line, 2));
call << name << args;
......
......@@ -290,7 +290,9 @@ namespace Sass {
case Node::function_call: {
// TO DO: default-constructed Function should be a generic callback (maybe)
pair<string, size_t> sig(expr[0].token().to_string(), expr[1].size());
// eval the function name in case it's interpolated
expr[0] = eval(expr[0], prefix, env, f_env, new_Node, ctx);
pair<string, size_t> sig(expr[0].to_string(), expr[1].size());
if (!f_env.count(sig)) {
Node args(expr[1]);
for (size_t i = 0, S = args.size(); i < S; ++i) {
......
......@@ -298,7 +298,7 @@ namespace Sass {
}
// Match CSS function call openers.
const char* functional(const char* src) {
return sequence< identifier, exactly<'('> >(src);
return sequence< alternatives< identifier_schema, identifier >, exactly<'('> >(src);
}
// Match the CSS negation pseudo-class.
extern const char pseudo_not_chars[] = ":not(";
......
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