ext/libsass/src/prelexer.hpp in sassc-1.8.3 vs ext/libsass/src/prelexer.hpp in sassc-1.8.4
- old
+ new
@@ -198,20 +198,23 @@
const char* identifier_alnum(const char* src);
const char* strict_identifier(const char* src);
const char* strict_identifier_alpha(const char* src);
const char* strict_identifier_alnum(const char* src);
// Match a CSS unit identifier.
+ const char* one_unit(const char* src);
+ const char* multiple_units(const char* src);
const char* unit_identifier(const char* src);
// const char* strict_identifier_alnums(const char* src);
// Match reference selector.
const char* re_reference_combinator(const char* src);
const char* static_reference_combinator(const char* src);
const char* schema_reference_combinator(const char* src);
// Match interpolant schemas
const char* identifier_schema(const char* src);
const char* value_schema(const char* src);
+ const char* sass_value(const char* src);
// const char* filename(const char* src);
// const char* filename_schema(const char* src);
// const char* url_schema(const char* src);
// const char* url_value(const char* src);
const char* vendor_prefix(const char* src);
@@ -250,10 +253,11 @@
const char* kwd_while_directive(const char* src);
const char* re_nothing(const char* src);
const char* re_type_selector2(const char* src);
+ const char* re_special_fun(const char* src);
const char* kwd_warn(const char* src);
const char* kwd_err(const char* src);
const char* kwd_dbg(const char* src);
@@ -280,10 +284,11 @@
// Attribute name in an attribute selector
const char* attribute_name(const char* src);
// Match placeholder selectors.
const char* placeholder(const char* src);
// Match CSS numeric constants.
+ const char* op(const char* src);
const char* sign(const char* src);
const char* unsigned_number(const char* src);
const char* number(const char* src);
const char* coefficient(const char* src);
const char* binomial(const char* src);
@@ -294,11 +299,10 @@
const char* hexa(const char* src);
const char* hex0(const char* src);
// const char* rgb_prefix(const char* src);
// Match CSS uri specifiers.
const char* uri_prefix(const char* src);
- const char* uri_value(const char* src);
// Match CSS "!important" keyword.
const char* kwd_important(const char* src);
// Match CSS "!optional" keyword.
const char* kwd_optional(const char* src);
// Match Sass "!default" keyword.
@@ -379,10 +383,22 @@
else if (mx(beg)) return beg;
++beg;
}
return 0;
}
+ template<prelexer mx, prelexer skip>
+ const char* find_first_in_interval(const char* beg, const char* end) {
+ bool esc = false;
+ while ((beg < end) && *beg) {
+ if (esc) esc = false;
+ else if (*beg == '\\') esc = true;
+ else if (const char* pos = skip(beg)) beg = pos;
+ else if (mx(beg)) return beg;
+ ++beg;
+ }
+ return 0;
+ }
template <prelexer mx>
unsigned int count_interval(const char* beg, const char* end) {
unsigned int counter = 0;
bool esc = false;
while (beg < end && *beg) {
@@ -403,13 +419,45 @@
}
return counter;
}
template <size_t size, prelexer mx, prelexer pad>
- const char* padded_token(const char* src);
+ const char* padded_token(const char* src)
+ {
+ size_t got = 0;
+ const char* pos = src;
+ while (got < size) {
+ if (!mx(pos)) break;
+ ++ pos; ++ got;
+ }
+ while (got < size) {
+ if (!pad(pos)) break;
+ ++ pos; ++ got;
+ }
+ return got ? pos : 0;
+ }
template <size_t min, size_t max, prelexer mx>
- const char* minmax_range(const char* src);
+ const char* minmax_range(const char* src)
+ {
+ size_t got = 0;
+ const char* pos = src;
+ while (got < max) {
+ if (!mx(pos)) break;
+ ++ pos; ++ got;
+ }
+ if (got < min) return 0;
+ if (got > max) return 0;
+ return pos;
+ }
+
+ template <char min, char max>
+ const char* char_range(const char* src)
+ {
+ if (*src < min) return 0;
+ if (*src > max) return 0;
+ return src + 1;
+ }
}
}
#endif