Commit f99b3c6b by Aaron Leung

Foundations of value schemas (i.e., embedded interpolants).

parent f8627553
...@@ -670,7 +670,13 @@ namespace Sass { ...@@ -670,7 +670,13 @@ namespace Sass {
return result; return result;
} }
if (lex< true_kwd >()) if (lex< value_schema >())
{
// TO DO: handle value schemas!
return Node(Node::identifier, line_number, lexed);
}
if (lex< sequence< true_kwd, negate< identifier > > >())
{ {
Node T(Node::boolean); Node T(Node::boolean);
T.line_number = line_number; T.line_number = line_number;
...@@ -678,7 +684,7 @@ namespace Sass { ...@@ -678,7 +684,7 @@ namespace Sass {
return T; return T;
} }
if (lex< false_kwd >()) if (lex< sequence< false_kwd, negate< identifier > > >())
{ {
Node F(Node::boolean); Node F(Node::boolean);
F.line_number = line_number; F.line_number = line_number;
......
...@@ -2,5 +2,10 @@ $x: bar; ...@@ -2,5 +2,10 @@ $x: bar;
div { div {
a: blah foo#{$x}; a: blah foo#{$x};
b: 1 + 123#{a b @fuzzle}; b: (1#{2+3}) + 4;
b: (1 (2+3)) + 4;
c: 1#{2 + 3} + 4;
d: type-of(false);
e: type-of(fa#{lse});
e: 12fa#{lse}345;
} }
\ No newline at end of file
...@@ -79,6 +79,15 @@ namespace Sass { ...@@ -79,6 +79,15 @@ namespace Sass {
exactly<'-'>, exactly<'-'>,
exactly<'_'> > > >(src); exactly<'_'> > > >(src);
} }
// Match interpolant schemas
const char* value_schema(const char* src) {
// follows this pattern: ([xyz]*i[xyz]*)+
return one_plus< sequence< zero_plus< alternatives< identifier, number > >,
interpolant,
zero_plus< alternatives< identifier, number > > > >(src);
}
// Match CSS '@' keywords. // Match CSS '@' keywords.
const char* at_keyword(const char* src) { const char* at_keyword(const char* src) {
return sequence<exactly<'@'>, identifier>(src); return sequence<exactly<'@'>, identifier>(src);
......
...@@ -274,6 +274,8 @@ namespace Sass { ...@@ -274,6 +274,8 @@ namespace Sass {
// Match a CSS identifier. // Match a CSS identifier.
const char* identifier(const char* src); const char* identifier(const char* src);
// Match interpolant schemas
const char* value_schema(const char* src);
// Match CSS '@' keywords. // Match CSS '@' keywords.
const char* at_keyword(const char* src); const char* at_keyword(const char* src);
const char* import(const char* src); const char* import(const char* src);
......
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