 |
| Variable substitution explained |
|
Since ESC isn't ECMAScript or DOM-aware on its own, it to has manually be given awareness of what is
ECMAScript and DOM related and what is not in the matter of keywords, statements, host specific intrinsics
and other native members etc.
|
| |
|
This is achieved by having builtin maps containing all native known words and during processing
evaluate whether found wordboundaries (A-Z, `$´ and `_´) encountered in the stream that
appears having top-level DOM priority or statement/keyword status are to be subjected for
substitution or not and if it is safe to remove whitespace between a pair of words.
|
| |
|
If the processed word doesn't have a match in any of the maps, it'll get substituted globally
with a new name. These new names are stored per session and any identical word coming up ahead will
be substituted with the very same name it previously was assigned.
|
| |
|
Substitution-names are assigned incrementally by looking up a session counter and gets the format
`$xx´ where `xx´ is an hexadecimal representation of the current counter-status
beginning from 00 ($00, $01, .., $f00f). Note that words having a length less than four (4) chars
are not substituted since they wouldn't have any impact of decreasing the total size, rather the opposite.
|
| |
|
To further being able to control the substitution engine,
there are two custom pluggable maps that you can use, namely 'bless.map' and 'mangle.map'.
They are picked up and taken into account by ESC at startup if present in the same directory
as ESC. Note that these maps does not exist by default, you have to create them and name them accordingly,
thus *pluggable*. The deal is you use only one of them at a time, enabling both kindof defeats the purpose.
If present, each introduce following additional features:
|
| |
 |
| bless.map |
|
Entries herein represent variable-names that you explicitly NOT want to have mangled
by the substitution engine. Names are entered ONE per line. Comments MUST be preceeded by
a '#' or ';'. Following rules apply:
|
| |
-
Any variable not present here or in the built-in maps WILL be subjected for name-mangling.
-
Method names are blessed by default and are not subjected for
mangling unless prefixed with [$_].
-
Any variable or member prefixed with [$_] are substituted unless present.
|
| |
 |
| mangle.map |
|
If this file is found in the same directory as ESC and contains atlest ONE entry,
ESC will invert its substitution behavior as following:
|
| |
-
Variable-names are ONLY substituted if present in this map.
-
Method-names ARE substituted if present in this map.
-
Member and method-names prefixed with [$_] are substituted as normal unless specified.
|
| |
| |