Introduction
Lineparse is a new configuration file format used currently in two places in AllegroGraph. It is a very simple general purpose format that doesn't have strict whitespace rules unlike formats like YAML.
Syntax
A lineparse file consists of a sequence of lines which either specify the beginning of a section or specify an item within the current section.
Each use of a lineparse file as a configuration file has its own rules about what sections are allowed and what items are allowed in a each section and what arguments are permitted for each item.
A file in lineparse format consists of a set of sections.
Each section has a list of valid items.
Each item accepts one or more arguments.
Some items accept only certain arguments and others accept any arguments.
The file consists of a sequence of lines, each ended by a newline or a semicolon or EOF. After a semicolon the following characters constitute another line (thus a single physical line may contain multiple lineparse lines).
The character # starts a comment and any characters (including semicolons and double quotes) following a # up to a newline or an EOF are part of the comment and ignored when processing the lineparse file.
These characters have a special meaning:
- space,tab - whitespace, separates arguments but are otherwise ignored
- newline - ends a line
- semicolon - ends a line
- double quote - makes all following characters (including semicolons and newlines) into normal characters until the next double quote
- backslash - makes the next character a normal character
- sharpsign (#) - begins a comment. All characters up to newline or EOF are normal characters.
This is similar to the shell processing of arguments but much more limited.
One difference from Lisp is that "a b c"^^xsd:string is a single word and identical to "a b c^^xsd:string". This is similar to how the shell parses arguments.
In lineparse format each line contains zero or more whitespace separated words.
- If there are no words the line is ignored
- If there is one word then that begins a section named by that word.
- If there are two or more words then the first word is the name of an item and the rest of the words are arguments to the item (recall that all items must have at least one argument)
Example:
foo arg1 arg2; bar # comment text which may include ;, # or " but not newline
is two lineparse lines and is the same as
foo arg1 arg2; bar
or
foo arg1 arg2
bar
Double quotes or a backslash are used to escape otherwise special characters
So the holiday item below
holiday "Christmas Eve" Christmas New\ Year's\ Day
has three arguments:
Christmas Eve
Christmas
New Year's Day
It's possible to have an empty string as an argument
foo a b\ c "" d e
has arguments
a
b c <-- string with embedded whitespace
<empty string>
d
e
Currently lineparse is used to define Fedshard definitions and AllegroGraph users and roles.
Lineparse is not used in the agraph.cfg
file. Its format is unchanged.