return 0;
}
+static int escape_to_negative(const char c,
+ compiler_state * cs) {
+ switch (c) {
+ case 'D': {
+ const char digit_chars[] = "0123456789";
+ strcpy(cs->blacklist, digit_chars);
+ *cs->is_negative = true;
+ return sizeof(digit_chars)-1;
+ };
+ }
+
+ return 0;
+}
+
//static int compile_hologram(char * hologram, char * whitelist) {
// if (hologram[0] == '\\') {
// switch (hologram[1]) {
// }
//}
-static int compile_range(const char * const range,
- char * whitelist,
- bool * is_negative) {
+static int compile_dot(compiler_state * cs) {
+ *cs->do_catch = true;
+ return true;
+}
+
+static int compile_escape(const char c,
+ compiler_state * cs) {
+
+ return escape_1_to_1(c, cs)
+ || escape_1_to_N(c, cs)
+ || escape_to_negative(c, cs)
+ //|| compile_hologram(*s, whitelist)
+ ;
+}
+
+static int compile_range(const char * const range,
+ compiler_state * cs) {
assert((range[0] == '[') && "Not a range.");
+ char * target_list = (*cs->is_negative) ? cs->blacklist : cs->whitelist;
+
const char * s;
if (range[1] == '^') {
- *is_negative = true;
+ *cs->is_negative = true;
s = range + 2;
} else {
s = range + 1;
static int regex_assert(const regex_t * const regex,
const char * const string,
int state,
- int * width) {
+ int width) {
for (const char * s = string; *s != '\00'; s++) {
// delta
for (size_t i = 0; i < regex->delta_table.element_count; i++) {
}
if (catch_(regex, &state)) {
+ width += 1;
continue;
}