Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

ISKEYWORD ignores words in hints such as nolock, hash

Open
#24 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
powershell, sql
Domain
compilers

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

bug
  • 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:
  1. 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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from microsoft/SqlScriptDOM

All issues in microsoft/SqlScriptDOM

Similar issues

More Compilers issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.