pike.git / src / language.yacc

version» Context lines:

pike.git/src/language.yacc:158:   /* #define LAMBDA_DEBUG 1 */      static void yyerror_reserved(const char *keyword);   static struct pike_string *get_new_name(struct pike_string *prefix);   int add_local_name(struct pike_string *, struct pike_type *, node *);   int low_add_local_name(struct compiler_frame *,    struct pike_string *, struct pike_type *, node *);   static void mark_lvalues_as_used(node *n);   static node *lexical_islocal(struct pike_string *);   static node *safe_inc_enum(node *n); + static node *find_versioned_identifier(struct pike_string *identifier, +  int major, int minor);   static int call_handle_import(struct pike_string *s);      static int inherit_depth;   static struct program_state *inherit_state = NULL;      /*    * Kludge for Bison not using prototypes.    */   #ifndef __GNUC__   #ifndef __cplusplus
pike.git/src/language.yacc:4058:    add_ref( $$->name=$3->u.sval.u.string );    free_node(tmp2);    free_node($3);    }    | TOK_PREDEF TOK_COLON_COLON bad_identifier    {    $$=0;    }    | TOK_VERSION TOK_COLON_COLON TOK_IDENTIFIER    { -  struct compilation *c = THIS_COMPILATION; -  int old_major = Pike_compiler->compat_major; -  int old_minor = Pike_compiler->compat_minor; -  struct svalue *efun = NULL; -  -  change_compiler_compatibility($1->u.integer.a, $1->u.integer.b); -  -  if(Pike_compiler->last_identifier) -  free_string(Pike_compiler->last_identifier); -  copy_shared_string(Pike_compiler->last_identifier, $3->u.sval.u.string); -  -  /* Check predef:: first, and then the modules. */ -  -  $$ = 0; -  -  if (TYPEOF(c->default_module) == T_MAPPING) { -  if ((efun = low_mapping_lookup(c->default_module.u.mapping, -  &($3->u.sval)))) -  $$ = mkconstantsvaluenode(efun); -  } -  -  else if (TYPEOF(c->default_module) != T_INT) { -  JMP_BUF tmp; -  if (SETJMP (tmp)) -  handle_compile_exception ("Couldn't index %d.%d " -  "default module with %O.", -  $1->u.integer.a, $1->u.integer.b, -  &$3->u.sval); -  else { -  push_svalue (&c->default_module); -  push_svalue (&$3->u.sval); -  f_index (2); -  if (!IS_UNDEFINED (Pike_sp - 1)) -  $$ = mkconstantsvaluenode (Pike_sp - 1); -  pop_stack(); -  } -  UNSETJMP(tmp); -  } -  -  if (!$$ && !($$ = resolve_identifier(Pike_compiler->last_identifier))) { -  if((Pike_compiler->flags & COMPILATION_FORCE_RESOLVE) || -  (Pike_compiler->compiler_pass==2)) { -  my_yyerror("Undefined identifier %d.%d::%S.", -  $1->u.integer.a, $1->u.integer.b, -  Pike_compiler->last_identifier); -  $$=0; -  }else{ -  $$=mknode(F_UNDEFINED,0,0); -  } -  } -  -  change_compiler_compatibility(old_major, old_minor); +  $$ = find_versioned_identifier($3->u.sval.u.string, +  $1->u.integer.a, $1->u.integer.b);    free_node($1);    free_node($3);    }    | TOK_VERSION TOK_COLON_COLON bad_identifier    {    free_node($1);    $$=0;    }    | inherit_specifier TOK_IDENTIFIER    {
pike.git/src/language.yacc:4905:    f_add(2);    }    UNSETJMP(recovery);    STACK_LEVEL_DONE(1);    free_node(n);    n = mkconstantsvaluenode(Pike_sp-1);    pop_stack();    return n;   }    + static node *find_versioned_identifier(struct pike_string *identifier, +  int major, int minor) + { +  struct compilation *c = THIS_COMPILATION; +  int old_major = Pike_compiler->compat_major; +  int old_minor = Pike_compiler->compat_minor; +  struct svalue *efun = NULL; +  node *res = NULL;    -  +  change_compiler_compatibility(major, minor); +  +  if(Pike_compiler->last_identifier) +  free_string(Pike_compiler->last_identifier); +  copy_shared_string(Pike_compiler->last_identifier, identifier); +  +  /* Check predef:: first, and then the modules. */ +  +  if (TYPEOF(c->default_module) == T_MAPPING) { +  if ((efun = low_mapping_string_lookup(c->default_module.u.mapping, +  identifier))) +  res = mkconstantsvaluenode(efun); +  } +  else if (TYPEOF(c->default_module) != T_INT) { +  JMP_BUF tmp; +  if (SETJMP (tmp)) { +  handle_compile_exception ("Couldn't index %d.%d " +  "default module with \"%S\".", +  major, minor, identifier); +  } else { +  push_svalue(&c->default_module); +  ref_push_string(identifier); +  f_index (2); +  if (!IS_UNDEFINED(Pike_sp - 1)) +  res = mkconstantsvaluenode(Pike_sp - 1); +  pop_stack(); +  } +  UNSETJMP(tmp); +  } +  +  if (!res && !(res = resolve_identifier(identifier))) { +  if((Pike_compiler->flags & COMPILATION_FORCE_RESOLVE) || +  (Pike_compiler->compiler_pass==2)) { +  my_yyerror("Undefined identifier %d.%d::%S.", +  major, minor, identifier); +  }else{ +  res = mknode(F_UNDEFINED, 0, 0); +  } +  } +  +  change_compiler_compatibility(old_major, old_minor); +  +  return res; + } +    static int call_handle_import(struct pike_string *s)   {    struct compilation *c = THIS_COMPILATION;    int args;       ref_push_string(s);    ref_push_string(c->lex.current_file);    if (c->handler && c->handler->prog) {    ref_push_object(c->handler);    args = 3;