pike.git / src / language.yacc

version» Context lines:

pike.git/src/language.yacc:181:   %left F_LSH F_RSH   %left '+' '-'   %left '*' '%' '/'   %right F_NOT '~'   %nonassoc F_INC F_DEC      %{   /* This is the grammar definition of Pike. */      #include "global.h" - RCSID("$Id: language.yacc,v 1.162 2000/02/02 21:45:59 hubbe Exp $"); + RCSID("$Id: language.yacc,v 1.163 2000/02/15 22:06:17 hubbe 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:1725:    $3=mkstrnode(s);    free_string(s);    $1|=ID_STATIC | ID_PRIVATE | ID_INLINE;    }    /* fprintf(stderr, "LANGUAGE.YACC: CLASS start\n"); */    if(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, $3->u.sval.u.string, +  $1, +  &$<number>$);    if(lex.current_file)    {    store_linenumber(lex.current_line, lex.current_file);    debug_malloc_name(new_program, lex.current_file->str,    lex.current_line);    }    }else{    int i;    struct program *p;    struct identifier *id;    int tmp=compiler_pass;    i=isidentifier($3->u.sval.u.string);    if(i<0)    { -  low_start_new_program(new_program,0); +  low_start_new_program(new_program,0, +  $1, +  &$<number>$);    yyerror("Pass 2: program not defined!");    }else{    id=ID_FROM_INT(new_program, i);    if(IDENTIFIER_IS_CONSTANT(id->identifier_flags))    {    struct svalue *s;    s=&PROG_FROM_INT(new_program,i)->constants[id->func.offset].sval;    if(s->type==T_PROGRAM)    { -  low_start_new_program(s->u.program, $3->u.sval.u.string); +  low_start_new_program(s->u.program, +  $3->u.sval.u.string, +  $1, +  &$<number>$);    }else{    yyerror("Pass 2: constant redefined!"); -  low_start_new_program(new_program, 0); +  low_start_new_program(new_program, 0, +  $1, +  &$<number>$);    }    }else{    yyerror("Pass 2: class constant no longer constant!"); -  low_start_new_program(new_program, 0); +  low_start_new_program(new_program, 0, +  $1, +  &$<number>$);    }    }    compiler_pass=tmp;    }    num_parse_error=num_errors; /* Kluge to prevent gazillion error messages */    }    failsafe_program    { -  int id; +     struct program *p;    if(compiler_pass == 1)    p=end_first_pass(0);    else    p=end_first_pass(1);       /* fprintf(stderr, "LANGUAGE.YACC: CLASS end\n"); */       if(!p) { -  struct svalue s; +     yyerror("Class definition failed."); -  s.type = T_INT; -  s.subtype = 0; -  s.u.integer = 0; -  id = add_constant($3->u.sval.u.string, &s, $1 & ~ID_EXTERN); -  } -  else { -  struct svalue s; -  s.type = T_PROGRAM; -  s.u.program = p; -  id = add_constant($3->u.sval.u.string, &s, $1 & ~ID_EXTERN); +  }else{    free_program(p);    }    -  $$=mkidentifiernode(id); +  $$=mkidentifiernode($<number>4);       free_node($3);    check_tree($$,0);    }    ;      cond: F_IF    {    $<number>$=compiler_frame->current_number_of_locals;    }