Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

ISKEYWORD ignores words in hints such as nolock, hash

未关闭
#24 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
35/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
powershell, sql
领域
compilers

调研方向

首先使用 TSql150Parser 运行提供的 PowerShell 脚本,并检查 nolock 和 hash 的 ScriptTokenStream 输出,重点关注它们的 token 类型和 IsKeyword() 结果。跟踪 TSql150Parser 如何对这些提示词进行分类,并验证修正后的分类已在 token 流中得到反映且没有解析错误。

由索引模型根据 Issue 内容生成。

描述

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)

主要语言
GAP
星标
277
派生
43
平均合并
6 天 17 小时
30 天内合并 PR
3

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

microsoft/SqlScriptDOM 的其他 Issue

查看 microsoft/SqlScriptDOM 的全部 Issue

相似的 Issue

更多 Compilers Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。