-
Notifications
You must be signed in to change notification settings - Fork 1
The NSS Format
(In progress)
NSS (Newline Separated Sections) is a custom format used by the .itl and .def file types in this project.
The format uses ISO 8859-1 encoding, and is organized into sections. NSS files also contain a small, human-readable, header that describes the file. Leading spaces and empty lines are ignored, and data is separated by newlines.
Starting at the first byte, NSS files must contain a header formatted as such:
{
name:"value"
name:"value"
name:"value"
...
}
The opening/closing brackets must be on their own lines, and values must be contained within a pair of quotation marks.
Required name/value pairs are:
-
type
The NSS implementation the file uses. This is defined by each implementation individually. -
version
The implementation revision being used. -
encoding
Defines the text encoding used by the file. At the moment, the only option isiso-8859-1.
Implementations may also define additional options.
A basic NSS header might look like this:
{
type:"example"
version:"1"
encoding:"iso-8859-1"
}
Sections are declared via a leading period, and provide information about the lines scoped to them. Sections scopes begin with their declaration, and end when a new section is declared. All text directly after the leading period up to the first space is considered to be the section name, and everything after the first space is considered to be a space separated list of quoted arguments for that section. What section names are available, and what arguments they take is completely up to the implementation being used; NSS does not define any by itself.
An example section might look like this:
.name "arg1" "arg2"
DATA
DATA
...
Comments can be written by prefixing a line with a hash. Any lines marked as comments are treated as if they were empty. There is no way to write a multi-line comment other than marking each line individually. Additionally, a line will only be marked as a comment if the first parsed character is a hash, if the hash comes after other data, it will simply be parsed as if it were part of that data.
An example comment might look like this:
# Should split this
# section for clarity.
A complete file using NSS might look something like this:
{
type:"example"
version:"2"
encoding:"iso-8859-1"
}
.sec "a" "b"
DATA
DATA DATA
DATA
.sec "b" "c"
DATA DATA DATA
DATA
# Need to finish metal translations
DATA