6static inline const uint8_t *
7pm_strpbrk_multi_byte(
const pm_parser_t *parser,
const uint8_t *source,
const uint8_t *charset,
size_t maximum) {
10 while (index < maximum) {
11 if (strchr((
const char *) charset, source[index]) != NULL) {
12 return source + index;
15 size_t width = parser->
encoding->
char_width(source + index, (ptrdiff_t) (maximum - index));
29static inline const uint8_t *
30pm_strpbrk_single_byte(
const uint8_t *source,
const uint8_t *charset,
size_t maximum) {
33 while (index < maximum) {
34 if (strchr((
const char *) charset, source[index]) != NULL) {
35 return source + index;
64pm_strpbrk(
const pm_parser_t *parser,
const uint8_t *source,
const uint8_t *charset, ptrdiff_t length) {
68 return pm_strpbrk_multi_byte(parser, source, charset, (
size_t) length);
70 return pm_strpbrk_single_byte(source, charset, (
size_t) length);
A custom strpbrk implementation.
size_t(* char_width)(const uint8_t *b, ptrdiff_t n)
Return the number of bytes that the next character takes if it is valid in the encoding.
bool multibyte
Return true if the encoding is a multibyte encoding.
This struct represents the overall parser.
const pm_encoding_t * encoding
The encoding functions for the current file is attached to the parser as it's parsing so that it can ...
bool encoding_changed
Whether or not the encoding has been changed by a magic comment.