From a4716732437dd9407b6de02036bc93924cd04b79 Mon Sep 17 00:00:00 2001 From: xzyfer Date: Mon, 6 Oct 2014 15:53:11 +1100 Subject: [PATCH] Don't error on css variable syntax --- parser.cpp | 3 +++ prelexer.cpp | 5 +++++ prelexer.hpp | 2 ++ 3 files changed, 10 insertions(+) diff --git a/parser.cpp b/parser.cpp index fcb924e465..7ede684b97 100644 --- a/parser.cpp +++ b/parser.cpp @@ -745,6 +745,9 @@ namespace Sass { else if (lex< sequence< optional< exactly<'*'> >, identifier > >()) { prop = new (ctx.mem) String_Constant(path, source_position, lexed); } + else if (lex< custom_property_name >()) { + prop = new (ctx.mem) String_Constant(path, source_position, lexed); + } else { error("invalid property name"); } diff --git a/prelexer.cpp b/prelexer.cpp index f0de5f990a..0dde79f1dd 100644 --- a/prelexer.cpp +++ b/prelexer.cpp @@ -166,6 +166,11 @@ namespace Sass { backslash_something > > >(src); } + // Match CSS css variables. + const char* custom_property_name(const char* src) { + return sequence< exactly<'-'>, exactly<'-'>, identifier >(src); + } + // Match interpolant schemas const char* identifier_schema(const char* src) { // follows this pattern: (x*ix*)+ ... well, not quite diff --git a/prelexer.hpp b/prelexer.hpp index e2f4756ed9..d0ad75409d 100644 --- a/prelexer.hpp +++ b/prelexer.hpp @@ -320,6 +320,8 @@ namespace Sass { const char* backslash_something(const char* src); + // Match CSS css variables. + const char* custom_property_name(const char* src); // Match a CSS identifier. const char* identifier(const char* src); // Match selector names.