Syntax
Nittos syntax is hevily inspired by Jenkin’s declarative pipelines.
Literals
There are 4 core literals in Nitto:
Symbols
Un-escaped strings or ‘symbols’, sometimes also refered as identifiers: someSymbol32
.
They must begin with a letter and can contain normal letters, numbers and underscores.
Regex equivalent: [a-zA-Z][a-zA-Z0-9_]*
Strings
Strings, which are your typicall strings: "some string"
.
They can hold any character inbetween two "
.
Note that newlines dosnt need to be escaped and are included as-is into the string’s value.
Numbers
Nitto supports hexadecimal, binary and decimal numbers with underscores for better readability:
0x1234567890_ABCDEF
0b0_1
0123456789
Lists
This is the only higher-level construct nitto supports at the moment and can only hold non-array values:
[ "hello", "world" ]
Lists are also the only thing allowing an command to span multiple lines:
cmd a b [
"hello",
"world"
]
Commands
Everything in nitto starts with what we call a “command”. Youve already encountered some if you read the quick start guide: plugin
, target
, lang
, sources
… they are all commands, while consisting always out of an symbol.
Them follow a list of arguments until a newline occurs, this for example is correct:
includes "includes/lib" public
while these are not:
includes
"includes/lib" public
includes
"includes/lib"
public
includes "includes/lib"
public
Commandblocks
Each command can additionally have an block which needs to be put after all arguments:
target "mylib" {
# Everything between the curly brackets is the "block"
}
Blocks can have newlines and even need them: in them you can but other commands which are then scoped to the command the block is given to. For example the lang
command only works in target
’s scope, because target
intereprets all command in it to have something to do / modify a target. Because of this, a command’s arguments, block and function can all change based on the scope.
# Here the 'option' commands defines a option and needs an block to be configured.
option "abc" {
# ...
}
target "test" {
# ...
# Here the block isn't needed, which then causes 'option' to apply
# the option we defined above to the target.
option "abc"
}