Browse Source

fixed bug in VB Lexer: ParameterList in ExpressionRangeVariable was not recognized

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@6393 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
pull/1/head
Siegfried Pammer 15 years ago
parent
commit
6784d914d2
  1. 4
      src/Libraries/NRefactory/Project/Src/Lexer/VBNet/ExpressionFinder.atg
  2. 2094
      src/Libraries/NRefactory/Project/Src/Lexer/VBNet/Parser.cs
  3. 33
      src/Libraries/NRefactory/Test/Lexer/VBNet/XmlModeLexerTests.cs

4
src/Libraries/NRefactory/Project/Src/Lexer/VBNet/ExpressionFinder.atg

@ -575,7 +575,9 @@ SimpleExpressionWithSuffix = @@ -575,7 +575,9 @@ SimpleExpressionWithSuffix =
SimpleExpression =
(. PushContext(Context.Expression, la, t); .)
( Literal
| ( "(" Expression ")" )
| ( "(" Expression // HACK in ExpressionRangeVariable Identifier is consumed before start
// of Expression so this can be an argument list too
{ "," Expression } ")" )
| IdentifierForExpressionStart
| PrimitiveTypeName
| ( "." | "!" | ".@" | "..." ) (. nextTokenIsStartOfImportsOrAccessExpression = true; wasQualifierTokenAtStart = true; .) [ XmlOpenTag ] IdentifierOrKeyword [ XmlCloseTag ]

2094
src/Libraries/NRefactory/Project/Src/Lexer/VBNet/Parser.cs

File diff suppressed because it is too large Load Diff

33
src/Libraries/NRefactory/Test/Lexer/VBNet/XmlModeLexerTests.cs

@ -531,6 +531,23 @@ Next"; @@ -531,6 +531,23 @@ Next";
Tokens.CloseParenthesis, Tokens.OpenCurlyBrace, Tokens.CloseCurlyBrace);
}
[Test]
public void Bug4()
{
ILexer lexer = GenerateLexer(new StringReader(TestStatement(@"Dim x = From kvp As KeyValuePair(Of String, DataGridViewCellStyle) In styleCache.CellStyleCache _
Select includeStyle(kvp.Key, kvp.Value)")));
CheckHead(lexer);
CheckTokens(lexer, Tokens.Dim, Tokens.Identifier, Tokens.Assign, Tokens.From, Tokens.Identifier, Tokens.As, Tokens.Identifier,
Tokens.OpenParenthesis, Tokens.Of, Tokens.String, Tokens.Comma, Tokens.Identifier, Tokens.CloseParenthesis,
Tokens.In, Tokens.Identifier, Tokens.Dot, Tokens.Identifier,
Tokens.Select, Tokens.Identifier, Tokens.OpenParenthesis, Tokens.Identifier, Tokens.Dot, Tokens.Key, Tokens.Comma,
Tokens.Identifier, Tokens.Dot, Tokens.Identifier, Tokens.CloseParenthesis);
CheckFoot(lexer);
}
[Test]
public void LessThanCheck()
{
@ -916,7 +933,7 @@ End Using"; @@ -916,7 +933,7 @@ End Using";
public void NewExpressionWithObjectInitializer()
{
string code = @"New Common.ComboBoxItem With {.Item = _
Localizer.GetString(""Month"" & initParameters.SelectedDate.FirstDayOfPreviousMonth.Month) & "" "" &
Localizer.GetString(""Month"" & initParameters.SelectedDate.FirstDayOfPreviousMonth.Month) & "" "" &
initParameters.SelectedDate.FirstDayOfPreviousMonth.Year, .Value = New Date(2010, initParameters.SelectedDate.FirstDayOfPreviousMonth.Month, 1)}";
ILexer lexer = GenerateLexerForSnippet(new StringReader(code), SnippetType.Expression);
@ -924,13 +941,13 @@ End Using"; @@ -924,13 +941,13 @@ End Using";
CheckTokens(lexer, Tokens.New, Tokens.Identifier, Tokens.Dot, Tokens.Identifier,
Tokens.With, Tokens.OpenCurlyBrace, Tokens.Dot, Tokens.Identifier, Tokens.Assign,
Tokens.Identifier, Tokens.Dot, Tokens.Identifier, Tokens.OpenParenthesis, Tokens.LiteralString,
Tokens.ConcatString, Tokens.Identifier, Tokens.Dot, Tokens.Identifier, Tokens.Dot,
Tokens.Identifier, Tokens.Dot, Tokens.Identifier, Tokens.CloseParenthesis, Tokens.ConcatString,
Tokens.LiteralString, Tokens.ConcatString, Tokens.Identifier, Tokens.Dot, Tokens.Identifier,
Tokens.Dot, Tokens.Identifier, Tokens.Dot, Tokens.Identifier, Tokens.Comma, Tokens.Dot,
Tokens.Identifier, Tokens.Assign, Tokens.New, Tokens.Date, Tokens.OpenParenthesis, Tokens.LiteralInteger,
Tokens.Comma, Tokens.Identifier, Tokens.Dot, Tokens.Identifier, Tokens.Dot, Tokens.Identifier, Tokens.Dot,
Tokens.Identifier, Tokens.Comma, Tokens.LiteralInteger, Tokens.CloseParenthesis, Tokens.CloseCurlyBrace);
Tokens.ConcatString, Tokens.Identifier, Tokens.Dot, Tokens.Identifier, Tokens.Dot,
Tokens.Identifier, Tokens.Dot, Tokens.Identifier, Tokens.CloseParenthesis, Tokens.ConcatString,
Tokens.LiteralString, Tokens.ConcatString, Tokens.Identifier, Tokens.Dot, Tokens.Identifier,
Tokens.Dot, Tokens.Identifier, Tokens.Dot, Tokens.Identifier, Tokens.Comma, Tokens.Dot,
Tokens.Identifier, Tokens.Assign, Tokens.New, Tokens.Date, Tokens.OpenParenthesis, Tokens.LiteralInteger,
Tokens.Comma, Tokens.Identifier, Tokens.Dot, Tokens.Identifier, Tokens.Dot, Tokens.Identifier, Tokens.Dot,
Tokens.Identifier, Tokens.Comma, Tokens.LiteralInteger, Tokens.CloseParenthesis, Tokens.CloseCurlyBrace);
}
#endregion

Loading…
Cancel
Save