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.212 2000/09/20 13:22:51 grubba Exp $"); + RCSID("$Id: language.yacc,v 1.213 2000/09/26 00:17:45 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:2460:    if ($3) {    $$=mknode(F_ARG_LIST,$1,$3);    } else {    /* Error in assoc_pair */    $$=$1;    }    }    | m_expr_list2 ',' error    ;    - assoc_pair: expr0 expected_colon expr1 { $$=mknode(F_ARG_LIST,$1,$3); } + assoc_pair: expr0 expected_colon expr0 { $$=mknode(F_ARG_LIST,$1,$3); }    | expr0 expected_colon error { free_node($1); $$=0; }    ;      expr1: expr2    | expr1 TOK_LOR expr1 { $$=mknode(F_LOR,$1,$3); }    | expr1 TOK_LAND expr1 { $$=mknode(F_LAND,$1,$3); }    | expr1 '|' expr1 { $$=mkopernode("`|",$1,$3); }    | expr1 '^' expr1 { $$=mkopernode("`^",$1,$3); }    | expr1 '&' expr1 { $$=mkopernode("`&",$1,$3); }    | expr1 TOK_EQ expr1 { $$=mkopernode("`==",$1,$3); }
pike.git/src/language.yacc:2859:    $$=mknode(F_UNDEFINED,0,0);    }    }else{    $$=mkintnode(0);    }    }    free_node($1);    }    | TOK_PREDEF TOK_COLON_COLON TOK_IDENTIFIER    { -  struct svalue tmp; +     node *tmp2; -  tmp.type=T_MAPPING; - #ifdef __CHECKER__ -  tmp.subtype=0; - #endif /* __CHECKER__ */ +  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); -  tmp.u.mapping=get_builtin_constants(); -  tmp2=mkconstantsvaluenode(&tmp); +  +  tmp2=mkconstantsvaluenode((struct svalue *) used_modules.s.str );    $$=index_node(tmp2, "predef", $3->u.sval.u.string);    if(!$$->name)    add_ref( $$->name=$3->u.sval.u.string );    free_node(tmp2);    free_node($3);    }    | TOK_PREDEF TOK_COLON_COLON bad_identifier    {    $$=0;    }
pike.git/src/language.yacc:3009:    mkfloatnode((FLOAT_TYPE)1000.0)));   #endif    };      typeof: TOK_TYPEOF '(' expr0 ')'    {    struct pike_string *s;    node *tmp;       /* FIXME: Why build the node at all? */ -  +  /* Because the optimizer cannot optimize the root node of the +  * tree properly -Hubbe +  */    tmp=mknode(F_COMMA_EXPR, $3, 0);       s=(tmp && CAR(tmp) && CAR(tmp)->type ? CAR(tmp)->type : mixed_type_string); -  +  if(TEST_COMPAT(7,0)) +  { +  s=describe_type(s); +  $$ = mkstrnode(s); +  free_string(s); +  }else{    $$ = mktypenode(s); -  +  }    free_node(tmp);    }    | TOK_TYPEOF '(' error ')' { $$=0; yyerrok; }    | TOK_TYPEOF '(' error '}' { $$=0; yyerror("Missing ')'."); }    | TOK_TYPEOF '(' error TOK_LEX_EOF    {    $$=0; yyerror("Missing ')'.");    yyerror("Unexpected end of file.");    }    | TOK_TYPEOF '(' error ';' { $$=0; yyerror("Missing ')'."); }
pike.git/src/language.yacc:3304:    fflush(stderr);    }   }         int low_add_local_name(struct compiler_frame *frame,    struct pike_string *str,    struct pike_string *type,    node *def)   { -  if (str->len) { +  +  if (str->len && !TEST_COMPAT(7,0)) {    int tmp=islocal(str);    if(tmp >= frame->last_block_level)    {    if(str->size_shift)    my_yyerror("Duplicate local variable, "    "previous declaration on line %d\n",    frame->variable[tmp].line);    else    my_yyerror("Duplicate local variable '%s', "    "previous declaration on line %d\n",