heckformat/docs/heckformat.md

42 lines
1.6 KiB
Markdown

# HECK metadata format
```
%%% heck
element value value
element value value
element tag=value
> subelement value
> subelement value
>> sub-subelement value
%%% something else
arbitrary data
```
reBNF:
```
COMMENT ::= # .*$
ATOM ::= [A-Za-z_][A-Za-z0-9_-]?
BASE10NUMBER ::= (-)?[0-9]+(\.)?[0-9]+([FLUIDCfluidc])?
BASE16NUMBER ::= 0x[0-9A-Fa-f]+
NUMBER ::= (<BASE10NUMBER|BASE16NUMBER>)
STRING ::= "([^\"]*|(\\)|(\"))"
VALUE ::= (<ATOM>|<STRING>|<NUMBER>)
VALUES ::= <VALUE>(\s+<VALUES>)?
TAGNAME ::= <ATOM>
TAG ::= <TAGNAME>=<VALUE>
TAGS ::= <TAG>(\s+<TAGS>)?
SECTIONLABEL ::= <ATOM>
SECTION ::= %%%\s+<SECTIONLABEL>\s+<TAGS>
ELEMENTLABEL ::= [A-Za-z_][A-Za-z0-9!@#$%^&*()_+/\\-]?
ELEMENT ::= <ELEMENTLABEL>\s+(<VALUES>|<TAGS>)
LINE ::= ^(((>)*<ELEMENT>) | <SECTION> | <COMMENT>) (<COMMENT>|$)
```
Heck is composed of a series of elements each with a label and one or more values. Elements may also have several key-value pairs associated with them as tags. Elements may also have sub-elements which then take the place of the value indicated with a > before the value at the current level. The heck document also can have several sections. Sections all start with %%% and a label. If the label is heck, the section is interpreted as more elements for the heck document. Any other label is stored as an element of arbitrary string value under that label name.
The data structure represented is an ordered array. Elements may have the same name as previous elmenents in the same containment.