Vocable Expression Language ¶
intaQt uses the Vocable Expression Language for defining expressions. The following sections provide examples of different supported expressions.
Property Accessors¶
A Property Accessor addresses one or more properties contained within an object.
Syntax
1 | <object Identifier>.<property Any> |
Parameters
-
object - The object's identifier
-
property - The property of the object
Example
1 | A.ringTone |
In the example above, A.ringtone
is a Context Variable, where the object A
is a phone and ringTone
is a subscriber property of A
.
Identifiers ¶
Identifiers describe variables or function names. They are comprised of:
-
letters -
A-Z a-z $ _
-
digits -
0 - 9
Example
1 | Given a phone as A |
In the example above, A
is the phone's identifier.
Note: The first character of an identifier must be a letter.
Functions ¶
A Function call contains and identifier followed by arguments contained within parentheses. Functions may also return generic objects. More information is available in Models and Functions.
Example 1
1 | logOutput("Hello World", 2) |
The example above calls the function logOutput
and passes on two arguments, "Hello World"
and 2
in the parentheses.
Note:
The function's name and the starting parenthesis must not be separated by Whitespace characters. Any Whitespace will result in the syntax error mismatched input '('
.
Example 2
1 | test.number |
number
attribute of the object called test
.
Arrays ¶
Arrays are lists of expressions that are accessed by using square brackets []
and the index position (for example, 2
) of the element.
Example
1 | [1, 2 + 3, 16 - 2 ] |
0
. In the example above, the number 1
stands at index 0
, while the calculation 2 + 3
stands at index 1
. The example below accesses the calculation 16 - 2
from the example above.
1 | myArray[2] |
16 - 2
from the examples above.
Maps ¶
A Map is a set of key-value pairs, where each key must have a unique identifier.
Syntax
1 | <key String> : <value Any> |
Parameters
-
key - A user defined name for the key
-
value - The values that comprise the key
Example
1 2 3 4 5 | myMap := { "balance" : 1700 "username" : "Batman" "flag" : true } |
Values can be accessed by using square brackets and the key. In the example below, the return value would be "Batman"
.
Example
1 | myMap["username"] |
Note: Maps do not necessarily return the key-value pairs in the same order that they were originally saved in.
Line Comments and Whitespace ¶
Line Comments can be defined by starting a line with a double slash (//
).
Example
1 | // This is a line comment
|
When using Line Comments, Whitespaces such as blanks, newlines, carriage returns, and tabulators are ignored.