This tool compiles to Kustom expressions from a more familiar syntax
Every expression that has a return value will be outputted. This includes plain strings and numbers.
"hello!";
batteryInfo("charging");
Output:hello!$bi("charging")$
Local variables are prefixed with #. They can be declared and read.
#a = 5;
#b = #a * 2;
Global variables are prefixed with @. They can only be read.
#b = @c * 2;
Conditions are declared in the usual if else blocks.
The else block is optional, single line expressions and else if are supported.
if (#a == 5) {
"hello!";
}
if (#a == 5) {
"hello!";
} else "goodbye!";
if (#a == 5) {
"hello!";
} else if (#a == 6) {
"goodbye!";
} else {
"what?";
}
Loops use a for block, they take a start, end and step arguments, separated by a semicolon.
You have to increment i inside the step argument, and the iterator is then available inside the for block as a local variable #i
You can optionally specify the separator in the next set of parenthesis before the block
for (0; 10; i + 1) {
#i * 2;
}
for (0; 10; i + 1) (", ") {
"We are at ";
#i;
}
Each Kustom function has been mapped inside the linter. You will get the definition and argument suggestions as per the Kustom docs as you type
Kustom functions are not very fit for a conventional language, as some of its middle arguments are optional/change as you type. To solve this, if you want to skip an argument, you can use the omit keyword. You don't have to use omit at all (as it's just ignored at output), but it helps with linting/readability.
Rest arguments are prefixed with ... and optional arguments are prefixed with *
batteryInfo("level");
"\n";
systemNotification("com.whatsapp", omit, "text");
Output:$bi("level")$
$ni("com.whatsapp", "text")$