local UCase * new_node(const Match *matches, UCase *failure, UCase *subtree) { LCase *limbs; if (IsCharCase(matches)) { limbs = char_case(failure); ca_assign(limbs->lc_c_limbs, matches->index, subtree); } else { limbs = IsNumCase(matches) ? num_case(failure) : alg_case(matches->ncases, failure); limbs->lc_limbs[matches->index] = subtree; } return ucase(matches->level, p_stash(matches->where), limbs); }
static unsigned json_parse_character(struct json_parser* parser) { char c = peek(parser); switch(c) { case '\\': { skip(parser); switch(peek(parser)) { #define char_case(c, result) case (c): skip(parser); return (result) char_case('t', '\t'); char_case('b', '\b'); char_case('n', '\n'); char_case('r', '\r'); char_case('f', '\f'); char_case('"', '"'); char_case('\\', '\\'); char_case('/', '/'); #undef char_case case 'u': { unsigned result = 0; for (int i=0; i<4; i++) { result = (result << 8)| json_parse_hex_digit(parser); } } } } default: skip(parser); return c; } }