static NODE * print(void){ NODE * t = new_stmt(N_PRINT); match(PRINT); if (t != NULL) t->child[0] = exp(); return t; }
static NODE * read(void){ NODE * t = new_stmt(N_READ); match(READ); if ((t != NULL) &&(token.type == VAR)){ t->attribute.name = toHeap(token.attribute.name); } match(VAR); return t; }
static NODE * assign_stmt(void){ NODE * t = new_stmt(N_ASSIGN); if ((t != NULL) && (token.type == VAR)){ t->attribute.name = toHeap(token.attribute.name); } match(VAR); match(ASSIGN); if (t != NULL){ t->child[0] = exp(); } return t; }
static NODE * while_stmt(void){ NODE * t = new_stmt(N_WHILE); match(WHILE); if(t != NULL){ t->child[0] = exp(); } match(DO); if(t != NULL) { t->child[1] = stmt_list(); } return t; }
static NODE * if_stmt(void){ NODE * t = new_stmt(N_IF); match(IF); if (t != NULL){ t->child[0] = exp(); } match(THEN); if (t != NULL){ t->child[1] = stmt_list(); } if (token.type == ELSE){ match(ELSE); if (t!= NULL){ t->child[2] = stmt_list(); } } return t; }
StatementPtr ClassRequireStatement::clone() { ClassRequireStatementPtr new_stmt(new ClassRequireStatement(*this)); return new_stmt; }
StatementPtr TraitRequireStatement::clone() { TraitRequireStatementPtr new_stmt(new TraitRequireStatement(*this)); return new_stmt; }