pike.git / src / language.yacc

version» Context lines:

pike.git/src/language.yacc:1:   /* -*- c -*-   || This file is part of Pike. For copyright information see COPYRIGHT.   || Pike is distributed under GPL, LGPL and MPL. See the file COPYING   || for more information. - || $Id: language.yacc,v 1.312 2003/12/03 09:35:24 grubba Exp $ + || $Id: language.yacc,v 1.313 2004/03/12 20:49:51 grubba Exp $   */      %pure_parser      %token TOK_ARROW      /*    * Basic value pushing    */   %token TOK_CONSTANT TOK_FLOAT TOK_STRING
pike.git/src/language.yacc:106:   %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.312 2003/12/03 09:35:24 grubba Exp $"); + RCSID("$Id: language.yacc,v 1.313 2004/03/12 20:49:51 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:2402:    $3=mkstrnode(s);    free_string(s);    $1|=ID_STATIC | ID_PRIVATE | ID_INLINE;    }    /* fprintf(stderr, "LANGUAGE.YACC: CLASS start\n"); */    if(Pike_compiler->compiler_pass==1)    {    if ($1 & ID_EXTERN) {    yywarning("Extern declared class definition.");    } -  low_start_new_program(0, $3->u.sval.u.string, +  low_start_new_program(0, 1, $3->u.sval.u.string,    $1,    &$<number>$);       /* fprintf(stderr, "Pass 1: Program %s has id %d\n",    $3->u.sval.u.string->str, Pike_compiler->new_program->id); */       if(lex.current_file)    {    store_linenumber($<number>2, lex.current_file);    debug_malloc_name(Pike_compiler->new_program, lex.current_file->str,    $<number>2);    }    }else{    int i;    struct identifier *id;    int tmp=Pike_compiler->compiler_pass;    i=isidentifier($3->u.sval.u.string);    if(i<0)    { -  low_start_new_program(Pike_compiler->new_program,0, +  low_start_new_program(Pike_compiler->new_program, 2, 0,    $1,    &$<number>$);    yyerror("Pass 2: program not defined!");    }else{    id=ID_FROM_INT(Pike_compiler->new_program, i);    if(IDENTIFIER_IS_CONSTANT(id->identifier_flags))    {    struct svalue *s;    s=&PROG_FROM_INT(Pike_compiler->new_program,i)->constants[id->func.offset].sval;    if(s->type==T_PROGRAM)    { -  low_start_new_program(s->u.program, +  low_start_new_program(s->u.program, 2,    $3->u.sval.u.string,    $1,    &$<number>$);       /* fprintf(stderr, "Pass 2: Program %s has id %d\n",    $3->u.sval.u.string->str, Pike_compiler->new_program->id); */       }else{    yyerror("Pass 2: constant redefined!"); -  low_start_new_program(Pike_compiler->new_program, 0, +  low_start_new_program(Pike_compiler->new_program, 2, 0,    $1,    &$<number>$);    }    }else{    yyerror("Pass 2: class constant no longer constant!"); -  low_start_new_program(Pike_compiler->new_program, 0, +  low_start_new_program(Pike_compiler->new_program, 2, 0,    $1,    &$<number>$);    }    }    Pike_compiler->compiler_pass=tmp;    }    Pike_compiler->num_parse_error=num_errors; /* Kluge to prevent gazillion error messages */    }    optional_create_arguments failsafe_program    {
pike.git/src/language.yacc:3356:    {    if(Pike_compiler->last_identifier) free_string(Pike_compiler->last_identifier);    copy_shared_string(Pike_compiler->last_identifier, $1->u.sval.u.string);       if(($$=lexical_islocal(Pike_compiler->last_identifier)))    {    /* done, nothing to do here */    }else if(!($$=find_module_identifier(Pike_compiler->last_identifier,1)) &&    !($$ = program_magic_identifier (Pike_compiler, 0, 0,    Pike_compiler->last_identifier, 0))) { -  if(!Pike_compiler->num_parse_error) -  { -  if(Pike_compiler->compiler_pass==2) -  { +  if(force_resolve || +  ((!Pike_compiler->num_parse_error) && +  (Pike_compiler->compiler_pass==2))) {    my_yyerror("Undefined identifier %s.", Pike_compiler->last_identifier->str);    $$=0;    }else{    $$=mknode(F_UNDEFINED,0,0);    } -  }else{ -  $$=mkintnode(0); +     } -  } +     free_node($1);    }    | TOK_PREDEF TOK_COLON_COLON TOK_IDENTIFIER    {    node *tmp2;    extern dynamic_buffer used_modules;       if(Pike_compiler->last_identifier) free_string(Pike_compiler->last_identifier);    copy_shared_string(Pike_compiler->last_identifier, $3->u.sval.u.string);   
pike.git/src/language.yacc:3419:    if (inherit_depth > 0) {    $$ = mkexternalnode(inherit_state->new_program, id);    } else {    $$ = mkidentifiernode(id);    }    } else if (($$ = program_magic_identifier (inherit_state, inherit_depth, $1,    Pike_compiler->last_identifier, 1))) {    /* All done. */    }    else { -  if (Pike_compiler->compiler_pass == 2) { +  if (force_resolve || (Pike_compiler->compiler_pass == 2)) {    if (inherit_state->new_program->inherits[$1].name) {    my_yyerror("Undefined identifier %s::%s.",    inherit_state->new_program->inherits[$1].name->str,    Pike_compiler->last_identifier->str);    } else { -  my_yyerror("Undefined identifier %s.", Pike_compiler->last_identifier->str); +  my_yyerror("Undefined identifier %s.", +  Pike_compiler->last_identifier->str);    }    $$=0;    }    else    $$=mknode(F_UNDEFINED,0,0);    }    } else {    $$=0;    }