Expanded vtable for methods to determine whether a combinator is ok to use with regular or CF grammars.
This commit is contained in:
parent
8163b3981d
commit
36e1f66de0
25 changed files with 200 additions and 4 deletions
|
|
@ -21,8 +21,28 @@ static HParseResult* parse_choice(void *env, HParseState *state) {
|
|||
return NULL;
|
||||
}
|
||||
|
||||
static bool choice_isValidRegular(void *env) {
|
||||
HSequence *s = (HSequence*)env;
|
||||
for (size_t i=0; i<s->len; ++i) {
|
||||
if (!s->p_array[i]->vtable->isValidRegular(s->p_array[i]->env))
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool choice_isValidCF(void *env) {
|
||||
HSequence *s = (HSequence*)env;
|
||||
for (size_t i=0; i<s->len; ++i) {
|
||||
if (!s->p_array[i]->vtable->isValidCF(s->p_array[i]->env))
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
static const HParserVtable choice_vt = {
|
||||
.parse = parse_choice,
|
||||
.isValidRegular = choice_isValidRegular,
|
||||
.isValidCF = choice_isValidCF,
|
||||
};
|
||||
|
||||
const HParser* h_choice(const HParser* p, ...) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue