LSPS Expression Language 3.3

Types and values
Simple
String"string"
#ASCII_CODE
#"not-localized string"
$localizedString(argument1, argument2,…)
Booleantrue
false
Integer1 -100
Decimal24.86
6.63E-34
Decimal(scale)
Decimal(scale, rounding)
Dated'yyyy-MM-dd HH:mm:ss.SSS'
date(year, month, day)
date(year, month, day, hours, minutes, seconds, millis)
date(string)
date(string, pattern)
LocalDateld'yyyy-MM-dd'
localDate(epochDay)
localDate(string)
date(year, month, day)
Objectany expression
Nullnull
Containers
Set<T> { element1,… }
List<T> [ element1,… ]
List<Integer> -5..81
1000..0
Map<K,V> [ key1 -> value1,… ]
empty map: [ -> ]
Other
Recordnew record_name()
new record_name(value1, value2,…)
new record_name(field2 -> value2, field4 -> value4,…)
Reference<T> &variable
Closure
{T,…: U}
{ -> expression }
{ x:Type, y -> expression }
Typetype(type_definition) record_name

Operators
Assignment
Assignmentvariable := expression
Arithmetic
Addition+
Subtraction-
Increment++var var++
Decrement--var var--
Multiplication*
Division/
Modulo%
Exponentiation**
Boolean
Equality == != <>
Comparison< <= > >= <=> instanceof
Negationnot !
Conjunctionand &&
Disjunctionor ||
Exclusive disjunction xor
Pattern matching string like pattern
Collection containment item in collection
Other
String concatenation +
Parenthetical grouping (precedence) ( )
Compound Assignment
Addition +=
Subtraction -=
Multiplication *=
Division /=
Modulo %=

Access
Set element set[index]
List element list[index]
Map element map[key]
Record field record.field
Record safe field record?.field
Record reference field reference.field
Record ref. safe field reference?.field
Enumeration literal enum.literal
Dereferencing*reference
Namespace separator ::
Function call function|T1,…|(argument1, argument2,…)
function|T1,…|(name1->value1, name2->value2,…)
Closure invocation closure(argument1, argument2,…)
Method call object.method(argument1, argument2,…)

Special constructs
Local variable def type name
with assignment:
def type name := expression
Comments// single-line comment
/*
multi-line comment
*/
Assignmentvariable := expression
Expression variable def type name
final variable:
final type name
with assignment:
def type name := expression
Expression chaining expr1 ; expr2 ; expr3 ; …
Blockbegin expression end
Error throw error(string_expression)
Try-catch try expression
catch exception,… -> expression

end
Castexpression as type

Control flow
If-then
If-then-else
If-then-elsif-then
If-then-elsif-then-else
if condition1 then
  expression1
elsif condition2 then
  expression2

else
  expressionN
end
Ternary conditional condition ? expression1 : expression2
Null-coalescing expression1 ?? expression2
Switchswitch arg_expression
case c1, c2,… -> expression1
  …
default -> defaultExpression
end
While looping while condition do
  expression
end
For looping for(init; condition; update) do
  expression
end
Collection iteration foreach type iterator in collection do
  expression
end
Looping break
(in while,for and foreach)
break
Looping iteration skipping
(in while, for and foreach)
continue

Function definition file
Function/** description */
annotations
visibility <T,…> ReturnType function(Type1 param1,…)
body
Function body expression: { expression }
native: native java_method_path
Annotations@SideEffect
@Deprecated
@Disabled
@Status(statusName)
@Meta(key1->value1, key2->value2,…)
Visibilitypublic
private
Function parameter optional: Type name
mandatory: Type name*
variadic: Type... name
default value: Type name = defaultValueExpression

Method definition file
Record methods Record {
methods
}
Method/** description */
annotations
visibility modifiers <T,…> ReturnType function(Type1 param1, Type2 param2*,…)
body
Note: Annotations and parameters follow syntax of function.
Constructor/** description */
annotations
visibility Record(Type1 param1, Type2 param2*,…)
body
Note: Annotations, parameters and body follow syntax of function; visibility follows syntax of method.
Method body expression: { expression }
native: native java_method_path
abstract: ;
Visibilitypublic
private
protected
Modifiersabstract
static
Access (only in method)
This instance this
Super-type members super.method(argument,…)
Access (only as first statement of constructor)
Calling constructor of this record this(argument,…)
Calling constructor of supertype super(argument,…)