Skip to content

Latest commit

 

History

History

basestar-expression

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

Expressions

Arithmetic expressions

Modulo

Syntax:

lhs % rhs

Parameters:

  • lhs:number Left hand operand
  • rhs:number Right hand operand

Subtract

Syntax:

lhs - rhs

Parameters:

  • lhs:number Left hand operand
  • rhs:number Right hand operand

Negate

Syntax:

-operand

Parameters:

  • operand:number Operand

Divide

Numeric division

Syntax:

lhs / rhs

Parameters:

  • lhs:number Left hand operand
  • rhs:number Right hand operand

Pow

Numeric exponentiation

Syntax:

lhs ** rhs

Parameters:

  • lhs:number Left hand operand
  • rhs:number Right hand operand

Add

Numeric addition/String concatenation

Syntax:

lhs + rhs

Parameters:

  • lhs:number|string Left hand operand
  • rhs:number|string Right hand operand

Return type: number|string

Multiply

Numeric multiplication

Syntax:

lhs * rhs

Parameters:

  • lhs:number Left hand operand
  • rhs:number Right hand operand

Bitwise expressions

Bitwise Left-Shift

Syntax:

lhs << rhs

Parameters:

  • lhs:integer Left hand operand
  • rhs:integer Right hand operand

Bitwise Right-Shift

Syntax:

lhs >> rhs

Parameters:

  • lhs:integer Left hand operand
  • rhs:integer Right hand operand

Bitwise And

Syntax:

lhs & rhs

Parameters:

  • lhs:integer Left hand operand
  • rhs:integer Right hand operand

Bitwise Or

Syntax:

lhs | rhs

Parameters:

  • lhs:integer Left hand operand
  • rhs:integer Right hand operand

Bitwise Xor

Syntax:

lhs ^ rhs

Parameters:

  • lhs:integer Left hand operand
  • rhs:integer Right hand operand

Bitwise Not

Syntax:

~operand

Parameters:

  • operand:integer Operand

Call

Syntax:

with(args...)

Parameters:

  • with:any Lambda callable
  • args:args Function arguments

Call

Syntax:

with.member(...args)

Parameters:

  • with:any Object
  • member:member Member name
  • args:args Function arguments

Comparison expressions

Less Than

Syntax:

lhs < rhs

Parameters:

  • lhs:any Left hand operand
  • rhs:any Right hand operand

Equals

Syntax:

lhs == rhs

Parameters:

  • lhs:any Left hand operand
  • rhs:any Right hand operand

Compare

Syntax:

lhs <=> rhs

Parameters:

  • lhs:any Left hand operand
  • rhs:any Right hand operand

Greater Than or Equal

Syntax:

lhs >= rhs

Parameters:

  • lhs:any Left hand operand
  • rhs:any Right hand operand

Greater Than

Syntax:

lhs > rhs

Parameters:

  • lhs:any Left hand operand
  • rhs:any Right hand operand

Not Equal

Syntax:

lhs != rhs

Parameters:

  • lhs:any Left hand operand
  • rhs:any Right hand operand

Less Than or Equal

Syntax:

lhs <= rhs

Parameters:

  • lhs:any Left hand operand
  • rhs:any Right hand operand

Functional expressions

If-Else

Ternary operator

Syntax:

predicate ? then : otherwise

Parameters:

  • predicate:boolean Left hand operand
  • then:expression Evaluated if true
  • otherwise:expression Evaluated if false

Member

Syntax:

with.member

Parameters:

  • with:any Left hand operand
  • member:collection Right hand operand

Coalesce

Return the first non-null operand

Syntax:

lhs ?? rhs

Parameters:

  • lhs:any Left hand operand
  • rhs:any Right hand operand

In

Set membership

Syntax:

lhs in rhs

Parameters:

  • lhs:any Left hand operand
  • rhs:collection Right hand operand

Syntax:


Parameters:

Lambda

Syntax:

(args...) -> yield

Parameters:

  • args:string
  • yield:expression

Index

Syntax:

lhs[rhs]

Parameters:

  • lhs:collection|object Left hand operand
  • rhs:any Right hand operand

With

Call the provided expression with additional bound variables

Syntax:


Parameters:

Iterator expressions

Iterate

Create an iterator

Syntax:

key:value of expr

Parameters:

  • key:identifier Name-binding for key
  • value:identifier Name-binding for value
  • expr:map Map to iterate
value of expr

Parameters:

  • value:identifier Name-binding for value
  • expr:collection Collection to iterate

For All

Universal Quantification: Returns true if the provided predicate is true for all iterator results

Syntax:

lhs for all rhs

Parameters:

  • lhs:expression Predicate
  • rhs:iterator Iterator

For Any

Existential Quantification: Returns true if the provided predicate is true for any iterator result

Syntax:

lhs for any rhs

Parameters:

  • lhs:expression Predicate
  • rhs:iterator Iterator

Set Comprehension

Create a set from an iterator

Syntax:

[yield for iter]

Parameters:

  • yield:expression Value-yielding expression
  • iter:iterator Iterator

Object Comprehension

Create an object from an iterator

Syntax:

{yieldKey:yieldValue for iter}

Parameters:

  • yieldKey:expression Key-yielding expression
  • yieldValue:expression Value-yielding expression
  • iter:iterator Iterator

Array Comprehension

Create an array from an iterator

Syntax:

[yield for iter]

Parameters:

  • yield:expression Value-yielding expression
  • iter:iterator Iterator

Where

Filter an iterator using a predicate

Syntax:

lhs where rhs

Parameters:

  • lhs:iterator Iterator
  • rhs:predicate Expression to be evaluated for each iterator

Literal expressions

Literal Array

Create an array by providing values

Syntax:

[args...]

Parameters:

  • args:expression Array values

Parameters:

Literal Set

Create a set by providing values

Syntax:

{args...}

Parameters:

  • args:expression Array values

Literal Object

Create an object by providing keys and values

Syntax:


Parameters:

Logical expressions

Or

Logical Disjunction

Syntax:


Parameters:

lhs || rhs

Parameters:

  • lhs:any Left hand operand
  • rhs:any Right hand operand

Parameters:

Not

Logical Complement

Syntax:

!operand

Parameters:

  • operand:any Operand

And

Logical Conjunction

Syntax:


Parameters:

lhs && rhs

Parameters:

  • lhs:any Left hand operand
  • rhs:any Right hand operand

Parameters:

Text expressions

ILike

Case-insensitive wildcard match.

The supported syntax is as-per standard SQL with ESCAPE \

For example, % matches any number of characters and _ matches any single character

Syntax:

lhs ILIKE rhs

Parameters:

  • lhs:string Left hand operand
  • rhs:string Right hand operand

Syntax:


Parameters:

Syntax:


Parameters:

Syntax:


Parameters:

Syntax:


Parameters:

Syntax:


Parameters:

Like

Case-sensitive wildcard match.

The supported syntax is as-per standard SQL with ESCAPE \

For example, % matches any number of characters and _ matches any single character

Syntax:

lhs LIKE rhs

Parameters:

  • lhs:string Left hand operand
  • rhs:string Right hand operand