Skip to content

Instantly share code, notes, and snippets.

@migueldeicaza
Created September 6, 2016 02:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save migueldeicaza/630331ecb44dcec3aa815a7dca6eaeee to your computer and use it in GitHub Desktop.
Save migueldeicaza/630331ecb44dcec3aa815a7dca6eaeee to your computer and use it in GitHub Desktop.
mcs tuple grammer changes
diff --git a/mcs/mcs/cs-parser.jay b/mcs/mcs/cs-parser.jay
index bb2bd6e..a41ae23 100644
--- a/mcs/mcs/cs-parser.jay
+++ b/mcs/mcs/cs-parser.jay
@@ -3222,6 +3222,20 @@ type_expression
$$ = new ComposedCast ((ATypeNameExpression) $1, (ComposedTypeSpecifier) $2);
}
| builtin_type_expression
+ | tuple_type
+ ;
+
+tuple_type
+ : OPEN_PARENS tuple_type_element_list CLOSE_PARENS { $$ = $2; }
+ ;
+
+tuple_type_element_list
+ : tuple_type_element COMMA tuple_type_element
+ | tuple_type_element_list COMMA tuple_type_element
+ ;
+
+tuple_type_element
+ : type opt_identifier {}
;
void_invalid
@@ -3341,6 +3355,7 @@ literal
: boolean_literal
| LITERAL
| NULL { $$ = new NullLiteral (GetLocation ($1)); }
+ | tuple_literal
;
boolean_literal
@@ -3348,6 +3363,20 @@ boolean_literal
| FALSE { $$ = new BoolLiteral (compiler.BuiltinTypes, false, GetLocation ($1)); }
;
+tuple_literal
+ : OPEN_PARENS tuple_literal_element_list CLOSE_PARENS
+ ;
+
+tuple_literal_element_list
+ : tuple_literal_element COMMA tuple_literal_element
+ | tuple_literal_element_list COMMA tuple_literal_element
+ ;
+
+tuple_literal_element
+ : IDENTIFIER SEMICOLON expression
+ | expression
+ ;
+
interpolated_string
: INTERPOLATED_STRING interpolations INTERPOLATED_STRING_END
{
@@ -6483,6 +6512,11 @@ opt_identifier
| identifier_inside_body
;
+opt_identifier_semicolon
+ : /* empty */
+ | IDENTIFIER SEMICOLON { $$ = $1;}
+ ;
+
catch_clause
: CATCH opt_catch_filter block
{
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment