pike.git / src / language.yacc

version» Context lines:

pike.git/src/language.yacc:311:   %type <n> TOK_STRING   %type <n> TOK_NUMBER   %type <n> TOK_BITS   %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> annotation + %type <n> annotation_list   %type <n> attribute   %type <n> assoc_pair   %type <n> line_number_info   %type <n> block   %type <n> optional_block   %type <n> failsafe_block   %type <n> open_paren_with_line_info   %type <n> close_paren_or_missing   %type <n> open_bracket_with_line_info   %type <n> block_or_semi
pike.git/src/language.yacc:477:    $$ = $2;    }    ;      inheritance: modifiers TOK_INHERIT inherit_ref optional_rename_inherit ';'    {    if (($1 & ID_EXTERN) &&    (Pike_compiler->compiler_pass == COMPILER_PASS_FIRST)) {    yywarning("Extern declared inherit.");    } +  if (Pike_compiler->current_annotations && +  (Pike_compiler->compiler_pass == COMPILER_PASS_FIRST)) { +  yywarning("Annotations not supported for inherits."); +  }    if($3)    {    struct pike_string *s=Pike_sp[-1].u.string;    if($4) s=$4->u.sval.u.string;    compiler_do_inherit($3,$1,s);    }    if($4) free_node($4);    pop_stack();    if ($3) free_node($3);    }
pike.git/src/language.yacc:520:    yyerror("Unexpected end of file.");    }    | modifiers TOK_INHERIT error '}' { yyerror("Missing ';'."); }    ;      implement: modifiers TOK_IMPLEMENT inherit_ref ';'    {    if ($1 && (Pike_compiler->compiler_pass == COMPILER_PASS_FIRST)) {    yywarning("Modifiers ignored for implement.");    } +  if (Pike_compiler->current_annotations && +  (Pike_compiler->compiler_pass == COMPILER_PASS_FIRST)) { +  yywarning("Annotations not supported for implements."); +  }    if($3) {    compiler_do_implement($3);    }    pop_stack();    if ($3) free_node($3);    }    | modifiers TOK_IMPLEMENT inherit_ref error ';'    {    if ($3) free_node($3);    pop_stack();
pike.git/src/language.yacc:1059:    {    if ($10) free_node($10);    }    | modifiers optional_attributes simple_type optional_constant name_list ';'    | inheritance {}    | implement {}    | import {}    | constant {}    | modifiers named_class { free_node($2); }    | modifiers enum { free_node($2); } -  | annotation ';' { free_node($1); } +  | annotation ';' +  { +  $1 = mknode(F_COMMA_EXPR, $1, NULL); +  compiler_add_annotations(-1, $1); +  free_node($1); +  }    | typedef {}    | static_assertion expected_semicolon {}    | error TOK_LEX_EOF    {    reset_type_stack();    yyerror("Missing ';'.");    yyerror("Unexpected end of file");    }    | error ';'    {
pike.git/src/language.yacc:1085:    {    reset_type_stack();    yyerror("Missing ';'.");    /* yychar = '}'; */ /* Put the '}' back on the input stream */    }    | modifiers    '{'    {    $<number>$=THIS_COMPILATION->lex.pragmas;    THIS_COMPILATION->lex.pragmas|=$1; +  if (Pike_compiler->current_annotations) { +  yywarning("Annotation blocks are not supported.");    } -  +  }    program    close_brace_or_eof    {    THIS_COMPILATION->lex.pragmas=$<number>3;    }    ;      static_assertion: TOK_STATIC_ASSERT '(' expr0 ',' expr0 ')'    {    Pike_compiler->init_node =
pike.git/src/language.yacc:1265:    free_string(tmp);    }    ;      annotation: '@' constant_expr    {    $$ = $2;    }    ;    - modifiers: modifier_list + annotation_list: /* empty */ { $$ = NULL; } +  | annotation ':' annotation_list    { -  $$=Pike_compiler->current_modifiers=$1 | -  (THIS_COMPILATION->lex.pragmas & ID_MODIFIER_MASK); +  $$ = mknode(F_COMMA_EXPR, $1, $3);    } -  | annotation ':' modifiers +  ; +  + modifiers: annotation_list modifier_list    { -  if ($1) free_node($1); -  $$ = $3; +  free_node(Pike_compiler->current_annotations); +  Pike_compiler->current_annotations = $1; +  $$ = Pike_compiler->current_modifiers = $2 | +  (THIS_COMPILATION->lex.pragmas & ID_MODIFIER_MASK);    }    ;      modifier_list: /* empty */ { $$ = 0; }    | modifier_list modifier { $$ = $1 | $2; }    ;      attribute: TOK_ATTRIBUTE_ID '(' string_constant optional_comma ')'    {    $$ = $3;
pike.git/src/language.yacc:1955:    if(tmp < 1)    {    if(Pike_compiler->compiler_pass == COMPILER_PASS_LAST)    yyerror("Error evaluating constant expression.");    push_int(0);    } else {    pop_n_elems((INT32)(tmp - 1));    }    }    free_node($$); -  $$ = mksvaluenode(Pike_sp - 1); +  $$ = mkconstantsvaluenode(Pike_sp - 1);    pop_stack();    }    ;      local_constant_name: TOK_IDENTIFIER '=' safe_expr0    {    struct pike_type *type;       /* Ugly hack to make sure that $3 is optimized */    {
pike.git/src/language.yacc:3703:    | expr4 open_paren_with_line_info error '}'    {    yyerror("Missing ')'.");    $$=mkapplynode($1, NULL);    free_node ($2);    }    ;      implicit_modifiers:    { +  free_node(Pike_compiler->current_annotations); +  Pike_compiler->current_annotations = NULL;    $$ = Pike_compiler->current_modifiers = ID_PROTECTED|ID_INLINE|ID_PRIVATE |    (THIS_COMPILATION->lex.pragmas & ID_MODIFIER_MASK);    }    ;      expr4: idents | expr5    | expr5 '.' line_number_info TOK_IDENTIFIER    {    $$=index_node($1,".",$4->u.sval.u.string);    COPY_LINE_NUMBER_INFO($$, $3);