TreeNode Format
Simkin script can be stored within any convenient mechanism.
The distrubution includes classes that show how it can be stored within XML files, or within a format called "TreeNode".
The TreeNode format is hierarchical textual format which echoes that used in many applications.
The advantages of using the TreeNode format over XML are:
- A 3rd party XML library (such as Xerces for C++ or jaxp for Java) is not required - all TreeNode classes are included in the distribution
- Simkin script is slightly simpler in TreeNode files
- The TreeNode classes seem to operate faster than XML ones, and the memory footprint is smaller
The TreeNode format is a recursive definition. Each TreeNode item is composed of:
- a label - this is alphanumeric, but may also include the following characters:
- : - colon
- - - minus sign
- . - dot
- / - forward slash
- \ - back slash
- _ - underscore
- ~ - tilde
This makes it possible to store path names without spaces as a label.Simkin methods use the label to store the method name.
- data - this is arbitrary text, including spaces and line endings, within the delimeters "[" and "]". You use "\[" and "\]" to quote these delimeters within the text. Whitespace in the text is preserved.
Simkin methods are stored within the data for an item.
- children - this is a list of descendents of the item, which are themselves items. The list is delimeted by "{" and "}"
Each element is optional.
A TreeNode "file" is an item with no label or data, but a list of items.
Here are some examples:
A TreeNode file with a single item, with the label "field" but no data or children:
{
field
}
A TreeNode file with a single item, with the label "field", data "value" and a single child with the label "child":
{
field [value]
{
child
}
}
A TreeNode file with a field "field" and a Simkin method "method":
{
field [value]
method [(){
}]
}