YAML
Some cuby input files in YAML format can bee seen on Examples page.
YAML structures
The basic keyword->value record in cuby input looks like
keyword: value
In some cases, cuby uses subsections in input files to contain keywords specific to some part of the calculation. It is created as a list one level deeper, indented by two spaces:
subsection_name:
key1: value
key2: value
another_subsection:
key1: different_value
key2: value
Third feature of YAML used in cuby input files are arrays - ordered lists values. Array is written in YAML using - characters:
keyword_requiring_array:
- value1
- value2
- value3
Some keywords are read as comma-separated lists, but these are not recognized by YAML parser, but processed by cuby itself:
keyword: this, that, something else
Empty lines are ignored, # character starts comments.
Warning!
YAML language specification does not allow the use of duplicate keys, but the ruby parser does not complain when it encounters this problems and just overwrites the value. Therefore, input
keyword: 1, 2, 3
keyword: 6, 7
sets the value of the key to "6, 7". Unfortunately, this is the behavior of the YAML parser itself, so it is not possible to warn the user when such duplicity is encountered.
Syntax highlighting
And advantage of standardized file format is that there are syntax highligters for it. If one is not a part of your favorite editor and the editor is vim, you can get the highilgter here