// <bare-function-type> ::= <(signature) type>+ static bool ParseBareFunctionType(State *state) { State copy = *state; DisableAppend(state); if (OneOrMore(ParseType, state)) { RestoreAppend(state, copy.append); MaybeAppend(state, "()"); return true; } *state = copy; return false; }
// <template-args> ::= I <template-arg>+ E static bool ParseTemplateArgs(State *state) { State copy = *state; DisableAppend(state); if (ParseChar(state, 'I') && OneOrMore(ParseTemplateArg, state) && ParseChar(state, 'E')) { RestoreAppend(state, copy.append); MaybeAppend(state, "<>"); return true; } *state = copy; return false; }
static int drv(int p,int c) { int p1,p2,cf,cl,cn,ret,m; assert(!P_IS(p,P_ERROR)); m=new_memo(p,c); if(m!=-1) return M_RET(m); switch(P_TYP(p)) { case P_NOT_ALLOWED: case P_EMPTY: ret=notAllowed; break; case P_CHOICE: Choice(p,p1,p2); ret=choice(drv(p1,c),drv(p2,c)); break; case P_GROUP: Group(p,p1,p2); {int p11=group(drv(p1,c),p2); ret=nullable(p1)?choice(p11,drv(p2,c)):p11;} break; case P_ONE_OR_MORE: OneOrMore(p,p1); ret=group(drv(p1,c),choice(empty,p)); break; case P_EXCEPT: Except(p,p1,p2); ret=nullable(drv(p1,c))&&!nullable(drv(p2,c))?empty:notAllowed; break; case P_RANGE: Range(p,cf,cl); ret=cf<=c&&c<=cl?empty:notAllowed; break; case P_CLASS: Class(p,cn); ret=in_class(c,cn)?empty:notAllowed; break; case P_ANY: ret=empty; break; case P_CHAR: Char(p,cf); ret=c==cf?empty:notAllowed; break; default: ret=0; assert(0); } new_memo(p,c); M_SET(ret); accept_m(); return ret; }