The "Unknown:"s below indicate that an entry is incomplete.
- Category: Object Oriented, Dynamically typed, Has anonymous functions
- Various
{ ... } block (grouping statements, especially when statements are not expressions)
nothing needed breaking lines (useful when end-of-line and/or indentation has a special meaning)
/* ... */ commenting (non nestable)
// commenting (until end of line)
< > <= >= comparison
/** ... */(1) documentation comment (non nestable)
== === != !==(2) equality / inequality (shallow)
VM.garbageCollect() force garbage collection
( ... ) grouping expressions
eval runtime evaluation
case-sensitive tokens (case-sensitivity (keywords, variable identifiers...))
[$A-Za-z_\x7f-\uffff][$\w\x7f-\uffff]* tokens (variable identifier regexp)
= variable assignment or declaration (assignment)
var variable assignment or declaration (declaration)
Unknown:
information about the current line and file
comparison (returns 3 values (i.e. inferior, equal or superior))
comparison (min / max (binary or more))
- Functions
function(a, b) { ... } anonymous function
f(a,b,...) function call
f() function call (with no parameter)
__noSuchMethod__(3) function called when a function is not defined (in dynamic languages)
function f(para1, para2) { ... } function definition
return(4) function return value (breaks the control flow)
Unknown:
runtime inspecting the caller information
- Control Flow
continue / break breaking control flow (continue / break)
return(4) breaking control flow (returning a value)
try a catch (exn) ... exception (catching)
throw exception (throwing)
if (c) ... if_then
if (c) b1 else b2 if_then_else
c ? b1 : b2 if_then_else
do ... while (!c) loop (do something until condition)
for loop (for "a la C" (while + initialisation))
for (i = 10; i >= 1; i--) ... loop (for each value in a numeric range, 1 decrement)
for (i = 1; i <= 10; i++) ... loop (for each value in a numeric range, 1 increment (see also the entries about ranges))
for (i = 1; i <= 10; i += 2) ... loop (for each value in a numeric range, free increment)
while (c) ... loop (while condition do something)
switch (val) {
case v1: ...; break;
case v2: case v3: ...; break;
default: ...;
}
multiple selection (switch)
, sequence
; sequence
end-of-line sequence
- Object Oriented & Reflexivity
this current instance
typeof get the type/class corresponding to an object/instance/value
delete manually call an object's destructor
object.method(para) method invocation
object.method() method invocation (with no parameter)
new class_name(...) object creation
instanceof testing class membership
Unknown:
object cloning
class declaration
methods available
inheritance
has the method
accessing parent method
- Strings
charAt accessing n-th character
fromCharCode ascii to character
charCodeAt character to ascii
toString convert something to a string (see also string interpolation)
String convert something to a string (see also string interpolation)
"" + e convert something to a string (see also string interpolation)
slice extract a substring
mid$ extract a substring
indexOf locate a substring
lastIndexOf locate a substring (starting at the end)
write simple print (on strings)
writeln simple print (on strings)
+ string concatenation
== !=(Vimscript: whether or not == and != are case-sensitive depends on user settings.) string equality & inequality
length string size
"\n" strings (end-of-line (without writing the real CR or LF character))
'...' strings (with no interpolation of variables)
"..." strings (with no interpolation of variables)
String type name
toUpperCase / toLowerCase upper / lower case character
toUpperCase / toLowerCase uppercase / lowercase / capitalized string
Unknown:
strings (with interpolation of variables)
multi-line
serialize (marshalling)
unserialize (un-marshalling)
- Booleans
false false value
null false value
undefined false value
NaN false value
"" false value
! logical not
|| / && logical or / and (short circuit)
true true value
boolean type name
- Bags and Lists
unshift adding an element at the beginning (list cons) (side-effect)
push adding an element at the end (side-effect)
for (var v in l) { ... } for each element do something
shift get the first element and remove it
pop get the last element and remove it
in is an element in the list
l.join(s) join a list of strings in a string using a glue string
concat list concatenation
[ a, b, c ](6) list constructor
Array(a, b, c)(7) list constructor
length list size
a[i] list/array indexing
reverse reverse
Unknown:
adding an element at index
transform a list (or bag) in another one
transform two lists in parallel
find an element
keep elements
is the predicate true for an element
is the predicate true for every element
f(... f(f(init, e1), e2) ..., en)
- Various Data Types
h[k] dictionary (access: read/write)
h.k dictionary (access: read/write)
{ a: b, c: d } dictionary (constructor)
k in h dictionary (has the key ?)
delete dictionary (remove by key)
|| optional value (null coalescing)
null optional value (null value)
v optional value (value)
. record (selector)
r["field"] record (selector)
Unknown:
computable tuple (these are a kind of immutable lists playing a special role in parameter passing) (empty tuple)
computable tuple (these are a kind of immutable lists playing a special role in parameter passing) (1-uple)
computable tuple (these are a kind of immutable lists playing a special role in parameter passing) (using a tuple for a function call)
dictionary (list of keys)
dictionary (list of values)
dictionary (merge)
range
- Mathematics
+ / - / * / / addition / subtraction / multiplication / division
& / | / ^ bitwise operators (and / or / xor)
~ bitwise operators (bitwise inversion)
<< / >> / >>> bitwise operators (left shift / right shift / unsigned right shift)
pow exponentiation (power)
log logarithm (base e)
% modulo (modulo of -3 / 2 is -1)
- negation
1000., 1E3 numbers syntax (floating point)
07, 0xf numbers syntax (integers in base 2, octal and hexadecimal)
1000 numbers syntax (integers)
sqrt / exp / abs square root / e-exponential / absolute value
sin / cos / tan trigonometry (basic)
asin / acos / atan(9) trigonometry (inverse)
int / round / floor / ceil truncate / round / floor / ceil
Unknown:
random (random number)
random (seed the pseudo random generator)
operator priorities and associativities
logarithm (base 10)
.