{name}(\.{name}|\.?\[{pointer}\])+
count: {array}\s*?
append: ^\s*{array}\s*\.\.\s*{expression}\s*$
In Eas, arrays are
variables that contain other variables.
You can write them simply with a
point:
arrayname.key
Or you can use the format of
V
Pointers / Variable Variables:
arrayname["key"]
(No space is allowed
between the arrayname and the key pointer.)
Arrays can be
nested:
main.sub.key
-- and so on
You can combine the two key formats freely:
main["sub"].key
main.sub["key"]
main["sub"]["key"]
Keys are always converted to string:
a[0] = a["0"]
The key cannot be empty, so
writing to a[""] for instance does nothing.
Get the
count of (direct) elements:
main.sub?
--
empty arrays count as unset
To
append,
i.e. set the next free integer-ID element:
arrayname .. value
To
unset an array entry or subarray:
arrayname.key ?
-- as a full line
Eas:
array.key
main?
main.sub?
friends .. "Kitty"
mya[19] ?
PHP:
$array["key"]
count($main)
count($main["sub"])
$friends[]="Kitty";
unset($mya[19]);
While in JS
main.sub.length
equals PHP's
count($main["sub"])
for natural-number key arrays,
other arrays are considered "objects" in JS,
and they require the following
(which also works with natural-number keys):
function count(a){
var c=0,i;
for(i in a)c++;
return c;
}
...
count(main.sub)
...