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

Merge branch 'features/match' into features/patterns

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