Merge branch 'BigIntegerParse'
[mono.git] / mcs / mcs / cs-parser.jay
index 0c4aa6be32a6aa3447b4eeab19fc27597840d521..54cfde6ae2d8f842a4d1487c564ba37577e48bd3 100644 (file)
@@ -739,7 +739,7 @@ attribute_section_cont
          }
        | error
          {
-               CheckAttributeTarget (GetTokenName (yyToken), GetLocation ($1)); 
+               CheckAttributeTarget (yyToken, GetTokenName (yyToken), GetLocation ($1)); 
                $$ = null;
          }
        ;       
@@ -748,7 +748,7 @@ attribute_target
        : IDENTIFIER
          {
                var lt = (LocatedToken) $1;
-               $$ = CheckAttributeTarget (lt.Value, lt.Location);
+               $$ = CheckAttributeTarget (yyToken, lt.Value, lt.Location);
          }
        | EVENT  { $$ = "event"; }
        | RETURN { $$ = "return"; }
@@ -2601,6 +2601,8 @@ enum_declaration
          }
          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;
@@ -5900,12 +5902,12 @@ try_statement
          }
        | 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
@@ -5945,12 +5947,12 @@ opt_identifier
 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) {
@@ -6978,15 +6980,20 @@ Location PopLocation ()
        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;
 }