tEDAx - syntax

lines, fields

tEDAx is a plain text file. The line delimiter is any combination of \n and \r. Empty files are ignored. The last line of the file ends in a line delimiter. The maximum length of a line is 512 characters, including the line delimiter.

If the first character of a line is a hash mark ("#"), the line is a comment and is ignored up to the line delimiter.

Leading space and tab characters are ignored on the beginning of lines, allowing indentation.

Escaping: a backslash character preceding a character escapes that character. Escaping means the character is taken as a literal character instead of being implemented as a directive (separator, delimiter, or any other part of the syntax). It is not possible to escape the line delimiter. Special escape sequences:

Unless otherwise specified, each line consists of an ordered sequence of fields separated by a sequence of unescaped tab and/or space character. Thus a field may contain tabs, spaces, \n or \r characters only if those characters are each escaped.

For example the following logical lines all specify 3 fields:

	foo bar baz
	 foo b\ ar baz
	foo b\tar baz

The first field is often called the command and the rest of the fileds are often called parameters in this document. Commands and parameters are case sensitive unless otherwise specified.

A tEDAx file is flat. It does specifies blocks, but does not specify an arbitrary tree of data.

Multiline support: none. Most of the data to be exchanged can be, and should be split up to smaller atoms and packed in a "one atom per line" manner. Most often blocks use the "set" semantic: a line results in an atom written into a single slot of the in-memory model. When a single atom becomes large, an "append" semantic command should be introduced for it so that the atom can be written in multiple lines.

header

The first non-empty, non-comment line of a tEDAx file is the header. The first field of the header is "tEDAx", the second field is the file format version, v1 for this document. A valid header line looks like this:

tEDAx v1

blocks

A tEDAx file contains the header and a series of zero or more blocks. A block starts with a begin command and ends with an end command. begin has 3 parameters:

End has only the first parameter, the type of the block.

For example a valid tEDAx file with a single birthday block (semantics made up for this example) could look like this:

tEDAx v1

# John Doe, my good old friend
begin birthday v1 John\ Doe
	year   1982
	month  02
	day    11
end birthday

Comment, indentation, empty lines are all optional to help manual edition.

Notes

The syntax does not allow empty fields. If a block specification needs optional fields those fields should be either at the end of the record or an explicit special value for "empty" needs to be declared (e.g. a single dash).

The hard limit on number of fields is 256. In practice, implementations may decide to support less fields: as many as block specifications require.