aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorBruce Hill <bitbucket@bruce-hill.com>2018-08-29 15:59:30 -0700
committerBruce Hill <bitbucket@bruce-hill.com>2018-08-29 16:00:04 -0700
commit811fdd685670d2eb8c6bcb9e6e103e57bf402ca8 (patch)
treec599fd7a609159c2ec50a30f1131000070e8eb03 /lib
parent22495c7d708b4950b83c5bc9b97806e19cd1fcfa (diff)
Tweaked version 3.6 to include deprecating list append/removal functions
in favor of using a method call style.
Diffstat (limited to 'lib')
-rw-r--r--lib/base64.nom26
1 files changed, 13 insertions, 13 deletions
diff --git a/lib/base64.nom b/lib/base64.nom
index 2b7e22e..fb12319 100644
--- a/lib/base64.nom
+++ b/lib/base64.nom
@@ -21,22 +21,22 @@ action [base64 %str, base64 encode %str, %str base64]:
%chars = []
for %i in 1 to (length of %str) via 3:
%bytes = [=lua "\%str:byte(\%i, \(%i + 2))"]
- add %b64_str.(((%bytes.1 & 252) >> 2) + 1) to %chars
+ %chars::add %b64_str.(((%bytes.1 & 252) >> 2) + 1)
if (length of %bytes) is:
3:
- add %b64_str.(((%bytes.1 & 3) << 4) + ((%bytes.2 & 240) >> 4) + 1) to %chars
- add %b64_str.(((%bytes.2 & 15) << 2) + ((%bytes.3 & 192) >> 6) + 1) to %chars
- add %b64_str.((%bytes.3 & 63) + 1) to %chars
+ %chars::add %b64_str.(((%bytes.1 & 3) << 4) + ((%bytes.2 & 240) >> 4) + 1)
+ %chars::add %b64_str.(((%bytes.2 & 15) << 2) + ((%bytes.3 & 192) >> 6) + 1)
+ %chars::add %b64_str.((%bytes.3 & 63) + 1)
2:
- add %b64_str.(((%bytes.1 & 3) << 4) + ((%bytes.2 & 240) >> 4) + 1) to %chars
- add %b64_str.(((%bytes.2 & 15) << 2) + 1) to %chars
- add "=" to %chars
+ %chars::add %b64_str.(((%bytes.1 & 3) << 4) + ((%bytes.2 & 240) >> 4) + 1)
+ %chars::add %b64_str.(((%bytes.2 & 15) << 2) + 1)
+ %chars::add "="
1:
- add %b64_str.(((%bytes.1 & 3) << 4) + 1) to %chars
- add "=" to %chars
- add "=" to %chars
+ %chars::add %b64_str.(((%bytes.1 & 3) << 4) + 1)
+ %chars::add "="
+ %chars::add "="
return (%chars joined)
@@ -45,10 +45,10 @@ action [decode base64 %str, %str base64 decoded, base64 decode %str]:
%chars = []
for %i in 1 to (length of %str) via 4:
%indices = (%reverse_b64.(%str.%) for % in %i to (%i + 3))
- add (chr ((%indices.1 << 2) + ((%indices.2 & 48) >> 4))) to %chars
+ %chars::add (chr ((%indices.1 << 2) + ((%indices.2 & 48) >> 4)))
if (%str.(%i + 2) == "="): stop
- add (chr (((%indices.2 & 15) << 4) + ((%indices.3 & 60) >> 2))) to %chars
+ %chars::add (chr (((%indices.2 & 15) << 4) + ((%indices.3 & 60) >> 2)))
if (%str.(%i + 3) == "="): stop
- add (chr (((%indices.3 & 3) << 6) + %indices.4)) to %chars
+ %chars::add (chr (((%indices.3 & 3) << 6) + %indices.4))
return (%chars joined)