55 , f_start_position(pos)
85 <<
"we accepted '==' instead of '=' in an expression, you probably want to change the operator to just '=', though."
156 if(n >=
'0' && n <=
'9')
205 if(n >=
'0' && n <=
'9')
214 if(p >=
'0' && p <=
'9')
231 if(n >=
'0' && n <=
'9')
240 if(p >=
'0' && p <=
'9')
263 && (n <
'0' || n >
'9'))
347 std::string
const str(
string(c));
374 <<
"C++ comments should not be preserved as they are not supported by most CSS parsers."
438#if __cplusplus >= 201700
490 unsigned char c(
static_cast<unsigned char>(*s));
524 for(++s; cnt > 0; --cnt, ++s)
527 c =
static_cast<unsigned char>(*s);
533 if(c < 0x80 || c > 0xBF)
538 wc = (wc << 6) | (c & 0x3F);
564 mb[0] =
static_cast<char>(wc);
570 mb[0] =
static_cast<char>((wc >> 6) | 0xC0);
571 mb[1] = (wc & 0x3F) | 0x80;
577 if(wc >= 0xD800 && wc <= 0xDFFF)
582 if(wc == 0xFFFE || wc == 0xFFFF)
588 mb[0] =
static_cast<char>((wc >> 12) | 0xE0);
589 mb[1] = ((wc >> 6) & 0x3F) | 0x80;
590 mb[2] = (wc & 0x3F) | 0x80;
596 if((wc & 0xFFFF) == 0xFFFE || (wc & 0xFFFF) == 0xFFFF)
601 mb[0] =
static_cast<char>((wc >> 18) | 0xF0);
602 mb[1] = ((wc >> 12) & 0x3F) | 0x80;
603 mb[2] = ((wc >> 6) & 0x3F) | 0x80;
604 mb[3] = (wc & 0x3F) | 0x80;
615 wctomb(wc, mb,
sizeof(mb) /
sizeof(mb[0]));
637 if(c >= 0xC0 && c < 0xFF)
643 for(
size_t i(1);; ++i)
645 if(i >=
sizeof(mb) /
sizeof(mb[0]))
649 for(c =
f_in.get(); c >= 0x80 && c <= 0xBF; c =
f_in.get());
658 if(c < 0x80 || c > 0xBF)
675 for(c =
f_in.get(); c >= 0x80 && c <= 0xBF; c =
f_in.get());
720 if(c == EOF || c == 0xFFFD)
726 if(c < 0 || c > 0x10FFFF)
747 if(c >=
'0' && c <=
'9')
751 if(c >=
'A' && c <=
'F')
755 if(c >=
'a' && c <=
'f')
790 for(
int count(1); count < 6; ++count)
827 std::string lowercase_id;
854 lowercase_id +=
wctomb(std::tolower(c));
860 lowercase_id +=
wctomb(std::tolower(c));
894 lowercase_id +=
wctomb(std::tolower(c));
911 if(lowercase_id ==
"url")
923 if(c ==
'"' || c ==
'\'')
989 n->set_string(lowercase_id);
999 n->set_lowercase_string(lowercase_id);
1005 bool const has_sign(c ==
'-' || c ==
'+');
1006 int const sign(c ==
'-' ? -1 : 1);
1026 uint64_t ni(
static_cast<uint64_t
>(integer) * 10 + c -
'0');
1027 if(ni >= 0x8000000000000000LL)
1048 decimal_frac *= 10.0;
1049 decimal_part += (c -
'0') / decimal_frac;
1050 if(decimal_frac >= 1e21 && decimal_frac < 1e22)
1055#pragma GCC diagnostic push
1056#pragma GCC diagnostic ignored "-Wfloat-equal"
1057 if(decimal_frac == 1.0)
1058#pragma GCC diagnostic pop
1066 decimal_frac = 10.0;
1071 if(c ==
'e' || c ==
'E')
1075 bool is_exponent(
false);
1077 if(s ==
'-' || s ==
'+')
1107 throw csspp_exception_logic(
"we just checked that there would be a digit here, optionally preceeded by a sign.");
1111 exponent = exponent * 10 + c -
'0';
1112 if(exponent >= 1024)
1117 exponent *= exponent_sign;
1123 std::string dimension;
1149 dimension +=
wctomb(std::tolower(c));
1153 if(dimension ==
"-")
1161#pragma GCC diagnostic push
1162#pragma GCC diagnostic ignored "-Wfloat-equal"
1163 if(decimal_frac == 1.0)
1164#pragma GCC diagnostic pop
1166 decimal_frac = 10.0;
1176#pragma GCC diagnostic push
1177#pragma GCC diagnostic ignored "-Wfloat-equal"
1179 || decimal_frac != 1.0)
1180#pragma GCC diagnostic pop
1191 n->set_decimal_number(sign * (
static_cast<decimal_number_t>(integer) + decimal_part)
1196 n->set_decimal_number(n->get_decimal_number() / 100.0);
1200 n->set_string(dimension);
1206 n->set_integer(integer * sign);
1207 n->set_string(dimension);
1209 n->set_boolean(has_sign);
1282 else if(n == 0xFFFD)
1407 if(str.find(
"@preserve") != std::string::npos)
1410 while(!str.empty() &&
is_space(str.back()))
1417 n->set_integer(c_comment ? 1 : 0);
1430 bool has_mask(
false);
1432 count < 6 && ((
is_hex(d) && !has_mask) || d ==
'?');
1433 ++count, d =
getc())
1443 end = end * 16 + 15;
1454 if(start >= 0x110000)
1476 for(
int count(0); count < 6 &&
is_hex(d); ++count, d =
getc())
1487 if(start >= 0x110000
1525 var +=
wctomb(std::tolower(c));
static error & instance()
node::pointer_t number(wide_char_t c)
node::pointer_t identifier(wide_char_t c)
static bool constexpr is_start_identifier(wide_char_t c)
static bool constexpr is_hex(wide_char_t c)
node::pointer_t unicode_range(wide_char_t c)
position f_start_position
static int hex_to_dec(wide_char_t c)
lexer(std::istream &in, position const &pos)
std::string string(wide_char_t const quote)
wide_char_t mbtowc(char const *mb)
wide_char_t f_ungetc[UNGETSIZ]
static bool constexpr is_identifier(wide_char_t c)
void wctomb(wide_char_t const wc, char *mb, size_t max_length)
node::pointer_t variable(wide_char_t c)
static bool constexpr is_digit(wide_char_t c)
static bool constexpr is_variable(wide_char_t c)
void ungetc(wide_char_t c)
node::pointer_t comment(bool c_comment)
node::pointer_t next_token()
static bool constexpr is_hash_character(wide_char_t c)
static bool constexpr is_space(wide_char_t c)
static bool constexpr is_non_printable(wide_char_t c)
std::shared_ptr< node > pointer_t
range_value_t get_range() const
The namespace of all the classes in the CSS Preprocessor.