Browse Source

fixed SD2-1452 - VB Parser: dictionary access in with block

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/vbnet@6166 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
pull/1/head
Siegfried Pammer 16 years ago
parent
commit
af6ed353ce
  1. 1707
      src/Libraries/NRefactory/Project/Src/Parser/VBNet/Parser.cs
  2. 3
      src/Libraries/NRefactory/Project/Src/Parser/VBNet/VBNET.ATG
  3. 3
      src/Libraries/NRefactory/Test/Lexer/VBNet/TokenTests.cs
  4. 20
      src/Libraries/NRefactory/Test/Parser/Expressions/BinaryOperatorExpressionTests.cs

1707
src/Libraries/NRefactory/Project/Src/Parser/VBNet/Parser.cs

File diff suppressed because it is too large Load Diff

3
src/Libraries/NRefactory/Project/Src/Parser/VBNet/VBNET.ATG

@ -1761,7 +1761,8 @@ SimpleNonInvocationExpression<out Expression pexpr>
| IdentifierOrKeyword<out name> | IdentifierOrKeyword<out name>
(. pexpr = new MemberReferenceExpression(null, name); .) (. pexpr = new MemberReferenceExpression(null, name); .)
) | ) |
(. XmlAxisType axisType = XmlAxisType.Element; bool isXmlIdentifier = false; .) "!" IdentifierOrKeyword<out name> (. pexpr = new BinaryOperatorExpression(null, BinaryOperatorType.DictionaryAccess, new PrimitiveExpression(name, name)); .)
| (. XmlAxisType axisType = XmlAxisType.Element; bool isXmlIdentifier = false; .)
( "..." (. axisType = XmlAxisType.Descendents; .) | ".@" (. axisType = XmlAxisType.Attribute; .) ) ( ( "..." (. axisType = XmlAxisType.Descendents; .) | ".@" (. axisType = XmlAxisType.Attribute; .) ) (
[ XmlOpenTag (. isXmlIdentifier = true; .) ] IdentifierOrKeyword<out name> [ XmlCloseTag ] [ XmlOpenTag (. isXmlIdentifier = true; .) ] IdentifierOrKeyword<out name> [ XmlCloseTag ]
(. pexpr = new XmlMemberAccessExpression(null, axisType, name, isXmlIdentifier); .) (. pexpr = new XmlMemberAccessExpression(null, axisType, name, isXmlIdentifier); .)

3
src/Libraries/NRefactory/Test/Lexer/VBNet/TokenTests.cs

@ -16,12 +16,11 @@ namespace ICSharpCode.NRefactory.Tests.Lexer.VB
public class TokenTests public class TokenTests
{ {
[Test] [Test]
public void TestMethod() public void TokenToStringDoesNotThrowException()
{ {
Assert.DoesNotThrow( Assert.DoesNotThrow(
() => { () => {
string text = new Token(71, 1, 1).ToString(); string text = new Token(71, 1, 1).ToString();
Console.WriteLine(text);
} }
); );
} }

20
src/Libraries/NRefactory/Test/Parser/Expressions/BinaryOperatorExpressionTests.cs

@ -253,7 +253,6 @@ namespace ICSharpCode.NRefactory.Tests.Ast
Assert.IsTrue(boe.Left is IdentifierExpression); Assert.IsTrue(boe.Left is IdentifierExpression);
Assert.IsTrue(boe.Right is IdentifierExpression); Assert.IsTrue(boe.Right is IdentifierExpression);
} }
[Test] [Test]
@ -439,7 +438,24 @@ namespace ICSharpCode.NRefactory.Tests.Ast
VBNetTestBinaryOperatorExpressionTest("If(a, b)", BinaryOperatorType.NullCoalescing); VBNetTestBinaryOperatorExpressionTest("If(a, b)", BinaryOperatorType.NullCoalescing);
} }
#endregion [Test]
public void VBNetDictionaryAccess()
{
BinaryOperatorExpression boe = ParseUtilVBNet.ParseExpression<BinaryOperatorExpression>("a!b");
Assert.AreEqual(BinaryOperatorType.DictionaryAccess, boe.Op);
Assert.IsTrue(boe.Left is IdentifierExpression);
Assert.IsTrue(boe.Right is PrimitiveExpression);
}
[Test]
public void VBNetWithDictionaryAccess()
{
BinaryOperatorExpression boe = ParseUtilVBNet.ParseExpression<BinaryOperatorExpression>("!b");
Assert.AreEqual(BinaryOperatorType.DictionaryAccess, boe.Op);
Assert.IsTrue(boe.Left.IsNull);
Assert.IsTrue(boe.Right is PrimitiveExpression);
}
#endregion
#region AddIntegerTests #region AddIntegerTests
string AddIntegerToBoe(string input, int number) string AddIntegerToBoe(string input, int number)

Loading…
Cancel
Save