mirror of
https://github.com/Nikolay-Shirokov/cc-1c-skills.git
synced 2026-09-17 23:35:22 +03:00
fix(skd-compile): accept bare decimal and decimal(N) with sensible defaults
Emit-SingleValueType / emit_single_value_type previously required full decimal(D,F) — anything else fell through to a fallback that produced invalid <v8:Type>decimal</v8:Type> (no xs: prefix, no qualifiers). New regex `^decimal(\((\d+)(,(\d+))?(,nonneg)?\))?$` accepts: - decimal → 10,2,Any (money default — most common 1C intent) - decimal(N) → N,0,Any (integer) - decimal(N,nonneg) → N,0,Nonnegative - decimal(N,M) → as before - decimal(N,M,nonneg) → as before Synonyms (число, число(N), etc.) inherit the same forms via Resolve-TypeStr. Shared Emit-ValueType is called from fields, parameters, and output parameters — one fix covers all three paths. 3 existing snapshots regenerated with proper xs:decimal + qualifiers, plus new decimal-qualifier-defaults test case covering all 5 forms × synonyms. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.7
parent
449f814d16
commit
05374100c1
@@ -1,4 +1,4 @@
|
||||
# skd-compile v1.24 — Compile 1C DCS from JSON
|
||||
# skd-compile v1.25 — Compile 1C DCS from JSON
|
||||
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||
param(
|
||||
[string]$DefinitionFile,
|
||||
@@ -230,11 +230,20 @@ function Emit-SingleValueType {
|
||||
return
|
||||
}
|
||||
|
||||
# decimal(D,F) or decimal(D,F,nonneg)
|
||||
if ($typeStr -match '^decimal\((\d+),(\d+)(,nonneg)?\)$') {
|
||||
$digits = $Matches[1]
|
||||
$fraction = $Matches[2]
|
||||
$sign = if ($Matches[3]) { "Nonnegative" } else { "Any" }
|
||||
# decimal forms (defaults — bare decimal = money 10,2; decimal(N) = integer N,0):
|
||||
# decimal → 10,2,Any
|
||||
# decimal(N) → N,0,Any
|
||||
# decimal(N,nonneg) → N,0,Nonnegative
|
||||
# decimal(N,M) → N,M,Any
|
||||
# decimal(N,M,nonneg) → N,M,Nonnegative
|
||||
if ($typeStr -match '^decimal(\((\d+)(,(\d+))?(,nonneg)?\))?$') {
|
||||
if (-not $Matches[1]) {
|
||||
$digits = "10"; $fraction = "2"; $sign = "Any"
|
||||
} else {
|
||||
$digits = $Matches[2]
|
||||
$fraction = if ($Matches[4]) { $Matches[4] } else { "0" }
|
||||
$sign = if ($Matches[5]) { "Nonnegative" } else { "Any" }
|
||||
}
|
||||
X "$indent<v8:Type>xs:decimal</v8:Type>"
|
||||
X "$indent<v8:NumberQualifiers>"
|
||||
X "$indent`t<v8:Digits>$digits</v8:Digits>"
|
||||
|
||||
Reference in New Issue
Block a user