astree clone (astree src, int symbol) { astree clone; switch (symbol){ case ROOT: clone = new_astree (symbol, src->filenr, src->linenr, src->offset, "<<ROOT>>"); break; case PROTOTYPE: clone = new_astree (symbol, src->filenr, src->linenr, src->offset, "<<PROTOTYPE>>"); break; case FUNCTION: clone = new_astree (symbol, src->filenr, src->linenr, src->offset, "<<FUNCTION>>"); break; } return clone; }
int yylval_token (int symbol) { int offset = scan_offset - yyleng; char *lexeme = inserthash(&stringset, yytext); yylval = new_astree (symbol, filename_stack.last_filenr, scan_linenr, offset, lexeme); addtokens(yylval); add_hashstack( identstack, lexeme); return symbol; }
int yylval_token (int symbol) { int offset = scan_offset - yyleng; yylval = new_astree (symbol, filename_stack.last_filenr, scan_linenr, offset, yytext); // print token info to "program.tok" xfprintf (tokfile, " %2d %4d.%.3d %3d %-16s (%s)\n", filename_stack.last_filenr, scan_linenr, offset, symbol, get_yytname (symbol), yytext); return symbol; }
astree* new_proto (int symbol, astree* a, astree* b) { astree* t = new_astree(symbol, a->filenr, a->linenr, a->offset, ""); return adopt2(t, a, b); }
astree* new_func (int symbol, astree* a, astree* b, astree* c) { astree* t = new_astree(symbol, a->filenr, a->linenr, a->offset, ""); return adopt3(t, a, b, c); }
int yylval_token (int symbol) { int offset = scan_offset - yyleng; yylval = new_astree (symbol, filename_stack.last_filenr, scan_linenr, offset, yytext); return symbol; }
astree new_parseroot (void) { yyparse_astree = new_astree (TOK_ROOT, 0, 0, 0, "<<TOK_ROOT>>"); return yyparse_astree; }
astree new_prototype(void) { new_tree = new_astree(TOK_PROTOTYPE, filename_stack.last_filenr, scan_linenr, yyleng,""); return new_tree; }
astree new_function (void) { new_tree = new_astree(TOK_FUNCTION, filename_stack.last_filenr,scan_linenr,yyleng,""); return new_tree; }