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:

TextAnnotationC# equivalent
nullN/AN/A
falsebool(bool)false
truebool(bool)true
NaNf64double.NaN
+Inff64double.Infinity
-Inff64double.NegativeInfinity
Integer numbersi32int
Floating-point numbersf64double
Stringsstringstring

The following data types are supported for the value:

AnnotationC# equivalentDescription
boolBooleanBoolean data type
i8SByteSigned 8-bit integer
u8ByteUnsigned 8-bit integer
i16Int16Signed 16-bit integer
u16UInt16Unsigned 16-bit integer
i32Int32Signed 32-bit integer
u32UInt32Unsigned 32-bit integer
i64Int64Signed 64-bit integer
u64UInt64Unsigned 64-bit integer
i128Int128Signed 128-bit integer
u128UInt128Unsigned 128-bit integer
f16Half16-bit floating point number
f32Single32-bit floating point number
f64Double64-bit floating point number
d128Decimal128-bit decimal number
datetimeDateTimeOffsetDate, time, and timezone
dateonlyDateOnlyOnly date component
timeonlyTimeOnlyOnly time component
durationTimeSpanTime duration
ipIPAddressIP address
endpointIPEndPointIP endpoint
uriUriURI
uuidGuidUUID
base64Byte[]Raw bytes, hex is preferred
hexByte[]Raw bytes
stringStringString

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:

Values are parsed in the following order:

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:

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:

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).