File tree Expand file tree Collapse file tree 7 files changed +35
-16
lines changed Expand file tree Collapse file tree 7 files changed +35
-16
lines changed Original file line number Diff line number Diff line change @@ -63,7 +63,7 @@ namespace Sass {
63
63
return true ;
64
64
}
65
65
else if (next == $asterisk) {
66
- loudComment ();
66
+ scanLoudComment ();
67
67
return true ;
68
68
}
69
69
else {
@@ -82,14 +82,11 @@ namespace Sass {
82
82
}
83
83
84
84
// Consumes and ignores a loud (CSS-style) comment.
85
- void Parser::loudComment ()
85
+ void Parser::scanLoudComment ()
86
86
{
87
87
scanner.expect (" /*" );
88
88
while (true ) {
89
89
auto next = scanner.readChar ();
90
- if (isNewline (next)) {
91
- scanner._fail (" */" );
92
- }
93
90
if (next != $asterisk) continue ;
94
91
95
92
do {
@@ -275,7 +272,7 @@ namespace Sass {
275
272
276
273
case $slash:
277
274
if (scanner.peekChar (1 ) == $asterisk) {
278
- buffer.write (rawText (&Parser::loudComment ));
275
+ buffer.write (rawText (&Parser::scanLoudComment ));
279
276
}
280
277
else {
281
278
buffer.write (scanner.readChar ());
Original file line number Diff line number Diff line change @@ -91,7 +91,7 @@ namespace Sass {
91
91
virtual SilentComment* readSilentComment ();
92
92
93
93
// Consumes and ignores a loud (CSS-style) comment.
94
- void loudComment ();
94
+ virtual void scanLoudComment ();
95
95
96
96
// Consumes a plain CSS identifier. If [unit] is `true`, this
97
97
// doesn't parse a `-` followed by a digit. This ensures that
Original file line number Diff line number Diff line change @@ -24,6 +24,26 @@ namespace Sass {
24
24
return buffer.getInterpolation (scanner.rawSpanFrom (start));
25
25
}
26
26
27
+ // Consumes and ignores a loud (CSS-style) comment.
28
+ // This overrides loud comment consumption so that
29
+ // it doesn't consume multi-line comments.
30
+ void SassParser::scanLoudComment ()
31
+ {
32
+ scanner.expect (" /*" );
33
+ while (true ) {
34
+ auto next = scanner.readChar ();
35
+ if (isNewline (next)) {
36
+ scanner._fail (" */" );
37
+ }
38
+ if (next != $asterisk) continue ;
39
+
40
+ do {
41
+ next = scanner.readChar ();
42
+ } while (next == $asterisk);
43
+ if (next == $slash) break ;
44
+ }
45
+ }
46
+
27
47
void SassParser::expectStatementSeparator (sass::string name) {
28
48
if (!atEndOfStatement ()) expectNewline ();
29
49
if (peekIndentation () <= currentIndentation) return ;
@@ -182,7 +202,7 @@ namespace Sass {
182
202
return lastSilentComment.ptr ();
183
203
break ;
184
204
case $asterisk:
185
- return loudComment ();
205
+ return readLoudComment ();
186
206
break ;
187
207
default :
188
208
return (this ->*child)();
@@ -243,7 +263,7 @@ namespace Sass {
243
263
return lastSilentComment;
244
264
}
245
265
246
- LoudComment* SassParser::loudComment ()
266
+ LoudComment* SassParser::readLoudComment ()
247
267
{
248
268
Offset start (scanner.offset );
249
269
scanner.expect (" /*" );
Original file line number Diff line number Diff line change @@ -114,7 +114,9 @@ namespace Sass {
114
114
// Consumes an indented-style loud context.
115
115
// This overrides loud comment consumption so
116
116
// that it doesn't consume multi-line comments.
117
- LoudComment* loudComment ();
117
+ LoudComment* readLoudComment ();
118
+
119
+ void scanLoudComment () override final ;
118
120
119
121
void scanWhitespaceWithoutComments () override final ;
120
122
Original file line number Diff line number Diff line change @@ -109,7 +109,7 @@ namespace Sass {
109
109
scanWhitespaceWithoutComments ();
110
110
break ;
111
111
case $asterisk:
112
- children.emplace_back (loudComment ());
112
+ children.emplace_back (readLoudComment ());
113
113
scanWhitespaceWithoutComments ();
114
114
break ;
115
115
default :
@@ -155,7 +155,7 @@ namespace Sass {
155
155
scanWhitespaceWithoutComments ();
156
156
break ;
157
157
case $asterisk:
158
- statements.emplace_back (loudComment ());
158
+ statements.emplace_back (readLoudComment ());
159
159
scanWhitespaceWithoutComments ();
160
160
break ;
161
161
default :
@@ -205,7 +205,7 @@ namespace Sass {
205
205
// EO readSilentComment
206
206
207
207
// Consumes a statement-level loud comment block.
208
- LoudComment* ScssParser::loudComment ()
208
+ LoudComment* ScssParser::readLoudComment ()
209
209
{
210
210
InterpolationBuffer buffer (scanner);
211
211
Offset start (scanner.offset );
Original file line number Diff line number Diff line change @@ -81,7 +81,7 @@ namespace Sass {
81
81
virtual SilentComment* readSilentComment () override ;
82
82
83
83
// Consumes a statement-level loud comment block.
84
- virtual LoudComment* loudComment ();
84
+ virtual LoudComment* readLoudComment ();
85
85
86
86
// ///////////////////////////////////////////////////////////////////////
87
87
// ///////////////////////////////////////////////////////////////////////
Original file line number Diff line number Diff line change @@ -540,7 +540,7 @@ namespace Sass {
540
540
}
541
541
542
542
isUseAllowed = false ;
543
- if (scanner.matches (" /*" )) nameBuffer.write (rawText (&StylesheetParser::loudComment ));
543
+ if (scanner.matches (" /*" )) nameBuffer.write (rawText (&StylesheetParser::scanLoudComment ));
544
544
545
545
StringBuffer midBuffer;
546
546
midBuffer.write (rawText (&StylesheetParser::scanWhitespace));
@@ -4713,7 +4713,7 @@ namespace Sass {
4713
4713
4714
4714
case $slash:
4715
4715
if (scanner.peekChar (1 ) == $asterisk) {
4716
- buffer.write (rawText (&StylesheetParser::loudComment ));
4716
+ buffer.write (rawText (&StylesheetParser::scanLoudComment ));
4717
4717
}
4718
4718
else {
4719
4719
buffer.write (scanner.readChar ());
You can’t perform that action at this time.
0 commit comments