}
| error
{
- CheckAttributeTarget (GetTokenName (yyToken), GetLocation ($1));
+ CheckAttributeTarget (yyToken, GetTokenName (yyToken), GetLocation ($1));
$$ = null;
}
;
: IDENTIFIER
{
var lt = (LocatedToken) $1;
- $$ = CheckAttributeTarget (lt.Value, lt.Location);
+ $$ = CheckAttributeTarget (yyToken, lt.Value, lt.Location);
}
| EVENT { $$ = "event"; }
| RETURN { $$ = "return"; }
}
opt_enum_member_declarations
{
+ lexer.parsing_modifiers = true;
+
// here will be evaluated after CLOSE_BLACE is consumed.
if (doc_support)
Lexer.doc_state = XmlCommentState.Allowed;
}
| TRY block FINALLY block
{
- $$ = new TryFinally ((Statement) $2, (Block) $4, GetLocation ($1));
+ $$ = new TryFinally ((Statement) $2, (ExplicitBlock) $4, GetLocation ($1));
lbag.AddStatement ($$, GetLocation ($3));
}
| TRY block catch_clauses FINALLY block
{
- $$ = new TryFinally (new TryCatch ((Block) $2, (List<Catch>) $3, Location.Null, true), (Block) $5, GetLocation ($1));
+ $$ = new TryFinally (new TryCatch ((Block) $2, (List<Catch>) $3, Location.Null, true), (ExplicitBlock) $5, GetLocation ($1));
lbag.AddStatement ($$, GetLocation ($4));
}
| TRY block error
catch_clause
: CATCH block
{
- $$ = new Catch ((Block) $2, GetLocation ($1));
+ $$ = new Catch ((ExplicitBlock) $2, GetLocation ($1));
}
| CATCH open_parens_any type opt_identifier CLOSE_PARENS
{
start_block (GetLocation ($2));
- var c = new Catch (current_block, GetLocation ($1));
+ var c = new Catch ((ExplicitBlock) current_block, GetLocation ($1));
c.TypeExpression = (FullNamedExpression) $3;
if ($4 != null) {
return location_stack.Pop ();
}
-string CheckAttributeTarget (string a, Location l)
+string CheckAttributeTarget (int token, string a, Location l)
{
switch (a) {
case "assembly" : case "module" : case "field" : case "method" : case "param" : case "property" : case "type" :
return a;
}
- report.Warning (658, 1, l,
- "`{0}' is invalid attribute target. All attributes in this attribute section will be ignored", a);
+ if (!Tokenizer.IsValidIdentifier (a)) {
+ Error_SyntaxError (token);
+ } else {
+ report.Warning (658, 1, l,
+ "`{0}' is invalid attribute target. All attributes in this attribute section will be ignored", a);
+ }
+
return string.Empty;
}