Note: This is subject to future work. Errors, ambiguities, and omissions are to be expected.
The following tao:
first name [John] last name [Smith] age [25]
May be considered a dictionary
.
Each key in this dictionary is a matter
. This is the usual case for dictionaries.
The leading and trailing whitespace are not considered part of a key, i.e. keys may be checked for equality only after trimming any whitespace that they contain. This is similar to a common practice of trimming strings before comparison.
Rarely however we might want to include leading or trailing (or both) whitespace in a key. This can be done by delimiting the key by `'
ops
:
`' key with leading whitespace []
key with trailing whitespace `' []
`' key with padding `' []
`' indented key with padding `' []
This would be equivalent to a JSON object:
{
" key with leading whitespace": "",
"key with trailing whitespace ": "",
" key with padding ": "",
" indented key with padding ": ""
}
Also rarely it might be necessary to include the meta symbols [
or ]
or `
in a dictionary key. This can be achieved by escaping them with op
:
key with `[ brackets `] []
`[ `` `] []
`[ []
`] []
`` []
is a dictionary with unusual keys that contain meta symbols.
So keys in the general case besides matter
, may be interleaved notes
and ops
. Note that two consecutive notes
are impossible by TAO’s grammar.
The first op
in a key may be the `'
delimiter if it is not preceded by matter
. The last op
may be the same delimiter if it is not followed by matter
. The ops
inbetween are restricted to [
or ]
or `
.
This is a complete definition of a key
.
The value of a key
can then be obtained by removing any leading space from its first note
and trailing space from its last note
, removing the `'
delimiters, resolving ops to their escaped symbols and concatenating thus obtained parts into one string.