Great Symbol Renaming done; get_domain and set_rr stubbed

This commit is contained in:
Meredith L. Patterson 2012-05-26 14:27:12 +02:00
parent 56b8413b6d
commit d7818bb8c4
3 changed files with 147 additions and 143 deletions

View file

@ -7,55 +7,55 @@
/**
* A label can't be more than 63 characters.
*/
bool validate_label(parse_result_t *p) {
bool validate_label(HParseResult *p) {
if (TT_SEQUENCE != p->ast->token_type)
return false;
return (64 > p->ast->seq->used);
}
const parser_t* init_domain() {
static const parser_t *domain = NULL;
const HParser* init_domain() {
static const HParser *domain = NULL;
if (domain)
return domain;
const parser_t *letter = choice(ch_range('a', 'z'),
ch_range('A', 'Z'),
NULL);
const parser_t *let_dig = choice(letter,
ch_range('0', '9'),
const HParser *letter = h_choice(h_ch_range('a', 'z'),
h_ch_range('A', 'Z'),
NULL);
const parser_t *ldh_str = many1(choice(let_dig,
ch('-'),
NULL));
const HParser *let_dig = h_choice(letter,
h_ch_range('0', '9'),
NULL);
const parser_t *label = attr_bool(sequence(letter,
optional(sequence(optional(ldh_str),
let_dig,
NULL)),
NULL),
validate_label);
const HParser *ldh_str = h_many1(h_choice(let_dig,
h_ch('-'),
NULL));
const HParser *label = h_attr_bool(h_sequence(letter,
h_optional(h_sequence(h_optional(ldh_str),
let_dig,
NULL)),
NULL),
validate_label);
/**
* You could write it like this ...
* parser_t *indirect_subdomain = indirect();
* const parser_t *subdomain = choice(label,
* sequence(indirect_subdomain,
* ch('.'),
* label,
* NULL),
* NULL);
* bind_indirect(indirect_subdomain, subdomain);
* HParser *indirect_subdomain = h_indirect();
* const HParser *subdomain = h_choice(label,
* h_sequence(indirect_subdomain,
* h_ch('.'),
* label,
* NULL),
* NULL);
* h_bind_indirect(indirect_subdomain, subdomain);
*
* ... but this is easier and equivalent
*/
const HParser *subdomain = sepBy1(label, ch('.'));
const HParser *subdomain = h_sepBy1(label, h_ch('.'));
domain = choice(subdomain,
ch(' '),
NULL);
domain = h_choice(subdomain,
h_ch(' '),
NULL);
return domain;
}
@ -65,7 +65,7 @@ const HParser* init_character_string() {
if (cstr)
return cstr;
cstr = length_value(uint8(), uint8());
cstr = h_length_value(h_uint8(), h_uint8());
return cstr;
}