diff --git a/parser.cpp b/parser.cpp index fe3d997cd6..da7ba2ccef 100644 --- a/parser.cpp +++ b/parser.cpp @@ -490,7 +490,7 @@ namespace Sass { return seq; } } - if (sawsomething && lex< sequence< negate< functional >, alternatives< hyphens_and_identifier, universal, string_constant, dimension, percentage, number > > >()) { + if (sawsomething && lex< sequence< negate< functional >, alternatives< identifier_fragment, universal, string_constant, dimension, percentage, number > > >()) { // saw an ampersand, then allow type selectors with arbitrary number of hyphens at the beginning (*seq) << new (ctx.mem) Type_Selector(path, source_position, lexed); } else if (lex< sequence< negate< functional >, alternatives< type_selector, universal, string_constant, dimension, percentage, number > > >()) { @@ -1776,6 +1776,8 @@ namespace Sass { (q = peek< sequence< optional, digits > >(p)) || (q = peek< number >(p)) || + (q = peek< sequence< exactly<'&'>, + identifier_fragment > >(p)) || (q = peek< exactly<'&'> >(p)) || (q = peek< exactly<'%'> >(p)) || (q = peek< alternatives, digits > >(p)) || (q = peek< number >(p)) || + (q = peek< sequence< exactly<'&'>, + identifier_fragment > >(p)) || (q = peek< exactly<'&'> >(p)) || (q = peek< exactly<'%'> >(p)) || (q = peek< alternatives > >(src); } + const char* identifier_fragment(const char* src) { + return one_plus< alternatives< alnum, + exactly<'-'>, + exactly<'_'>, + backslash_something > >(src); + } + // Match CSS selectors. const char* sel_ident(const char* src) { return sequence< optional< alternatives< exactly<'-'>, exactly<'|'> > >, diff --git a/prelexer.hpp b/prelexer.hpp index 57b72c2f72..c67e9ecc3c 100644 --- a/prelexer.hpp +++ b/prelexer.hpp @@ -324,6 +324,7 @@ namespace Sass { const char* custom_property_name(const char* src); // Match a CSS identifier. const char* identifier(const char* src); + const char* identifier_fragment(const char* src); // Match selector names. const char* sel_ident(const char* src); // Match interpolant schemas