static struct ast_node* stmt(void *opaque) { struct ast_node *node; token_t prev_token; prev_token = current_token; if (match(TOKEN_FUNCTION)) node = process_function(opaque); else if (match(TOKEN_LOCAL)) node = process_local_declaration(opaque); else if (match(TOKEN_IF)) node = if_expr(opaque); else if (match(TOKEN_FOR)) node = for_expr(opaque); else if (match(TOKEN_WHILE)) node = while_expr(opaque); else if (match(TOKEN_BREAK)) node = break_expr(opaque); else if (match(TOKEN_CONTINUE)) node = continue_expr(opaque); else if (match(TOKEN_RETURN)) node = process_return_node(opaque); else if (match(TOKEN_LBRACE)) node = process_scope(opaque); else if (match(TOKEN_RBRACE)) node = end_scope_expr(opaque); else if (match(TOKEN_UNKNOWN)) node = unknown_expr(opaque); else node = other_expr(opaque); return node; }
static const char* copy_while( char *dest, const char* src, size_t destsize, bool (*while_expr)(const char*)) { while ( *src!='\0' && destsize-- && while_expr(src) ) { checkline(*src); *dest++ = *src++; } *dest = '\0'; return src; }