Expressions
You can add expressions strings to perform functions in Amazon Lex V2. This table shows the syntax and examples that can be used in SRGS expressions.
Expression type | Syntax | Example | Supported? |
---|---|---|---|
Regular expression literal | String literal containing valid regex special characters |
|
No |
Function | function functionName(parameters) {
functionBody} |
|
No |
Delete | delete expression |
|
No |
Void | void expression |
|
No |
Typeof | typeof expression |
|
No |
Member index | expression [ expressions
] |
|
Yes |
Member dot | expression . identifier |
|
yes |
Arguments | expression (arguments) |
|
Yes |
Post increment | expression++ |
|
Yes |
Post decrement | expression-- |
|
Yes |
Pre increment | ++expression |
|
Yes |
Pre decrement | --expression |
|
Yes |
Unary plusĀ / Unary minus | +expression /
-expression |
|
Yes |
Bit not | ~ expression |
|
Yes |
Logical not | ! expression |
|
Yes |
Multiplicative | expression ('*' | '/' | '%')
expression |
|
Yes |
Additive | expression ('+' | '-')
expression |
|
Yes |
Bit shift | expression ('<<' | '>>' | '>>>')
expression |
|
Yes |
Relative | expression ('<' | '>' | '<=' |
'>=') expression |
|
Yes |
In | expression in expression |
|
Yes |
Equality | expression ('==' | '!=' | '===' |
'!===') expression |
|
Yes |
Bit and / xor / or | expression ('&' | '^' | '|')
expression |
|
Yes |
Logical and / or | expression ('&&' | '||')
expression |
|
Yes |
Ternary | expression ? expression :
expression |
|
Yes |
Assignment | expression = expression |
|
Yes |
Assignment operator | expression ('*=' | '/=' | '+=' | '-=' |
'%=') expression |
|
Yes |
Assignment bitwise operator | expression ('<<=' | '>>=' |
'>>>=' | '&=' | '^=' | '|=')
expression |
|
Yes |
Identifier | identifierSequence where
identifierSequence is a
sequence of valid characters |
|
Yes |
Null literal | null |
|
Yes |
Boolean literal | true | false |
|
Yes |
String literal | 'string' / "string" |
|
Yes |
Decimal literal | integer [.] digits
[exponent] |
|
Yes |
Hex literal | 0 (x | X)[0-9a-fA-F] |
|
Yes |
Octal literal | O [0-7] |
|
Yes |
Array literal | [ expression, ... ] |
|
Yes |
Object literal | {property: value, ...} |
|
Yes |
Parenthesized | ( expressions ) |
|
Yes |