Cheat Sheet for YINI
Based on the official YINI Specification (v1.0 Release Candidate 7)
A quick reference for writing clean, readable YINI configuration files.
Want to test a snippet while reading? Open the YINI Playground.
YINI makes data files (such as configuration files and application settings) easy for humans to read and predictable for machines to process — like INI, but with real structure, lists (arrays), objects, and comments.
More structured than INI, less noisy than JSON, and less fragile than YAML.
🧱 Basic Syntax
| Element | YINI Syntax |
|---|---|
| Section heading: level 1 | ^ App |
| Section heading: level 2 | ^^ Database |
| Section heading: level 3 | ^^^ Pool |
| Section marker separator | ^^^_^^^_^^^ DeepSection_ may visually separate repeated section markers and does not count toward section depth. |
| String | "text", 'text', "C:\Users\Robin", '/usr/local/bin' 👉 Strings are raw by default — \ and \n are treated as normal text👉 Use E"..." or e'...' for escape sequences like \n, \t, \\ (escapes are transformed during parse time) |
| Number | 42, 3.14, -10, 1e4 |
| Boolean | true, false, on, off, yes, no (case-insensitive) |
| Null | null, Null, (or blank in lenient mode) |
| List (array) | [1, 2, 3] |
| Inline object (map/dict) | { a: 1, b: 2 } |
| Comment | // Default comment |
| Alt. comment | # Comment#Comment# starts a comment outside string literals and backticked identifiers. |
| Multi-line (block) comment | /* comment *//* Multi-line comment*/ |
| Full-line comment | ; This is a full-line comment (only full lines) |
| Disable line | --debug = true |
📝 Naming Rules
- Simple section names and keys should use normal identifier-like names.
- Use backticks for spaces, punctuation, special characters, or reserved-looking names:
^ `My App`
`api-key` = "abc123"
`user.name` = "Alex"💡 Style Convention (Optional)
- Section names typically start with a capital letter, like:
Title. - Keys typically start with a lowercase letter, like:
key.
This is a readability convention — not a requirement.
🔤 String Types
YINI strings are quoted and are raw by default.
| String type | Example | Meaning |
|---|---|---|
| Raw string | "C:\Users\Robin" | Default string type. Backslashes are treated as normal characters. |
| Single-quoted raw string | 'hello' | Same raw behavior, using single quotes. |
| Escaped String | E"hello\nworld" | Escape sequences such as \n, \t, and \\ are interpreted. |
| Triple-quoted raw string | """multi-line text""" | Multi-line raw string. Escapes are not interpreted. |
| Escaped triple-quoted string | E"""line 1\nline 2""" | Multi-line string with escape sequences interpreted. |
Use normal raw strings for most values. Use E"...", e'...', or E"""...""" when you need escape sequences. The older C/c prefixes remain valid in both modes but are deprecated in RC7.
Source LF, CRLF, and CR line endings become LF in all multiline string values. Escape results such as \r keep their own characters. \xhh is a two-digit Unicode escape for U+00hh, not a raw byte.
Command Strings
Use lowercase command""" for multiline command or script text:
build = command"""
npm ci
npm run build
"""The value is npm ci\nnpm run build, with structural indentation removed and no final newline. Backslashes stay literal. The opening delimiter must end its line, and the closing delimiter must be alone on its line. YINI produces an ordinary string and does not execute it.
String Concatenation
title = "YINI: " + "Readable config"
label = "port-" + 8080 // Lenient mode only.
scale = "scale-" + 1e3 // "scale-1e3" in lenient mode.Concatenation must start with a string literal. Strict mode permits only string operands; lenient mode also permits later number, boolean, and null operands. Lists and objects are invalid operands, and numeric addition is not defined. Line breaks may follow +, but must not precede it.
🧩 Inline Objects & Nested Data
Objects are also called maps or dictionaries in many languages.
Simple object
db = { host: "localhost", port: 5432 }Nested objects
service = {
http: { port: 8080, secure: true },
limits: { rpm: 1000 }
}🧭 Important Rules
-
Indentation is cosmetic — structure is defined by section markers (
^,^^,^^^, etc.). -
Repeated section markers are supported up to level 9. For deeper nesting, use numeric shorthand such as
^10 DeepSection. -
Strings must be quoted using
'...'or"...". -
Strings are raw by default. Use
E"..."ore'...'only when you need escape sequences like\nor\t. -
key = valueassigns a single value. -
Lists are assigned with
=and square brackets, for exampleitems = ["one", "two"]. -
Trailing commas are allowed in lists and objects (lenient mode).
-
Duplicate sections under the same parent are errors in both modes. A key and child section cannot share a name under the same parent.
-
Duplicate keys are errors in strict mode. In lenient mode, the first value wins and later duplicates are ignored with a warning.
-
Blank root-level or section-level values become null with a warning in lenient mode; strict mode rejects them. Missing list items or object values are errors in both modes.
-
Inline objects use canonical
:separators. Lenient parsers must also accept=, including mixed separators; strict mode requires:. -
Lenient root-level members appear directly beside top-level sections, without an implicit
baseobject. -
Strict mode requires exactly one top-level section, no root-level members, and
/END. Only comments and whitespace may follow/ENDin either mode. -
@yini strictand@yini lenientdeclare the expected mode; they do not select it. Strict declarations must be rejected by lenient parsers. Lenient declarations produce a warning under strict parsing and must still pass strict checks. -
#starts a comment outside string literals and backticked identifiers. -
_may be used as a visual separator in number literals and repeated section markers. It improves readability and does not change the value or section depth.maxUploadSize = 10_000_000Meaning: same as
10000000, but easier to read.Header fragment at depth 9, after ancestor levels 1–8 have been established:
^^^_^^^_^^^ DeepSettingsMeaning: same section depth (9 in this case) as
^^^^^^^^^ DeepSettings; the_separators are only visual and do not count as section markers.
🔢 Number Formats
YINI supports multiple numeric formats:
| Format | Example |
|---|---|
| Integer | 42, -42❌ 01 (leading zero not allowed)✅ 1✅ 0 |
| Float | 3.14, -3.14❌ 3,14✅ 0.14 |
| Scientific (base-10) | 1e6, 5.2E-3 |
| Hexadecimal (base-16) | 0xFFAA00, 0X3fa, hex:FFAA00❌ #FFAA00 — # starts a comment, not a hex number.✅ 0xffaa00✅ hex:ffaa00 |
| Binary (base-2) | 0b101010 |
| Octal (base-8) | 0o755 |
| Duodecimal (base-12) | 0z2BA9, 0z2EX9Digits: 0–9, A or X = 10, B or E = 11 (case-insensitive)💡 0z10 equals decimal 12. |
| Digit separators | 1_000, 0x_FF_AA_00, 0b_1010_1100, hex:FF_AA_00Underscores are for readability and do not change the numeric value. |
Number literals need no quotes. Non-decimal integers must fit the signed 64-bit range in both modes. Prefer 0b for binary; the older % prefix remains valid but is deprecated in RC7.
🧪 Example 1 — Minimal Real-World
^ App
name = "Nebula"
version = "2.3.1"
^^ Network
ports = [80, 443]
ssl = true // boolean (case-insensitive)
^^ `Rate Limits`
requests = { perMinute: 1200, burst: 60 }
timeout = null🧪 Example 2 — Practical Config with Comments
# Optional YINI marker
@yini
^ Service
name = 'Aurora' # Single quotes
message = E"Server started\nReady." # Escaped String with newline escape.
path = 'E:\Program Files\App' # Backslashes are raw (no escaping needed)
enabled = Off # Boolean (case-insensitive)
retries = 3
^^ Database
host = 'localhost'
port = 5432
color = 0x336699 # Hex number literal
; This is a full-line comment (for humans)
--password = 'secret' # Disabled line (ignored by parser)
^^^ Limits
maxUsers = 1000
timeout = # Null with a warning in lenient mode.💡 Strings:
Regular strings are raw by default.
UseE"..."ore'...'only when escape sequences are needed.
💡 Note:
Lines prefixed with--are disabled configuration lines.
They behave like comments (the parser ignores them), but are intended to temporarily disable real configuration — not to serve as documentation.In editors, they are typically highlighted differently from normal comments to indicate “disabled code” rather than explanatory text.
Next steps
-
➡️ YINI Examples
Explore practical configurations using the syntax.
-
➡️ Get YINI Tools
Find the CLI, parsers, and editor tooling.
