Lexical structure of the language is very close to the JavaScript with some minor additions (e.g. const and type constructions).
Identifiers (nmtokens) start with a alphabetic character, '_' or '$' followed by any number of alphabetic characters, '_', '$' or digits ([0-9]).
nmtoken -> [a-zA-Z_$]+[a-zA-Z_$0-9]*
TIScript uses following identifiers as reserved words:
type function var if else while return for break continue do switch case default null super new try catch finally throw typeof instanceof in property const get set like
The following operators are supported by the language:
<= == != >= << >> && || ++ -- += -= *= /= %= &= |= ^= <<= >>= %> <% === !== + - * / ^ | &
Tokens that have special meaning:
.. [] {} # : ?
TIScript accepts integer numbers, floating point numbers, stings literals, symbols, regexp literals, stream expressions and binary literals.
integer-literal -> [0-9]+ | '0x' [0-9A-Fa-f]+ | ''' [.] ''' float-literal -> [0-9]+ '.' [0-9]+ float-literal -> [0-9]+ '.' 'e'|'E' '+'|'-' [0-9]+ string-literal -> '"' [.]* '"' symbol-literal -> '#' [a-zA-Z_$0-9-]* regexp-literal -> '/' <single line regular expression> ['/ig'] ';' stream-literal -> '%>' <text> '<%' binary-literal -> '*' [A–Za–z0–9+/=]+ ';'Examples:
34 - Integer
0xAFED1234 - Integer
'f' - Integer, code point value
1.52 - Float
1.e2 - Float
1.e-2 - Float
"Hello world!" - String
#foo - Symbol
Comment is a sequence of characters ignored by compiler. There are two types of comments:
'//' <text-no-crlf> end-of-line
'/*' <text> '*/'