Documentation
Docs/en/reference/text-format/syntax.md
Text Pack Syntax
Generated reference. Do not edit directly. Update
BuildTools/TextFormatInterface.json, then runpython BuildTools/docs_text_format.py --write.
| Index | Syntax | Languages | Prototype text | Runtime | Validation | Canonical JSON | Guide |
A raw text file supplies the collection through its filename. Each parsed logical entry supplies Key1, Key2, and Text:
{Welcome}{}{Welcome to the wasteland.}
{QuestName}{Short}{A difficult choice}
{LongMessage}{}{First line
Second line}
Raw .fotxt does not author Key3. Use prototype $Text fields when a prototype-owned key needs both Key2 and Key3.
| Stable ID | Rule | Requirement | Why | Source |
|---|---|---|---|---|
text-format.syntax.entry |
Raw entry shape | A parsed .fotxt entry contains Key1, Key2, and Text in three brace-delimited fields; the collection is the text-pack filename segment. | LoadFromString supplies the collection separately and constructs TextPackKey from the two authored key fields. | Source/Common/TextPack.cpp |
text-format.syntax.key-tuple |
Structured key identity | TextPackKey identity is Collection plus Key1, Key2, and Key3, each represented as a hashed string wrapper. | Raw .fotxt entries leave Key3 empty, while prototype $Text fields may populate Key2 and Key3. | Source/Common/TextPack.h |
text-format.syntax.multiline-text |
Multiline value | Only the third field may continue across physical lines; joined lines retain newline characters until the first closing brace. | The first two ExtractBraceToken calls disable multiline input and the third enables it. | Source/Common/TextPack.cpp |
text-format.syntax.comment-boundary |
No comment grammar | The parser skips a physical line only when it cannot find the first opening brace; comment conventions are project policy and comment text must not contain parseable brace fields. | LoadFromString has no comment-token branch and begins parsing at the first opening brace anywhere on the line. | Source/Common/TextPack.cpp |
text-format.syntax.empty-fields |
Required and optional fields | The collection and Key1 must be non-empty; Key2 and Text may be empty. | The parser rejects only an empty collection or first key after all three fields were extracted. | Source/Common/TextPack.cpp |
text-format.syntax.variants |
Duplicate-key variants | Multiple entries may share the same complete TextPackKey and remain adjacent ordered variants in the sorted backing vector. | Variant count and indexed selection use one binary-search range; duplicate cardinality is not language-normalized and read paths never repair shared state. | Source/Common/TextPack.h, Source/Tests/Test_TextPack.cpp |
text-format.syntax.no-closing-brace-escape |
Closing-brace boundary | The first closing brace terminates each field; the raw format has no escape sequence for a literal closing brace inside Text. | ExtractBraceToken searches directly for the next closing brace and does not decode escapes. | Source/Common/TextPack.cpp |