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.377 2007/09/15 13:03:42 grubba Exp $ + || $Id: language.yacc,v 1.378 2007/09/15 13:17:55 grubba Exp $   */      %pure_parser      %token TOK_ARROW      /*    * Basic value pushing    */   %token TOK_CONSTANT TOK_FLOAT TOK_STRING
pike.git/src/language.yacc:1794:    if ($1 && (Pike_compiler->compiler_pass == 2) && !TEST_COMPAT (0, 6)) {    yywarning("The *-syntax in types is obsolete. Use array instead.");    }    while($1--) push_type(T_ARRAY);    type = compiler_pop_type();       name = get_new_name();       add_ref(type);    id = define_variable(name, type, ID_STATIC|ID_PRIVATE|ID_INLINE); -  free_string(name); +     if (id >= 0) {    n = mkidentifiernode(id); -  +  if ($4->tree_info & OPT_NOT_CONST) { +  my_yyerror("Invalid initializer for static variable %S(%S).", +  $2->u.sval.u.string, name); +  } +  add_ref(n);    Pike_compiler->init_node =    mknode(F_COMMA_EXPR, Pike_compiler->init_node,    mkcastnode(void_type_string, -  mknode(F_ASSIGN, $4, mkidentifiernode(id)))); +  mknode(F_ASSIGN, $4, n)));    } -  +  free_string(name);    id = add_local_name($2->u.sval.u.string, type, n);   #if 0    if (id >= 0)    $$ = mklocalnode(id, 0);    else   #endif    $$ = 0;    if (!n) free_node($4);    free_node($2);    }
pike.git/src/language.yacc:1843:    {    int id;    struct pike_type *type = $<n>0->u.sval.u.type;    struct pike_string *name;    node *n = NULL;       name = get_new_name();       add_ref(type);    id = define_variable(name, type, ID_STATIC|ID_PRIVATE|ID_INLINE); +  free_string(name);    if (id >= 0) {    n = mkidentifiernode(id);    }    add_ref(type);    id = add_local_name($1->u.sval.u.string, type, n);    if (id >= 0) {    $$ = mklocalnode(id, 0);    } else    $$ = 0;    free_node($1);
pike.git/src/language.yacc:1868:    struct pike_type *type = $<n>0->u.sval.u.type;    struct pike_string *name;    node *n = NULL;       name = get_new_name();       add_ref(type);    id = define_variable(name, type, ID_STATIC|ID_PRIVATE|ID_INLINE);    if (id >= 0) {    n = mkidentifiernode(id); +  if ($3->tree_info & OPT_NOT_CONST) { +  my_yyerror("Invalid initializer for static variable %S(%S).", +  $1->u.sval.u.string, name); +  }    add_ref(n);    Pike_compiler->init_node =    mknode(F_COMMA_EXPR, Pike_compiler->init_node,    mkcastnode(void_type_string,    mknode(F_ASSIGN, $3, n)));    } -  +  free_string(name);    add_ref(type);    id = add_local_name($1->u.sval.u.string, type, n);    if (id >= 0)    $$ = mklocalnode(id, 0);    else    $$ = 0;    free_node($1);    }    | bad_identifier '=' safe_expr0 { $$=$3; }    ;