From f0e9ed5a8591bec54d0a671ee36ea134f3155b43 Mon Sep 17 00:00:00 2001 From: xzyfer Date: Mon, 22 Dec 2014 20:02:15 +1100 Subject: [PATCH 1/2] Fix prelexer alternatives for 7 and 8 arguments --- prelexer.hpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/prelexer.hpp b/prelexer.hpp index c67e9ecc3c..889ad39eb2 100644 --- a/prelexer.hpp +++ b/prelexer.hpp @@ -172,11 +172,11 @@ namespace Sass { prelexer mx5, prelexer mx6, prelexer mx7> const char* alternatives(const char* src) { - const char* rslt = src; - (rslt = mx1(rslt)) || (rslt = mx2(rslt)) || - (rslt = mx3(rslt)) || (rslt = mx4(rslt)) || - (rslt = mx5(rslt)) || (rslt = mx6(rslt)) || - (rslt = mx7(rslt)); + const char* rslt; + (rslt = mx1(src)) || (rslt = mx2(src)) || + (rslt = mx3(src)) || (rslt = mx4(src)) || + (rslt = mx5(src)) || (rslt = mx6(src)) || + (rslt = mx7(src)); return rslt; } @@ -186,11 +186,11 @@ namespace Sass { prelexer mx5, prelexer mx6, prelexer mx7, prelexer mx8> const char* alternatives(const char* src) { - const char* rslt = src; - (rslt = mx1(rslt)) || (rslt = mx2(rslt)) || - (rslt = mx3(rslt)) || (rslt = mx4(rslt)) || - (rslt = mx5(rslt)) || (rslt = mx6(rslt)) || - (rslt = mx7(rslt)) || (rslt = mx8(rslt)); + const char* rslt; + (rslt = mx1(src)) || (rslt = mx2(src)) || + (rslt = mx3(src)) || (rslt = mx4(src)) || + (rslt = mx5(src)) || (rslt = mx6(src)) || + (rslt = mx7(src)) || (rslt = mx8(src)); return rslt; } From b9a75d714ae4f85a4399c5c609b9f41ae28b845c Mon Sep 17 00:00:00 2001 From: xzyfer Date: Mon, 22 Dec 2014 20:03:03 +1100 Subject: [PATCH 2/2] Move some modulo handling logic from parser to prelexer --- parser.cpp | 4 +--- prelexer.cpp | 8 ++++---- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/parser.cpp b/parser.cpp index e7dabb11c6..42df5d9676 100644 --- a/parser.cpp +++ b/parser.cpp @@ -1136,9 +1136,7 @@ namespace Sass { if (lex< important >()) { return new (ctx.mem) String_Constant(path, source_position, "!important"); } - // #TODO: Use the uncommented version when #745 is fixed - // if (lex< value_schema >()) - if (lex< sequence< value_schema, optional< exactly<'%'> > > >()) + if (lex< value_schema >()) { return Parser::from_token(lexed, ctx, path, source_position).parse_value_schema(); } if (lex< sequence< true_val, negate< identifier > > >()) diff --git a/prelexer.cpp b/prelexer.cpp index f8d448d650..5b95f3c644 100644 --- a/prelexer.cpp +++ b/prelexer.cpp @@ -183,16 +183,16 @@ namespace Sass { // Match interpolant schemas const char* identifier_schema(const char* src) { // follows this pattern: (x*ix*)+ ... well, not quite - return one_plus< sequence< zero_plus< alternatives< identifier, exactly<'-'> > >, + return sequence< one_plus< sequence< zero_plus< alternatives< identifier, exactly<'-'> > >, interpolant, - zero_plus< alternatives< identifier, number, exactly<'-'> > > > >(src); + zero_plus< alternatives< identifier, number, exactly<'-'> > > > >, + negate< exactly<'%'> > >(src); } const char* value_schema(const char* src) { // follows this pattern: ([xyz]*i[xyz]*)+ return one_plus< sequence< zero_plus< alternatives< identifier, percentage, dimension, hex, number, string_constant > >, interpolant, - // #TODO: uncomment the 7th param whrn #745 is fixed - zero_plus< alternatives< identifier, percentage, dimension, hex, number, string_constant/*, exactly<'%'>*/ > > > >(src); + zero_plus< alternatives< identifier, percentage, dimension, hex, number, string_constant, exactly<'%'> > > > >(src); } const char* filename_schema(const char* src) { return one_plus< sequence< zero_plus< alternatives< identifier, number, exactly<'.'>, exactly<'/'> > >,