Browse Source

Fixed parser error.

newNRvisualizers
Mike Krüger 13 years ago
parent
commit
e77fadd5bd
  1. 6583
      ICSharpCode.NRefactory.CSharp/Parser/mcs/cs-parser.cs
  2. 34
      ICSharpCode.NRefactory.CSharp/Parser/mcs/cs-parser.jay

6583
ICSharpCode.NRefactory.CSharp/Parser/mcs/cs-parser.cs

File diff suppressed because it is too large Load Diff

34
ICSharpCode.NRefactory.CSharp/Parser/mcs/cs-parser.jay

@ -2954,7 +2954,10 @@ type_parameter
: opt_attributes opt_type_parameter_variance IDENTIFIER : opt_attributes opt_type_parameter_variance IDENTIFIER
{ {
var lt = (Tokenizer.LocatedToken)$3; var lt = (Tokenizer.LocatedToken)$3;
$$ = new TypeParameter (new MemberName (lt.Value, lt.Location), (Attributes)$1, (Variance) $2); var variance = (Variance) $2;
$$ = new TypeParameter (new MemberName (lt.Value, lt.Location), (Attributes)$1, variance);
if (variance != Variance.None)
lbag.AddLocation ($$, savedLocation);
} }
| error | error
{ {
@ -4789,6 +4792,19 @@ block_prepared
} }
; ;
block_prepared_strict
: OPEN_BRACE
{
++lexer.parsing_block;
current_block.StartLocation = GetLocation ($1);
}
opt_statement_list CLOSE_BRACE
{
--lexer.parsing_block;
$$ = end_block (GetLocation ($4));
}
;
opt_statement_list opt_statement_list
: /* empty */ : /* empty */
| statement_list | statement_list
@ -5779,8 +5795,7 @@ try_statement
} }
| TRY block catch_clauses FINALLY block | TRY block catch_clauses FINALLY block
{ {
var loc = GetLocation ($1); $$ = 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, loc, true), (Block) $5, loc);
lbag.AddStatement ($$, GetLocation ($4)); lbag.AddStatement ($$, GetLocation ($4));
} }
| TRY block error | TRY block error
@ -5837,7 +5852,7 @@ catch_clause
lbag.AddLocation (c, GetLocation ($2), GetLocation ($5)); lbag.AddLocation (c, GetLocation ($2), GetLocation ($5));
$$ = c; $$ = c;
} }
block_prepared block_prepared_strict
{ {
$$ = $6; $$ = $6;
} }
@ -5852,6 +5867,17 @@ catch_clause
$$ = new Catch (null, GetLocation ($1)); $$ = new Catch (null, GetLocation ($1));
} }
| CATCH open_parens_any type opt_identifier CLOSE_PARENS error
{
Error_SyntaxError (yyToken);
var c = new Catch (null, GetLocation ($1));
c.TypeExpression = (FullNamedExpression) $3;
lbag.AddLocation (c, GetLocation ($2), GetLocation ($5));
$$ = c;
}
; ;
checked_statement checked_statement

Loading…
Cancel
Save