/Expression

Statement runtime bridges with Objective C

Primary LanguageObjective-CMIT LicenseMIT

Expression

Statement runtime bridges with Objective C, which is faster than JavaScript Core.

Operator

+ - ~ * / & | && || % < <= > >= == != ?: ( )

Operand

100, 3.14, '万', true, false, max(), min(), func()

Operand Extend

'string'
any + 'string'=any.description+'string' //@any, number, string
obj1 == obj2 //[obj1 isEqual:obj2]
obj1 != obj2 //![obj1 isEqual:obj2]

switch-case

switch(expression)
case constNumber:
    expression
case constString:
    expression
default:
    expression

if-else

if (expression)
    expression
elif (expression)
    expression
else
    expression

switch-case , if-else can't contains each other.

Assignment

variable.assign(value)
#id.setVisibility(true) //#id.visibility=true,equivalent [idObj setVisibility:true]

Internal functions

min(a,b)
max(a, b)
split('str', 'seperator', index) //string
len(arg) //array.count, dictionary.count, string.length
ele(array, index) //array[index]
get(dict, key) //dict[key]
dict(key1, value1, key2, value2) //dict
array(element1, element2) //array
round(number) //round()
ceil(number) //ceil()
floor(number) //floor
decimal(decimal, number) //"%.number", decimal
joined(array, 'seperator')
onePixel() //1px on any device
isiOS() //true on iOS, false on Android
isAndroid() //true on Android, false on iOS
truncate(string, count, token) //if string.length>count string=string[0:count]+token

Font

Helvetica 30 italic
System 30 italic
30 italic
30

String

abc{expression}
{expression}
abc{expression1}efg{expression2}

{expression} in string

string, url, alignment, breakmode, etc. value of expression expected to be string

Color

rgba(r,g,b,a) //Color(r/255.0, g/255.0, b/255.0, a)
rgb(r,g,b)
#ffffff
#fff
white

literals

black darkGray lightGray white gray red green blue cyan yellow magenta orange purple brown clear

Coordinate

<View left="previous.right+10" right="next.left-10"/>

Size

<Label width="auto" height="100%">
<View width="auto" height="width">
    <UIView/>
</View>

Examples

a+3
max(b*3, 10)
a||b
a>10000?a/10000.0+'万':(a==0?:'评':a)