END_TEST START_TEST (test_operators) { const struct operator *op = in_op_set(op_test[_i].str, strlen(op_test[_i].str)); if(op_test[_i].is) fail_unless(op && !strcmp(op->name, op_test[_i].str), "operator mismatch"); else fail_unless(!op, "non-operator detected as operator"); }
static int parseOperator(YYSTYPE *lvalp, yyscan_t scanner) { size_t len = MIN(5, scanner->insize - scanner->pos); while(len) { const struct operator *kw = in_op_set(&scanner->in[scanner->pos], len); if(kw) { TOKEN_SET(lvalp, cstring, kw->name); scanner->pos += len; return kw->val; } len--; } /* never reached */ assert(0); scanner->pos++; TOKEN_SET(lvalp, cstring, NULL); return TOK_ERROR; }