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

ScriptDom.TSqlParser fails parsing valid expression #868

Closed
clement911 opened this issue Sep 23, 2019 · 7 comments
Closed

ScriptDom.TSqlParser fails parsing valid expression #868

clement911 opened this issue Sep 23, 2019 · 7 comments

Comments

@clement911
Copy link

I understand that Microsoft.SqlServer.TransactSql.ScriptDom.dll is not directly maintained here, but it seems to be the closest 'official' place to report bugs for this dll.
Is that right?
I really hope Microsoft opens sources Microsoft.SqlServer.TransactSql.ScriptDom but in the meantime I'll post the issue here and hope it can be reported internally to the relevant upstream team at Microsoft.

var parser = new TSql150Parser(true);
            string expr = @"
IIF
(
 (IIF(1 = 1, 1, NULL)) IS NULL,
 1,
 0
)";
            var res = parser.ParseExpression(new StringReader(expr), out var errors);
            bool isSuccess = errors.Count == 0;

Actual result: isSuccess is false
Expected result: isSuccess is true

@arvindshmicrosoft
Copy link
Member

@dzsquared - FYI.

@clement911
Copy link
Author

Any update on this long standing bug? Very simple expressions cannot be parsed.

@Websure-Denzil
Copy link

I know this is old, and I am very new to this - I expect @clement911 has already investigated - so I apologise in advance but I am curious.

There are obviously one or more errors being returned in the collection "errors". Are the messages just blank, or is there something it thinks it has found?

@clement911
Copy link
Author

@Websure-Denzil

The errors contain a single error, but it is useless. I can't remember exactly but it is a generic error message such as 'Invalid syntax near (' or something similar.

This error is of course wrong. The syntax is valid.

@Websure-Denzil
Copy link

This error is of course wrong. The syntax is valid.

Indeed, that is frustrating. It is a shame that such a simple, yet breaking error is left for so long. I found this error when looking for such a utility for my own purposes. If MS themselves cant be relied on for a reliable MS SQL parser, who can be?

@Charles-Gagnon
Copy link
Contributor

I'm going to close this one since it seems to be a duplicate of microsoft/SqlScriptDOM#28 and that's a better place for ScriptDom issues - and then I'll follow up with the owners to see if this is something they're going to be working on

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants