pike.git/
src/
language.yacc
Branch:
Tag:
Non-build tags
All tags
No tags
2018-11-06
2018-11-06 14:51:14 by Henrik Grubbström (Grubba) <grubba@grubba.org>
843d2ffb5117bf5c289979fea6ca78db685941df (
50
lines) (+
37
/-
13
)
[
Show
|
Annotate
]
Branch:
master
Compiler: First go at storing annotations.
318:
%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
484:
(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;
527:
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); }
1066:
| 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
1092:
{ $<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 {
1272:
} ;
-
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)
;
} ;
1962:
} } free_node($$);
-
$$ =
mksvaluenode
(Pike_sp - 1);
+
$$ =
mkconstantsvaluenode
(Pike_sp - 1);
pop_stack(); } ;
3710:
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); }