@@ -77,19 +77,19 @@ namespace Sass {
77
77
78
78
// Match a single character literal.
79
79
// Regex equivalent: /(?:literal)/
80
- template <char pre >
80
+ template <char chr >
81
81
const char * exactly (const char * src) {
82
- return *src == pre ? src + 1 : 0 ;
82
+ return *src == chr ? src + 1 : 0 ;
83
83
}
84
84
85
85
// Match a string constant.
86
86
// Regex equivalent: /[axy]/
87
- template <const char * prefix >
87
+ template <const char * str >
88
88
const char * exactly (const char * src) {
89
- if (prefix == 0 ) return 0 ;
90
- const char * pre = prefix ;
89
+ if (str == 0 ) return 0 ;
90
+ const char * pre = str ;
91
91
if (src == 0 ) return 0 ;
92
- // there is a small chance that the search prefix
92
+ // there is a small chance that the search string
93
93
// is longer than the rest of the string to look at
94
94
while (*pre && *src == *pre) {
95
95
++src, ++pre;
@@ -117,9 +117,9 @@ namespace Sass {
117
117
118
118
// Match all except the supplied one.
119
119
// Regex equivalent: /[^x]/
120
- template <const char c >
120
+ template <const char chr >
121
121
const char * any_char_but (const char * src) {
122
- return (*src && *src != c ) ? src + 1 : 0 ;
122
+ return (*src && *src != chr ) ? src + 1 : 0 ;
123
123
}
124
124
125
125
// Succeeds if the matcher fails.
@@ -210,14 +210,29 @@ namespace Sass {
210
210
211
211
// Match with word boundary rule.
212
212
// Regex equivalent: /(?:$mx)\b/
213
- template <const char * mx >
213
+ template <const char * str >
214
214
const char * word (const char * src) {
215
215
return sequence <
216
- exactly < mx >,
216
+ exactly < str >,
217
217
word_boundary
218
218
>(src);
219
219
}
220
220
221
+ template <char chr>
222
+ const char * loosely (const char * src) {
223
+ return sequence <
224
+ optional_spaces,
225
+ exactly < chr >
226
+ >(src);
227
+ }
228
+ template <const char * str>
229
+ const char * loosely (const char * src) {
230
+ return sequence <
231
+ optional_spaces,
232
+ exactly < str >
233
+ >(src);
234
+ }
235
+
221
236
}
222
237
}
223
238
0 commit comments