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

Failed parsing nested case statement #121

Open
teyc opened this issue Feb 5, 2023 · 0 comments
Open

Failed parsing nested case statement #121

teyc opened this issue Feb 5, 2023 · 0 comments
Labels
under review Attempting to verify and confirm bug

Comments

@teyc
Copy link

teyc commented Feb 5, 2023

It looks like the CaseExpressionParser isn't able to handle complex grammars.

[Test]
public void CaseExpression_Inside_CaseExpression()
{
	const string sql = @"CASE 10
WHEN 20 THEN 30
ELSE CASE 40
 WHEN 50 THEN 60
 ELSE 70
 END
END";

	TSQLTokenizer tokenizer = new TSQLTokenizer(sql);

	Assert.IsTrue(tokenizer.MoveNext());

	var expression = new TSQLCaseExpressionParser().Parse(tokenizer);
	CollectionAssert.AllItemsAreNotNull(expression.Tokens);
	Assert.AreEqual(0, expression.BeginPosition);

}
teyc added a commit to teyc/tsql-parser that referenced this issue Feb 5, 2023
teyc added a commit to teyc/tsql-parser that referenced this issue Feb 5, 2023
@bruce-dunwiddie bruce-dunwiddie added the under review Attempting to verify and confirm bug label Feb 7, 2023
bruce-dunwiddie added a commit that referenced this issue Feb 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
under review Attempting to verify and confirm bug
Projects
None yet
Development

No branches or pull requests

2 participants