From d1fa69910fbbc553fe454aeb47877298594115f2 Mon Sep 17 00:00:00 2001 From: Marcel Greter Date: Fri, 6 Mar 2015 19:57:11 +0100 Subject: [PATCH] Fix selector parsing to allow hyphen after other tokens Fixes https://github.com/sass/libsass/issues/922 --- parser.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/parser.cpp b/parser.cpp index 3f1bc8adfb..0b543d90e0 100644 --- a/parser.cpp +++ b/parser.cpp @@ -1904,6 +1904,7 @@ namespace Sass { (q = peek< exactly<'~'> >(p)) || (q = peek< exactly<'>'> >(p)) || (q = peek< exactly<','> >(p)) || + (saw_stuff && (q = peek< exactly<'-'> >(p))) || (q = peek< binomial >(p)) || (q = peek< sequence< optional, optional, @@ -1927,8 +1928,8 @@ namespace Sass { (q = peek< sequence< pseudo_prefix, interpolant > >(p)) || (q = peek< interpolant >(p))) { saw_stuff = true; + if (*(p) == '#' && *(p + 1) == '{' && *(q - 1) == '}') saw_interpolant = true; p = q; - if (*(p - 1) == '}') saw_interpolant = true; } Selector_Lookahead result; @@ -1962,6 +1963,7 @@ namespace Sass { (q = peek< exactly<'~'> >(p)) || (q = peek< exactly<'>'> >(p)) || (q = peek< exactly<','> >(p)) || + (saw_stuff && (q = peek< exactly<'-'> >(p))) || (q = peek< binomial >(p)) || (q = peek< sequence< optional, optional, @@ -1985,8 +1987,8 @@ namespace Sass { (q = peek< sequence< pseudo_prefix, interpolant > >(p)) || (q = peek< interpolant >(p)) || (q = peek< optional >(p))) { + if (*(p) == '#' && *(p + 1) == '{' && *(q - 1) == '}') saw_interpolant = true; p = q; - if (*(p - 1) == '}') saw_interpolant = true; saw_stuff = true; }