Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the problem with inner double quotes #195

Merged
merged 12 commits into from
Aug 13, 2018
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
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
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
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
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