ISKEYWORD ignores words in hints such as nolock, hash
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 35/100
Research direction
Start by running the provided PowerShell script with TSql150Parser and inspect the ScriptTokenStream output for nolock and hash, focusing on their token types and IsKeyword() results. Trace how TSql150Parser classifies these hint words and verify that the corrected classification is reflected in the token stream without parsing errors.
Written by the indexing model from the issue text.
Description
- SqlPackage or DacFx Version:
- .NET Framework (Windows-only) or .NET Core: .NET Framework
- Environment (local platform and source/target platforms):
Parser for 2019, Windows
Steps to Reproduce:
- Powershell script as below - does not recognize nolock , returns no for iskeyword.
$ScriptData = @"
--Testing tokens
begin tran
SELECT * FROM mytable (nolock);
commit tran
"@
Add-Type -Path "C:\ugpresentation\ScriptDom\Microsoft.SqlServer.TransactSql.ScriptDom.dll"
Write-Host "Attempting to parse..."
try {
$parser = New-Object Microsoft.SqlServer.TransactSql.ScriptDom.TSql150Parser($true)
#object to handle parsing errors if any
$parseErrors = New-Object System.Collections.Generic.List[Microsoft.SqlServer.TransactSql.ScriptDom.ParseError]
#object that handles strings script to parse
$stringReader = New-Object System.IO.StringReader($ScriptData)
#parser creates parsed objects from strings
$parsedObjects = $parser.Parse($stringReader, [ref]$parseErrors)
$ctr = 0
foreach ($token in $parsedobjects.ScriptTokenStream)
{
write-host "Text: " $token.text -ForegroundColor Cyan
write-host "Type: " $token.tokentype -ForegroundColor green
write-host "Location: Line" $parsedobjects.ScriptTokenStream[$ctr].Line "Column " $parsedobjects.ScriptTokenStream[$ctr].column -ForegroundColor yellow
write-host "Is this a Reserved Word? " $token.IsKeyword()-ForegroundColor white
$ctr++
} #token
if($parseErrors.Count -gt 0) {
throw "$($parseErrors.Count) parsing error(s): $(($parseErrors | ConvertTo-Json))"
}
Write-Host "Complete!" -ForegroundColor Green
}
catch {
throw
}
Did this occur in prior versions? If not - which version(s) did it work in?
Works same on every version
(DacFx/SqlPackage/SSMS/Azure Data Studio)
- Dominant language
- GAP
- Stars
- 277
- Forks
- 43
- Avg merge
- 6d 17h
- Merged PRs (30d)
- 3
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from microsoft/SqlScriptDOM
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
microsoft/SqlScriptDOM#228 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
microsoft/SqlScriptDOM#183 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 56/100
microsoft/SqlScriptDOM#226 · 1 reaction ·
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
microsoft/SqlScriptDOM#225 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 58/100
microsoft/SqlScriptDOM#224 ·
All issues in microsoft/SqlScriptDOM
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
internal.h中,漏掉了1个定义。 Open
Difficulty 1/5 Under an hour Newbie friendliness 95/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
oxc-project/oxc#26944 ·