diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2025-04-06 14:20:18 -0400 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2025-04-06 14:20:18 -0400 |
| commit | 2bb2ff871fa1761478442bec5f6a32c9428360a1 (patch) | |
| tree | 9b73df7a0c50c02353ae7bca7c2cd54788ef0077 /examples/base64/base64.tm | |
| parent | 59845e610f2c90474f34079d27b5f1e07071ded4 (diff) | |
Change method calls to use `foo.baz()` instead of `foo:baz()`
Diffstat (limited to 'examples/base64/base64.tm')
| -rw-r--r-- | examples/base64/base64.tm | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/examples/base64/base64.tm b/examples/base64/base64.tm index e2f5ea19..714e223b 100644 --- a/examples/base64/base64.tm +++ b/examples/base64/base64.tm @@ -1,6 +1,6 @@ # Base 64 encoding and decoding -_enc := "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/":bytes() +_enc := "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".bytes() _EQUAL_BYTE := Byte(0x3D) @@ -25,7 +25,7 @@ _dec : [Byte] = [ lang Base64: func parse(text:Text -> Base64?): - return Base64.from_bytes(text:bytes()) + return Base64.from_bytes(text.bytes()) func from_bytes(bytes:[Byte] -> Base64?): output := &[Byte(0) for _ in bytes.length * 4 / 3 + 4] @@ -61,10 +61,10 @@ lang Base64: return Base64.from_text(Text.from_bytes(output[]) or return none) func decode_text(b64:Base64 -> Text?): - return Text.from_bytes(b64:decode_bytes() or return none) + return Text.from_bytes(b64.decode_bytes() or return none) func decode_bytes(b64:Base64 -> [Byte]?): - bytes := b64.text:bytes() + bytes := b64.text.bytes() output := &[Byte(0) for _ in bytes.length/4 * 3] src := Int64(1) dest := Int64(1) @@ -83,14 +83,14 @@ lang Base64: dest += 3 while output[-1] == 0xFF: - output[] = output:to(-2) + output[] = output.to(-2) return output[] func main(input=(/dev/stdin), decode=no): if decode: - b := Base64.from_text(input:read()!) - say(b:decode_text()!) + b := Base64.from_text(input.read()!) + say(b.decode_text()!) else: - text := input:read()! + text := input.read()! say(Base64.parse(text)!.text) |
