Document Format
AASeq Document is a simplified node-based case-insensitive language that aims to provide Attribute-Value pair semantics. It allows for explicit data types and both explicit and implicit conversion.
Node
A node consists of a node name string, followed by value, zero or more properties, and optional children.
title "Hello, World"
Node name can be any non-white space unicode character except for braces ({ and }), brackets (( and )), slashes (\ and /), equals character (=), quote ("), semicolon (;), and hash character (#). Full list of forbidden node characters is thus: {}()\/=";#. Not all forbidden characters are utilized at this time.
Value is canonically listed immediatelly after node name, separated by one or more whitespace characters. Any properties are then listed after the value. Property name follows the same naming rules as node name does while value can be quoted as necessary.
author lastName=John firstName=Green isAlive=true
Value
Each node can contain a single value.
author "John Green"
Value can come either before or after properties but canonical output will always place it after. In case multiple values exist, the last one will be used.
Each value can also have a type prefix in round brackets that will denote its type.
author (u64)42
While values are strongly typed, it is not necessary to prefix each value with a type annotation. If there is no such annotation, the following conversions will apply:
| Text | Annotation | C# equivalent |
|---|---|---|
null | N/A | N/A |
false | bool | (bool)false |
true | bool | (bool)true |
NaN | f64 | double.NaN |
+Inf | f64 | double.Infinity |
-Inf | f64 | double.NegativeInfinity |
| Integer numbers | i32 | int |
| Floating-point numbers | f64 | double |
| Strings | string | string |
The following data types are supported for the value:
| Annotation | C# equivalent | Description |
|---|---|---|
bool | Boolean | Boolean data type |
i8 | SByte | Signed 8-bit integer |
u8 | Byte | Unsigned 8-bit integer |
i16 | Int16 | Signed 16-bit integer |
u16 | UInt16 | Unsigned 16-bit integer |
i32 | Int32 | Signed 32-bit integer |
u32 | UInt32 | Unsigned 32-bit integer |
i64 | Int64 | Signed 64-bit integer |
u64 | UInt64 | Unsigned 64-bit integer |
i128 | Int128 | Signed 128-bit integer |
u128 | UInt128 | Unsigned 128-bit integer |
f16 | Half | 16-bit floating point number |
f32 | Single | 32-bit floating point number |
f64 | Double | 64-bit floating point number |
d128 | Decimal | 128-bit decimal number |
datetime | DateTimeOffset | Date, time, and timezone |
dateonly | DateOnly | Only date component |
timeonly | TimeOnly | Only time component |
duration | TimeSpan | Time duration |
ip | IPAddress | IP address |
endpoint | IPEndPoint | IP endpoint |
uri | Uri | URI |
uuid | Guid | UUID |
base64 | Byte[] | Raw bytes, hex is preferred |
hex | Byte[] | Raw bytes |
string | String | String |
Null
Null values are always unquoted.
node null
Any node without children is implied to have value null.
node
Booleans
Boolean values are always unquoted.
node1 true
node2 false
Numbers
Value is considered a number, if value is unquoted and matches the following rules:
- value is a special constant (
NaN,+Inf,-Inf) - value starts with a digit;
- value starts with
+,-,., and a digit - value starts with
-.,+., and a digit
Values are parsed in the following order:
- float constants (
NaN,+Inf,-Inf) - integer values
- float values
Numeric values always use comma (,) as thousand separator and a period (.) as a decimal point.
Strings
If value doesn’t match any of the above types, it is considered to be an unquoted string. No escape sequences are allowed in unquoted strings. Unquoted string also cannot contain any of the following:
- braces (
{and}): used for children nodes - brackets (
(and)): used for type annotation - backslash (
\): reserved - forward slash (
/): complex comments - equals character (
=): used for properties - quote (
"): used to start quoted string - semicolon (
;): used to end children node - hash (
#). Full list of forbidden node characters is thus:
Values will use unquoted strings if they don’t match any of the null, boolean, or number characteristics.
Byte Arrays
Byte arrays can be specified using either the hexadecimal prefix (0x) or the binary prefix (0b).
Number of hexadecimal characters must be divisible by 2 (i.e., a full byte must always be specified). Any underscore (_) or dash (-) is considered a separator and it’s ignored during parsing.
Binary characters can be specified using either 0 and 1, or H and L. Any underscore (_) or dash (-) is considered a separator and it’s ignored during parsing. Any number of bits specified will be right aligned, i.e., 0b11 is equivalent to 0b_0000_0011.
Alternatively, you can specify binary data by using strings and manually specifying the conversion.
Data (hex)"414243"
Data (base64)"QUJD"
Property
Any number of properties can follow value. Property name follows the same limitations as the node name.
Property is defined by its name, followed immediately with equals character (=), and finally value. No space is to be used before or after equals.
author firstName=John lastName=Green
Property value is always a string.
If there are duplicates, the later defined property will overwrite previously defined one. Please note that names are case-insensitive by design and thus P1 and p1 are considered to be the same property name.
author firstName=John lastName=Green
Property value can also use simple quoting.
author fullName="John Green"
Multiline quoting for properties is not supported.
Child Node
Alteratively, node can define its children.
author "John Green" {
book "Looking for Alaska"
book "The Fault in Our Stars"
book "Everything Is Tuberculosis"
}
Nodes without children can be terminated using semicolon ;.
node1; node2; node3;
Quoting
If value is quoted, all characters are allowed, with following escape values:
\": double quote (\u0022)\\: backslash (\u005C)\0: null (\u0000)\a: alert (\u0007)\b: backspace (\u0008)\e: escape (\u001B)\f: Form feed (\u000C)\n: New line (\u000A)\r: Carriage return (\u000D)\t: Horizontal tab (\u0009)\v: Vertical tab (\u000B)\x: Unicode escape sequence (ASCII,\uHH)\u: Unicode escape sequence (UTF-16,\uHHHH)\U: Unicode escape sequence (UTF-32,\UHHHHHHHH)
node "Hello\nWorld!"
Block Quoting
For easier writing of multiline strings, one can use block quotes that allow for multiline strings. To start one, use at least 3 quote characters ("). and close it with the same number of quotes.
node """Hello World,
in "multiple" lines"""
nodeSingle "Hello World,\nin \"multiple\" lines"
Prefix whitespace present in second and later lines will be reduced by common whitespace count.
Nothing is expected after node ends (i.e. node ends).