Menu ▾ ▴

SyntaxExpression

Brad Lanam

Wiki Home
Syntax

Syntax: Expressions

Precedence of operators is the same as in the C language. The precedence of the eq~ and ne~ operators is the same as the other string operators.

Listed by precedence (high to low):

  • file_exists is_defined is_dictionary is_directory is_list
  • Unary: + ‑ !
  • * / %
  • + ‑
  • < <= > >= lt le gt ge
  • == != eq ne eq~ ne~
  • &&
  • ||

Unary Operations on Integers

+ ‑ !

Binary Operations on Integers

+ ‑ * / % && || == != < <= > >=

Binary Operations on Strings

eq ne lt le gt ge eq~ ne~

eq~ applies the regular expression in the second operand to the first operand. If there is a match, true is returned, otherwise false is returned.

ne~ applies the regular expression in the second operand to the first operand. If there is no match, true is returned, otherwise false is returned.

Internal Functions

file_exists (path) returns true if path exists and is a file.

is_defined (variable‑name) returns true if the variable is defined.

is_dictionary (variable‑name) returns true if the variable is defined and is a dictionary.

is_directory (path) return true if path exists and is a directory.

is_list (variable‑name) returns true if the variable is defined and is a list.

Examples
.set a 1 - 2;
.set b 0;
.set c ${a} && ${b};
.if (${a} || ${b}) {
   .print 'hello';
}

Wiki Home
Syntax


Related

Wiki: Home
Wiki: Syntax