2. Documents and layout
Readable Object Notation
RON source is UTF-8 text. A document contains one value, which can be a scalar, a list, or a map. The outer braces of a map may be omitted, allowing the document to read as a series of keys and values.
name Ada Lovelace active true scores [3 5 8] address { city London country UK } ; TODO: add phone number
<active> address {city London country UK} name Ada Lovelace scores [3 5 8] ; TODO: add phone number
{
"$comment": ":: TODO: add phone number",
"name": "Ada Lovelace",
"active": true,
"scores": [
3,
5,
8
],
"address": {
"city": "London",
"country": "UK"
}
}
In this document, name is a key and Ada Lovelace is its string value.
The words after the key belong to the value on that line.
To write a string containing spaces as the entire document, enclose the string in quotes.
An empty document represents an empty map.
Lists and braced maps have two layout modes. If the opening [ is alone on its line, each item line
holds one value. If the first item follows [ on the same line, whitespace
separates items throughout the list, including on following lines.
Indentation makes nested values easier to read, but does not introduce or close a container. Brackets and braces must still match. A closing bracket may follow the last value on its line, and several closing brackets may appear together.
Lines end with a newline or a carriage return followed by a newline. In these syntax rules, whitespace means spaces, tabs, and line endings. Blank lines are allowed between members and items. A trailing comma may appear at the end of a member or item line, but commas do not separate items in compact notation.
Table of Contents
2.1. Nesting depth ↑
Lists, maps, and tagged elements can nest to a maximum depth of 256.
Each list, map, and tagged element adds one level.
A scalar adds no level, so [[1]] has a depth of 2.
A list that is the payload of a tagged element adds no level.
Thus #a [1] and {#a [1]} each have a depth of 1, and a DUST invocation has the same depth in RON and in DUST.
A root map adds one level, with or without its braces.
A decoder rejects a container that is deeper than 256 levels.
This is a resource limit, not a syntax error.
The Odin implementation reports the error kind Depth_Limit, with the byte offset of the first container that is too deep.