Gypsy is a simplified YAML parser written in Go. It is intended to be used as
a simple configuration file, and as such does not support a lot of the more
nuanced syntaxes allowed in full-fledged YAML. YAML does not allow indent with
tabs, and GYPSY does not ever consider a tab to be a space character. It is
recommended that your editor be configured to convert tabs to spaces when
editing Gypsy config files.
Gypsy understands the following to be a list:
This is parsed as a `yaml.YamlList`, and can be retrieved from the
`yaml.YamlNode.YamlList()` method. In this case, each element of the `yaml.YamlList` would
be a `yaml.YamlScalar` whose value can be retrieved with the `yaml.YamlScalar.String()`
Gypsy understands the following to be a mapping:
A mapping is an unordered list of `key:value` pairs. All whitespace after the
colon is stripped from the value and is used for alignment purposes during
export. If the value is not a list or a map, everything after the first
non-space character until the end of the line is used as the `yaml.YamlScalar`
Gypsy allows arbitrary nesting of maps inside lists, lists inside of maps, and
maps and/or lists nested inside of themselves.
A map inside of a list:
A list inside of a map:
A list of lists:
A map of maps:
In the case of a map of maps, all sub-keys must be on subsequent lines and
indented equally. It is allowable for the first key/value to be on the same
line if there is more than one key/value pair, but this is not recommended.
Values can also be expressed in long form (leading whitespace of the first line
is removed from it and all subsequent lines). In the normal (baz) case,
newlines are treated as spaces, all indentation is removed. In the folded case
(bar), newlines are treated as spaces, except pairs of newlines (e.g. a blank
line) are treated as a single newline, only the indentation level of the first
line is removed, and newlines at the end of indented lines are preserved. In
the verbatim (foo) case, only the indent at the level of the first line is
stripped. The example:
The YAML subset understood by Gypsy can be expressed (loosely) in the following
grammar (not including comments):
Any line where the first non-space character is a sharp sign (#) is a comment.
It will be ignored.
Only full-line comments are allowed.