void AST::build_stmt(ASTNode *parent, Node *node) { switch (node->children[0]->token.type) { case Token::KW_VAR: build_var_init(parent, node); break; case Token::IDENTIFIER: build_insert(parent, node); break; case Token::KW_FOR: build_for_loop(parent, node); break; case Token::KW_READ: build_read(parent, node); break; case Token::KW_PRINT: build_print(parent, node); break; case Token::KW_ASSERT: build_assert(parent, node); break; default: std::string e_str = "AST::build_stmt - Invalid token node location in parse tree for token type "; report_error(e_str.append(node->children[0]->token.type_str())); } }
void Line::touch() { char* tmp = strchr(str, '\t'); if(!tmp && buf_len) return; int slen = len(); slen = (slen/CHUNK_SIZE + 1) * CHUNK_SIZE; tmp = new char[slen]; build_print(tmp); if(buf_len) delete str; buf_len = slen; str = tmp; recalc_sz(); }