CUBY logo


Difference between revisions from 2011/10/17 14:04 and 2011/10/17 13:51.
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
{html}<pre><code>keyword: value</code></pre>{/html}
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:
&nbsp;&nbsp;key1: value
&nbsp;&nbsp;key2: value
&nbsp;&nbsp;key1: different_value
&nbsp;&nbsp;key2: value</code></pre>{/html}
Third feature of YAML used in cuby input files are '''array'''s - ordered lists values. Array is written in YAML using - characters:
&nbsp;&nbsp;- value1
&nbsp;&nbsp;- value2
&nbsp;&nbsp;- value3

Some keywords are read as '''comma-separated lists''', but these are not recognized by YAML parser, but processed by cuby itself:
{html}<pre><code>keyword: this, that, something else</code></pre>{/html}

Empty lines are ignored, # character starts comments.

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
{html}<pre><code>keyword: 1, 2, 3
keyword: 6, 7
sets the value of the key to "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|]