S14V1.71
This commit is contained in:
parent
e2c01a9eb7
commit
36cd0bdd58
36
build.ps1
36
build.ps1
|
|
@ -83,6 +83,10 @@ function Get-ModuleDir {
|
|||
}
|
||||
$good = @($cands | Where-Object { $_.Count -ge 10 } | Sort-Object -Descending Count)
|
||||
|
||||
# 兼容「模块与脚本平铺在同一目录」的布局(仓库里可能没有子文件夹)
|
||||
$flat = @(Get-ChildItem -LiteralPath $Root -Filter '*.txt' -File -ErrorAction SilentlyContinue |
|
||||
Where-Object { $_.Name -match '^\d{2}-' }).Count
|
||||
if ($flat -ge 10) { return $Root }
|
||||
if ($good.Count -eq 0) {
|
||||
$tip = ''
|
||||
if ($cands.Count -gt 0) {
|
||||
|
|
@ -152,7 +156,7 @@ function Get-Modules([string]$Dir) {
|
|||
}
|
||||
|
||||
function Get-Lines([string]$Text) {
|
||||
$a = $Text -split "`r`n"
|
||||
$a = $Text -split "\r?\n"
|
||||
if ($a.Count -gt 0 -and $a[-1] -eq '') {
|
||||
if ($a.Count -eq 1) { return @() }
|
||||
return $a[0..($a.Count - 2)]
|
||||
|
|
@ -186,11 +190,15 @@ $PhSet = [System.Collections.Generic.HashSet[string]]::new([System.StringCompare
|
|||
foreach ($x in @($Colors + $Special + $InfoCodes)) { [void]$PhSet.Add($x) }
|
||||
$NumPrefix = @('SK','STAT','CHARSTAT','TABSK','FORMULA')
|
||||
$KwPrefix = @('SK','STAT','CHARSTAT','TABSK','MULTI','CLSK','FORMULA')
|
||||
$IgnoreUndef = @('SPEARBASE2_3')
|
||||
$IgnoreUndef = @()
|
||||
$MaxLineLen = 1024
|
||||
|
||||
function Test-Placeholder([string]$name) {
|
||||
if ($PhSet.Contains($name)) { return $true }
|
||||
# 带连字符的显示宏(图标/边框/音效/层级):只认合法形态,写错即报非法占位符
|
||||
if ($name -match '^(MAP|DOT|BG|BORDER|PX|PY)-[0-9A-Fa-f]{2}$') { return $true }
|
||||
if ($name -match '^SOUNDID-\d+$') { return $true }
|
||||
if ($name -match '^TIER-[1-5]$') { return $true }
|
||||
foreach ($p in $NumPrefix) {
|
||||
if (-not $name.StartsWith($p, [System.StringComparison]::Ordinal)) { continue }
|
||||
$tail = $name.Substring($p.Length)
|
||||
|
|
@ -300,7 +308,7 @@ function Invoke-SelfCheck([string[]]$Lines, $Mods) {
|
|||
$ruleRe = [regex]'^ItemDisplay\[([^\]]*)\]:(.*)$'
|
||||
$aliasRe = [regex]'^Alias\[([^\]]+)\]:(.*)$'
|
||||
$formulaRe = [regex]'^Formula\[([^\]]+)\]:(.*)$'
|
||||
$phRe = [regex]'%([A-Za-z][A-Za-z0-9_]*)%'
|
||||
$phRe = [regex]'%([A-Za-z][A-Za-z0-9_\-]*)%'
|
||||
$tokRe = [regex]'(?<![A-Za-z0-9_])([A-Z][A-Z0-9_]{1,})(?![A-Za-z0-9_])'
|
||||
|
||||
$rules = New-Object System.Collections.ArrayList
|
||||
|
|
@ -332,7 +340,27 @@ function Invoke-SelfCheck([string[]]$Lines, $Mods) {
|
|||
}
|
||||
}
|
||||
$ma = $aliasRe.Match($s)
|
||||
if ($ma.Success) { [void]$aliasNames.Add($ma.Groups[1].Value) }
|
||||
if ($ma.Success) {
|
||||
$anm = $ma.Groups[1].Value
|
||||
[void]$aliasNames.Add($anm)
|
||||
$abody = $ma.Groups[2].Value
|
||||
$acut = $abody.IndexOf('//')
|
||||
if ($acut -ge 0) { $abody = $abody.Substring(0, $acut) }
|
||||
$aopen = ([regex]::Matches($abody, '\(')).Count
|
||||
$aclose = ([regex]::Matches($abody, '\)')).Count
|
||||
if ($aopen -ne $aclose) {
|
||||
[void]$errors.Add("L$ln 别名 $anm 条件括号不平衡(( $aopen / ) $aclose):$abody")
|
||||
}
|
||||
if ($abody -match '\)(?=[A-Za-z0-9!])') {
|
||||
[void]$errors.Add("L$ln 别名 $anm 右括号后粘连(缺空格):$abody")
|
||||
}
|
||||
if ($abody -match '\dOR\b') {
|
||||
[void]$errors.Add("L$ln 别名 $anm 数字与 OR 粘连:$abody")
|
||||
}
|
||||
if ($abody -match '=~(?![0-9])') {
|
||||
[void]$errors.Add("L$ln 别名 $anm 非法比较符 =~:$abody")
|
||||
}
|
||||
}
|
||||
$mf = $formulaRe.Match($s)
|
||||
if ($mf.Success) { $formulaCount++; [void]$formulaNames.Add($mf.Groups[1].Value) }
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue