Skip to content

Commit af8365d

Browse files
committed
Merge pull request #1474 from mgreter/bugfix/functional-schema-parsing
Fix `functional_schema` parsing ending with interpolation
2 parents 06ad34e + be49d4f commit af8365d

File tree

1 file changed

+54
-6
lines changed

1 file changed

+54
-6
lines changed

src/prelexer.cpp

Lines changed: 54 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -128,11 +128,31 @@ namespace Sass {
128128

129129
// Match interpolant schemas
130130
const char* identifier_schema(const char* src) {
131-
// follows this pattern: (x*ix*)+ ... well, not quite
132-
return sequence< one_plus< sequence< zero_plus< alternatives< identifier, exactly<'-'> > >,
133-
interpolant,
134-
zero_plus< alternatives< identifier, number, exactly<'-'> > > > >,
135-
negate< exactly<'%'> > >(src);
131+
132+
return sequence <
133+
one_plus <
134+
sequence <
135+
zero_plus <
136+
alternatives <
137+
identifier,
138+
exactly <'-'>
139+
>
140+
>,
141+
interpolant,
142+
zero_plus <
143+
alternatives <
144+
digits,
145+
identifier,
146+
exactly<'+'>,
147+
exactly<'-'>
148+
>
149+
>
150+
>
151+
>,
152+
negate <
153+
exactly<'%'>
154+
>
155+
> (src);
136156
}
137157

138158
// interpolants can be recursive/nested
@@ -590,7 +610,35 @@ namespace Sass {
590610
}
591611
// Match CSS function call openers.
592612
const char* functional_schema(const char* src) {
593-
return sequence< identifier_schema, lookahead < exactly<'('> > >(src);
613+
return sequence <
614+
one_plus <
615+
sequence <
616+
zero_plus <
617+
alternatives <
618+
identifier,
619+
exactly <'-'>
620+
>
621+
>,
622+
one_plus <
623+
sequence <
624+
interpolant,
625+
alternatives <
626+
digits,
627+
identifier,
628+
exactly<'+'>,
629+
exactly<'-'>
630+
>
631+
>
632+
>
633+
>
634+
>,
635+
negate <
636+
exactly <'%'>
637+
>,
638+
lookahead <
639+
exactly <'('>
640+
>
641+
> (src);
594642
}
595643

596644
const char* re_nothing(const char* src) {

0 commit comments

Comments
 (0)