提交 337fc5b9 编写于 作者: N Neal Gafter

Merge branch 'features/match' into features/patterns

......@@ -1598,6 +1598,35 @@
<summary>Creates an IsPatternExpressionSyntax node.</summary>
</FactoryComment>
</Node>
<Node Name="MatchExpressionSyntax" Base="ExpressionSyntax">
<Kind Name="MatchExpression"/>
<Field Name="Left" Type="ExpressionSyntax" />
<Field Name="MatchToken" Type="SyntaxToken">
<Kind Name="MatchKeyword"/>
</Field>>
<Field Name="OpenParenToken" Type="SyntaxToken">
<Kind Name="OpenParenToken"/>
</Field>
<Field Name="Sections" Type="SyntaxList&lt;MatchSectionSyntax&gt;" />
<Field Name="CloseParenToken" Type="SyntaxToken">
<Kind Name="CloseParenToken"/>
</Field>
</Node>
<Node Name="MatchSectionSyntax" Base="CSharpSyntaxNode">
<Kind Name="MatchSection" />
<Field Name="CaseKeyword" Type="SyntaxToken">
<Kind Name="CaseKeyword"/>
</Field>
<Field Name="Pattern" Type="PatternSyntax" />
<Field Name="WhenKeyword" Type="SyntaxToken" Optional="true">
<Kind Name="WhenKeyword"/>
</Field>
<Field Name="Condition" Type="ExpressionSyntax" Optional="true" />
<Field Name="ColonToken" Type="SyntaxToken">
<Kind Name="ColonToken"/>
</Field>
<Field Name="Expression" Type="ExpressionSyntax" />
</Node>
<AbstractNode Name="PatternSyntax" Base="CSharpSyntaxNode" />
<Node Name="DeclarationPatternSyntax" Base="PatternSyntax">
<Kind Name="DeclarationPattern" />
......
......@@ -192,6 +192,7 @@ public enum SyntaxKind : ushort
AsyncKeyword = 8435,
AwaitKeyword = 8436,
WhenKeyword = 8437,
MatchKeyword = 8438,
// additional preprocessor keywords
ElifKeyword = 8467,
......@@ -548,5 +549,7 @@ public enum SyntaxKind : ushort
ShebangDirectiveTrivia = 8922,
LoadDirectiveTrivia = 8923,
MatchSection = 8924,
MatchExpression = 8925,
}
}
......@@ -1033,7 +1033,7 @@ public static SyntaxKind GetPreprocessorKeywordKind(string text)
public static IEnumerable<SyntaxKind> GetContextualKeywordKinds()
{
for (int i = (int)SyntaxKind.YieldKeyword; i <= (int)SyntaxKind.WhenKeyword; i++)
for (int i = (int)SyntaxKind.YieldKeyword; i <= (int)SyntaxKind.MatchKeyword; i++)
{
yield return (SyntaxKind)i;
}
......@@ -1076,6 +1076,7 @@ public static bool IsContextualKeyword(SyntaxKind kind)
case SyntaxKind.AsyncKeyword:
case SyntaxKind.AwaitKeyword:
case SyntaxKind.WhenKeyword:
case SyntaxKind.MatchKeyword:
return true;
default:
return false;
......@@ -1175,6 +1176,8 @@ public static SyntaxKind GetContextualKeywordKind(string text)
return SyntaxKind.WhenKeyword;
case "nameof":
return SyntaxKind.NameOfKeyword;
case "match":
return SyntaxKind.MatchKeyword;
default:
return SyntaxKind.None;
}
......@@ -1578,6 +1581,8 @@ public static string GetText(SyntaxKind kind)
return "$\"";
case SyntaxKind.InterpolatedStringEndToken:
return "\"";
case SyntaxKind.MatchKeyword:
return "match";
default:
return string.Empty;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册