public void TypeSyntax_GenericNameSyntax_RoslynMLFromRoslyn_OK() { var converter = new RoslynML(); var node = SyntaxFactory.ParseName("a<,>"); var xElement = converter.Visit(node); Assert.AreEqual("<GenericName Name=\"true\" TypeSyntax=\"true\" startLine=\"1\" startColumn=\"1\" endLine=\"1\" endColumn=\"4\">" + "<Token kind=\"IdentifierToken\" startLine=\"1\" startColumn=\"1\" endLine=\"1\" endColumn=\"1\" part=\"Identifier\">a</Token>" + "<TypeArgumentList startLine=\"1\" startColumn=\"2\" endLine=\"1\" endColumn=\"4\" part=\"TypeArgumentList\">" + "<Token kind=\"LessThanToken\" Punctuation=\"true\" Language=\"true\" startLine=\"1\" startColumn=\"2\" endLine=\"1\" endColumn=\"2\" part=\"LessThanToken\"><</Token>" + "<SeparatedList_of_Type part=\"Arguments\">" + "<OmittedTypeArgument>" + "<Token kind=\"OmittedTypeArgumentToken\" part=\"OmittedTypeArgumentToken\"></Token>" + "</OmittedTypeArgument>" + "<OmittedTypeArgument>" + "<Token kind=\"OmittedTypeArgumentToken\" part=\"OmittedTypeArgumentToken\"></Token>" + "</OmittedTypeArgument>" + "</SeparatedList_of_Type>" + "<Token kind=\"GreaterThanToken\" Punctuation=\"true\" Language=\"true\" startLine=\"1\" startColumn=\"4\" endLine=\"1\" endColumn=\"4\" part=\"GreaterThanToken\">></Token>" + "</TypeArgumentList>" + "</GenericName>", xElement.ToString(SaveOptions.DisableFormatting)); node = SyntaxFactory.ParseName("a<x,t>"); xElement = converter.Visit(node); Assert.AreEqual("<GenericName Name=\"true\" TypeSyntax=\"true\" startLine=\"1\" startColumn=\"1\" endLine=\"1\" endColumn=\"6\">" + "<Token kind=\"IdentifierToken\" startLine=\"1\" startColumn=\"1\" endLine=\"1\" endColumn=\"1\" part=\"Identifier\">a</Token>" + "<TypeArgumentList startLine=\"1\" startColumn=\"2\" endLine=\"1\" endColumn=\"6\" part=\"TypeArgumentList\">" + "<Token kind=\"LessThanToken\" Punctuation=\"true\" Language=\"true\" startLine=\"1\" startColumn=\"2\" endLine=\"1\" endColumn=\"2\" part=\"LessThanToken\"><</Token>" + "<SeparatedList_of_Type part=\"Arguments\">" + "<IdentifierName Name=\"true\" TypeSyntax=\"true\" startLine=\"1\" startColumn=\"3\" endLine=\"1\" endColumn=\"3\">" + "<Token kind=\"IdentifierToken\" startLine=\"1\" startColumn=\"3\" endLine=\"1\" endColumn=\"3\" part=\"Identifier\">x</Token>" + "</IdentifierName>" + "<IdentifierName Name=\"true\" TypeSyntax=\"true\" startLine=\"1\" startColumn=\"5\" endLine=\"1\" endColumn=\"5\">" + "<Token kind=\"IdentifierToken\" startLine=\"1\" startColumn=\"5\" endLine=\"1\" endColumn=\"5\" part=\"Identifier\">t</Token>" + "</IdentifierName>" + "</SeparatedList_of_Type>" + "<Token kind=\"GreaterThanToken\" Punctuation=\"true\" Language=\"true\" startLine=\"1\" startColumn=\"6\" endLine=\"1\" endColumn=\"6\" part=\"GreaterThanToken\">></Token>" + "</TypeArgumentList>" + "</GenericName>", xElement.ToString(SaveOptions.DisableFormatting)); node = SyntaxFactory.ParseName("a<x,>"); xElement = converter.Visit(node); Assert.AreEqual("<GenericName Name=\"true\" TypeSyntax=\"true\" startLine=\"1\" startColumn=\"1\" endLine=\"1\" endColumn=\"5\">" + "<Token kind=\"IdentifierToken\" startLine=\"1\" startColumn=\"1\" endLine=\"1\" endColumn=\"1\" part=\"Identifier\">a</Token>" + "<TypeArgumentList startLine=\"1\" startColumn=\"2\" endLine=\"1\" endColumn=\"5\" part=\"TypeArgumentList\">" + "<Token kind=\"LessThanToken\" Punctuation=\"true\" Language=\"true\" startLine=\"1\" startColumn=\"2\" endLine=\"1\" endColumn=\"2\" part=\"LessThanToken\"><</Token>" + "<SeparatedList_of_Type part=\"Arguments\">" + "<IdentifierName Name=\"true\" TypeSyntax=\"true\" startLine=\"1\" startColumn=\"3\" endLine=\"1\" endColumn=\"3\">" + "<Token kind=\"IdentifierToken\" startLine=\"1\" startColumn=\"3\" endLine=\"1\" endColumn=\"3\" part=\"Identifier\">x</Token>" + "</IdentifierName>" + "<IdentifierName Name=\"true\" TypeSyntax=\"true\">" + "<Token kind=\"IdentifierToken\" part=\"Identifier\"></Token>" + "</IdentifierName>" + "</SeparatedList_of_Type>" + "<Token kind=\"GreaterThanToken\" Punctuation=\"true\" Language=\"true\" startLine=\"1\" startColumn=\"5\" endLine=\"1\" endColumn=\"5\" part=\"GreaterThanToken\">></Token>" + "</TypeArgumentList>" + "</GenericName>", xElement.ToString(SaveOptions.DisableFormatting)); }
public void TypeSyntax_ArrayTypeSyntax_RoslynMLFromRoslyn_OK() { var converter = new RoslynML(); var node = SyntaxFactory.ParseTypeName("int[1, 2]"); var xElement = converter.Visit(node); Assert.AreEqual("<ArrayType TypeSyntax=\"true\" startLine=\"1\" startColumn=\"1\" endLine=\"1\" endColumn=\"9\">" + "<PredefinedType TypeSyntax=\"true\" startLine=\"1\" startColumn=\"1\" endLine=\"1\" endColumn=\"3\" part=\"ElementType\">" + "<Token kind=\"IntKeyword\" Keyword=\"true\" startLine=\"1\" startColumn=\"1\" endLine=\"1\" endColumn=\"3\" part=\"Keyword\">int</Token>" + "</PredefinedType>" + "<List_of_ArrayRankSpecifier part=\"RankSpecifiers\">" + "<ArrayRankSpecifier startLine=\"1\" startColumn=\"4\" endLine=\"1\" endColumn=\"9\">" + "<Token kind=\"OpenBracketToken\" Punctuation=\"true\" Language=\"true\" startLine=\"1\" startColumn=\"4\" endLine=\"1\" endColumn=\"4\" part=\"OpenBracketToken\">[</Token>" + "<SeparatedList_of_Expression part=\"Sizes\">" + "<LiteralExpression kind=\"NumericLiteralExpression\" startLine=\"1\" startColumn=\"5\" endLine=\"1\" endColumn=\"5\">" + "<Token kind=\"NumericLiteralToken\" startLine=\"1\" startColumn=\"5\" endLine=\"1\" endColumn=\"5\" part=\"Token\">1</Token>" + "</LiteralExpression>" + "<LiteralExpression kind=\"NumericLiteralExpression\" startLine=\"1\" startColumn=\"8\" endLine=\"1\" endColumn=\"8\">" + "<Token kind=\"NumericLiteralToken\" startLine=\"1\" startColumn=\"8\" endLine=\"1\" endColumn=\"8\" part=\"Token\">2</Token>" + "</LiteralExpression>" + "</SeparatedList_of_Expression>" + "<Token kind=\"CloseBracketToken\" Punctuation=\"true\" Language=\"true\" startLine=\"1\" startColumn=\"9\" endLine=\"1\" endColumn=\"9\" part=\"CloseBracketToken\">]</Token>" + "</ArrayRankSpecifier>" + "</List_of_ArrayRankSpecifier>" + "</ArrayType>", xElement.ToString(SaveOptions.DisableFormatting)); node = SyntaxFactory.ParseTypeName("int[1][2]"); xElement = converter.Visit(node); Assert.AreEqual("<ArrayType TypeSyntax=\"true\" startLine=\"1\" startColumn=\"1\" endLine=\"1\" endColumn=\"9\">" + "<PredefinedType TypeSyntax=\"true\" startLine=\"1\" startColumn=\"1\" endLine=\"1\" endColumn=\"3\" part=\"ElementType\">" + "<Token kind=\"IntKeyword\" Keyword=\"true\" startLine=\"1\" startColumn=\"1\" endLine=\"1\" endColumn=\"3\" part=\"Keyword\">int</Token>" + "</PredefinedType>" + "<List_of_ArrayRankSpecifier part=\"RankSpecifiers\">" + "<ArrayRankSpecifier startLine=\"1\" startColumn=\"4\" endLine=\"1\" endColumn=\"6\">" + "<Token kind=\"OpenBracketToken\" Punctuation=\"true\" Language=\"true\" startLine=\"1\" startColumn=\"4\" endLine=\"1\" endColumn=\"4\" part=\"OpenBracketToken\">[</Token>" + "<SeparatedList_of_Expression part=\"Sizes\">" + "<LiteralExpression kind=\"NumericLiteralExpression\" startLine=\"1\" startColumn=\"5\" endLine=\"1\" endColumn=\"5\">" + "<Token kind=\"NumericLiteralToken\" startLine=\"1\" startColumn=\"5\" endLine=\"1\" endColumn=\"5\" part=\"Token\">1</Token>" + "</LiteralExpression>" + "</SeparatedList_of_Expression>" + "<Token kind=\"CloseBracketToken\" Punctuation=\"true\" Language=\"true\" startLine=\"1\" startColumn=\"6\" endLine=\"1\" endColumn=\"6\" part=\"CloseBracketToken\">]</Token>" + "</ArrayRankSpecifier>" + "<ArrayRankSpecifier startLine=\"1\" startColumn=\"7\" endLine=\"1\" endColumn=\"9\">" + "<Token kind=\"OpenBracketToken\" Punctuation=\"true\" Language=\"true\" startLine=\"1\" startColumn=\"7\" endLine=\"1\" endColumn=\"7\" part=\"OpenBracketToken\">[</Token>" + "<SeparatedList_of_Expression part=\"Sizes\">" + "<LiteralExpression kind=\"NumericLiteralExpression\" startLine=\"1\" startColumn=\"8\" endLine=\"1\" endColumn=\"8\">" + "<Token kind=\"NumericLiteralToken\" startLine=\"1\" startColumn=\"8\" endLine=\"1\" endColumn=\"8\" part=\"Token\">2</Token>" + "</LiteralExpression>" + "</SeparatedList_of_Expression>" + "<Token kind=\"CloseBracketToken\" Punctuation=\"true\" Language=\"true\" startLine=\"1\" startColumn=\"9\" endLine=\"1\" endColumn=\"9\" part=\"CloseBracketToken\">]</Token>" + "</ArrayRankSpecifier>" + "</List_of_ArrayRankSpecifier>" + "</ArrayType>", xElement.ToString(SaveOptions.DisableFormatting)); }
public void ExpressionSyntax_FromClauseSyntax_RoslynMLFromRoslyn_OK() { var converter = new RoslynML(); var node = (QueryExpressionSyntax)SyntaxFactory.ParseExpression("from f in s where f.A select f.R"); var xElement = converter.Visit(node.FromClause); Assert.AreEqual("<FromClause startLine=\"1\" startColumn=\"1\" endLine=\"1\" endColumn=\"11\"><Token kind=\"FromKeyword\" Keyword=\"true\" Contextual=\"true\" Query=\"true\" startLine=\"1\" startColumn=\"1\" endLine=\"1\" endColumn=\"4\" part=\"FromKeyword\">from</Token><Token kind=\"IdentifierToken\" startLine=\"1\" startColumn=\"6\" endLine=\"1\" endColumn=\"6\" part=\"Identifier\">f</Token><Token kind=\"InKeyword\" Keyword=\"true\" TypeParameterVariance=\"true\" startLine=\"1\" startColumn=\"8\" endLine=\"1\" endColumn=\"9\" part=\"InKeyword\">in</Token><IdentifierName Name=\"true\" TypeSyntax=\"true\" startLine=\"1\" startColumn=\"11\" endLine=\"1\" endColumn=\"11\" part=\"Expression\"><Token kind=\"IdentifierToken\" startLine=\"1\" startColumn=\"11\" endLine=\"1\" endColumn=\"11\" part=\"Identifier\">s</Token></IdentifierName></FromClause>", xElement.ToString(SaveOptions.DisableFormatting)); node = (QueryExpressionSyntax)SyntaxFactory.ParseExpression("from A f in s"); xElement = converter.Visit(node.FromClause); Assert.AreEqual("<FromClause startLine=\"1\" startColumn=\"1\" endLine=\"1\" endColumn=\"13\"><Token kind=\"FromKeyword\" Keyword=\"true\" Contextual=\"true\" Query=\"true\" startLine=\"1\" startColumn=\"1\" endLine=\"1\" endColumn=\"4\" part=\"FromKeyword\">from</Token><IdentifierName Name=\"true\" TypeSyntax=\"true\" startLine=\"1\" startColumn=\"6\" endLine=\"1\" endColumn=\"6\" part=\"Type\"><Token kind=\"IdentifierToken\" startLine=\"1\" startColumn=\"6\" endLine=\"1\" endColumn=\"6\" part=\"Identifier\">A</Token></IdentifierName><Token kind=\"IdentifierToken\" startLine=\"1\" startColumn=\"8\" endLine=\"1\" endColumn=\"8\" part=\"Identifier\">f</Token><Token kind=\"InKeyword\" Keyword=\"true\" TypeParameterVariance=\"true\" startLine=\"1\" startColumn=\"10\" endLine=\"1\" endColumn=\"11\" part=\"InKeyword\">in</Token><IdentifierName Name=\"true\" TypeSyntax=\"true\" startLine=\"1\" startColumn=\"13\" endLine=\"1\" endColumn=\"13\" part=\"Expression\"><Token kind=\"IdentifierToken\" startLine=\"1\" startColumn=\"13\" endLine=\"1\" endColumn=\"13\" part=\"Identifier\">s</Token></IdentifierName></FromClause>", xElement.ToString(SaveOptions.DisableFormatting)); }
public void ExpressionSyntax_SelectClauseSyntax_RoslynMLFromRoslyn_OK() { var converter = new RoslynML(); var node = SyntaxFactory.ParseExpression("from A f in s select f"); var xElement = converter.Visit(((QueryExpressionSyntax)node).Body.SelectOrGroup); Assert.AreEqual("<SelectClause startLine=\"1\" startColumn=\"15\" endLine=\"1\" endColumn=\"22\"><Token kind=\"SelectKeyword\" Keyword=\"true\" Contextual=\"true\" Query=\"true\" startLine=\"1\" startColumn=\"15\" endLine=\"1\" endColumn=\"20\" part=\"SelectKeyword\">select</Token><IdentifierName Name=\"true\" TypeSyntax=\"true\" startLine=\"1\" startColumn=\"22\" endLine=\"1\" endColumn=\"22\" part=\"Expression\"><Token kind=\"IdentifierToken\" startLine=\"1\" startColumn=\"22\" endLine=\"1\" endColumn=\"22\" part=\"Identifier\">f</Token></IdentifierName></SelectClause>", xElement.ToString(SaveOptions.DisableFormatting)); node = SyntaxFactory.ParseExpression("from A f in s select w.z"); xElement = converter.Visit(((QueryExpressionSyntax)node).Body.SelectOrGroup); Assert.AreEqual("<SelectClause startLine=\"1\" startColumn=\"15\" endLine=\"1\" endColumn=\"24\"><Token kind=\"SelectKeyword\" Keyword=\"true\" Contextual=\"true\" Query=\"true\" startLine=\"1\" startColumn=\"15\" endLine=\"1\" endColumn=\"20\" part=\"SelectKeyword\">select</Token><MemberAccessExpression kind=\"SimpleMemberAccessExpression\" startLine=\"1\" startColumn=\"22\" endLine=\"1\" endColumn=\"24\" part=\"Expression\"><IdentifierName Name=\"true\" TypeSyntax=\"true\" startLine=\"1\" startColumn=\"22\" endLine=\"1\" endColumn=\"22\" part=\"Expression\"><Token kind=\"IdentifierToken\" startLine=\"1\" startColumn=\"22\" endLine=\"1\" endColumn=\"22\" part=\"Identifier\">w</Token></IdentifierName><Token kind=\"DotToken\" Operator=\"true\" startLine=\"1\" startColumn=\"23\" endLine=\"1\" endColumn=\"23\" part=\"OperatorToken\">.</Token><IdentifierName Name=\"true\" TypeSyntax=\"true\" startLine=\"1\" startColumn=\"24\" endLine=\"1\" endColumn=\"24\" part=\"Name\"><Token kind=\"IdentifierToken\" startLine=\"1\" startColumn=\"24\" endLine=\"1\" endColumn=\"24\" part=\"Identifier\">z</Token></IdentifierName></MemberAccessExpression></SelectClause>", xElement.ToString(SaveOptions.DisableFormatting)); }
public void ExpressionSyntax_OrderByClauseSyntax_RoslynMLFromRoslyn_OK() { var converter = new RoslynML(); var node = (QueryExpressionSyntax)SyntaxFactory.ParseExpression("from A f in s orderby f.y"); var xElement = converter.Visit(node.Body.Clauses[0]); Assert.AreEqual("<OrderByClause startLine=\"1\" startColumn=\"15\" endLine=\"1\" endColumn=\"25\"><Token kind=\"OrderByKeyword\" Keyword=\"true\" Contextual=\"true\" Query=\"true\" startLine=\"1\" startColumn=\"15\" endLine=\"1\" endColumn=\"21\" part=\"OrderByKeyword\">orderby</Token><SeparatedList_of_Ordering part=\"Orderings\"><Ordering kind=\"AscendingOrdering\" startLine=\"1\" startColumn=\"23\" endLine=\"1\" endColumn=\"25\"><MemberAccessExpression kind=\"SimpleMemberAccessExpression\" startLine=\"1\" startColumn=\"23\" endLine=\"1\" endColumn=\"25\" part=\"Expression\"><IdentifierName Name=\"true\" TypeSyntax=\"true\" startLine=\"1\" startColumn=\"23\" endLine=\"1\" endColumn=\"23\" part=\"Expression\"><Token kind=\"IdentifierToken\" startLine=\"1\" startColumn=\"23\" endLine=\"1\" endColumn=\"23\" part=\"Identifier\">f</Token></IdentifierName><Token kind=\"DotToken\" Operator=\"true\" startLine=\"1\" startColumn=\"24\" endLine=\"1\" endColumn=\"24\" part=\"OperatorToken\">.</Token><IdentifierName Name=\"true\" TypeSyntax=\"true\" startLine=\"1\" startColumn=\"25\" endLine=\"1\" endColumn=\"25\" part=\"Name\"><Token kind=\"IdentifierToken\" startLine=\"1\" startColumn=\"25\" endLine=\"1\" endColumn=\"25\" part=\"Identifier\">y</Token></IdentifierName></MemberAccessExpression></Ordering></SeparatedList_of_Ordering></OrderByClause>", xElement.ToString(SaveOptions.DisableFormatting)); node = (QueryExpressionSyntax)SyntaxFactory.ParseExpression("from A f in s orderby f.y ascending, f.z descending"); xElement = converter.Visit(node.Body.Clauses[0]); Assert.AreEqual("<OrderByClause startLine=\"1\" startColumn=\"15\" endLine=\"1\" endColumn=\"51\"><Token kind=\"OrderByKeyword\" Keyword=\"true\" Contextual=\"true\" Query=\"true\" startLine=\"1\" startColumn=\"15\" endLine=\"1\" endColumn=\"21\" part=\"OrderByKeyword\">orderby</Token><SeparatedList_of_Ordering part=\"Orderings\"><Ordering kind=\"AscendingOrdering\" startLine=\"1\" startColumn=\"23\" endLine=\"1\" endColumn=\"35\"><MemberAccessExpression kind=\"SimpleMemberAccessExpression\" startLine=\"1\" startColumn=\"23\" endLine=\"1\" endColumn=\"25\" part=\"Expression\"><IdentifierName Name=\"true\" TypeSyntax=\"true\" startLine=\"1\" startColumn=\"23\" endLine=\"1\" endColumn=\"23\" part=\"Expression\"><Token kind=\"IdentifierToken\" startLine=\"1\" startColumn=\"23\" endLine=\"1\" endColumn=\"23\" part=\"Identifier\">f</Token></IdentifierName><Token kind=\"DotToken\" Operator=\"true\" startLine=\"1\" startColumn=\"24\" endLine=\"1\" endColumn=\"24\" part=\"OperatorToken\">.</Token><IdentifierName Name=\"true\" TypeSyntax=\"true\" startLine=\"1\" startColumn=\"25\" endLine=\"1\" endColumn=\"25\" part=\"Name\"><Token kind=\"IdentifierToken\" startLine=\"1\" startColumn=\"25\" endLine=\"1\" endColumn=\"25\" part=\"Identifier\">y</Token></IdentifierName></MemberAccessExpression><Token kind=\"AscendingKeyword\" Keyword=\"true\" Contextual=\"true\" Query=\"true\" startLine=\"1\" startColumn=\"27\" endLine=\"1\" endColumn=\"35\" part=\"AscendingOrDescendingKeyword\">ascending</Token></Ordering><Ordering kind=\"DescendingOrdering\" startLine=\"1\" startColumn=\"38\" endLine=\"1\" endColumn=\"51\"><MemberAccessExpression kind=\"SimpleMemberAccessExpression\" startLine=\"1\" startColumn=\"38\" endLine=\"1\" endColumn=\"40\" part=\"Expression\"><IdentifierName Name=\"true\" TypeSyntax=\"true\" startLine=\"1\" startColumn=\"38\" endLine=\"1\" endColumn=\"38\" part=\"Expression\"><Token kind=\"IdentifierToken\" startLine=\"1\" startColumn=\"38\" endLine=\"1\" endColumn=\"38\" part=\"Identifier\">f</Token></IdentifierName><Token kind=\"DotToken\" Operator=\"true\" startLine=\"1\" startColumn=\"39\" endLine=\"1\" endColumn=\"39\" part=\"OperatorToken\">.</Token><IdentifierName Name=\"true\" TypeSyntax=\"true\" startLine=\"1\" startColumn=\"40\" endLine=\"1\" endColumn=\"40\" part=\"Name\"><Token kind=\"IdentifierToken\" startLine=\"1\" startColumn=\"40\" endLine=\"1\" endColumn=\"40\" part=\"Identifier\">z</Token></IdentifierName></MemberAccessExpression><Token kind=\"DescendingKeyword\" Keyword=\"true\" Contextual=\"true\" Query=\"true\" startLine=\"1\" startColumn=\"42\" endLine=\"1\" endColumn=\"51\" part=\"AscendingOrDescendingKeyword\">descending</Token></Ordering></SeparatedList_of_Ordering></OrderByClause>", xElement.ToString(SaveOptions.DisableFormatting)); }
public void ExpressionSyntax_QueryBodySyntax_RoslynMLFromRoslyn_OK() { var converter = new RoslynML(); var node = (QueryExpressionSyntax)SyntaxFactory.ParseExpression("from f in s let y = 5 where f.A select f.R"); var xElement = converter.Visit(node.Body); Assert.AreEqual("<QueryBody startLine=\"1\" startColumn=\"13\" endLine=\"1\" endColumn=\"42\"><List_of_QueryClause part=\"Clauses\"><LetClause startLine=\"1\" startColumn=\"13\" endLine=\"1\" endColumn=\"21\"><Token kind=\"LetKeyword\" Keyword=\"true\" Contextual=\"true\" Query=\"true\" startLine=\"1\" startColumn=\"13\" endLine=\"1\" endColumn=\"15\" part=\"LetKeyword\">let</Token><Token kind=\"IdentifierToken\" startLine=\"1\" startColumn=\"17\" endLine=\"1\" endColumn=\"17\" part=\"Identifier\">y</Token><Token kind=\"EqualsToken\" Operator=\"true\" startLine=\"1\" startColumn=\"19\" endLine=\"1\" endColumn=\"19\" part=\"EqualsToken\">=</Token><LiteralExpression kind=\"NumericLiteralExpression\" startLine=\"1\" startColumn=\"21\" endLine=\"1\" endColumn=\"21\" part=\"Expression\"><Token kind=\"NumericLiteralToken\" startLine=\"1\" startColumn=\"21\" endLine=\"1\" endColumn=\"21\" part=\"Token\">5</Token></LiteralExpression></LetClause><WhereClause startLine=\"1\" startColumn=\"23\" endLine=\"1\" endColumn=\"31\"><Token kind=\"WhereKeyword\" Keyword=\"true\" Contextual=\"true\" Query=\"true\" startLine=\"1\" startColumn=\"23\" endLine=\"1\" endColumn=\"27\" part=\"WhereKeyword\">where</Token><MemberAccessExpression kind=\"SimpleMemberAccessExpression\" startLine=\"1\" startColumn=\"29\" endLine=\"1\" endColumn=\"31\" part=\"Condition\"><IdentifierName Name=\"true\" TypeSyntax=\"true\" startLine=\"1\" startColumn=\"29\" endLine=\"1\" endColumn=\"29\" part=\"Expression\"><Token kind=\"IdentifierToken\" startLine=\"1\" startColumn=\"29\" endLine=\"1\" endColumn=\"29\" part=\"Identifier\">f</Token></IdentifierName><Token kind=\"DotToken\" Operator=\"true\" startLine=\"1\" startColumn=\"30\" endLine=\"1\" endColumn=\"30\" part=\"OperatorToken\">.</Token><IdentifierName Name=\"true\" TypeSyntax=\"true\" startLine=\"1\" startColumn=\"31\" endLine=\"1\" endColumn=\"31\" part=\"Name\"><Token kind=\"IdentifierToken\" startLine=\"1\" startColumn=\"31\" endLine=\"1\" endColumn=\"31\" part=\"Identifier\">A</Token></IdentifierName></MemberAccessExpression></WhereClause></List_of_QueryClause><SelectClause startLine=\"1\" startColumn=\"33\" endLine=\"1\" endColumn=\"42\" part=\"SelectOrGroup\"><Token kind=\"SelectKeyword\" Keyword=\"true\" Contextual=\"true\" Query=\"true\" startLine=\"1\" startColumn=\"33\" endLine=\"1\" endColumn=\"38\" part=\"SelectKeyword\">select</Token><MemberAccessExpression kind=\"SimpleMemberAccessExpression\" startLine=\"1\" startColumn=\"40\" endLine=\"1\" endColumn=\"42\" part=\"Expression\"><IdentifierName Name=\"true\" TypeSyntax=\"true\" startLine=\"1\" startColumn=\"40\" endLine=\"1\" endColumn=\"40\" part=\"Expression\"><Token kind=\"IdentifierToken\" startLine=\"1\" startColumn=\"40\" endLine=\"1\" endColumn=\"40\" part=\"Identifier\">f</Token></IdentifierName><Token kind=\"DotToken\" Operator=\"true\" startLine=\"1\" startColumn=\"41\" endLine=\"1\" endColumn=\"41\" part=\"OperatorToken\">.</Token><IdentifierName Name=\"true\" TypeSyntax=\"true\" startLine=\"1\" startColumn=\"42\" endLine=\"1\" endColumn=\"42\" part=\"Name\"><Token kind=\"IdentifierToken\" startLine=\"1\" startColumn=\"42\" endLine=\"1\" endColumn=\"42\" part=\"Identifier\">R</Token></IdentifierName></MemberAccessExpression></SelectClause></QueryBody>", xElement.ToString(SaveOptions.DisableFormatting)); node = (QueryExpressionSyntax)SyntaxFactory.ParseExpression("from A a in t let y = 5 where a.F select b.C into r select r.R"); xElement = converter.Visit(node.Body); Assert.AreEqual("<QueryBody startLine=\"1\" startColumn=\"15\" endLine=\"1\" endColumn=\"62\"><List_of_QueryClause part=\"Clauses\"><LetClause startLine=\"1\" startColumn=\"15\" endLine=\"1\" endColumn=\"23\"><Token kind=\"LetKeyword\" Keyword=\"true\" Contextual=\"true\" Query=\"true\" startLine=\"1\" startColumn=\"15\" endLine=\"1\" endColumn=\"17\" part=\"LetKeyword\">let</Token><Token kind=\"IdentifierToken\" startLine=\"1\" startColumn=\"19\" endLine=\"1\" endColumn=\"19\" part=\"Identifier\">y</Token><Token kind=\"EqualsToken\" Operator=\"true\" startLine=\"1\" startColumn=\"21\" endLine=\"1\" endColumn=\"21\" part=\"EqualsToken\">=</Token><LiteralExpression kind=\"NumericLiteralExpression\" startLine=\"1\" startColumn=\"23\" endLine=\"1\" endColumn=\"23\" part=\"Expression\"><Token kind=\"NumericLiteralToken\" startLine=\"1\" startColumn=\"23\" endLine=\"1\" endColumn=\"23\" part=\"Token\">5</Token></LiteralExpression></LetClause><WhereClause startLine=\"1\" startColumn=\"25\" endLine=\"1\" endColumn=\"33\"><Token kind=\"WhereKeyword\" Keyword=\"true\" Contextual=\"true\" Query=\"true\" startLine=\"1\" startColumn=\"25\" endLine=\"1\" endColumn=\"29\" part=\"WhereKeyword\">where</Token><MemberAccessExpression kind=\"SimpleMemberAccessExpression\" startLine=\"1\" startColumn=\"31\" endLine=\"1\" endColumn=\"33\" part=\"Condition\"><IdentifierName Name=\"true\" TypeSyntax=\"true\" startLine=\"1\" startColumn=\"31\" endLine=\"1\" endColumn=\"31\" part=\"Expression\"><Token kind=\"IdentifierToken\" startLine=\"1\" startColumn=\"31\" endLine=\"1\" endColumn=\"31\" part=\"Identifier\">a</Token></IdentifierName><Token kind=\"DotToken\" Operator=\"true\" startLine=\"1\" startColumn=\"32\" endLine=\"1\" endColumn=\"32\" part=\"OperatorToken\">.</Token><IdentifierName Name=\"true\" TypeSyntax=\"true\" startLine=\"1\" startColumn=\"33\" endLine=\"1\" endColumn=\"33\" part=\"Name\"><Token kind=\"IdentifierToken\" startLine=\"1\" startColumn=\"33\" endLine=\"1\" endColumn=\"33\" part=\"Identifier\">F</Token></IdentifierName></MemberAccessExpression></WhereClause></List_of_QueryClause><SelectClause startLine=\"1\" startColumn=\"35\" endLine=\"1\" endColumn=\"44\" part=\"SelectOrGroup\"><Token kind=\"SelectKeyword\" Keyword=\"true\" Contextual=\"true\" Query=\"true\" startLine=\"1\" startColumn=\"35\" endLine=\"1\" endColumn=\"40\" part=\"SelectKeyword\">select</Token><MemberAccessExpression kind=\"SimpleMemberAccessExpression\" startLine=\"1\" startColumn=\"42\" endLine=\"1\" endColumn=\"44\" part=\"Expression\"><IdentifierName Name=\"true\" TypeSyntax=\"true\" startLine=\"1\" startColumn=\"42\" endLine=\"1\" endColumn=\"42\" part=\"Expression\"><Token kind=\"IdentifierToken\" startLine=\"1\" startColumn=\"42\" endLine=\"1\" endColumn=\"42\" part=\"Identifier\">b</Token></IdentifierName><Token kind=\"DotToken\" Operator=\"true\" startLine=\"1\" startColumn=\"43\" endLine=\"1\" endColumn=\"43\" part=\"OperatorToken\">.</Token><IdentifierName Name=\"true\" TypeSyntax=\"true\" startLine=\"1\" startColumn=\"44\" endLine=\"1\" endColumn=\"44\" part=\"Name\"><Token kind=\"IdentifierToken\" startLine=\"1\" startColumn=\"44\" endLine=\"1\" endColumn=\"44\" part=\"Identifier\">C</Token></IdentifierName></MemberAccessExpression></SelectClause><QueryContinuation startLine=\"1\" startColumn=\"46\" endLine=\"1\" endColumn=\"62\" part=\"Continuation\"><Token kind=\"IntoKeyword\" Keyword=\"true\" Contextual=\"true\" Query=\"true\" startLine=\"1\" startColumn=\"46\" endLine=\"1\" endColumn=\"49\" part=\"IntoKeyword\">into</Token><Token kind=\"IdentifierToken\" startLine=\"1\" startColumn=\"51\" endLine=\"1\" endColumn=\"51\" part=\"Identifier\">r</Token><QueryBody startLine=\"1\" startColumn=\"53\" endLine=\"1\" endColumn=\"62\" part=\"Body\"><SelectClause startLine=\"1\" startColumn=\"53\" endLine=\"1\" endColumn=\"62\" part=\"SelectOrGroup\"><Token kind=\"SelectKeyword\" Keyword=\"true\" Contextual=\"true\" Query=\"true\" startLine=\"1\" startColumn=\"53\" endLine=\"1\" endColumn=\"58\" part=\"SelectKeyword\">select</Token><MemberAccessExpression kind=\"SimpleMemberAccessExpression\" startLine=\"1\" startColumn=\"60\" endLine=\"1\" endColumn=\"62\" part=\"Expression\"><IdentifierName Name=\"true\" TypeSyntax=\"true\" startLine=\"1\" startColumn=\"60\" endLine=\"1\" endColumn=\"60\" part=\"Expression\"><Token kind=\"IdentifierToken\" startLine=\"1\" startColumn=\"60\" endLine=\"1\" endColumn=\"60\" part=\"Identifier\">r</Token></IdentifierName><Token kind=\"DotToken\" Operator=\"true\" startLine=\"1\" startColumn=\"61\" endLine=\"1\" endColumn=\"61\" part=\"OperatorToken\">.</Token><IdentifierName Name=\"true\" TypeSyntax=\"true\" startLine=\"1\" startColumn=\"62\" endLine=\"1\" endColumn=\"62\" part=\"Name\"><Token kind=\"IdentifierToken\" startLine=\"1\" startColumn=\"62\" endLine=\"1\" endColumn=\"62\" part=\"Identifier\">R</Token></IdentifierName></MemberAccessExpression></SelectClause></QueryBody></QueryContinuation></QueryBody>", xElement.ToString(SaveOptions.DisableFormatting)); }
public void CasePatternSwitchLabelSyntax_RoslynMLFromRoslyn_OK() { var converter = new RoslynML(); var node = (SwitchStatementSyntax)SyntaxFactory.ParseStatement("switch(obj){ case 'a' when obj.Lenght > 0: }"); var xElement = converter.Visit(((CasePatternSwitchLabelSyntax)node.Sections[0].Labels[0])); Assert.AreEqual("<CasePatternSwitchLabel startLine=\"1\" startColumn=\"14\" endLine=\"1\" endColumn=\"42\"><Token kind=\"CaseKeyword\" Keyword=\"true\" startLine=\"1\" startColumn=\"14\" endLine=\"1\" endColumn=\"17\" part=\"Keyword\">case</Token><ConstantPattern startLine=\"1\" startColumn=\"19\" endLine=\"1\" endColumn=\"21\" part=\"Pattern\"><LiteralExpression kind=\"CharacterLiteralExpression\" startLine=\"1\" startColumn=\"19\" endLine=\"1\" endColumn=\"21\" part=\"Expression\"><Token kind=\"CharacterLiteralToken\" startLine=\"1\" startColumn=\"19\" endLine=\"1\" endColumn=\"21\" part=\"Token\">a</Token></LiteralExpression></ConstantPattern><WhenClause startLine=\"1\" startColumn=\"23\" endLine=\"1\" endColumn=\"41\" part=\"WhenClause\"><Token kind=\"WhenKeyword\" Keyword=\"true\" Contextual=\"true\" startLine=\"1\" startColumn=\"23\" endLine=\"1\" endColumn=\"26\" part=\"WhenKeyword\">when</Token><BinaryExpression kind=\"GreaterThanExpression\" startLine=\"1\" startColumn=\"28\" endLine=\"1\" endColumn=\"41\" part=\"Condition\"><MemberAccessExpression kind=\"SimpleMemberAccessExpression\" startLine=\"1\" startColumn=\"28\" endLine=\"1\" endColumn=\"37\" part=\"Left\"><IdentifierName Name=\"true\" TypeSyntax=\"true\" startLine=\"1\" startColumn=\"28\" endLine=\"1\" endColumn=\"30\" part=\"Expression\"><Token kind=\"IdentifierToken\" startLine=\"1\" startColumn=\"28\" endLine=\"1\" endColumn=\"30\" part=\"Identifier\">obj</Token></IdentifierName><Token kind=\"DotToken\" Operator=\"true\" startLine=\"1\" startColumn=\"31\" endLine=\"1\" endColumn=\"31\" part=\"OperatorToken\">.</Token><IdentifierName Name=\"true\" TypeSyntax=\"true\" startLine=\"1\" startColumn=\"32\" endLine=\"1\" endColumn=\"37\" part=\"Name\"><Token kind=\"IdentifierToken\" startLine=\"1\" startColumn=\"32\" endLine=\"1\" endColumn=\"37\" part=\"Identifier\">Lenght</Token></IdentifierName></MemberAccessExpression><Token kind=\"GreaterThanToken\" startLine=\"1\" startColumn=\"39\" endLine=\"1\" endColumn=\"39\" part=\"OperatorToken\">></Token><LiteralExpression kind=\"NumericLiteralExpression\" startLine=\"1\" startColumn=\"41\" endLine=\"1\" endColumn=\"41\" part=\"Right\"><Token kind=\"NumericLiteralToken\" startLine=\"1\" startColumn=\"41\" endLine=\"1\" endColumn=\"41\" part=\"Token\">0</Token></LiteralExpression></BinaryExpression></WhenClause><Token kind=\"ColonToken\" Punctuation=\"true\" Language=\"true\" startLine=\"1\" startColumn=\"42\" endLine=\"1\" endColumn=\"42\" part=\"ColonToken\">:</Token></CasePatternSwitchLabel>", xElement.ToString(SaveOptions.DisableFormatting)); node = (SwitchStatementSyntax)SyntaxFactory.ParseStatement("switch(obj){ case Shape s: }"); xElement = converter.Visit(((CasePatternSwitchLabelSyntax)node.Sections[0].Labels[0])); Assert.AreEqual("<CasePatternSwitchLabel startLine=\"1\" startColumn=\"14\" endLine=\"1\" endColumn=\"26\"><Token kind=\"CaseKeyword\" Keyword=\"true\" startLine=\"1\" startColumn=\"14\" endLine=\"1\" endColumn=\"17\" part=\"Keyword\">case</Token><DeclarationPattern startLine=\"1\" startColumn=\"19\" endLine=\"1\" endColumn=\"25\" part=\"Pattern\"><IdentifierName Name=\"true\" TypeSyntax=\"true\" startLine=\"1\" startColumn=\"19\" endLine=\"1\" endColumn=\"23\" part=\"Type\"><Token kind=\"IdentifierToken\" startLine=\"1\" startColumn=\"19\" endLine=\"1\" endColumn=\"23\" part=\"Identifier\">Shape</Token></IdentifierName><SingleVariableDesignation startLine=\"1\" startColumn=\"25\" endLine=\"1\" endColumn=\"25\" part=\"Designation\"><Token kind=\"IdentifierToken\" startLine=\"1\" startColumn=\"25\" endLine=\"1\" endColumn=\"25\" part=\"Identifier\">s</Token></SingleVariableDesignation></DeclarationPattern><Token kind=\"ColonToken\" Punctuation=\"true\" Language=\"true\" startLine=\"1\" startColumn=\"26\" endLine=\"1\" endColumn=\"26\" part=\"ColonToken\">:</Token></CasePatternSwitchLabel>", xElement.ToString(SaveOptions.DisableFormatting)); node = (SwitchStatementSyntax)SyntaxFactory.ParseStatement("switch(obj){ case Shape s when s.Lenght > 0: }"); xElement = converter.Visit(((CasePatternSwitchLabelSyntax)node.Sections[0].Labels[0])); Assert.AreEqual("<CasePatternSwitchLabel startLine=\"1\" startColumn=\"14\" endLine=\"1\" endColumn=\"44\"><Token kind=\"CaseKeyword\" Keyword=\"true\" startLine=\"1\" startColumn=\"14\" endLine=\"1\" endColumn=\"17\" part=\"Keyword\">case</Token><DeclarationPattern startLine=\"1\" startColumn=\"19\" endLine=\"1\" endColumn=\"25\" part=\"Pattern\"><IdentifierName Name=\"true\" TypeSyntax=\"true\" startLine=\"1\" startColumn=\"19\" endLine=\"1\" endColumn=\"23\" part=\"Type\"><Token kind=\"IdentifierToken\" startLine=\"1\" startColumn=\"19\" endLine=\"1\" endColumn=\"23\" part=\"Identifier\">Shape</Token></IdentifierName><SingleVariableDesignation startLine=\"1\" startColumn=\"25\" endLine=\"1\" endColumn=\"25\" part=\"Designation\"><Token kind=\"IdentifierToken\" startLine=\"1\" startColumn=\"25\" endLine=\"1\" endColumn=\"25\" part=\"Identifier\">s</Token></SingleVariableDesignation></DeclarationPattern><WhenClause startLine=\"1\" startColumn=\"27\" endLine=\"1\" endColumn=\"43\" part=\"WhenClause\"><Token kind=\"WhenKeyword\" Keyword=\"true\" Contextual=\"true\" startLine=\"1\" startColumn=\"27\" endLine=\"1\" endColumn=\"30\" part=\"WhenKeyword\">when</Token><BinaryExpression kind=\"GreaterThanExpression\" startLine=\"1\" startColumn=\"32\" endLine=\"1\" endColumn=\"43\" part=\"Condition\"><MemberAccessExpression kind=\"SimpleMemberAccessExpression\" startLine=\"1\" startColumn=\"32\" endLine=\"1\" endColumn=\"39\" part=\"Left\"><IdentifierName Name=\"true\" TypeSyntax=\"true\" startLine=\"1\" startColumn=\"32\" endLine=\"1\" endColumn=\"32\" part=\"Expression\"><Token kind=\"IdentifierToken\" startLine=\"1\" startColumn=\"32\" endLine=\"1\" endColumn=\"32\" part=\"Identifier\">s</Token></IdentifierName><Token kind=\"DotToken\" Operator=\"true\" startLine=\"1\" startColumn=\"33\" endLine=\"1\" endColumn=\"33\" part=\"OperatorToken\">.</Token><IdentifierName Name=\"true\" TypeSyntax=\"true\" startLine=\"1\" startColumn=\"34\" endLine=\"1\" endColumn=\"39\" part=\"Name\"><Token kind=\"IdentifierToken\" startLine=\"1\" startColumn=\"34\" endLine=\"1\" endColumn=\"39\" part=\"Identifier\">Lenght</Token></IdentifierName></MemberAccessExpression><Token kind=\"GreaterThanToken\" startLine=\"1\" startColumn=\"41\" endLine=\"1\" endColumn=\"41\" part=\"OperatorToken\">></Token><LiteralExpression kind=\"NumericLiteralExpression\" startLine=\"1\" startColumn=\"43\" endLine=\"1\" endColumn=\"43\" part=\"Right\"><Token kind=\"NumericLiteralToken\" startLine=\"1\" startColumn=\"43\" endLine=\"1\" endColumn=\"43\" part=\"Token\">0</Token></LiteralExpression></BinaryExpression></WhenClause><Token kind=\"ColonToken\" Punctuation=\"true\" Language=\"true\" startLine=\"1\" startColumn=\"44\" endLine=\"1\" endColumn=\"44\" part=\"ColonToken\">:</Token></CasePatternSwitchLabel>", xElement.ToString(SaveOptions.DisableFormatting)); }
public void AttributeArgumentSyntax_RoslynMLFromRoslyn_OK() { var converter = new RoslynML(); var node = SyntaxFactory.ParseCompilationUnit("[module: XAttribute(\"X\")]").AttributeLists[0].Attributes[0].ArgumentList.Arguments[0]; var xElement = converter.Visit(node); Assert.AreEqual("<AttributeArgument startLine=\"1\" startColumn=\"21\" endLine=\"1\" endColumn=\"23\"><LiteralExpression kind=\"StringLiteralExpression\" startLine=\"1\" startColumn=\"21\" endLine=\"1\" endColumn=\"23\" part=\"Expression\"><Token kind=\"StringLiteralToken\" startLine=\"1\" startColumn=\"21\" endLine=\"1\" endColumn=\"23\" part=\"Token\">X</Token></LiteralExpression></AttributeArgument>", xElement.ToString(SaveOptions.DisableFormatting)); }
public void TypeSyntax_PredefinedTypeSyntax_RoslynMLFromRoslyn_OK() { var converter = new RoslynML(); var node = SyntaxFactory.ParseTypeName("int"); var xElement = converter.Visit(node); Assert.AreEqual("<PredefinedType TypeSyntax=\"true\" startLine=\"1\" startColumn=\"1\" endLine=\"1\" endColumn=\"3\">" + "<Token kind=\"IntKeyword\" Keyword=\"true\" startLine=\"1\" startColumn=\"1\" endLine=\"1\" endColumn=\"3\" part=\"Keyword\">int</Token>" + "</PredefinedType>", xElement.ToString(SaveOptions.DisableFormatting)); node = SyntaxFactory.ParseTypeName("byte"); xElement = converter.Visit(node); Assert.AreEqual("<PredefinedType TypeSyntax=\"true\" startLine=\"1\" startColumn=\"1\" endLine=\"1\" endColumn=\"4\">" + "<Token kind=\"ByteKeyword\" Keyword=\"true\" startLine=\"1\" startColumn=\"1\" endLine=\"1\" endColumn=\"4\" part=\"Keyword\">byte</Token>" + "</PredefinedType>", xElement.ToString(SaveOptions.DisableFormatting)); }
public void DiscardDesignationSyntax_RoslynMLFromRoslyn_OK() { var converter = new RoslynML(); var node = SyntaxFactory.DiscardDesignation(SyntaxFactory.Token(SyntaxKind.UnderscoreToken)); var xElement = converter.Visit(node); Assert.AreEqual("<DiscardDesignation startLine=\"1\" startColumn=\"1\" endLine=\"1\" endColumn=\"1\"><Token kind=\"UnderscoreToken\" Keyword=\"true\" Contextual=\"true\" startLine=\"1\" startColumn=\"1\" endLine=\"1\" endColumn=\"1\" part=\"UnderscoreToken\">_</Token></DiscardDesignation>", xElement.ToString(SaveOptions.DisableFormatting)); }
public void SingleVariableDesignationSyntax_RoslynMLFromRoslyn_OK() { var converter = new RoslynML(); var node = SyntaxFactory.SingleVariableDesignation(SyntaxFactory.Identifier("a")); var xElement = converter.Visit(node); Assert.AreEqual("<SingleVariableDesignation startLine=\"1\" startColumn=\"1\" endLine=\"1\" endColumn=\"1\"><Token kind=\"IdentifierToken\" startLine=\"1\" startColumn=\"1\" endLine=\"1\" endColumn=\"1\" part=\"Identifier\">a</Token></SingleVariableDesignation>", xElement.ToString(SaveOptions.DisableFormatting)); }
public void AttributeListSyntax_RoslynMLFromRoslyn_OK() { var converter = new RoslynML(); var node = SyntaxFactory.ParseCompilationUnit("[module: XAttribute(\"X\"), YAttribute(Y: 3), ZAttribute(Z= 4)]").AttributeLists[0]; var xElement = converter.Visit(node); Assert.AreEqual("<AttributeList startLine=\"1\" startColumn=\"1\" endLine=\"1\" endColumn=\"61\"><Token kind=\"OpenBracketToken\" Punctuation=\"true\" Language=\"true\" startLine=\"1\" startColumn=\"1\" endLine=\"1\" endColumn=\"1\" part=\"OpenBracketToken\">[</Token><AttributeTargetSpecifier startLine=\"1\" startColumn=\"2\" endLine=\"1\" endColumn=\"8\" part=\"Target\"><Token kind=\"ModuleKeyword\" Keyword=\"true\" Contextual=\"true\" startLine=\"1\" startColumn=\"2\" endLine=\"1\" endColumn=\"7\" part=\"Identifier\">module</Token><Token kind=\"ColonToken\" Punctuation=\"true\" Language=\"true\" startLine=\"1\" startColumn=\"8\" endLine=\"1\" endColumn=\"8\" part=\"ColonToken\">:</Token></AttributeTargetSpecifier><SeparatedList_of_Attribute part=\"Attributes\"><Attribute startLine=\"1\" startColumn=\"10\" endLine=\"1\" endColumn=\"24\"><IdentifierName Name=\"true\" TypeSyntax=\"true\" startLine=\"1\" startColumn=\"10\" endLine=\"1\" endColumn=\"19\" part=\"Name\"><Token kind=\"IdentifierToken\" startLine=\"1\" startColumn=\"10\" endLine=\"1\" endColumn=\"19\" part=\"Identifier\">XAttribute</Token></IdentifierName><AttributeArgumentList startLine=\"1\" startColumn=\"20\" endLine=\"1\" endColumn=\"24\" part=\"ArgumentList\"><Token kind=\"OpenParenToken\" Punctuation=\"true\" Language=\"true\" startLine=\"1\" startColumn=\"20\" endLine=\"1\" endColumn=\"20\" part=\"OpenParenToken\">(</Token><SeparatedList_of_AttributeArgument part=\"Arguments\"><AttributeArgument startLine=\"1\" startColumn=\"21\" endLine=\"1\" endColumn=\"23\"><LiteralExpression kind=\"StringLiteralExpression\" startLine=\"1\" startColumn=\"21\" endLine=\"1\" endColumn=\"23\" part=\"Expression\"><Token kind=\"StringLiteralToken\" startLine=\"1\" startColumn=\"21\" endLine=\"1\" endColumn=\"23\" part=\"Token\">X</Token></LiteralExpression></AttributeArgument></SeparatedList_of_AttributeArgument><Token kind=\"CloseParenToken\" Punctuation=\"true\" Language=\"true\" startLine=\"1\" startColumn=\"24\" endLine=\"1\" endColumn=\"24\" part=\"CloseParenToken\">)</Token></AttributeArgumentList></Attribute><Attribute startLine=\"1\" startColumn=\"27\" endLine=\"1\" endColumn=\"42\"><IdentifierName Name=\"true\" TypeSyntax=\"true\" startLine=\"1\" startColumn=\"27\" endLine=\"1\" endColumn=\"36\" part=\"Name\"><Token kind=\"IdentifierToken\" startLine=\"1\" startColumn=\"27\" endLine=\"1\" endColumn=\"36\" part=\"Identifier\">YAttribute</Token></IdentifierName><AttributeArgumentList startLine=\"1\" startColumn=\"37\" endLine=\"1\" endColumn=\"42\" part=\"ArgumentList\"><Token kind=\"OpenParenToken\" Punctuation=\"true\" Language=\"true\" startLine=\"1\" startColumn=\"37\" endLine=\"1\" endColumn=\"37\" part=\"OpenParenToken\">(</Token><SeparatedList_of_AttributeArgument part=\"Arguments\"><AttributeArgument startLine=\"1\" startColumn=\"38\" endLine=\"1\" endColumn=\"41\"><NameColon startLine=\"1\" startColumn=\"38\" endLine=\"1\" endColumn=\"39\" part=\"NameColon\"><IdentifierName Name=\"true\" TypeSyntax=\"true\" startLine=\"1\" startColumn=\"38\" endLine=\"1\" endColumn=\"38\" part=\"Name\"><Token kind=\"IdentifierToken\" startLine=\"1\" startColumn=\"38\" endLine=\"1\" endColumn=\"38\" part=\"Identifier\">Y</Token></IdentifierName><Token kind=\"ColonToken\" Punctuation=\"true\" Language=\"true\" startLine=\"1\" startColumn=\"39\" endLine=\"1\" endColumn=\"39\" part=\"ColonToken\">:</Token></NameColon><LiteralExpression kind=\"NumericLiteralExpression\" startLine=\"1\" startColumn=\"41\" endLine=\"1\" endColumn=\"41\" part=\"Expression\"><Token kind=\"NumericLiteralToken\" startLine=\"1\" startColumn=\"41\" endLine=\"1\" endColumn=\"41\" part=\"Token\">3</Token></LiteralExpression></AttributeArgument></SeparatedList_of_AttributeArgument><Token kind=\"CloseParenToken\" Punctuation=\"true\" Language=\"true\" startLine=\"1\" startColumn=\"42\" endLine=\"1\" endColumn=\"42\" part=\"CloseParenToken\">)</Token></AttributeArgumentList></Attribute><Attribute startLine=\"1\" startColumn=\"45\" endLine=\"1\" endColumn=\"60\"><IdentifierName Name=\"true\" TypeSyntax=\"true\" startLine=\"1\" startColumn=\"45\" endLine=\"1\" endColumn=\"54\" part=\"Name\"><Token kind=\"IdentifierToken\" startLine=\"1\" startColumn=\"45\" endLine=\"1\" endColumn=\"54\" part=\"Identifier\">ZAttribute</Token></IdentifierName><AttributeArgumentList startLine=\"1\" startColumn=\"55\" endLine=\"1\" endColumn=\"60\" part=\"ArgumentList\"><Token kind=\"OpenParenToken\" Punctuation=\"true\" Language=\"true\" startLine=\"1\" startColumn=\"55\" endLine=\"1\" endColumn=\"55\" part=\"OpenParenToken\">(</Token><SeparatedList_of_AttributeArgument part=\"Arguments\"><AttributeArgument startLine=\"1\" startColumn=\"56\" endLine=\"1\" endColumn=\"59\"><NameEquals startLine=\"1\" startColumn=\"56\" endLine=\"1\" endColumn=\"57\" part=\"NameEquals\"><IdentifierName Name=\"true\" TypeSyntax=\"true\" startLine=\"1\" startColumn=\"56\" endLine=\"1\" endColumn=\"56\" part=\"Name\"><Token kind=\"IdentifierToken\" startLine=\"1\" startColumn=\"56\" endLine=\"1\" endColumn=\"56\" part=\"Identifier\">Z</Token></IdentifierName><Token kind=\"EqualsToken\" Operator=\"true\" startLine=\"1\" startColumn=\"57\" endLine=\"1\" endColumn=\"57\" part=\"EqualsToken\">=</Token></NameEquals><LiteralExpression kind=\"NumericLiteralExpression\" startLine=\"1\" startColumn=\"59\" endLine=\"1\" endColumn=\"59\" part=\"Expression\"><Token kind=\"NumericLiteralToken\" startLine=\"1\" startColumn=\"59\" endLine=\"1\" endColumn=\"59\" part=\"Token\">4</Token></LiteralExpression></AttributeArgument></SeparatedList_of_AttributeArgument><Token kind=\"CloseParenToken\" Punctuation=\"true\" Language=\"true\" startLine=\"1\" startColumn=\"60\" endLine=\"1\" endColumn=\"60\" part=\"CloseParenToken\">)</Token></AttributeArgumentList></Attribute></SeparatedList_of_Attribute><Token kind=\"CloseBracketToken\" Punctuation=\"true\" Language=\"true\" startLine=\"1\" startColumn=\"61\" endLine=\"1\" endColumn=\"61\" part=\"CloseBracketToken\">]</Token></AttributeList>", xElement.ToString(SaveOptions.DisableFormatting)); }
public void ConstantPatternSyntax_RoslynMLFromRoslyn_OK() { var converter = new RoslynML(); var node = (SwitchStatementSyntax)SyntaxFactory.ParseStatement("switch(obj){ case 'a' when obj.Lenght > 0: }"); var xElement = converter.Visit(((CasePatternSwitchLabelSyntax)node.Sections[0].Labels[0]).Pattern); Assert.AreEqual("<ConstantPattern startLine=\"1\" startColumn=\"19\" endLine=\"1\" endColumn=\"21\"><LiteralExpression kind=\"CharacterLiteralExpression\" startLine=\"1\" startColumn=\"19\" endLine=\"1\" endColumn=\"21\" part=\"Expression\"><Token kind=\"CharacterLiteralToken\" startLine=\"1\" startColumn=\"19\" endLine=\"1\" endColumn=\"21\" part=\"Token\">a</Token></LiteralExpression></ConstantPattern>", xElement.ToString(SaveOptions.DisableFormatting)); }
public void ForEachVariableStatementSyntax_RoslynMLFromRoslyn_OK() { var converter = new RoslynML(); var node = SyntaxFactory.ParseStatement("foreach(var (a,b) in x){}"); var xElement = converter.Visit(node); Assert.AreEqual("<ForEachVariableStatement startLine=\"1\" startColumn=\"1\" endLine=\"1\" endColumn=\"25\"><Token kind=\"ForEachKeyword\" Keyword=\"true\" startLine=\"1\" startColumn=\"1\" endLine=\"1\" endColumn=\"7\" part=\"ForEachKeyword\">foreach</Token><Token kind=\"OpenParenToken\" Punctuation=\"true\" Language=\"true\" startLine=\"1\" startColumn=\"8\" endLine=\"1\" endColumn=\"8\" part=\"OpenParenToken\">(</Token><DeclarationExpression startLine=\"1\" startColumn=\"9\" endLine=\"1\" endColumn=\"17\" part=\"Variable\"><IdentifierName Name=\"true\" TypeSyntax=\"true\" startLine=\"1\" startColumn=\"9\" endLine=\"1\" endColumn=\"11\" part=\"Type\"><Token kind=\"IdentifierToken\" startLine=\"1\" startColumn=\"9\" endLine=\"1\" endColumn=\"11\" part=\"Identifier\">var</Token></IdentifierName><ParenthesizedVariableDesignation startLine=\"1\" startColumn=\"13\" endLine=\"1\" endColumn=\"17\" part=\"Designation\"><Token kind=\"OpenParenToken\" Punctuation=\"true\" Language=\"true\" startLine=\"1\" startColumn=\"13\" endLine=\"1\" endColumn=\"13\" part=\"OpenParenToken\">(</Token><SeparatedList_of_VariableDesignation part=\"Variables\"><SingleVariableDesignation startLine=\"1\" startColumn=\"14\" endLine=\"1\" endColumn=\"14\"><Token kind=\"IdentifierToken\" startLine=\"1\" startColumn=\"14\" endLine=\"1\" endColumn=\"14\" part=\"Identifier\">a</Token></SingleVariableDesignation><SingleVariableDesignation startLine=\"1\" startColumn=\"16\" endLine=\"1\" endColumn=\"16\"><Token kind=\"IdentifierToken\" startLine=\"1\" startColumn=\"16\" endLine=\"1\" endColumn=\"16\" part=\"Identifier\">b</Token></SingleVariableDesignation></SeparatedList_of_VariableDesignation><Token kind=\"CloseParenToken\" Punctuation=\"true\" Language=\"true\" startLine=\"1\" startColumn=\"17\" endLine=\"1\" endColumn=\"17\" part=\"CloseParenToken\">)</Token></ParenthesizedVariableDesignation></DeclarationExpression><Token kind=\"InKeyword\" Keyword=\"true\" TypeParameterVariance=\"true\" startLine=\"1\" startColumn=\"19\" endLine=\"1\" endColumn=\"20\" part=\"InKeyword\">in</Token><IdentifierName Name=\"true\" TypeSyntax=\"true\" startLine=\"1\" startColumn=\"22\" endLine=\"1\" endColumn=\"22\" part=\"Expression\"><Token kind=\"IdentifierToken\" startLine=\"1\" startColumn=\"22\" endLine=\"1\" endColumn=\"22\" part=\"Identifier\">x</Token></IdentifierName><Token kind=\"CloseParenToken\" Punctuation=\"true\" Language=\"true\" startLine=\"1\" startColumn=\"23\" endLine=\"1\" endColumn=\"23\" part=\"CloseParenToken\">)</Token><Block startLine=\"1\" startColumn=\"24\" endLine=\"1\" endColumn=\"25\" part=\"Statement\"><Token kind=\"OpenBraceToken\" Punctuation=\"true\" Language=\"true\" startLine=\"1\" startColumn=\"24\" endLine=\"1\" endColumn=\"24\" part=\"OpenBraceToken\">{</Token><Token kind=\"CloseBraceToken\" Punctuation=\"true\" Language=\"true\" startLine=\"1\" startColumn=\"25\" endLine=\"1\" endColumn=\"25\" part=\"CloseBraceToken\">}</Token></Block></ForEachVariableStatement>", xElement.ToString(SaveOptions.DisableFormatting)); }
public void DeclarationPatternSyntax_RoslynMLFromRoslyn_OK() { var converter = new RoslynML(); var node = (SwitchStatementSyntax)SyntaxFactory.ParseStatement("switch(obj){ case Shape s: }"); var xElement = converter.Visit(((CasePatternSwitchLabelSyntax)node.Sections[0].Labels[0]).Pattern); Assert.AreEqual("<DeclarationPattern startLine=\"1\" startColumn=\"19\" endLine=\"1\" endColumn=\"25\"><IdentifierName Name=\"true\" TypeSyntax=\"true\" startLine=\"1\" startColumn=\"19\" endLine=\"1\" endColumn=\"23\" part=\"Type\"><Token kind=\"IdentifierToken\" startLine=\"1\" startColumn=\"19\" endLine=\"1\" endColumn=\"23\" part=\"Identifier\">Shape</Token></IdentifierName><SingleVariableDesignation startLine=\"1\" startColumn=\"25\" endLine=\"1\" endColumn=\"25\" part=\"Designation\"><Token kind=\"IdentifierToken\" startLine=\"1\" startColumn=\"25\" endLine=\"1\" endColumn=\"25\" part=\"Identifier\">s</Token></SingleVariableDesignation></DeclarationPattern>", xElement.ToString(SaveOptions.DisableFormatting)); }
public void IsPatternExpressionSyntax_RoslynMLFromRoslyn_OK() { var converter = new RoslynML(); var node = SyntaxFactory.ParseExpression("obj is A a"); var xElement = converter.Visit(node); Assert.AreEqual("<IsPatternExpression startLine=\"1\" startColumn=\"1\" endLine=\"1\" endColumn=\"10\"><IdentifierName Name=\"true\" TypeSyntax=\"true\" startLine=\"1\" startColumn=\"1\" endLine=\"1\" endColumn=\"3\" part=\"Expression\"><Token kind=\"IdentifierToken\" startLine=\"1\" startColumn=\"1\" endLine=\"1\" endColumn=\"3\" part=\"Identifier\">obj</Token></IdentifierName><Token kind=\"IsKeyword\" Keyword=\"true\" startLine=\"1\" startColumn=\"5\" endLine=\"1\" endColumn=\"6\" part=\"IsKeyword\">is</Token><DeclarationPattern startLine=\"1\" startColumn=\"8\" endLine=\"1\" endColumn=\"10\" part=\"Pattern\"><IdentifierName Name=\"true\" TypeSyntax=\"true\" startLine=\"1\" startColumn=\"8\" endLine=\"1\" endColumn=\"8\" part=\"Type\"><Token kind=\"IdentifierToken\" startLine=\"1\" startColumn=\"8\" endLine=\"1\" endColumn=\"8\" part=\"Identifier\">A</Token></IdentifierName><SingleVariableDesignation startLine=\"1\" startColumn=\"10\" endLine=\"1\" endColumn=\"10\" part=\"Designation\"><Token kind=\"IdentifierToken\" startLine=\"1\" startColumn=\"10\" endLine=\"1\" endColumn=\"10\" part=\"Identifier\">a</Token></SingleVariableDesignation></DeclarationPattern></IsPatternExpression>", xElement.ToString(SaveOptions.DisableFormatting)); }
public void DeclarationExpressionSyntax_RoslynMLFromRoslyn_OK() { var converter = new RoslynML(); var node = (TupleExpressionSyntax)SyntaxFactory.ParseExpression("(int a, int b)"); var xElement = converter.Visit(node.Arguments[0].Expression); Assert.AreEqual("<DeclarationExpression startLine=\"1\" startColumn=\"2\" endLine=\"1\" endColumn=\"6\"><PredefinedType TypeSyntax=\"true\" startLine=\"1\" startColumn=\"2\" endLine=\"1\" endColumn=\"4\" part=\"Type\"><Token kind=\"IntKeyword\" Keyword=\"true\" startLine=\"1\" startColumn=\"2\" endLine=\"1\" endColumn=\"4\" part=\"Keyword\">int</Token></PredefinedType><SingleVariableDesignation startLine=\"1\" startColumn=\"6\" endLine=\"1\" endColumn=\"6\" part=\"Designation\"><Token kind=\"IdentifierToken\" startLine=\"1\" startColumn=\"6\" endLine=\"1\" endColumn=\"6\" part=\"Identifier\">a</Token></SingleVariableDesignation></DeclarationExpression>", xElement.ToString(SaveOptions.DisableFormatting)); }
public void RefExpressionSyntax_RoslynMLFromRoslyn_OK() { var converter = new RoslynML(); var node = SyntaxFactory.RefExpression(SyntaxFactory.Token(SyntaxKind.RefKeyword), SyntaxFactory.ParseExpression("s + d")); var xElement = converter.Visit(node); Assert.AreEqual("<RefExpression startLine=\"1\" startColumn=\"1\" endLine=\"1\" endColumn=\"8\"><Token kind=\"RefKeyword\" Keyword=\"true\" startLine=\"1\" startColumn=\"1\" endLine=\"1\" endColumn=\"3\" part=\"RefKeyword\">ref</Token><BinaryExpression kind=\"AddExpression\" startLine=\"1\" startColumn=\"4\" endLine=\"1\" endColumn=\"8\" part=\"Expression\"><IdentifierName Name=\"true\" TypeSyntax=\"true\" startLine=\"1\" startColumn=\"4\" endLine=\"1\" endColumn=\"4\" part=\"Left\"><Token kind=\"IdentifierToken\" startLine=\"1\" startColumn=\"4\" endLine=\"1\" endColumn=\"4\" part=\"Identifier\">s</Token></IdentifierName><Token kind=\"PlusToken\" Operator=\"true\" startLine=\"1\" startColumn=\"6\" endLine=\"1\" endColumn=\"6\" part=\"OperatorToken\">+</Token><IdentifierName Name=\"true\" TypeSyntax=\"true\" startLine=\"1\" startColumn=\"8\" endLine=\"1\" endColumn=\"8\" part=\"Right\"><Token kind=\"IdentifierToken\" startLine=\"1\" startColumn=\"8\" endLine=\"1\" endColumn=\"8\" part=\"Identifier\">d</Token></IdentifierName></BinaryExpression></RefExpression>", xElement.ToString(SaveOptions.DisableFormatting)); }
public void AttributeTargetSpecifierSyntax_RoslynMLFromRoslyn_OK() { var converter = new RoslynML(); var node = SyntaxFactory.ParseCompilationUnit("[module: XAttribute(\"X\"), YAttribute(\"Y\": 3), ZAttribute(\"Z\"= 4)]").AttributeLists[0]; var xElement = converter.Visit(node.Target); Assert.AreEqual("<AttributeTargetSpecifier startLine=\"1\" startColumn=\"2\" endLine=\"1\" endColumn=\"8\"><Token kind=\"ModuleKeyword\" Keyword=\"true\" Contextual=\"true\" startLine=\"1\" startColumn=\"2\" endLine=\"1\" endColumn=\"7\" part=\"Identifier\">module</Token><Token kind=\"ColonToken\" Punctuation=\"true\" Language=\"true\" startLine=\"1\" startColumn=\"8\" endLine=\"1\" endColumn=\"8\" part=\"ColonToken\">:</Token></AttributeTargetSpecifier>", xElement.ToString(SaveOptions.DisableFormatting)); }
public void WhenClauseSyntax_RoslynMLFromRoslyn_OK() { var converter = new RoslynML(); var node = (SwitchStatementSyntax)SyntaxFactory.ParseStatement("switch(obj){ case 'a' when obj.Lenght > 0: }"); var xElement = converter.Visit(((CasePatternSwitchLabelSyntax)node.Sections[0].Labels[0]).WhenClause); Assert.AreEqual("<WhenClause startLine=\"1\" startColumn=\"23\" endLine=\"1\" endColumn=\"41\"><Token kind=\"WhenKeyword\" Keyword=\"true\" Contextual=\"true\" startLine=\"1\" startColumn=\"23\" endLine=\"1\" endColumn=\"26\" part=\"WhenKeyword\">when</Token><BinaryExpression kind=\"GreaterThanExpression\" startLine=\"1\" startColumn=\"28\" endLine=\"1\" endColumn=\"41\" part=\"Condition\"><MemberAccessExpression kind=\"SimpleMemberAccessExpression\" startLine=\"1\" startColumn=\"28\" endLine=\"1\" endColumn=\"37\" part=\"Left\"><IdentifierName Name=\"true\" TypeSyntax=\"true\" startLine=\"1\" startColumn=\"28\" endLine=\"1\" endColumn=\"30\" part=\"Expression\"><Token kind=\"IdentifierToken\" startLine=\"1\" startColumn=\"28\" endLine=\"1\" endColumn=\"30\" part=\"Identifier\">obj</Token></IdentifierName><Token kind=\"DotToken\" Operator=\"true\" startLine=\"1\" startColumn=\"31\" endLine=\"1\" endColumn=\"31\" part=\"OperatorToken\">.</Token><IdentifierName Name=\"true\" TypeSyntax=\"true\" startLine=\"1\" startColumn=\"32\" endLine=\"1\" endColumn=\"37\" part=\"Name\"><Token kind=\"IdentifierToken\" startLine=\"1\" startColumn=\"32\" endLine=\"1\" endColumn=\"37\" part=\"Identifier\">Lenght</Token></IdentifierName></MemberAccessExpression><Token kind=\"GreaterThanToken\" startLine=\"1\" startColumn=\"39\" endLine=\"1\" endColumn=\"39\" part=\"OperatorToken\">></Token><LiteralExpression kind=\"NumericLiteralExpression\" startLine=\"1\" startColumn=\"41\" endLine=\"1\" endColumn=\"41\" part=\"Right\"><Token kind=\"NumericLiteralToken\" startLine=\"1\" startColumn=\"41\" endLine=\"1\" endColumn=\"41\" part=\"Token\">0</Token></LiteralExpression></BinaryExpression></WhenClause>", xElement.ToString(SaveOptions.DisableFormatting)); }
public void ExpressionSyntax_QueryExpressionSyntax_RoslynMLFromRoslyn_OK() { var converter = new RoslynML(); var node = SyntaxFactory.ParseExpression("from f in s where f.A select f.R"); var xElement = converter.Visit(node); Assert.AreEqual("<QueryExpression startLine=\"1\" startColumn=\"1\" endLine=\"1\" endColumn=\"32\"><FromClause startLine=\"1\" startColumn=\"1\" endLine=\"1\" endColumn=\"11\" part=\"FromClause\"><Token kind=\"FromKeyword\" Keyword=\"true\" Contextual=\"true\" Query=\"true\" startLine=\"1\" startColumn=\"1\" endLine=\"1\" endColumn=\"4\" part=\"FromKeyword\">from</Token><Token kind=\"IdentifierToken\" startLine=\"1\" startColumn=\"6\" endLine=\"1\" endColumn=\"6\" part=\"Identifier\">f</Token><Token kind=\"InKeyword\" Keyword=\"true\" TypeParameterVariance=\"true\" startLine=\"1\" startColumn=\"8\" endLine=\"1\" endColumn=\"9\" part=\"InKeyword\">in</Token><IdentifierName Name=\"true\" TypeSyntax=\"true\" startLine=\"1\" startColumn=\"11\" endLine=\"1\" endColumn=\"11\" part=\"Expression\"><Token kind=\"IdentifierToken\" startLine=\"1\" startColumn=\"11\" endLine=\"1\" endColumn=\"11\" part=\"Identifier\">s</Token></IdentifierName></FromClause><QueryBody startLine=\"1\" startColumn=\"13\" endLine=\"1\" endColumn=\"32\" part=\"Body\"><List_of_QueryClause part=\"Clauses\"><WhereClause startLine=\"1\" startColumn=\"13\" endLine=\"1\" endColumn=\"21\"><Token kind=\"WhereKeyword\" Keyword=\"true\" Contextual=\"true\" Query=\"true\" startLine=\"1\" startColumn=\"13\" endLine=\"1\" endColumn=\"17\" part=\"WhereKeyword\">where</Token><MemberAccessExpression kind=\"SimpleMemberAccessExpression\" startLine=\"1\" startColumn=\"19\" endLine=\"1\" endColumn=\"21\" part=\"Condition\"><IdentifierName Name=\"true\" TypeSyntax=\"true\" startLine=\"1\" startColumn=\"19\" endLine=\"1\" endColumn=\"19\" part=\"Expression\"><Token kind=\"IdentifierToken\" startLine=\"1\" startColumn=\"19\" endLine=\"1\" endColumn=\"19\" part=\"Identifier\">f</Token></IdentifierName><Token kind=\"DotToken\" Operator=\"true\" startLine=\"1\" startColumn=\"20\" endLine=\"1\" endColumn=\"20\" part=\"OperatorToken\">.</Token><IdentifierName Name=\"true\" TypeSyntax=\"true\" startLine=\"1\" startColumn=\"21\" endLine=\"1\" endColumn=\"21\" part=\"Name\"><Token kind=\"IdentifierToken\" startLine=\"1\" startColumn=\"21\" endLine=\"1\" endColumn=\"21\" part=\"Identifier\">A</Token></IdentifierName></MemberAccessExpression></WhereClause></List_of_QueryClause><SelectClause startLine=\"1\" startColumn=\"23\" endLine=\"1\" endColumn=\"32\" part=\"SelectOrGroup\"><Token kind=\"SelectKeyword\" Keyword=\"true\" Contextual=\"true\" Query=\"true\" startLine=\"1\" startColumn=\"23\" endLine=\"1\" endColumn=\"28\" part=\"SelectKeyword\">select</Token><MemberAccessExpression kind=\"SimpleMemberAccessExpression\" startLine=\"1\" startColumn=\"30\" endLine=\"1\" endColumn=\"32\" part=\"Expression\"><IdentifierName Name=\"true\" TypeSyntax=\"true\" startLine=\"1\" startColumn=\"30\" endLine=\"1\" endColumn=\"30\" part=\"Expression\"><Token kind=\"IdentifierToken\" startLine=\"1\" startColumn=\"30\" endLine=\"1\" endColumn=\"30\" part=\"Identifier\">f</Token></IdentifierName><Token kind=\"DotToken\" Operator=\"true\" startLine=\"1\" startColumn=\"31\" endLine=\"1\" endColumn=\"31\" part=\"OperatorToken\">.</Token><IdentifierName Name=\"true\" TypeSyntax=\"true\" startLine=\"1\" startColumn=\"32\" endLine=\"1\" endColumn=\"32\" part=\"Name\"><Token kind=\"IdentifierToken\" startLine=\"1\" startColumn=\"32\" endLine=\"1\" endColumn=\"32\" part=\"Identifier\">R</Token></IdentifierName></MemberAccessExpression></SelectClause></QueryBody></QueryExpression>", xElement.ToString(SaveOptions.DisableFormatting)); }
public void TupleExpressionSyntax_RoslynMLFromRoslyn_OK() { var converter = new RoslynML(); var node = SyntaxFactory.ParseExpression("(string, int)"); var xElement = converter.Visit(node); Assert.AreEqual("<TupleExpression startLine=\"1\" startColumn=\"1\" endLine=\"1\" endColumn=\"13\"><Token kind=\"OpenParenToken\" Punctuation=\"true\" Language=\"true\" startLine=\"1\" startColumn=\"1\" endLine=\"1\" endColumn=\"1\" part=\"OpenParenToken\">(</Token><SeparatedList_of_Argument part=\"Arguments\"><Argument startLine=\"1\" startColumn=\"2\" endLine=\"1\" endColumn=\"7\"><PredefinedType TypeSyntax=\"true\" startLine=\"1\" startColumn=\"2\" endLine=\"1\" endColumn=\"7\" part=\"Expression\"><Token kind=\"StringKeyword\" Keyword=\"true\" startLine=\"1\" startColumn=\"2\" endLine=\"1\" endColumn=\"7\" part=\"Keyword\">string</Token></PredefinedType></Argument><Argument startLine=\"1\" startColumn=\"10\" endLine=\"1\" endColumn=\"12\"><PredefinedType TypeSyntax=\"true\" startLine=\"1\" startColumn=\"10\" endLine=\"1\" endColumn=\"12\" part=\"Expression\"><Token kind=\"IntKeyword\" Keyword=\"true\" startLine=\"1\" startColumn=\"10\" endLine=\"1\" endColumn=\"12\" part=\"Keyword\">int</Token></PredefinedType></Argument></SeparatedList_of_Argument><Token kind=\"CloseParenToken\" Punctuation=\"true\" Language=\"true\" startLine=\"1\" startColumn=\"13\" endLine=\"1\" endColumn=\"13\" part=\"CloseParenToken\">)</Token></TupleExpression>", xElement.ToString(SaveOptions.DisableFormatting)); }
public void RefTypeSyntax_RoslynMLFromRoslyn_OK() { var converter = new RoslynML(); var node = SyntaxFactory.RefType(SyntaxFactory.Token(SyntaxKind.RefKeyword), SyntaxFactory.ParseTypeName("var")); var xElement = converter.Visit(node); Assert.AreEqual("<RefType startLine=\"1\" startColumn=\"1\" endLine=\"1\" endColumn=\"6\"><Token kind=\"RefKeyword\" Keyword=\"true\" startLine=\"1\" startColumn=\"1\" endLine=\"1\" endColumn=\"3\" part=\"RefKeyword\">ref</Token><IdentifierName Name=\"true\" TypeSyntax=\"true\" startLine=\"1\" startColumn=\"4\" endLine=\"1\" endColumn=\"6\" part=\"Type\"><Token kind=\"IdentifierToken\" startLine=\"1\" startColumn=\"4\" endLine=\"1\" endColumn=\"6\" part=\"Identifier\">var</Token></IdentifierName></RefType>", xElement.ToString(SaveOptions.DisableFormatting)); }
public void AttributeSyntax_RoslynMLFromRoslyn_OK() { var converter = new RoslynML(); var node = SyntaxFactory.ParseCompilationUnit("[module: XAttribute(\"X\", Y: 3, Z= 4)]").AttributeLists[0].Attributes[0]; var xElement = converter.Visit(node); Assert.AreEqual("<Attribute startLine=\"1\" startColumn=\"10\" endLine=\"1\" endColumn=\"36\"><IdentifierName Name=\"true\" TypeSyntax=\"true\" startLine=\"1\" startColumn=\"10\" endLine=\"1\" endColumn=\"19\" part=\"Name\"><Token kind=\"IdentifierToken\" startLine=\"1\" startColumn=\"10\" endLine=\"1\" endColumn=\"19\" part=\"Identifier\">XAttribute</Token></IdentifierName><AttributeArgumentList startLine=\"1\" startColumn=\"20\" endLine=\"1\" endColumn=\"36\" part=\"ArgumentList\"><Token kind=\"OpenParenToken\" Punctuation=\"true\" Language=\"true\" startLine=\"1\" startColumn=\"20\" endLine=\"1\" endColumn=\"20\" part=\"OpenParenToken\">(</Token><SeparatedList_of_AttributeArgument part=\"Arguments\"><AttributeArgument startLine=\"1\" startColumn=\"21\" endLine=\"1\" endColumn=\"23\"><LiteralExpression kind=\"StringLiteralExpression\" startLine=\"1\" startColumn=\"21\" endLine=\"1\" endColumn=\"23\" part=\"Expression\"><Token kind=\"StringLiteralToken\" startLine=\"1\" startColumn=\"21\" endLine=\"1\" endColumn=\"23\" part=\"Token\">X</Token></LiteralExpression></AttributeArgument><AttributeArgument startLine=\"1\" startColumn=\"26\" endLine=\"1\" endColumn=\"29\"><NameColon startLine=\"1\" startColumn=\"26\" endLine=\"1\" endColumn=\"27\" part=\"NameColon\"><IdentifierName Name=\"true\" TypeSyntax=\"true\" startLine=\"1\" startColumn=\"26\" endLine=\"1\" endColumn=\"26\" part=\"Name\"><Token kind=\"IdentifierToken\" startLine=\"1\" startColumn=\"26\" endLine=\"1\" endColumn=\"26\" part=\"Identifier\">Y</Token></IdentifierName><Token kind=\"ColonToken\" Punctuation=\"true\" Language=\"true\" startLine=\"1\" startColumn=\"27\" endLine=\"1\" endColumn=\"27\" part=\"ColonToken\">:</Token></NameColon><LiteralExpression kind=\"NumericLiteralExpression\" startLine=\"1\" startColumn=\"29\" endLine=\"1\" endColumn=\"29\" part=\"Expression\"><Token kind=\"NumericLiteralToken\" startLine=\"1\" startColumn=\"29\" endLine=\"1\" endColumn=\"29\" part=\"Token\">3</Token></LiteralExpression></AttributeArgument><AttributeArgument startLine=\"1\" startColumn=\"32\" endLine=\"1\" endColumn=\"35\"><NameEquals startLine=\"1\" startColumn=\"32\" endLine=\"1\" endColumn=\"33\" part=\"NameEquals\"><IdentifierName Name=\"true\" TypeSyntax=\"true\" startLine=\"1\" startColumn=\"32\" endLine=\"1\" endColumn=\"32\" part=\"Name\"><Token kind=\"IdentifierToken\" startLine=\"1\" startColumn=\"32\" endLine=\"1\" endColumn=\"32\" part=\"Identifier\">Z</Token></IdentifierName><Token kind=\"EqualsToken\" Operator=\"true\" startLine=\"1\" startColumn=\"33\" endLine=\"1\" endColumn=\"33\" part=\"EqualsToken\">=</Token></NameEquals><LiteralExpression kind=\"NumericLiteralExpression\" startLine=\"1\" startColumn=\"35\" endLine=\"1\" endColumn=\"35\" part=\"Expression\"><Token kind=\"NumericLiteralToken\" startLine=\"1\" startColumn=\"35\" endLine=\"1\" endColumn=\"35\" part=\"Token\">4</Token></LiteralExpression></AttributeArgument></SeparatedList_of_AttributeArgument><Token kind=\"CloseParenToken\" Punctuation=\"true\" Language=\"true\" startLine=\"1\" startColumn=\"36\" endLine=\"1\" endColumn=\"36\" part=\"CloseParenToken\">)</Token></AttributeArgumentList></Attribute>", xElement.ToString(SaveOptions.DisableFormatting)); }
public void ThrowExpressionSyntax_RoslynMLFromRoslyn_OK() { var converter = new RoslynML(); var node = SyntaxFactory.ParseExpression("throw e"); var xElement = converter.Visit(node); Assert.AreEqual("<ThrowExpression startLine=\"1\" startColumn=\"1\" endLine=\"1\" endColumn=\"7\"><Token kind=\"ThrowKeyword\" Keyword=\"true\" startLine=\"1\" startColumn=\"1\" endLine=\"1\" endColumn=\"5\" part=\"ThrowKeyword\">throw</Token><IdentifierName Name=\"true\" TypeSyntax=\"true\" startLine=\"1\" startColumn=\"7\" endLine=\"1\" endColumn=\"7\" part=\"Expression\"><Token kind=\"IdentifierToken\" startLine=\"1\" startColumn=\"7\" endLine=\"1\" endColumn=\"7\" part=\"Identifier\">e</Token></IdentifierName></ThrowExpression>", xElement.ToString(SaveOptions.DisableFormatting)); }
public void ExternAliasDirectiveSyntax_RoslynMLFromRoslyn_OK() { var converter = new RoslynML(); var node = SyntaxFactory.ParseCompilationUnit("extern alias a;").Externs[0]; var xElement = converter.Visit(node); Assert.AreEqual("<ExternAliasDirective startLine=\"1\" startColumn=\"1\" endLine=\"1\" endColumn=\"15\"><Token kind=\"ExternKeyword\" Keyword=\"true\" startLine=\"1\" startColumn=\"1\" endLine=\"1\" endColumn=\"6\" part=\"ExternKeyword\">extern</Token><Token kind=\"AliasKeyword\" Keyword=\"true\" Contextual=\"true\" startLine=\"1\" startColumn=\"8\" endLine=\"1\" endColumn=\"12\" part=\"AliasKeyword\">alias</Token><Token kind=\"IdentifierToken\" startLine=\"1\" startColumn=\"14\" endLine=\"1\" endColumn=\"14\" part=\"Identifier\">a</Token><Token kind=\"SemicolonToken\" Punctuation=\"true\" Language=\"true\" startLine=\"1\" startColumn=\"15\" endLine=\"1\" endColumn=\"15\" part=\"SemicolonToken\">;</Token></ExternAliasDirective>", xElement.ToString(SaveOptions.DisableFormatting)); }
public void ExpressionSyntax_InterpolatedStringExpressionSyntaxAndInterpolatedStringTextSyntax_RoslynMLFromRoslyn_OK() { var converter = new RoslynML(); var node = SyntaxFactory.ParseExpression("$\"Hello world\""); var xElement = converter.Visit(node); Assert.AreEqual("<InterpolatedStringExpression startLine=\"1\" startColumn=\"1\" endLine=\"1\" endColumn=\"14\"><Token kind=\"InterpolatedStringStartToken\" startLine=\"1\" startColumn=\"1\" endLine=\"1\" endColumn=\"2\" part=\"StringStartToken\">$\"</Token><List_of_InterpolatedStringContent part=\"Contents\"><InterpolatedStringText startLine=\"1\" startColumn=\"3\" endLine=\"1\" endColumn=\"13\"><Token kind=\"InterpolatedStringTextToken\" startLine=\"1\" startColumn=\"3\" endLine=\"1\" endColumn=\"13\" part=\"TextToken\">Hello world</Token></InterpolatedStringText></List_of_InterpolatedStringContent><Token kind=\"InterpolatedStringEndToken\" startLine=\"1\" startColumn=\"14\" endLine=\"1\" endColumn=\"14\" part=\"StringEndToken\">\"</Token></InterpolatedStringExpression>", xElement.ToString(SaveOptions.DisableFormatting)); }
public void ExpressionSyntax_JoinClauseSyntax_RoslynMLFromRoslyn_OK() { var converter = new RoslynML(); var node = (QueryExpressionSyntax)SyntaxFactory.ParseExpression("from f in s join T t in F on t.L equals s.R into y"); var xElement = converter.Visit(node.Body.Clauses[0]); Assert.AreEqual("<JoinClause startLine=\"1\" startColumn=\"13\" endLine=\"1\" endColumn=\"50\"><Token kind=\"JoinKeyword\" Keyword=\"true\" Contextual=\"true\" Query=\"true\" startLine=\"1\" startColumn=\"13\" endLine=\"1\" endColumn=\"16\" part=\"JoinKeyword\">join</Token><IdentifierName Name=\"true\" TypeSyntax=\"true\" startLine=\"1\" startColumn=\"18\" endLine=\"1\" endColumn=\"18\" part=\"Type\"><Token kind=\"IdentifierToken\" startLine=\"1\" startColumn=\"18\" endLine=\"1\" endColumn=\"18\" part=\"Identifier\">T</Token></IdentifierName><Token kind=\"IdentifierToken\" startLine=\"1\" startColumn=\"20\" endLine=\"1\" endColumn=\"20\" part=\"Identifier\">t</Token><Token kind=\"InKeyword\" Keyword=\"true\" TypeParameterVariance=\"true\" startLine=\"1\" startColumn=\"22\" endLine=\"1\" endColumn=\"23\" part=\"InKeyword\">in</Token><IdentifierName Name=\"true\" TypeSyntax=\"true\" startLine=\"1\" startColumn=\"25\" endLine=\"1\" endColumn=\"25\" part=\"InExpression\"><Token kind=\"IdentifierToken\" startLine=\"1\" startColumn=\"25\" endLine=\"1\" endColumn=\"25\" part=\"Identifier\">F</Token></IdentifierName><Token kind=\"OnKeyword\" Keyword=\"true\" Contextual=\"true\" Query=\"true\" startLine=\"1\" startColumn=\"27\" endLine=\"1\" endColumn=\"28\" part=\"OnKeyword\">on</Token><MemberAccessExpression kind=\"SimpleMemberAccessExpression\" startLine=\"1\" startColumn=\"30\" endLine=\"1\" endColumn=\"32\" part=\"LeftExpression\"><IdentifierName Name=\"true\" TypeSyntax=\"true\" startLine=\"1\" startColumn=\"30\" endLine=\"1\" endColumn=\"30\" part=\"Expression\"><Token kind=\"IdentifierToken\" startLine=\"1\" startColumn=\"30\" endLine=\"1\" endColumn=\"30\" part=\"Identifier\">t</Token></IdentifierName><Token kind=\"DotToken\" Operator=\"true\" startLine=\"1\" startColumn=\"31\" endLine=\"1\" endColumn=\"31\" part=\"OperatorToken\">.</Token><IdentifierName Name=\"true\" TypeSyntax=\"true\" startLine=\"1\" startColumn=\"32\" endLine=\"1\" endColumn=\"32\" part=\"Name\"><Token kind=\"IdentifierToken\" startLine=\"1\" startColumn=\"32\" endLine=\"1\" endColumn=\"32\" part=\"Identifier\">L</Token></IdentifierName></MemberAccessExpression><Token kind=\"EqualsKeyword\" Keyword=\"true\" Contextual=\"true\" Query=\"true\" startLine=\"1\" startColumn=\"34\" endLine=\"1\" endColumn=\"39\" part=\"EqualsKeyword\">equals</Token><MemberAccessExpression kind=\"SimpleMemberAccessExpression\" startLine=\"1\" startColumn=\"41\" endLine=\"1\" endColumn=\"43\" part=\"RightExpression\"><IdentifierName Name=\"true\" TypeSyntax=\"true\" startLine=\"1\" startColumn=\"41\" endLine=\"1\" endColumn=\"41\" part=\"Expression\"><Token kind=\"IdentifierToken\" startLine=\"1\" startColumn=\"41\" endLine=\"1\" endColumn=\"41\" part=\"Identifier\">s</Token></IdentifierName><Token kind=\"DotToken\" Operator=\"true\" startLine=\"1\" startColumn=\"42\" endLine=\"1\" endColumn=\"42\" part=\"OperatorToken\">.</Token><IdentifierName Name=\"true\" TypeSyntax=\"true\" startLine=\"1\" startColumn=\"43\" endLine=\"1\" endColumn=\"43\" part=\"Name\"><Token kind=\"IdentifierToken\" startLine=\"1\" startColumn=\"43\" endLine=\"1\" endColumn=\"43\" part=\"Identifier\">R</Token></IdentifierName></MemberAccessExpression><JoinIntoClause startLine=\"1\" startColumn=\"45\" endLine=\"1\" endColumn=\"50\" part=\"Into\"><Token kind=\"IntoKeyword\" Keyword=\"true\" Contextual=\"true\" Query=\"true\" startLine=\"1\" startColumn=\"45\" endLine=\"1\" endColumn=\"48\" part=\"IntoKeyword\">into</Token><Token kind=\"IdentifierToken\" startLine=\"1\" startColumn=\"50\" endLine=\"1\" endColumn=\"50\" part=\"Identifier\">y</Token></JoinIntoClause></JoinClause>", xElement.ToString(SaveOptions.DisableFormatting)); }
public void ExpressionSyntax_WhereClauseSyntax_RoslynMLFromRoslyn_OK() { var converter = new RoslynML(); var node = (QueryExpressionSyntax)SyntaxFactory.ParseExpression("from A f in s where y = 5"); var xElement = converter.Visit(node.Body.Clauses[0]); Assert.AreEqual("<WhereClause startLine=\"1\" startColumn=\"15\" endLine=\"1\" endColumn=\"25\"><Token kind=\"WhereKeyword\" Keyword=\"true\" Contextual=\"true\" Query=\"true\" startLine=\"1\" startColumn=\"15\" endLine=\"1\" endColumn=\"19\" part=\"WhereKeyword\">where</Token><AssignmentExpression kind=\"SimpleAssignmentExpression\" startLine=\"1\" startColumn=\"21\" endLine=\"1\" endColumn=\"25\" part=\"Condition\"><IdentifierName Name=\"true\" TypeSyntax=\"true\" startLine=\"1\" startColumn=\"21\" endLine=\"1\" endColumn=\"21\" part=\"Left\"><Token kind=\"IdentifierToken\" startLine=\"1\" startColumn=\"21\" endLine=\"1\" endColumn=\"21\" part=\"Identifier\">y</Token></IdentifierName><Token kind=\"EqualsToken\" Operator=\"true\" startLine=\"1\" startColumn=\"23\" endLine=\"1\" endColumn=\"23\" part=\"OperatorToken\">=</Token><LiteralExpression kind=\"NumericLiteralExpression\" startLine=\"1\" startColumn=\"25\" endLine=\"1\" endColumn=\"25\" part=\"Right\"><Token kind=\"NumericLiteralToken\" startLine=\"1\" startColumn=\"25\" endLine=\"1\" endColumn=\"25\" part=\"Token\">5</Token></LiteralExpression></AssignmentExpression></WhereClause>", xElement.ToString(SaveOptions.DisableFormatting)); }
public void ExpressionSyntax_LetClauseSyntax_RoslynMLFromRoslyn_OK() { var converter = new RoslynML(); var node = (QueryExpressionSyntax)SyntaxFactory.ParseExpression("from A f in s let y = 5"); var xElement = converter.Visit(node.Body.Clauses[0]); Assert.AreEqual("<LetClause startLine=\"1\" startColumn=\"15\" endLine=\"1\" endColumn=\"23\"><Token kind=\"LetKeyword\" Keyword=\"true\" Contextual=\"true\" Query=\"true\" startLine=\"1\" startColumn=\"15\" endLine=\"1\" endColumn=\"17\" part=\"LetKeyword\">let</Token><Token kind=\"IdentifierToken\" startLine=\"1\" startColumn=\"19\" endLine=\"1\" endColumn=\"19\" part=\"Identifier\">y</Token><Token kind=\"EqualsToken\" Operator=\"true\" startLine=\"1\" startColumn=\"21\" endLine=\"1\" endColumn=\"21\" part=\"EqualsToken\">=</Token><LiteralExpression kind=\"NumericLiteralExpression\" startLine=\"1\" startColumn=\"23\" endLine=\"1\" endColumn=\"23\" part=\"Expression\"><Token kind=\"NumericLiteralToken\" startLine=\"1\" startColumn=\"23\" endLine=\"1\" endColumn=\"23\" part=\"Token\">5</Token></LiteralExpression></LetClause>", xElement.ToString(SaveOptions.DisableFormatting)); }