Skip to content
10 changes: 10 additions & 0 deletions src/System.Linq.Dynamic.Core/Parser/ExpressionParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -755,6 +755,16 @@ Expression ParseStringLiteral()
_textParser.ValidateToken(TokenId.StringLiteral);
char quote = _textParser.CurrentToken.Text[0];
string s = _textParser.CurrentToken.Text.Substring(1, _textParser.CurrentToken.Text.Length - 2);
int index1 = 0;
while (true)
{
int index2 = s.IndexOf(quote, index1);
if (index2 < 0)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use {} in this new code. Example:

if (index2 < 0)
{
    break;
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok! I'm done.

break;
if (index2 + 1 < s.Length && s[index2 + 1] == quote)
s = s.Remove(index2, 1);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use {} in this new code. Example:

if (index2 < 0)
{
    break;
}

Copy link
Copy Markdown
Contributor Author

@OlegNadymov OlegNadymov Aug 12, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@StefH Ok! It was done.

index1 = index2 + 1;
}

if (quote == '\'')
{
Expand Down