feat(form-decompile,form-compile): string(N,fixed) — AllowedLength=Fixed для строк фикс. длины

Колонки/реквизиты строк фиксированной длины (ИНН/КПП/коды) несут
<v8:AllowedLength>Fixed</v8:AllowedLength>, но DSL выражал только Variable:
компилятор хардкодил Variable, декомпилятор не читал AllowedLength → Fixed терялся
(форма ЭлектроннаяТранспортнаяНакладная/ТитулПеревозчика*: 3 LOST Fixed + 3 ADDED
Variable — мультимножественный учёт тех же колонок).

Корпус 8.3.24: AllowedLength ВСЕГДА присутствует в StringQualifiers (Variable
443127 + Fixed 2687, ABSENT=0) → always-эмиссия Variable верна. Fixed (2687)
всегда с длиной > 0 (12/10/3/1/36…); при Length=0 — всегда Variable.

Грамматика `string(N,fixed)` (по аналогии с `decimal(D,F,nonneg)`). Variable —
дефолт (опускаем суффикс); `variable` принимается forgiving. Emit-SingleType
(ps1+py) эмитит Fixed при суффиксе; декомпилятор Decompile-Type читает AllowedLength
(Fixed → суффикс, Variable/Length=0 → плоский string(N)). Общий путь типов
(реквизиты/колонки/valueType/составные).

Выборка 46 форм с Fixed (вкл. указанную): 0 потерь AllowedLength, целевая форма →
match. Round-trip декомпиляции снэпшота: string(12,fixed)/string(9,fixed) читаются
обратно. Кейс attributes-types (+ValueTable с Fixed-колонками ИНН/Код) сертифицирован
в 1С. Регресс 43/43 (ps1+py).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Nick Shirokov
2026-06-11 17:29:09 +03:00
co-authored by Claude Opus 4.8
parent b2eaa9e129
commit b781f97832
6 changed files with 65 additions and 13 deletions
@@ -30,7 +30,12 @@
{ "name": "Период", "type": "СтандартныйПериод", "save": ["Период", "EndDate", "StartDate", "Variant"] },
{ "name": "СписокЗначений", "type": "ValueList", "valueType": "string(50) | decimal(10,2)" },
{ "name": "СписокЛюбой", "type": "ValueList", "valueType": "" },
{ "name": "Идентификатор", "type": "v8:UUID" }
{ "name": "Идентификатор", "type": "v8:UUID" },
{ "name": "Таблица", "type": "ValueTable", "title": "Таблица", "columns": [
{ "name": "ИНН", "type": "string(12,fixed)" },
{ "name": "Код", "type": "string(9,fixed)" },
{ "name": "Имя", "type": "string(100)" }
]}
]
}
}
@@ -164,5 +164,45 @@
<v8:Type>v8:UUID</v8:Type>
</Type>
</Attribute>
<Attribute name="Таблица" id="22">
<Title>
<v8:item>
<v8:lang>ru</v8:lang>
<v8:content>Таблица</v8:content>
</v8:item>
</Title>
<Type>
<v8:Type>v8:ValueTable</v8:Type>
</Type>
<Columns>
<Column name="ИНН" id="23">
<Type>
<v8:Type>xs:string</v8:Type>
<v8:StringQualifiers>
<v8:Length>12</v8:Length>
<v8:AllowedLength>Fixed</v8:AllowedLength>
</v8:StringQualifiers>
</Type>
</Column>
<Column name="Код" id="24">
<Type>
<v8:Type>xs:string</v8:Type>
<v8:StringQualifiers>
<v8:Length>9</v8:Length>
<v8:AllowedLength>Fixed</v8:AllowedLength>
</v8:StringQualifiers>
</Type>
</Column>
<Column name="Имя" id="25">
<Type>
<v8:Type>xs:string</v8:Type>
<v8:StringQualifiers>
<v8:Length>100</v8:Length>
<v8:AllowedLength>Variable</v8:AllowedLength>
</v8:StringQualifiers>
</Type>
</Column>
</Columns>
</Attribute>
</Attributes>
</Form>