# a totally incomplete / informal specification of ckt :P
# version 0.0.0
newline = \n (0x0A)
whitespace = [ space (0x20), \t (0x09), \r (0x0D) ]
escape sequences = [
\n = newline (0x0A)
\r = carriage return (0x0D)
\t = tab (0x09)
\" = double quote (0x22)
\\ = backslash (0x5C)
\xNN = hexadecimal 8-bit value
# The hash symbol (#) starts a comment, and the comment goes all the way to the end of a line.
# They can be at the start of a line, or anywhere in the line.
# Every key is a string, and every value is either a string or a table.
# Tables are surrounded by [ ]
# The top level is also a table!
# Key-Value pairs are 'record style initializations':
record style initialization = this is the record style initialization
initialization with table = [ key = value ]
# Surrounding whitespace is trimmed; so this is equal
"initialization with table" = [ "key" = "value" ]
# Duplicate keys are overwritten!
x = 13
x = 16
# x now equals 16
# Unspecified keys in record-style initializations are invalid;
# = value
# However, empty keys are.
"" = value
# Bare values are 'list style initializations':
this has a list style table = [value 1, value 2]
# Ckt makes no ditinction between tables and lists.
# The keys of list style initialization is the previous list style key + 1,
# starting at 0 and counting up in decimal.
equivelant to list style table = [
0 = value 1,
1 = value 2
# You can even mix and match record style and list style initializations.
polyline = [
color = blue; thickness = 2; npionts = 4
[ x = 0; y = 0 ]
[ x = -10; y = 0 ]
[ x = -10; y = 1 ]
[ x = 0; y = 1 ]
# In a table, newliens, commas, or semicolons seperate items, and they are mostly interchangable
seperated = [
seperated, by, commas; and; by; semicolons
# With only one difference:
# The parser should go through newlines and whitespace until it finds a non-neline, non-whitespace character.
# If the character is '=' then its a k/v pair; EG
this is valid
# This is fine. This should be interpreted the same as "this is valid" = "value"
this is invalid;
# This is not valid. It will interpret "this is invalid" and "= value" as two items of a table using list initialization syntax,
# and will error, as '=' is not allowed in unquoted strings.
# Same goes here:
this is also valid=
this is not also valid =;
# And of course:
this too is valid
# Strings can be unquoted, quoted, or multiline
# Unquoted strings are not escaped (what you see is what you get)
this is a bare unquoted string
this string includes \n which is not interpreted as a newline
# Quoted strings are surrounded by ", and are escaped (see escape sequences under DEFINITIONS)
"this is a quoted string"
# This are useful if you need a string that includes any of [ ] = , ; | # "
tag = "#Epic"
# Or if you need escaped characters
multiple lines quoted = "this string\nspans\nmultiple lines"
# Multiline strings start with a | on every line, and are mostly not escaped.
multiline string =
|This string spans multiple lines.
|Isn't it so cool?
# Aside from escape hatches. A \ before a newline in a multiline string will cause the next line to be on the same.
# A \ before the EOF should be interpreted as nothing.
singleline multiline string =
|This string only spans \
|a single line.
singleline unquoted string = This string only spans a single line.
# Escape hatches themselves can be escaped.
escaped escape hatches =
|This line ends in a single backslash. \\
|This line ends with two! \\\