Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/mcs
diff options
context:
space:
mode:
authorMarek Safar <marek.safar@gmail.com>2013-03-23 12:59:36 +0400
committerMarek Safar <marek.safar@gmail.com>2013-03-24 14:34:50 +0400
commitdfaeb0c3617d595e6fd21561186a39081925a9d6 (patch)
tree4f3be2b618e1c8142570a92c9fa5a12b148a78a4 /mcs
parentcd14fdd614425791ad772c6a8ba2f22672da3ae2 (diff)
Try to recover incomplete ternary expression. Fixes #5195
Diffstat (limited to 'mcs')
-rw-r--r--mcs/errors/cs1525-54.cs10
-rw-r--r--mcs/mcs/cs-parser.jay10
2 files changed, 19 insertions, 1 deletions
diff --git a/mcs/errors/cs1525-54.cs b/mcs/errors/cs1525-54.cs
new file mode 100644
index 00000000000..faf331eaf5b
--- /dev/null
+++ b/mcs/errors/cs1525-54.cs
@@ -0,0 +1,10 @@
+// CS1525: Unexpected symbol `}'
+// Line: 8
+
+class MainClass
+{
+ public string Test ()
+ {
+ return true ? "Hello" :
+ }
+}
diff --git a/mcs/mcs/cs-parser.jay b/mcs/mcs/cs-parser.jay
index 9330a3eb02d..fbd3c2086f8 100644
--- a/mcs/mcs/cs-parser.jay
+++ b/mcs/mcs/cs-parser.jay
@@ -4337,6 +4337,14 @@ conditional_expression
$$ = new Conditional (new BooleanExpression ((Expression) $1), (Expression) $3, null, GetLocation ($2));
lbag.AddLocation ($$, GetLocation ($4));
}
+ | null_coalescing_expression INTERR expression COLON CLOSE_BRACE
+ {
+ Error_SyntaxError (Token.CLOSE_BRACE);
+
+ $$ = new Conditional (new BooleanExpression ((Expression) $1), (Expression) $3, null, GetLocation ($2));
+ lbag.AddLocation ($$, GetLocation ($4));
+ lexer.putback ('}');
+ }
;
assignment_expression
@@ -5633,7 +5641,7 @@ for_initializer
$$ = current_variable;
if ($4 != null)
lbag.AddLocation (current_variable, PopLocation ());
-
+
current_variable = null;
}
| statement_expression_list