diff options
author | Dmitry Prokashev | 2016-05-28 21:59:28 +0200 |
---|---|---|
committer | Dmitry Prokashev | 2016-05-28 21:59:28 +0200 |
commit | 0d2ed3f1e0a80d20182bea8b530c7dfd3ad01696 (patch) | |
tree | 5129830e4b34be2a39f653a9179238ccb40ffd28 | |
parent | 593ba73adcc47bac577631b4aae0575f1d16a94b (diff) |
refactored for minification
-rw-r--r-- | microlight.js | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/microlight.js b/microlight.js index 9ea99bc..010b6a1 100644 --- a/microlight.js +++ b/microlight.js | |||
@@ -1,6 +1,6 @@ | |||
1 | /** | 1 | /** |
2 | * @fileoverview microlight - syntax highlightning library | 2 | * @fileoverview microlight - syntax highlightning library |
3 | * @version 0.0.1 | 3 | * @version 0.0.2 |
4 | * | 4 | * |
5 | * @license MIT, see http://github.com/asvd/microlight | 5 | * @license MIT, see http://github.com/asvd/microlight |
6 | * @copyright 2016 asvd <heliosframework@gmail.com> | 6 | * @copyright 2016 asvd <heliosframework@gmail.com> |
@@ -120,13 +120,13 @@ | |||
120 | ).setAttribute('style', [ | 120 | ).setAttribute('style', [ |
121 | // 0: not formatted | 121 | // 0: not formatted |
122 | '', | 122 | '', |
123 | // 1: punctuation | 123 | // 1: keywords |
124 | textShadow + _0px_0px+9+pxColor + alpha * .7 + '),' + | ||
125 | _0px_0px+2+pxColor + alpha * .4 + brace, | ||
126 | // 2: punctuation | ||
124 | opacity + 6 + | 127 | opacity + 6 + |
125 | textShadow + _0px_0px+7+pxColor + alpha / 4 + '),' + | 128 | textShadow + _0px_0px+7+pxColor + alpha / 4 + '),' + |
126 | _0px_0px+3+pxColor + alpha / 4 + brace, | 129 | _0px_0px+3+pxColor + alpha / 4 + brace, |
127 | // 2: keywords | ||
128 | textShadow + _0px_0px+9+pxColor + alpha * .7 + '),' + | ||
129 | _0px_0px+2+pxColor + alpha * .4 + brace, | ||
130 | // 3: strings and regexps | 130 | // 3: strings and regexps |
131 | opacity + 7 + | 131 | opacity + 7 + |
132 | textShadow + _3px_0px_5+pxColor + alpha / 5 + '),-' + | 132 | textShadow + _3px_0px_5+pxColor + alpha / 5 + '),-' + |
@@ -140,14 +140,14 @@ | |||
140 | // not formatted | 140 | // not formatted |
141 | !tokenType ? 0 : | 141 | !tokenType ? 0 : |
142 | // punctuation | 142 | // punctuation |
143 | tokenType < 3 ? 1 : | 143 | tokenType < 3 ? 2 : |
144 | // comments | 144 | // comments |
145 | tokenType > 6 ? 4 : | 145 | tokenType > 6 ? 4 : |
146 | // regex and strings | 146 | // regex and strings |
147 | tokenType > 3 ? 3 : | 147 | tokenType > 3 ? 3 : |
148 | // otherwise tokenType == 3, (key)word | 148 | // otherwise tokenType == 3, (key)word |
149 | // (2 if regexp matches, 0 otherwise) | 149 | // (1 if regexp matches, 0 otherwise) |
150 | 2 * /^(a(bstract|lias|nd|rguments|rray|s(m|sert)?|uto)|b(ase|egin|ool(ean)?|reak|yte)|c(ase|atch|har|hecked|lass|lone|ompl|onst|ontinue)|de(bugger|cimal|clare|f(ault|er)?|init|l(egate|ete)?)|do|double|e(cho|ls?if|lse(if)?|nd|nsure|num|vent|x(cept|ec|p(licit|ort)|te(nds|nsion|rn)))|f(allthrough|alse|inal(ly)?|ixed|loat|or(each)?|riend|rom|unc(tion)?)|global|goto|guard|i(f|mp(lements|licit|ort)|n(it|clude(_once)?|line|out|stanceof|t(erface|ernal)?)?|s)|l(ambda|et|ock|ong)|m(icrolight|odule|utable)|NaN|n(amespace|ative|ext|ew|il|ot|ull)|o(bject|perator|r|ut|verride)|p(ackage|arams|rivate|rotected|rotocol|ublic)|r(aise|e(adonly|do|f|gister|peat|quire(_once)?|scue|strict|try|turn))|s(byte|ealed|elf|hort|igned|izeof|tatic|tring|truct|ubscript|uper|ynchronized|witch)|t(emplate|hen|his|hrows?|ransient|rue|ry|ype(alias|def|id|name|of))|u(n(checked|def(ined)?|ion|less|signed|til)|se|sing)|v(ar|irtual|oid|olatile)|w(char_t|hen|here|hile|ith)|xor|yield)$/[test](token) | 150 | + /^(a(bstract|lias|nd|rguments|rray|s(m|sert)?|uto)|b(ase|egin|ool(ean)?|reak|yte)|c(ase|atch|har|hecked|lass|lone|ompl|onst|ontinue)|de(bugger|cimal|clare|f(ault|er)?|init|l(egate|ete)?)|do|double|e(cho|ls?if|lse(if)?|nd|nsure|num|vent|x(cept|ec|p(licit|ort)|te(nds|nsion|rn)))|f(allthrough|alse|inal(ly)?|ixed|loat|or(each)?|riend|rom|unc(tion)?)|global|goto|guard|i(f|mp(lements|licit|ort)|n(it|clude(_once)?|line|out|stanceof|t(erface|ernal)?)?|s)|l(ambda|et|ock|ong)|m(icrolight|odule|utable)|NaN|n(amespace|ative|ext|ew|il|ot|ull)|o(bject|perator|r|ut|verride)|p(ackage|arams|rivate|rotected|rotocol|ublic)|r(aise|e(adonly|do|f|gister|peat|quire(_once)?|scue|strict|try|turn))|s(byte|ealed|elf|hort|igned|izeof|tatic|tring|truct|ubscript|uper|ynchronized|witch)|t(emplate|hen|his|hrows?|ransient|rue|ry|ype(alias|def|id|name|of))|u(n(checked|def(ined)?|ion|less|signed|til)|se|sing)|v(ar|irtual|oid|olatile)|w(char_t|hen|here|hile|ith)|xor|yield)$/[test](token) |
151 | ]); | 151 | ]); |
152 | 152 | ||
153 | node[appendChild](_document.createTextNode(token)); | 153 | node[appendChild](_document.createTextNode(token)); |