pike.git / src / language.yacc

version» Context lines:

pike.git/src/language.yacc:103:   %left TOK_LSH TOK_RSH   %left '+' '-'   %left '*' '%' '/'   %right TOK_NOT '~'   %nonassoc TOK_INC TOK_DEC      %{   /* This is the grammar definition of Pike. */      #include "global.h" - RCSID("$Id: language.yacc,v 1.208 2000/08/18 22:05:40 grubba Exp $"); + RCSID("$Id: language.yacc,v 1.209 2000/08/30 21:58:15 grubba Exp $");   #ifdef HAVE_MEMORY_H   #include <memory.h>   #endif      #include "interpret.h"   #include "array.h"   #include "object.h"   #include "stralloc.h"   #include "las.h"   #include "interpret.h"
pike.git/src/language.yacc:704:   /* if(Pike_compiler->compiler_pass==1) */    {    /* FIXME:    * set current_function_number for local functions as well    */    Pike_compiler->compiler_frame->current_function_number=    define_function(check_node_hash($4)->u.sval.u.string,    check_node_hash($<n>$)->u.sval.u.string,    $1 & (~ID_EXTERN),    IDENTIFIER_PIKE_FUNCTION, -  0); +  0, +  OPT_EXTERNAL_DEPEND|OPT_SIDE_EFFECT);       if ($1 & ID_VARIANT) {    fprintf(stderr, "Function number: %d\n",    Pike_compiler->compiler_frame->current_function_number);    }    }    }    block_or_semi    {    int e;    if($10)    {    int f;    node *check_args = NULL;    int save_line = lex.current_line;    int num_required_args = 0; -  +  struct identifier *i;   #ifdef PIKE_DEBUG    struct pike_string *save_file = lex.current_file;    lex.current_file = $8->current_file;   #endif /* PIKE_DEBUG */    lex.current_line = $8->line_number;       if (($1 & ID_EXTERN) && (Pike_compiler->compiler_pass == 1)) {    yywarning("Extern declared function definition.");    }   
pike.git/src/language.yacc:778:    mknode(F_COMMA_EXPR, check_args,    mksoftcastnode(Pike_compiler->compiler_frame->variable[e].type,    local_node));    }    }    }    }    }       if ($1 & ID_VARIANT) { -  int i = isidentifier($4->u.sval.u.string); +     struct pike_string *bad_arg_str;    MAKE_CONSTANT_SHARED_STRING(bad_arg_str,    "Bad number of arguments!\n");       fprintf(stderr, "Required args: %d\n", num_required_args);       check_args =    mknode('?',    mkopernode("`<",    mkefuncallnode("query_num_arg", NULL),
pike.git/src/language.yacc:813:    lex.current_line = save_line;   #ifdef PIKE_DEBUG    lex.current_file = save_file;   #endif /* PIKE_DEBUG */       f=dooptcode(check_node_hash($4)->u.sval.u.string,    check_node_hash($10),    check_node_hash($<n>9)->u.sval.u.string,    $1);    +  i = ID_FROM_INT(Pike_compiler->new_program, f); +  i->opt_flags = Pike_compiler->compiler_frame->opt_flags; +     if ($1 & ID_VARIANT) {    fprintf(stderr, "Function number: %d\n", f);    }      #ifdef PIKE_DEBUG    if(Pike_interpreter.recoveries &&    ((Pike_sp - Pike_interpreter.evaluator_stack) <    Pike_interpreter.recoveries->stack_pointer))    fatal("Stack error (underflow)\n");   
pike.git/src/language.yacc:1722:    fprintf(stderr, "%d: LAMBDA: %s 0x%08lx 0x%08lx\n",    Pike_compiler->compiler_pass, buf, (long)Pike_compiler->new_program->id, Pike_compiler->local_class_counter-1);   #endif /* LAMBDA_DEBUG */       name=make_shared_string(buf);       id=define_function(name,    type,    0,    IDENTIFIER_PIKE_FUNCTION, -  0); +  0, +  OPT_SIDE_EFFECT|OPT_EXTERNAL_DEPEND);    n=0;   #if 0    if(Pike_compiler->compiler_pass > 1 &&    (i=ID_FROM_INT(Pike_compiler->new_program, id)))    if(!(i->identifier_flags & IDENTIFIER_SCOPED))    n = mkidentifiernode(id);   #endif       low_add_local_name(Pike_compiler->compiler_frame->previous,    $1->u.sval.u.string, type, n);
pike.git/src/language.yacc:1750:    struct identifier *i=ID_FROM_INT(Pike_compiler->new_program, $<number>4);       $5=mknode(F_COMMA_EXPR,$5,mknode(F_RETURN,mkintnode(0),0));       debug_malloc_touch($5);    dooptcode(i->name,    $5,    i->type,    ID_STATIC | ID_PRIVATE | ID_INLINE);    +  i->opt_flags = Pike_compiler->compiler_frame->opt_flags; +     pop_compiler_frame();    free_node($1);       /* WARNING: If the local function adds more variables we are screwed */    /* WARNING2: if add_local_name stops adding local variables at the end,    * this has to be fixed.    */       localid=Pike_compiler->compiler_frame->current_number_of_locals-1;    if(Pike_compiler->compiler_frame->variable[localid].def)
pike.git/src/language.yacc:1841:    Pike_compiler->compiler_pass, buf, (long)Pike_compiler->new_program->id, Pike_compiler->local_class_counter-1);   #endif /* LAMBDA_DEBUG */       name=make_shared_string(buf);          id=define_function(name,    type,    0,    IDENTIFIER_PIKE_FUNCTION, -  0); +  0, +  OPT_SIDE_EFFECT|OPT_EXTERNAL_DEPEND);    n=0;   #if 0    if(Pike_compiler->compiler_pass > 1 &&    (i=ID_FROM_INT(Pike_compiler->new_program, id)))    if(!(i->identifier_flags & IDENTIFIER_SCOPED))    n = mkidentifiernode(id);   #endif       low_add_local_name(Pike_compiler->compiler_frame->previous,    $2->u.sval.u.string, type, n);
pike.git/src/language.yacc:1870:    debug_malloc_touch($6);    $6=mknode(F_COMMA_EXPR,$6,mknode(F_RETURN,mkintnode(0),0));          debug_malloc_touch($6);    dooptcode(i->name,    $6,    i->type,    ID_STATIC | ID_PRIVATE | ID_INLINE);    +  i->opt_flags = Pike_compiler->compiler_frame->opt_flags; +     pop_compiler_frame();    free_node($2);       /* WARNING: If the local function adds more variables we are screwed */    /* WARNING2: if add_local_name stops adding local variables at the end,    * this has to be fixed.    */       localid=Pike_compiler->compiler_frame->current_number_of_locals-1;    if(Pike_compiler->compiler_frame->variable[localid].def)
pike.git/src/language.yacc:1976:    push_finished_type(Pike_compiler->compiler_frame->variable[e].type);    }    push_type(T_FUNCTION);       type = compiler_pop_type();       /* Second: Declare the function. */       Pike_compiler->compiler_frame->current_function_number=    define_function(create_string, type, -  ID_STATIC, IDENTIFIER_PIKE_FUNCTION, 0); +  ID_STATIC, IDENTIFIER_PIKE_FUNCTION, 0, +  OPT_SIDE_EFFECT);       /* Third: Generate the initialization code.    *    * global_arg = [type]local_arg;    * [,..]    */       for(e=0; e<$3; e++)    {    if(!Pike_compiler->compiler_frame->variable[e].name ||