Ejemplo n.º 1
0
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;
}
Ejemplo n.º 2
0
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;
}
Ejemplo n.º 3
0
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;
}
Ejemplo n.º 4
0
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);
}
Ejemplo n.º 5
0
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);
}
Ejemplo n.º 6
0
int yylval_token (int symbol) {
   int offset = scan_offset - yyleng;
   yylval = new_astree (symbol, filename_stack.last_filenr,
                        scan_linenr, offset, yytext);
   return symbol;
}
Ejemplo n.º 7
0
astree new_parseroot (void) {
   yyparse_astree = new_astree (TOK_ROOT, 0, 0, 0, "<<TOK_ROOT>>");
   return yyparse_astree;
}
Ejemplo n.º 8
0
astree new_prototype(void) {
    new_tree = new_astree(TOK_PROTOTYPE, filename_stack.last_filenr,
                          scan_linenr, yyleng,"");
    return new_tree;   
} 
Ejemplo n.º 9
0
astree new_function (void) {
    new_tree = new_astree(TOK_FUNCTION, filename_stack.last_filenr,scan_linenr,yyleng,"");
    return new_tree;
}