|
|
|
# CVU Expression Language
|
|
|
|
|
|
|
|
## Arithmetic Operators
|
|
|
|
```python
|
|
|
|
(5 + 10 * 4 - 3 / 10) / 10 # result: 4.470000000000001
|
|
|
|
```
|
|
|
|
|
|
|
|
## And and Or conditional statements
|
|
|
|
```python
|
|
|
|
true and false # result: false
|
|
|
|
true or false # result: true
|
|
|
|
```
|
|
|
|
|
|
|
|
## Conditions
|
|
|
|
```python
|
|
|
|
true ? 'yes' : 'no' # result: 'yes
|
|
|
|
true ? false and true ? -1 : false or true ? 'yes' : 'no' : -1 # result: 'yes
|
|
|
|
```
|
|
|
|
|
|
|
|
## Variable Lookup and function execution
|
|
|
|
```python
|
|
|
|
.bar and bar.foo(10) and bar[foo = 10] or shouldNeverGetHere"
|
|
|
|
```
|
|
|
|
|
|
|
|
## Plus and minus variable modifier
|
|
|
|
```python
|
|
|
|
-5 + -(5+10) - +'5' # result: -25
|
|
|
|
```
|
|
|
|
|
|
|
|
## Negation
|
|
|
|
```python
|
|
|
|
!true # result: false
|
|
|
|
```
|
|
|
|
|
|
|
|
## Strings
|
|
|
|
```python
|
|
|
|
'asdadsasd\\'asdasd' # result: "asdadsasd'asdasd"
|
|
|
|
```
|
|
|
|
|
|
|
|
## Type conversion
|
|
|
|
```python
|
|
|
|
5 + '10.34' + true # result: 16.34
|
|
|
|
0 ? -1 : 1 ? '' ? -1 : 'yes' : -1 # result: -1
|
|
|
|
```
|
|
|
|
|
|
|
|
## String mode
|
|
|
|
```python
|
|
|
|
"Hello {fetchName()}!"
|
|
|
|
"Hello {.firstName} {.lastName}"
|
|
|
|
"{fetchName()} Hello"
|
|
|
|
```
|
|
|
|
|
|
|
|
## Example
|
|
|
|
```python
|
|
|
|
!(test + -5.63537) or 4/3 ? variable.func() : me.address[primary = true].country ? ((4+5 * 10) + test[10]) : 'asdads\\'asdad' + ''
|
|
|
|
``` |