| 155 | } |
| 156 | |
| 157 | static size_t jl_whitespace_width(const jl_parser_t *parser) { |
| 158 | if (parser->pos >= parser->length) { |
| 159 | return 0U; |
| 160 | } |
| 161 | unsigned char c = (unsigned char)parser->text[parser->pos]; |
| 162 | if (c == ' ' || c == '\t' || c == '\r' || c == '\n') { |
| 163 | return 1U; |
| 164 | } |
| 165 | if (parser->strict) { |
| 166 | return 0U; |
| 167 | } |
| 168 | if (c == '\f' || c == '\v') { |
| 169 | return 1U; |
| 170 | } |
| 171 | if (parser->length - parser->pos >= 2U && c == 0xC2U && |
| 172 | (unsigned char)parser->text[parser->pos + 1U] == 0xA0U) { |
| 173 | return 2U; |
| 174 | } |
| 175 | if (parser->length - parser->pos >= 3U && c == 0xE2U && |
| 176 | (unsigned char)parser->text[parser->pos + 1U] == 0x80U && |
| 177 | ((unsigned char)parser->text[parser->pos + 2U] == 0xA8U || |
| 178 | (unsigned char)parser->text[parser->pos + 2U] == 0xA9U)) { |
| 179 | return 3U; |
| 180 | } |
| 181 | if (parser->length - parser->pos >= 3U && c == 0xEFU && |
| 182 | (unsigned char)parser->text[parser->pos + 1U] == 0xBBU && |
| 183 | (unsigned char)parser->text[parser->pos + 2U] == 0xBFU) { |
| 184 | return 3U; |
| 185 | } |
| 186 | return 0U; |
| 187 | } |
| 188 | |
| 189 | static bool jl_is_hex(unsigned char c) { |
| 190 | return (c >= '0' && c <= '9') || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F'); |