Add hex char rule
This commit is contained in:
parent
abb47e0d15
commit
30c322ab96
|
@ -0,0 +1,30 @@
|
|||
#ifndef _HDR_HYPERBUILD_RULE_HEX
|
||||
#define _HDR_HYPERBUILD_RULE_HEX
|
||||
|
||||
#include "../../ext/nicehash/set/int32.h"
|
||||
#include "../../util/hbchar.h"
|
||||
|
||||
static nh_set_int32_t hbr_hex_set;
|
||||
|
||||
void hbr_hex_add_elems(nh_set_int32_t set) {
|
||||
for (char c = 0x30; c <= 0x39; c++) { // 0-9
|
||||
nh_set_int32_add(set, c);
|
||||
}
|
||||
for (char c = 0x41; c <= 0x46; c++) { // A-F
|
||||
nh_set_int32_add(set, c);
|
||||
}
|
||||
for (char c = 0x61; c <= 0x66; c++) { // a-f
|
||||
nh_set_int32_add(set, c);
|
||||
}
|
||||
}
|
||||
|
||||
void hbr_hex_init(void) {
|
||||
hbr_hex_set = nh_set_int32_create();
|
||||
hbr_hex_add_elems(hbr_hex_set);
|
||||
}
|
||||
|
||||
int hbr_hex_check(hb_char_t c) {
|
||||
return nh_set_int32_has(hbr_hex_set, c);
|
||||
}
|
||||
|
||||
#endif // _HDR_HYPERBUILD_RULE_HEX
|
|
@ -5,6 +5,7 @@
|
|||
#include "./char/attrvalquote.c"
|
||||
#include "./char/c0.c"
|
||||
#include "./char/digit.c"
|
||||
#include "./char/hex.c"
|
||||
#include "./char/lcalpha.c"
|
||||
#include "./char/tagname.c"
|
||||
#include "./char/ucalpha.c"
|
||||
|
@ -34,6 +35,7 @@ void hbr_init(void) {
|
|||
// Core
|
||||
hbr_c0_init();
|
||||
hbr_digit_init();
|
||||
hbr_hex_init();
|
||||
hbr_ucalpha_init();
|
||||
hbr_lcalpha_init();
|
||||
hbr_whitespace_init();
|
||||
|
|
Loading…
Reference in New Issue