pike.git / src / language.yacc

version» Context lines:

pike.git/src/language.yacc:285:   %type <n> simple_identifier_type   %type <n> real_string_constant   %type <n> real_string_or_identifier   %type <n> string_constant   %type <n> string_or_identifier   %type <n> string_segment   %type <n> string   %type <n> TOK_STRING   %type <n> TOK_NUMBER   %type <n> TOK_BITS - %type <n> optional_attributes +    %type <n> optional_rename_inherit   %type <n> optional_identifier   %type <n> implicit_identifier   %type <n> TOK_IDENTIFIER   %type <n> TOK_RESERVED   %type <n> TOK_VERSION   %type <n> attribute   %type <n> assoc_pair   %type <n> line_number_info   %type <n> block
pike.git/src/language.yacc:800:    }else{    push_type(T_VOID);    }    push_type(T_MANY);    for(; e>=0; e--)    {    push_finished_type(Pike_compiler->compiler_frame->variable[e].type);    push_type(T_FUNCTION);    }    -  if ($2) { -  node *n = $2; +  if (Pike_compiler->current_attributes) { +  node *n = Pike_compiler->current_attributes;    while (n) {    push_type_attribute(CDR(n)->u.sval.u.string);    n = CAR(n);    }    }       {    struct pike_type *s=compiler_pop_type();    int i = isidentifier($6->u.sval.u.string);   
pike.git/src/language.yacc:955:    Pike_fatal("Lost track of compiler_frame!\n"    " Got: %p (Expected: %p) Previous: %p\n",    Pike_compiler->compiler_frame, $7,    Pike_compiler->compiler_frame->previous);    }   #endif    pop_compiler_frame();    free_node($6);    free_node($11);    free_node($<n>12); -  if ($2) free_node($2); +     } -  | modifiers optional_attributes type_or_error optional_constant optional_stars TOK_IDENTIFIER push_compiler_frame0 +  | modifiers optional_attributes type_or_error +  optional_constant optional_stars TOK_IDENTIFIER push_compiler_frame0    error    {   #ifdef PIKE_DEBUG    if (Pike_compiler->compiler_frame != $7) {    Pike_fatal("Lost track of compiler_frame!\n"    " Got: %p (Expected: %p) Previous: %p\n",    Pike_compiler->compiler_frame, $7,    Pike_compiler->compiler_frame->previous);    }   #endif    pop_compiler_frame();    free_node($6); -  if ($2) -  free_node($2); +     }    | modifiers optional_attributes type_or_error optional_constant optional_stars bad_identifier    { -  if ($2) -  free_node($2); +     compiler_discard_type();    }    '(' arguments ')' block_or_semi    {    if ($11) free_node($11);    }    | modifiers optional_attributes type_or_error optional_constant name_list ';' -  { -  if ($2) { -  yyerror("Invalid use of attributes in variable declaration.\n"); -  free_node($2); -  } -  } +     | inheritance {}    | import {}    | constant {}    | modifiers class { free_node($2); }    | modifiers enum { free_node($2); }    | typedef {}    | error TOK_LEX_EOF    {    reset_type_stack();    yyerror("Missing ';'.");
pike.git/src/language.yacc:1211:    $$ = mkstrnode(deprecated_string);    }    | TOK_DEPRECATED_ID    {    struct pike_string *deprecated_string;    MAKE_CONST_STRING(deprecated_string, "deprecated");    $$ = mkstrnode(deprecated_string);    }    ;    - optional_attributes: /* empty */ { $$ = 0; } -  | optional_attributes attribute { $$ = mknode(F_ARG_LIST, $1, $2); } + optional_attributes: /* empty */ +  { +  if (Pike_compiler->current_attributes) { +  free_node(Pike_compiler->current_attributes); +  } +  if ((Pike_compiler->current_attributes = +  THIS_COMPILATION->lex.attributes)) { +  add_ref(Pike_compiler->current_attributes); +  } +  } +  | optional_attributes attribute +  { +  if ($2) { +  Pike_compiler->current_attributes = +  mknode(F_ARG_LIST, Pike_compiler->current_attributes, $2); +  } +  }    ;      optional_stars: optional_stars '*' { $$=$1 + 1; }    | /* empty */ { $$=0; }    ;      cast: open_paren_with_line_info type ')'    {    struct pike_type *s = compiler_pop_type();    $$ = mktypenode(s);
pike.git/src/language.yacc:1678:    ;         name_list: new_name    | name_list ',' new_name    ;      new_name: optional_stars TOK_IDENTIFIER    {    struct pike_type *type; +  node *n;    push_finished_type(Pike_compiler->compiler_frame->current_type);    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); -  +  n = Pike_compiler->current_attributes; +  while(n) { +  push_type_attribute(CDR(n)->u.sval.u.string); +  n = CAR(n); +  }    type=compiler_pop_type();    define_variable($2->u.sval.u.string, type,    Pike_compiler->current_modifiers);    free_type(type);    free_node($2);    }    | optional_stars bad_identifier {}    | optional_stars TOK_IDENTIFIER '='    {    struct pike_type *type; -  +  node *n;    push_finished_type(Pike_compiler->compiler_frame->current_type);    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); -  +  n = Pike_compiler->current_attributes; +  while(n) { +  push_type_attribute(CDR(n)->u.sval.u.string); +  n = CAR(n); +  }    type=compiler_pop_type();    if ((Pike_compiler->current_modifiers & ID_EXTERN) &&    (Pike_compiler->compiler_pass == 1)) {    yywarning("Extern declared variable has initializer.");    }    $<number>$=define_variable($2->u.sval.u.string, type,    Pike_compiler->current_modifiers & (~ID_EXTERN));    free_type(type);    }    expr0