Giter Club home page Giter Club logo

cherri's People

Contributors

electrikmilk avatar erenyenigul avatar josephshenton avatar mikeogezi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

cherri's Issues

Commented includes are still parsed

Describe the bug
When an include is commented the Cherri compiler still parses it.

To Reproduce

// #include "not_in_existence.cherri"

alert("Hello, world!")

Debug output

Parsing includes...
runtime: goroutine stack exceeds 1000000000-byte limit
runtime: sp=0x14020160370 stack=[0x14020160000, 0x14040160000]
fatal error: stack overflow

runtime stack:
runtime.throw({0x100f372df?, 0x100e20a18?})
        /opt/homebrew/opt/go/libexec/src/runtime/panic.go:1077 +0x40 fp=0x17203ed50 sp=0x17203ed20 pc=0x100e28140
runtime.newstack()
        /opt/homebrew/opt/go/libexec/src/runtime/stack.go:1107 +0x458 fp=0x17203ef00 sp=0x17203ed50 pc=0x100e423c8
traceback: unexpected SPWRITE function runtime.morestack
runtime.morestack()
        /opt/homebrew/opt/go/libexec/src/runtime/asm_arm64.s:316 +0x70 fp=0x17203ef00 sp=0x17203ef00 pc=0x100e57870

goroutine 1 [running]:
runtime.deductAssistCredit(0x40?)
        /opt/homebrew/opt/go/libexec/src/runtime/malloc.go:1271 +0x7c fp=0x14020160370 sp=0x14020160370 pc=0x100e00bcc
runtime.mallocgc(0x40, 0x100f7d600, 0x1)
        /opt/homebrew/opt/go/libexec/src/runtime/malloc.go:1002 +0xe4 fp=0x140201603e0 sp=0x14020160370 pc=0x100e003c4
runtime.makeslice(0x14003e7fbc0?, 0x0?, 0x100f6af20?)
        /opt/homebrew/opt/go/libexec/src/runtime/slice.go:103 +0x50 fp=0x14020160410 sp=0x140201603e0 pc=0x100e400d0
strings.genSplit({0x14003e7fbc0, 0x3e}, {0x100f6af20, 0x1}, 0x0, 0x0?)
        /opt/homebrew/opt/go/libexec/src/strings/strings.go:254 +0x6c fp=0x14020160470 sp=0x14020160410 pc=0x100ea99dc
strings.Split(...)
        /opt/homebrew/opt/go/libexec/src/strings/strings.go:312
main.parseIncludes()
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/includes.go:66 +0x48 fp=0x14020160700 sp=0x14020160470 pc=0x100f05c48
main.parseIncludes()
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/includes.go:130 +0x6a8 fp=0x14020160990 sp=0x14020160700 pc=0x100f062a8
main.parseIncludes()
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/includes.go:130 +0x6a8 fp=0x14020160c20 sp=0x14020160990 pc=0x100f062a8
main.parseIncludes()
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/includes.go:130 +0x6a8 fp=0x14020160eb0 sp=0x14020160c20 pc=0x100f062a8
main.parseIncludes()
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/includes.go:130 +0x6a8 fp=0x14020161140 sp=0x14020160eb0 pc=0x100f062a8
main.parseIncludes()
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/includes.go:130 +0x6a8 fp=0x140201613d0 sp=0x14020161140 pc=0x100f062a8
main.parseIncludes()
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/includes.go:130 +0x6a8 fp=0x14020161660 sp=0x140201613d0 pc=0x100f062a8
main.parseIncludes()
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/includes.go:130 +0x6a8 fp=0x140201618f0 sp=0x14020161660 pc=0x100f062a8
main.parseIncludes()
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/includes.go:130 +0x6a8 fp=0x14020161b80 sp=0x140201618f0 pc=0x100f062a8
main.parseIncludes()
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/includes.go:130 +0x6a8 fp=0x14020161e10 sp=0x14020161b80 pc=0x100f062a8
main.parseIncludes()
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/includes.go:130 +0x6a8 fp=0x140201620a0 sp=0x14020161e10 pc=0x100f062a8
main.parseIncludes()
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/includes.go:130 +0x6a8 fp=0x14020162330 sp=0x140201620a0 pc=0x100f062a8
main.parseIncludes()
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/includes.go:130 +0x6a8 fp=0x140201625c0 sp=0x14020162330 pc=0x100f062a8
main.parseIncludes()
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/includes.go:130 +0x6a8 fp=0x14020162850 sp=0x140201625c0 pc=0x100f062a8
main.parseIncludes()
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/includes.go:130 +0x6a8 fp=0x14020162ae0 sp=0x14020162850 pc=0x100f062a8
main.parseIncludes()
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/includes.go:130 +0x6a8 fp=0x14020162d70 sp=0x14020162ae0 pc=0x100f062a8
main.parseIncludes()
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/includes.go:130 +0x6a8 fp=0x14020163000 sp=0x14020162d70 pc=0x100f062a8
main.parseIncludes()
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/includes.go:130 +0x6a8 fp=0x14020163290 sp=0x14020163000 pc=0x100f062a8
main.parseIncludes()
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/includes.go:130 +0x6a8 fp=0x14020163520 sp=0x14020163290 pc=0x100f062a8
main.parseIncludes()
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/includes.go:130 +0x6a8 fp=0x140201637b0 sp=0x14020163520 pc=0x100f062a8
main.parseIncludes()
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/includes.go:130 +0x6a8 fp=0x14020163a40 sp=0x140201637b0 pc=0x100f062a8
main.parseIncludes()
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/includes.go:130 +0x6a8 fp=0x14020163cd0 sp=0x14020163a40 pc=0x100f062a8
main.parseIncludes()
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/includes.go:130 +0x6a8 fp=0x14020163f60 sp=0x14020163cd0 pc=0x100f062a8
main.parseIncludes()
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/includes.go:130 +0x6a8 fp=0x140201641f0 sp=0x14020163f60 pc=0x100f062a8
main.parseIncludes()
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/includes.go:130 +0x6a8 fp=0x14020164480 sp=0x140201641f0 pc=0x100f062a8
main.parseIncludes()
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/includes.go:130 +0x6a8 fp=0x14020164710 sp=0x14020164480 pc=0x100f062a8
main.parseIncludes()
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/includes.go:130 +0x6a8 fp=0x140201649a0 sp=0x14020164710 pc=0x100f062a8
main.parseIncludes()
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/includes.go:130 +0x6a8 fp=0x14020164c30 sp=0x140201649a0 pc=0x100f062a8
main.parseIncludes()
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/includes.go:130 +0x6a8 fp=0x14020164ec0 sp=0x14020164c30 pc=0x100f062a8
main.parseIncludes()
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/includes.go:130 +0x6a8 fp=0x14020165150 sp=0x14020164ec0 pc=0x100f062a8
main.parseIncludes()
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/includes.go:130 +0x6a8 fp=0x140201653e0 sp=0x14020165150 pc=0x100f062a8
main.parseIncludes()
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/includes.go:130 +0x6a8 fp=0x14020165670 sp=0x140201653e0 pc=0x100f062a8
main.parseIncludes()
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/includes.go:130 +0x6a8 fp=0x14020165900 sp=0x14020165670 pc=0x100f062a8
main.parseIncludes()
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/includes.go:130 +0x6a8 fp=0x14020165b90 sp=0x14020165900 pc=0x100f062a8
main.parseIncludes()
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/includes.go:130 +0x6a8 fp=0x14020165e20 sp=0x14020165b90 pc=0x100f062a8
main.parseIncludes()
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/includes.go:130 +0x6a8 fp=0x140201660b0 sp=0x14020165e20 pc=0x100f062a8
main.parseIncludes()
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/includes.go:130 +0x6a8 fp=0x14020166340 sp=0x140201660b0 pc=0x100f062a8
main.parseIncludes()
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/includes.go:130 +0x6a8 fp=0x140201665d0 sp=0x14020166340 pc=0x100f062a8
main.parseIncludes()
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/includes.go:130 +0x6a8 fp=0x14020166860 sp=0x140201665d0 pc=0x100f062a8
main.parseIncludes()
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/includes.go:130 +0x6a8 fp=0x14020166af0 sp=0x14020166860 pc=0x100f062a8
main.parseIncludes()
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/includes.go:130 +0x6a8 fp=0x14020166d80 sp=0x14020166af0 pc=0x100f062a8
main.parseIncludes()
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/includes.go:130 +0x6a8 fp=0x14020167010 sp=0x14020166d80 pc=0x100f062a8
main.parseIncludes()
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/includes.go:130 +0x6a8 fp=0x140201672a0 sp=0x14020167010 pc=0x100f062a8
main.parseIncludes()
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/includes.go:130 +0x6a8 fp=0x14020167530 sp=0x140201672a0 pc=0x100f062a8
main.parseIncludes()
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/includes.go:130 +0x6a8 fp=0x140201677c0 sp=0x14020167530 pc=0x100f062a8
...818306 frames elided...
main.parseIncludes()
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/includes.go:130 +0x6a8 fp=0x14040158770 sp=0x140401584e0 pc=0x100f062a8
main.parseIncludes()
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/includes.go:130 +0x6a8 fp=0x14040158a00 sp=0x14040158770 pc=0x100f062a8
main.parseIncludes()
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/includes.go:130 +0x6a8 fp=0x14040158c90 sp=0x14040158a00 pc=0x100f062a8
main.parseIncludes()
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/includes.go:130 +0x6a8 fp=0x14040158f20 sp=0x14040158c90 pc=0x100f062a8
main.parseIncludes()
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/includes.go:130 +0x6a8 fp=0x140401591b0 sp=0x14040158f20 pc=0x100f062a8
main.parseIncludes()
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/includes.go:130 +0x6a8 fp=0x14040159440 sp=0x140401591b0 pc=0x100f062a8
main.parseIncludes()
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/includes.go:130 +0x6a8 fp=0x140401596d0 sp=0x14040159440 pc=0x100f062a8
main.parseIncludes()
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/includes.go:130 +0x6a8 fp=0x14040159960 sp=0x140401596d0 pc=0x100f062a8
main.parseIncludes()
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/includes.go:130 +0x6a8 fp=0x14040159bf0 sp=0x14040159960 pc=0x100f062a8
main.parseIncludes()
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/includes.go:130 +0x6a8 fp=0x14040159e80 sp=0x14040159bf0 pc=0x100f062a8
main.parseIncludes()
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/includes.go:130 +0x6a8 fp=0x1404015a110 sp=0x14040159e80 pc=0x100f062a8
main.parseIncludes()
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/includes.go:130 +0x6a8 fp=0x1404015a3a0 sp=0x1404015a110 pc=0x100f062a8
main.parseIncludes()
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/includes.go:130 +0x6a8 fp=0x1404015a630 sp=0x1404015a3a0 pc=0x100f062a8
main.parseIncludes()
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/includes.go:130 +0x6a8 fp=0x1404015a8c0 sp=0x1404015a630 pc=0x100f062a8
main.parseIncludes()
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/includes.go:130 +0x6a8 fp=0x1404015ab50 sp=0x1404015a8c0 pc=0x100f062a8
main.parseIncludes()
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/includes.go:130 +0x6a8 fp=0x1404015ade0 sp=0x1404015ab50 pc=0x100f062a8
main.parseIncludes()
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/includes.go:130 +0x6a8 fp=0x1404015b070 sp=0x1404015ade0 pc=0x100f062a8
main.parseIncludes()
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/includes.go:130 +0x6a8 fp=0x1404015b300 sp=0x1404015b070 pc=0x100f062a8
main.parseIncludes()
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/includes.go:130 +0x6a8 fp=0x1404015b590 sp=0x1404015b300 pc=0x100f062a8
main.parseIncludes()
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/includes.go:130 +0x6a8 fp=0x1404015b820 sp=0x1404015b590 pc=0x100f062a8
main.parseIncludes()
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/includes.go:130 +0x6a8 fp=0x1404015bab0 sp=0x1404015b820 pc=0x100f062a8
main.parseIncludes()
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/includes.go:130 +0x6a8 fp=0x1404015bd40 sp=0x1404015bab0 pc=0x100f062a8
main.parseIncludes()
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/includes.go:130 +0x6a8 fp=0x1404015bfd0 sp=0x1404015bd40 pc=0x100f062a8
main.parseIncludes()
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/includes.go:130 +0x6a8 fp=0x1404015c260 sp=0x1404015bfd0 pc=0x100f062a8
main.parseIncludes()
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/includes.go:130 +0x6a8 fp=0x1404015c4f0 sp=0x1404015c260 pc=0x100f062a8
main.parseIncludes()
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/includes.go:130 +0x6a8 fp=0x1404015c780 sp=0x1404015c4f0 pc=0x100f062a8
main.parseIncludes()
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/includes.go:130 +0x6a8 fp=0x1404015ca10 sp=0x1404015c780 pc=0x100f062a8
main.parseIncludes()
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/includes.go:130 +0x6a8 fp=0x1404015cca0 sp=0x1404015ca10 pc=0x100f062a8
main.parseIncludes()
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/includes.go:130 +0x6a8 fp=0x1404015cf30 sp=0x1404015cca0 pc=0x100f062a8
main.parseIncludes()
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/includes.go:130 +0x6a8 fp=0x1404015d1c0 sp=0x1404015cf30 pc=0x100f062a8
main.parseIncludes()
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/includes.go:130 +0x6a8 fp=0x1404015d450 sp=0x1404015d1c0 pc=0x100f062a8
main.parseIncludes()
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/includes.go:130 +0x6a8 fp=0x1404015d6e0 sp=0x1404015d450 pc=0x100f062a8
main.parseIncludes()
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/includes.go:130 +0x6a8 fp=0x1404015d970 sp=0x1404015d6e0 pc=0x100f062a8
main.parseIncludes()
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/includes.go:130 +0x6a8 fp=0x1404015dc00 sp=0x1404015d970 pc=0x100f062a8
main.parseIncludes()
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/includes.go:130 +0x6a8 fp=0x1404015de90 sp=0x1404015dc00 pc=0x100f062a8
main.parseIncludes()
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/includes.go:130 +0x6a8 fp=0x1404015e120 sp=0x1404015de90 pc=0x100f062a8
main.parseIncludes()
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/includes.go:130 +0x6a8 fp=0x1404015e3b0 sp=0x1404015e120 pc=0x100f062a8
main.parseIncludes()
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/includes.go:130 +0x6a8 fp=0x1404015e640 sp=0x1404015e3b0 pc=0x100f062a8
main.parseIncludes()
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/includes.go:130 +0x6a8 fp=0x1404015e8d0 sp=0x1404015e640 pc=0x100f062a8
main.parseIncludes()
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/includes.go:130 +0x6a8 fp=0x1404015eb60 sp=0x1404015e8d0 pc=0x100f062a8
main.parseIncludes()
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/includes.go:130 +0x6a8 fp=0x1404015edf0 sp=0x1404015eb60 pc=0x100f062a8
main.parseIncludes()
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/includes.go:130 +0x6a8 fp=0x1404015f080 sp=0x1404015edf0 pc=0x100f062a8
main.parseIncludes()
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/includes.go:130 +0x6a8 fp=0x1404015f310 sp=0x1404015f080 pc=0x100f062a8
main.parseIncludes()
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/includes.go:130 +0x6a8 fp=0x1404015f5a0 sp=0x1404015f310 pc=0x100f062a8
main.parseIncludes()
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/includes.go:130 +0x6a8 fp=0x1404015f830 sp=0x1404015f5a0 pc=0x100f062a8
main.parseIncludes()
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/includes.go:130 +0x6a8 fp=0x1404015fac0 sp=0x1404015f830 pc=0x100f062a8
main.handleIncludes()
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/includes.go:36 +0xf8 fp=0x1404015fc60 sp=0x1404015fac0 pc=0x100f055d8
main.main()
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/main.go:73 +0x358 fp=0x1404015ff30 sp=0x1404015fc60 pc=0x100f06818
runtime.main()
        /opt/homebrew/opt/go/libexec/src/runtime/proc.go:267 +0x2bc fp=0x1404015ffd0 sp=0x1404015ff30 pc=0x100e2a9bc
runtime.goexit()
        /opt/homebrew/opt/go/libexec/src/runtime/asm_arm64.s:1197 +0x4 fp=0x1404015ffd0 sp=0x1404015ffd0 pc=0x100e59d64

goroutine 2 [force gc (idle)]:
runtime.gopark(0x0?, 0x0?, 0x0?, 0x0?, 0x0?)
        /opt/homebrew/opt/go/libexec/src/runtime/proc.go:398 +0xc8 fp=0x1400004ef90 sp=0x1400004ef70 pc=0x100e2ade8
runtime.goparkunlock(...)
        /opt/homebrew/opt/go/libexec/src/runtime/proc.go:404
runtime.forcegchelper()
        /opt/homebrew/opt/go/libexec/src/runtime/proc.go:322 +0xb8 fp=0x1400004efd0 sp=0x1400004ef90 pc=0x100e2ac78
runtime.goexit()
        /opt/homebrew/opt/go/libexec/src/runtime/asm_arm64.s:1197 +0x4 fp=0x1400004efd0 sp=0x1400004efd0 pc=0x100e59d64
created by runtime.init.6 in goroutine 1
        /opt/homebrew/opt/go/libexec/src/runtime/proc.go:310 +0x24

goroutine 3 [GC sweep wait]:
runtime.gopark(0x1?, 0x0?, 0x0?, 0x0?, 0x0?)
        /opt/homebrew/opt/go/libexec/src/runtime/proc.go:398 +0xc8 fp=0x1400004f760 sp=0x1400004f740 pc=0x100e2ade8
runtime.goparkunlock(...)
        /opt/homebrew/opt/go/libexec/src/runtime/proc.go:404
runtime.bgsweep(0x0?)
        /opt/homebrew/opt/go/libexec/src/runtime/mgcsweep.go:321 +0x108 fp=0x1400004f7b0 sp=0x1400004f760 pc=0x100e17f98
runtime.gcenable.func1()
        /opt/homebrew/opt/go/libexec/src/runtime/mgc.go:200 +0x28 fp=0x1400004f7d0 sp=0x1400004f7b0 pc=0x100e0ccc8
runtime.goexit()
        /opt/homebrew/opt/go/libexec/src/runtime/asm_arm64.s:1197 +0x4 fp=0x1400004f7d0 sp=0x1400004f7d0 pc=0x100e59d64
created by runtime.gcenable in goroutine 1
        /opt/homebrew/opt/go/libexec/src/runtime/mgc.go:200 +0x6c

goroutine 4 [GC scavenge wait]:
runtime.gopark(0x15bb66a2?, 0x5d9d7d71?, 0x0?, 0x0?, 0x0?)
        /opt/homebrew/opt/go/libexec/src/runtime/proc.go:398 +0xc8 fp=0x1400004ff50 sp=0x1400004ff30 pc=0x100e2ade8
runtime.goparkunlock(...)
        /opt/homebrew/opt/go/libexec/src/runtime/proc.go:404
runtime.(*scavengerState).park(0x101086fa0)
        /opt/homebrew/opt/go/libexec/src/runtime/mgcscavenge.go:425 +0x5c fp=0x1400004ff80 sp=0x1400004ff50 pc=0x100e157dc
runtime.bgscavenge(0x0?)
        /opt/homebrew/opt/go/libexec/src/runtime/mgcscavenge.go:658 +0xac fp=0x1400004ffb0 sp=0x1400004ff80 pc=0x100e15d9c
runtime.gcenable.func2()
        /opt/homebrew/opt/go/libexec/src/runtime/mgc.go:201 +0x28 fp=0x1400004ffd0 sp=0x1400004ffb0 pc=0x100e0cc68
runtime.goexit()
        /opt/homebrew/opt/go/libexec/src/runtime/asm_arm64.s:1197 +0x4 fp=0x1400004ffd0 sp=0x1400004ffd0 pc=0x100e59d64
created by runtime.gcenable in goroutine 1
        /opt/homebrew/opt/go/libexec/src/runtime/mgc.go:201 +0xac

goroutine 5 [finalizer wait]:
runtime.gopark(0x1400004e5a8?, 0x100e55884?, 0x1?, 0xe5?, 0x100e61ba4?)
        /opt/homebrew/opt/go/libexec/src/runtime/proc.go:398 +0xc8 fp=0x1400004e580 sp=0x1400004e560 pc=0x100e2ade8
runtime.runfinq()
        /opt/homebrew/opt/go/libexec/src/runtime/mfinal.go:193 +0x108 fp=0x1400004e7d0 sp=0x1400004e580 pc=0x100e0bdb8
runtime.goexit()
        /opt/homebrew/opt/go/libexec/src/runtime/asm_arm64.s:1197 +0x4 fp=0x1400004e7d0 sp=0x1400004e7d0 pc=0x100e59d64
created by runtime.createfing in goroutine 1
        /opt/homebrew/opt/go/libexec/src/runtime/mfinal.go:163 +0x80

goroutine 6 [GC worker (idle)]:
runtime.gopark(0x0?, 0x0?, 0x0?, 0x0?, 0x0?)
        /opt/homebrew/opt/go/libexec/src/runtime/proc.go:398 +0xc8 fp=0x14000050730 sp=0x14000050710 pc=0x100e2ade8
runtime.gcBgMarkWorker()
        /opt/homebrew/opt/go/libexec/src/runtime/mgc.go:1293 +0xd8 fp=0x140000507d0 sp=0x14000050730 pc=0x100e0e688
runtime.goexit()
        /opt/homebrew/opt/go/libexec/src/runtime/asm_arm64.s:1197 +0x4 fp=0x140000507d0 sp=0x140000507d0 pc=0x100e59d64
created by runtime.gcBgMarkStartWorkers in goroutine 1
        /opt/homebrew/opt/go/libexec/src/runtime/mgc.go:1217 +0x28

goroutine 7 [GC worker (idle)]:
runtime.gopark(0x0?, 0x0?, 0x0?, 0x0?, 0x0?)
        /opt/homebrew/opt/go/libexec/src/runtime/proc.go:398 +0xc8 fp=0x14000050f30 sp=0x14000050f10 pc=0x100e2ade8
runtime.gcBgMarkWorker()
        /opt/homebrew/opt/go/libexec/src/runtime/mgc.go:1293 +0xd8 fp=0x14000050fd0 sp=0x14000050f30 pc=0x100e0e688
runtime.goexit()
        /opt/homebrew/opt/go/libexec/src/runtime/asm_arm64.s:1197 +0x4 fp=0x14000050fd0 sp=0x14000050fd0 pc=0x100e59d64
created by runtime.gcBgMarkStartWorkers in goroutine 1
        /opt/homebrew/opt/go/libexec/src/runtime/mgc.go:1217 +0x28

goroutine 18 [GC worker (idle)]:
runtime.gopark(0x0?, 0x0?, 0x0?, 0x0?, 0x0?)
        /opt/homebrew/opt/go/libexec/src/runtime/proc.go:398 +0xc8 fp=0x1400004a730 sp=0x1400004a710 pc=0x100e2ade8
runtime.gcBgMarkWorker()
        /opt/homebrew/opt/go/libexec/src/runtime/mgc.go:1293 +0xd8 fp=0x1400004a7d0 sp=0x1400004a730 pc=0x100e0e688
runtime.goexit()
        /opt/homebrew/opt/go/libexec/src/runtime/asm_arm64.s:1197 +0x4 fp=0x1400004a7d0 sp=0x1400004a7d0 pc=0x100e59d64
created by runtime.gcBgMarkStartWorkers in goroutine 1
        /opt/homebrew/opt/go/libexec/src/runtime/mgc.go:1217 +0x28

goroutine 34 [GC worker (idle)]:
runtime.gopark(0x1d2ccbc4c5db?, 0x1?, 0x54?, 0x51?, 0x0?)
        /opt/homebrew/opt/go/libexec/src/runtime/proc.go:398 +0xc8 fp=0x14000094730 sp=0x14000094710 pc=0x100e2ade8
runtime.gcBgMarkWorker()
        /opt/homebrew/opt/go/libexec/src/runtime/mgc.go:1293 +0xd8 fp=0x140000947d0 sp=0x14000094730 pc=0x100e0e688
runtime.goexit()
        /opt/homebrew/opt/go/libexec/src/runtime/asm_arm64.s:1197 +0x4 fp=0x140000947d0 sp=0x140000947d0 pc=0x100e59d64
created by runtime.gcBgMarkStartWorkers in goroutine 1
        /opt/homebrew/opt/go/libexec/src/runtime/mgc.go:1217 +0x28

goroutine 19 [GC worker (idle)]:
runtime.gopark(0x1d2ca264cafb?, 0x0?, 0x0?, 0x0?, 0x0?)
        /opt/homebrew/opt/go/libexec/src/runtime/proc.go:398 +0xc8 fp=0x1400004af30 sp=0x1400004af10 pc=0x100e2ade8
runtime.gcBgMarkWorker()
        /opt/homebrew/opt/go/libexec/src/runtime/mgc.go:1293 +0xd8 fp=0x1400004afd0 sp=0x1400004af30 pc=0x100e0e688
runtime.goexit()
        /opt/homebrew/opt/go/libexec/src/runtime/asm_arm64.s:1197 +0x4 fp=0x1400004afd0 sp=0x1400004afd0 pc=0x100e59d64
created by runtime.gcBgMarkStartWorkers in goroutine 1
        /opt/homebrew/opt/go/libexec/src/runtime/mgc.go:1217 +0x28

goroutine 35 [GC worker (idle)]:
runtime.gopark(0x1d2ca26489b7?, 0x0?, 0x0?, 0x0?, 0x0?)
        /opt/homebrew/opt/go/libexec/src/runtime/proc.go:398 +0xc8 fp=0x14000094f30 sp=0x14000094f10 pc=0x100e2ade8
runtime.gcBgMarkWorker()
        /opt/homebrew/opt/go/libexec/src/runtime/mgc.go:1293 +0xd8 fp=0x14000094fd0 sp=0x14000094f30 pc=0x100e0e688
runtime.goexit()
        /opt/homebrew/opt/go/libexec/src/runtime/asm_arm64.s:1197 +0x4 fp=0x14000094fd0 sp=0x14000094fd0 pc=0x100e59d64
created by runtime.gcBgMarkStartWorkers in goroutine 1
        /opt/homebrew/opt/go/libexec/src/runtime/mgc.go:1217 +0x28

goroutine 20 [GC worker (idle)]:
runtime.gopark(0x1d2ccbc4da87?, 0x0?, 0x0?, 0x0?, 0x0?)
        /opt/homebrew/opt/go/libexec/src/runtime/proc.go:398 +0xc8 fp=0x1400004b730 sp=0x1400004b710 pc=0x100e2ade8
runtime.gcBgMarkWorker()
        /opt/homebrew/opt/go/libexec/src/runtime/mgc.go:1293 +0xd8 fp=0x1400004b7d0 sp=0x1400004b730 pc=0x100e0e688
runtime.goexit()
        /opt/homebrew/opt/go/libexec/src/runtime/asm_arm64.s:1197 +0x4 fp=0x1400004b7d0 sp=0x1400004b7d0 pc=0x100e59d64
created by runtime.gcBgMarkStartWorkers in goroutine 1
        /opt/homebrew/opt/go/libexec/src/runtime/mgc.go:1217 +0x28

goroutine 36 [GC worker (idle)]:
runtime.gopark(0x1d2ccbc4d1e6?, 0x0?, 0x0?, 0x0?, 0x0?)
        /opt/homebrew/opt/go/libexec/src/runtime/proc.go:398 +0xc8 fp=0x14000095730 sp=0x14000095710 pc=0x100e2ade8
runtime.gcBgMarkWorker()
        /opt/homebrew/opt/go/libexec/src/runtime/mgc.go:1293 +0xd8 fp=0x140000957d0 sp=0x14000095730 pc=0x100e0e688
runtime.goexit()
        /opt/homebrew/opt/go/libexec/src/runtime/asm_arm64.s:1197 +0x4 fp=0x140000957d0 sp=0x140000957d0 pc=0x100e59d64
created by runtime.gcBgMarkStartWorkers in goroutine 1
        /opt/homebrew/opt/go/libexec/src/runtime/mgc.go:1217 +0x28

Additional context
N/A

Unable to insert multiple variables into string value

Here is the baseline script:

@fname = "Cherri"
@sname = "MacBerry"
alert("First: {fname} Last: {sname}")

Here is what is produced:
Screenshot 2023-10-31 at 6 22 05 AM

As you can observe, the second variable is ignored. The same holds for more than two variables.

Using the `takePhotos(count)` function causes an error during parsing

Describe the bug
The takePhotos(count) function causes the parser to panic

To Reproduce

takePhotos(2)

Debug output

Parsing main.cherri...
panic: interface conversion: interface {} is string, not int

goroutine 1 [running]:
main.mediaActions.func1({0x14000076220?, 0x1400007a4e0?, 0x140000101e0?})
        /Users/michaelogezi/go/pkg/mod/github.com/mikeogezi/[email protected]/actions_std.go:1746 +0xa0
main.checkAction()
        /Users/michaelogezi/go/pkg/mod/github.com/mikeogezi/[email protected]/action.go:206 +0xb4
main.collectAction()
        /Users/michaelogezi/go/pkg/mod/github.com/mikeogezi/[email protected]/parser.go:1154 +0x1cc
main.collectActionCall()
        /Users/michaelogezi/go/pkg/mod/github.com/mikeogezi/[email protected]/parser.go:1130 +0x24
main.parse()
        /Users/michaelogezi/go/pkg/mod/github.com/mikeogezi/[email protected]/parser.go:179 +0x2cc
main.initParse()
        /Users/michaelogezi/go/pkg/mod/github.com/mikeogezi/[email protected]/parser.go:49 +0x31c
main.main()
        /Users/michaelogezi/go/pkg/mod/github.com/mikeogezi/[email protected]/main.go:62 +0x258

Expected behavior
I expect this to compile into a valid Shortcut.

Screenshots
N/A

Version Information (please complete the following information):

  • macOS version: Darwin Michaels-MacBook-Air.local 23.2.0 Darwin Kernel Version 23.2.0: Fri Oct 13 09:28:08 PDT 2023; root:xnu-10002.60.54~14/RELEASE_ARM64_T8112 arm64
  • Golang version: go version go1.21.3 darwin/arm64

Additional context
N/A

Mac Signing Server

Currently, there is a way to try-out Cherri on any platform at playground.cherrilang.org. However, it does not have a Mac signing server yet. I am hoping to eventually host a Mac signing server.

Plan A: MacStadium Open Source Program

Apply to the Open Source program from MacStadium, which offers free Mac hosting for open-source projects, but there are some catches, meaning this project will probably need to mature more before that could happen.

Plan B: Dedicated Hosting

Pay for expensive Mac hosting (expensive for hosting) from the small number of Mac hosting options.

This is probably not going to happen. The reason it's so expensive is that you can't use a VPS server for signing Shortcuts––I have tried. Shortcut signing requires an iCloud sign-in which (unless you wanna jump through a bunch of hoops) requires a legit Mac, so we would need to pay for a dedicated Mac server, which is expensive in the first place for a Linux server, but even more so for a Mac (around $70-100/mo at least).


Darling? I tried it, but it currently does not have the ContentKit private framework, and would probably not work for signing shortcuts as iCloud sign-in is needed.

The web editor / playground is the right way to get non-technical people interested in using the language in my opinion over an app, as anyone with a web browser can use it.

I really like what the ScPL editor did, so much so that I had some minor involvement in it. However, it doesn’t support Shortcuts past iOS 13.

Error in Line Printing: Wrong Line Numbers

Describe the bug

When pointing where the error is, the line numbers are not correct for the printed lines of the program.

To Reproduce

Here is the program that I am trying to compile:

#define color red
#define glyph apple
#define name melon
/* 
    melon host shortcut 🍉

    melon is an orthogonally persistent language designed for creating automations for Apple devices that run blazingly fast ⚡. It uses Siri Shortcuts as a backend, but allows for more complex and performant automations to be created compared to Shortcuts application itself.

    this shortcut is powered by cherri 🍒.

    https://raw.githubusercontent.com/melon-lang/melon-webport/main/dist/index.html
*/

const MELON_VERSION = "1.0.0"
const MELON_MAX_PERSISTANCE = 2147483647

const MELON_VM_STATUS_SYSCALL = "syscall"
const MELON_VM_STATUS_HALTED = "halted"

const MELON_SOURCE_CODE_URL = url("https://github.com/melon-lang/melon-lang/releases/download/latest/build")

action getSyscallArg0() {
    @syscall_arg_0 = getListItem(syscall_args, 0)
    @syscall_arg_0 = getValue(syscall_arg_0, "value")
}

action getSyscallArg1() {
    @syscall_arg_1 = getListItem(syscall_args, 1)
    @syscall_arg_1 = getValue(syscall_arg_1, "value")
}

@MELON_SOURCE_CODE = downloadURL( MELON_SOURCE_CODE_URL )
@MELON_SOURCE_CODE = base64Encode( MELON_SOURCE_CODE )

@code = ShortcutInput

const b64code = base64Encode(code)

//const source_code_dir = "melon_cache"
//const source_code_path = source_code_dir + "/melon.bin"

@url = url("data:text/html;begin={b64code};base64,{MELON_SOURCE_CODE}")

repeat MELON_MAX_PERSISTANCE {    
    @response = getWebpageContents( url )
    @response = getText(response)
    
    @image = response

    @response = base64Decode(response)
    @response = getDictionary(response)

    @error = getValue(response, "error")
    const error = getText(error)

    if error {
        alert(error)
        stop()
    }

    @status = getValue(response, "status")
    const status = getText(status)

    @state = getValue(response, "state")
    const state = getText(state)
        
    if status == MELON_VM_STATUS_HALTED {
        stop()
    }

    if status == MELON_VM_STATUS_SYSCALL {
        @syscall = getValue(response, "syscall")
        const syscall = getDictionary(syscall)
        
        @syscall_name = getValue(syscall, "name")
        const syscall_name = getText(syscall_name)
        
        const syscall_args = getValue(syscall, "args")
        
        @syscall_out = ""
        
        if syscall_name == "is.workflow.actions.showresult" {
            getSyscallArg0()
            alert(syscall_arg_0)
        }

        if syscall_name == "is.workflow.actions.prompt" {
            getSyscallArg0()
            @syscall_out = prompt(syscall_arg_0)
        }

        if syscall_name == "is.workflow.actions.location" {
            @syscall_out = getCurrentLocation()
        }

        if syscall_name == "is.workflow.actions.searchmaps" {
            getSyscallArg0()
            openInMaps(syscall_arg_0)
        }

        if syscall_name == "is.workflow.actions.savefile" {
            getSyscallArg0()
            getSyscallArg1()
            saveFile(syscall_arg_0, syscall_arg_1, true)
        }

        if syscall_name == "is.workflow.actions.selectcontact" {
            @syscall_out = selectContact()
        }

        if syscall_name == "is.workflow.actions.call" {
            getSyscallArg0()
            call(syscall_arg_0)
        }

        if syscall_name == "is.workflow.actions.takephoto" {
            @syscall_out = takePhoto()
        }
    }
    
    @syscall_out = base64Encode(syscall_out)
    @syscall_out = "{syscall_out}"

    @url = url("data:text/html;resume={image};value={syscall_out};base64,{MELON_SOURCE_CODE}")
}

Here the code is 126 lines long, but I get the following compiler error:

melon.cherri:138:6
137 |         }
138 |     }
         ^
139 |     

Version Information (please complete the following information):

  • macOS version: Darwin Erens-MacBook-Pro.local 23.0.0 Darwin Kernel Version 23.0.0: Fri Sep 15 14:42:42 PDT 2023; root:xnu-10002.1.13~1/RELEASE_X86_64 x86_6
  • Golang version: go version go1.21.3 darwin/amd64

Sharing Actions

Most sharing actions that could be practically implemented are done.

Missing “select folder” action

In the iPhone shortcuts app the “select file” action can be morphed into “select folder”. Cherrilang doesn’t offer the folder variant.

Web Actions

Most web actions that could be practically implemented are done.

Implement custom action arguments

Allow custom actions to define their own arguments and allow references to those actions to input arguments into those actions.

To do this, we will collect values between commas in the action definition to know what values in the action definition body to replace with the values passed in when the action is referenced.

Handle magic variables more efficiently

There's a trend in the compiler of not really using magic variables almost at all so that we don't need to incorporate them into the language syntax.

The problem occurs when we then don't do any optimizations behind the scenes to directly use magic variables when possible.

To cut down on how large Shortcuts Cherri produces and probably make it more efficient when run, we should refactor how this is handled.

Unable to limit the number of contacts with `filterContacts`

Describe the bug
When the limit argument of filterContacts(variable contacts, enum ?sortByProperty, enum ?sortOrder = "A to Z", integer ?limit) is set, the produced Shortcut is still unable to limit the contacts because a boolean that enables limiting is not set.

To Reproduce

filterContacts(nil, "First Name", "A to Z", 6)

Debug output
N/A

Expected behavior
When a limit is set, the limit should be enabled implicitly

Screenshots

  • What is produced:
    Screenshot 2023-11-02 at 6 06 07 PM
  • What is expected:
    Screenshot 2023-11-02 at 6 06 17 PM

Version Information (please complete the following information):

  • macOS version (run uname -a): Darwin Michaels-MacBook-Air.local 23.2.0 Darwin Kernel Version 23.2.0: Fri Oct 13 09:28:08 PDT 2023; root:xnu-10002.60.54~14/RELEASE_ARM64_T8112 arm64
  • Golang version (run go version): go version go1.21.3 darwin/arm64

Additional context
N/A

Unable to stop and give a response when input isn't provided

Describe the bug
The compiler errors out when we use the syntax: #define noinput stopwith "..."

To Reproduce

#define noinput stopwith "Response"

alert("Hello World")

Debug output

Parsing test.cherri...

Undefined action 'Response()'

----- test.cherri:1:36
1 | 
                                       ^
2 | #define noinput stopwith "Response"
-----

###################
#   DEBUG PANIC   #
###################

### PARSING ###

Previous Character:
e 1:35

Current Character:
" 1:35

Next Character:
a 1:35

Current Line:

## TOKENS ##

## DEFINITIONS ##
Name: test
Color: -1263359489
Glyph: 61440
Inputs: []
Outputs: []
Workflows: []
No Input: {WFWorkflowNoInputBehaviorShowError [{Error string }]}
macOS Only: false
Mininum Version: 900
iOS Version: 17.0

## VARIABLES ##

## MENUS ##
map[]

## IMPORT QUESTIONS ##
map[]

### PLIST GEN ###

## UUIDS ##
map[]

### CUSTOM ACTIONS ###


### INCLUDES ###

## INCLUDED ##
[]

## INCLUDES MAP ##
[]

#############################################################

panic: debug

goroutine 1 [running]:
main.panicDebug({0x0, 0x0})
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/main.go:320 +0x12c
main.parserError({0x1400001e0c0, 0x1d})
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/parser.go:1401 +0x2a0
main.collectAction()
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/parser.go:1179 +0xb0
main.collectActionCall()
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/parser.go:1164 +0x24
main.parse()
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/parser.go:166 +0x420
main.initParse()
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/parser.go:49 +0x2f4
main.main()
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/main.go:75 +0x35c

Version Information (please complete the following information):

  • macOS version (run uname -a): Darwin Michaels-MacBook-Air.local 23.2.0 Darwin Kernel Version 23.2.0: Fri Oct 13 09:28:08 PDT 2023; root:xnu-10002.60.54~14/RELEASE_ARM64_T8112 arm64
  • Golang version (run go version): go version go1.21.4 darwin/arm64

Location Actions

Most location actions that could be practically implemented are done.

Backslash/escape character (\) is not being parsed correctly

I cannot successfully store the backslash character in a string. (The first two points are preamble. See 3 for the problem)

  1. ✅ Here is some baseline code:

    @var = "Cherri"
    alert(var)
    

    And a screenshot of the Shortcut produced:
    Screenshot 2023-10-30 at 9 49 12 PM

  2. ✅ Here is some code that uses a newline:

    @var = "\n"
    alert(var)
    
    Screenshot 2023-10-30 at 9 48 31 PM
  3. ❌ Here is some code that tries to use the backslash/escape character (\):

    @var = "\\"
    alert(var)
    

    Both the escaped and unescaped variants produce the same result:

    @var = "\"
    alert(var)
    
    Screenshot 2023-10-30 at 9 48 48 PM

    The produced shortcut is not faithful to the source code.

Issue with retrieving enums from a list

Describe the bug
I run into a panic when I try to use an enum that I retrieved from a list as an argument.

To Reproduce

@list = list("Device Name", "Device Hostname")
@name = getListItem(list, 0)
@hostname = getListItem(list, 1)
@val = getDeviceDetail(hostname)
alert(val)

Debug output
Parsing custom actions... ### CUSTOM ACTIONS ###

done!
Parsing test.cherri...
panic: interface conversion: interface {} is main.action, not string

goroutine 1 [running]:
main.checkEnum({{0x100d76fac, 0x6}, {0x100d766ce, 0x4}, {0x100d7ad07, 0xe}, {0x0, 0x0}, {0x1400007e3c0, 0xa, ...}, ...}, ...)
/Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/action.go:268 +0x210
main.checkArg(0x14000165468, 0x14000165378)
/Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/action.go:396 +0xac
main.collectArgument(0x100dc8ca0?, 0x14000165468, 0x14000010640?)
/Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/parser.go:413 +0x2dc
main.collectArguments()
/Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/parser.go:380 +0x12c
main.collectAction()
/Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/parser.go:1185 +0x220
main.collectValue(0x140001657b0, 0x140001657c0, 0xa)
/Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/parser.go:307 +0x4e4
main.collectVariableValue(0x0, 0x140001657b0, 0x140001657c0, 0x140001657f0, 0x140001657e0)
/Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/parser.go:240 +0x3c
main.collectVariable(0x0)
/Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/parser.go:485 +0x6e8
main.parse()
/Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/parser.go:147 +0x480
main.initParse()
/Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/parser.go:49 +0x2f4
main.main()
/Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/main.go:75 +0x35c

Expected behavior
I expect the retrieved enum to work as an argument.

Screenshots
N/A

Version Information (please complete the following information):

  • macOS version (run uname -a): Darwin Michaels-MacBook-Air.local 23.2.0 Darwin Kernel Version 23.2.0: Fri Oct 13 09:28:08 PDT 2023; root:xnu-10002.60.54~14/RELEASE_ARM64_T8112 arm64
  • Golang version (run go version): go version go1.21.4 darwin/arm64

Additional context
N/A

Standard Library of Custom Actions

A goal for this project is to expand custom actions to have custom arguments to allow for functions that act as a way to replicate the same actions with input parameters anywhere you like.

With this in mind, the current first built-in action makeVCard() could be greatly improved to not just create the text block for the V Card but also handle the annoying actions that must proceed to create a V Card based menu.

A standard library could then be created of custom actions written in Cherri containing common boilerplate, tricks, etc to make programming a Shortcut in Cherri even easier.

I wouldn't want to just add bloat as some standard libraries do, but a genuinely useful library of custom actions.


Getting this started should be pretty simple, the hard part will be supporting custom-defined arguments in custom actions, but once that is done this is entirely possible.

This would really set Cherri apart from other Shortcuts languages if this hasn't already been done.

Defining version 17 stops the shortcut from being signed successfully

Describe the bug
When I define version 17, the generated .plist file is invalid. It causes an error when a sign is attempted:

Signing main_unsigned.shortcut to main.shortcut...
failed!

Error: Failed to sign Shortcut

shortcuts: Error: The data couldn’t be read because it isn’t in the correct format.

To Reproduce
The code to reproduce your issue if applicable:

#define version 17

alert("Hello World!")

Debug output

Parsing main.cherri...
### PARSING ###

Previous Character:
) 3:21

Current Character:
EMPTY 3:21

Current Line:
alert("Hello World!")
## TOKENS ##
1 | {action alert action {alert [{text Hello World!}]}}

## DEFINITIONS ##
Name: main
Color: -1263359489
Glyph: 61440
Inputs: []
Outputs: []
Workflows: []
No Input: { []}
macOS Only: false
Mininum Version: 2038.0.2.4
iOS Version: 17.0

## VARIABLES ##

## MENUS ##
map[]

## IMPORT QUESTIONS ##
map[]

Done.

Generating plist...
### PLIST GEN ###

## UUIDS ##
map[]

Done.

Writing to main.plist...
Done.

Writing to main_unsigned.shortcut...
Done.

Signing main_unsigned.shortcut to main.shortcut...
failed!

Error: Failed to sign Shortcut

shortcuts: Error: The data couldn’t be read because it isn’t in the correct format.


###################
#   DEBUG PANIC   #
###################

### PARSING ###

Previous Character:
EMPTY 1:0

Current Character:
EMPTY 1:0

## TOKENS ##

## DEFINITIONS ##
Name: main
Color: -1263359489
Glyph: 61440
Inputs: []
Outputs: []
Workflows: []
No Input: { []}
macOS Only: false
Mininum Version: 2038.0.2.4
iOS Version: 17.0

## VARIABLES ##

## MENUS ##
map[]

## IMPORT QUESTIONS ##
map[]

### PLIST GEN ###

## UUIDS ##
map[]

### CUSTOM ACTIONS ###


### INCLUDES ###

## INCLUDED ##
[]

## INCLUDES MAP ##
[]

#############################################################

panic: debug

goroutine 1 [running]:
main.panicDebug({0x0, 0x0})
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/main.go:320 +0x12c
main.exit({0x140001a4080?, 0x102bceea5?})
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/main.go:393 +0x10c
main.sign()
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/main.go:227 +0x78c
main.createShortcut()
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/main.go:149 +0x280
main.main()
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/main.go:79 +0x364

Screenshots
N/A

Version Information (please complete the following information):

  • macOS version (run uname -a): Darwin Michaels-MacBook-Air.local 23.2.0 Darwin Kernel Version 23.2.0: Fri Oct 13 09:28:08 PDT 2023; root:xnu-10002.60.54~14/RELEASE_ARM64_T8112 arm64
  • Golang version (run go version): go version go1.21.4 darwin/arm64

Additional context
N/A

Compiler mistakes `index` (should be number type) for text type in `repeat` loop

Describe the bug
When repeat looping based on a number that has been set in a variable, the compiler thinks that the index is a text variable.

To Reproduce

@l = list("a", "b", "c")
@s = 3
repeat i for s {
  @x = getListItem(l, i)
}
@l = list("a", "b", "c")
@s = count(l)
repeat i for s {
  @x = getListItem(l, i)
}

Debug output

Parsing test.cherri...

Invalid variable value i (text) for argument 'index' (number).
getListItem(..., number index)

----- test.cherri:14:1
13 |   @x = getListItem(l, i)
14 | }
    ^
15 | 
-----

###################
#   DEBUG PANIC   #
###################

### PARSING ###

Previous Character:
) 14:0

Current Character:
LF 14:0

Next Character:
} 14:0

Current Line:
}
## TOKENS ##
1 | {variable l action {list [{text a} {text b} {text c}]}}
2 | {variable s action {count [{variable l}]}}
3 | {repeat  EB4EF905-7402-43BA-8B7F-CC29563C57F1 variable s}
4 | {variable i variable Repeat Index}

## DEFINITIONS ##
Name: test
Color: -1263359489
Glyph: 61440
Inputs: []
Outputs: []
Workflows: []
No Input: { []}
macOS Only: false
Mininum Version: 2106.0.3
iOS Version: 17.0

## VARIABLES ##
@s = {count [{variable l}]} (action)
@i = i (text) (repeat item var)
@l = {list [{text a} {text b} {text c}]} (action)

## MENUS ##
map[]

## IMPORT QUESTIONS ##
map[]

### PLIST GEN ###

## UUIDS ##
map[]

### CUSTOM ACTIONS ###


### INCLUDES ###

## INCLUDED ##
[]

## INCLUDES MAP ##
[]

#############################################################

panic: debug

goroutine 1 [running]:
main.panicDebug({0x0, 0x0})
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/main.go:320 +0x12c
main.parserError({0x1400010a2a0, 0x5d})
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/parser.go:1411 +0x2a0
main.typeCheck(0x14000153468, 0x14000153130?)
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/action.go:323 +0x31c
main.checkArg(0x140001b5468, 0x140001b5378)
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/action.go:401 +0xb8
main.collectArgument(0x0?, 0x14000153468, 0x140001285d0?)
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/parser.go:415 +0x2dc
main.collectArguments()
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/parser.go:382 +0x12c
main.collectAction()
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/parser.go:1187 +0x220
main.collectValue(0x140001537b0, 0x140001b57c0, 0xa)
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/parser.go:308 +0x4e4
main.collectVariableValue(0x0, 0x140001b57b0, 0x140001b57c0, 0x140001b57f0, 0x140001b57e0)
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/parser.go:242 +0x3c
main.collectVariable(0x0)
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/parser.go:487 +0x6e8
main.parse()
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/parser.go:147 +0x480
main.initParse()
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/parser.go:49 +0x2f4
main.main()
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/main.go:75 +0x35c

Expected behavior
I expect the index to be a number.

Version Information (please complete the following information):

  • macOS version (run uname -a): Darwin Michaels-MacBook-Air.local 23.2.0 Darwin Kernel Version 23.2.0: Fri Oct 13 09:28:08 PDT 2023; root:xnu-10002.60.54~14/RELEASE_ARM64_T8112 arm64
  • Golang version (run go version): go version go1.21.4 darwin/arm64

Additional Information:
May be related to #41.

`getListItem` and `getListItems` don't work (properly) with variables

Describe the bug
Issue #22 still exists.

To Reproduce

@l = list("Device Name", "Device Hostname")
@index = 0
@name = getListItem(l, index)
@x = list("a", "b", "c")
@y = 1
@z = 3
getListItems(x, y, z)

Debug output

Parsing test.cherri...

Program panic :(

Please report this: https://github.com/electrikmilk/cherri/issues/new

###################
#   DEBUG PANIC   #
###################

### PARSING ###

Previous Character:
) 8:0

Current Character:
LF 8:0

Next Character:
a 8:0

Current Line:
alert(name)
## TOKENS ##
1 | {variable lis action {list [{text Device Name} {text Device Hostname}]}}
2 | {variable index number 0}

## DEFINITIONS ##
Name: test
Color: -1263359489
Glyph: 61440
Inputs: []
Outputs: []
Workflows: []
No Input: { []}
macOS Only: false
Mininum Version: 2106.0.3
iOS Version: 17.0

## VARIABLES ##
@lis = {list [{text Device Name} {text Device Hostname}]} (action)
@index = 0 (number)

## MENUS ##
map[]

## IMPORT QUESTIONS ##
map[]

### PLIST GEN ###

## UUIDS ##
map[]

### CUSTOM ACTIONS ###


### INCLUDES ###

## INCLUDED ##
[]

## INCLUDES MAP ##
[]

#############################################################

panic: strconv.ParseInt: parsing "index": invalid syntax

goroutine 1 [running]:
main.panicDebug({0x102f817b8, 0x140000a6810})
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/main.go:317 +0x118
main.handle({0x102f817b8, 0x140000a6810})
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/main.go:271 +0x178
main.incrementValue({0x102f59600?, 0x140000a2210?})
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/action.go:391 +0x54
main.scriptingActions.func50({0x140000c4480, 0x140000a6750?, 0x140000b0590?})
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/actions_std.go:3902 +0x38
main.checkAction()
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/action.go:202 +0x7c
main.collectAction()
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/parser.go:1191 +0x270
main.collectValue(0x140000d97b0, 0x140001317c0, 0xa)
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/parser.go:308 +0x4e4
main.collectVariableValue(0x0, 0x140001317b0, 0x140001317c0, 0x140001317f0, 0x140001317e0)
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/parser.go:242 +0x3c
main.collectVariable(0x0)
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/parser.go:487 +0x6e8
main.parse()
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/parser.go:147 +0x480
main.initParse()
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/parser.go:49 +0x2f4
main.main()
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/main.go:75 +0x35c

Version Information (please complete the following information):

  • macOS version (run uname -a): Darwin Michaels-MacBook-Air.local 23.2.0 Darwin Kernel Version 23.2.0: Fri Oct 13 09:28:08 PDT 2023; root:xnu-10002.60.54~14/RELEASE_ARM64_T8112 arm64
  • Golang version (run go version): go version go1.21.4 darwin/arm64

Originally posted by @mikeogezi in #22 (comment)

Refactor custom actions to accept arguments and behave more like functions

The implementation of a simple addition "function" in Shortcuts in Cherri looks like this:

if ShortcutInput {
    const inputType = typeOf(ShortcutInput)
    if inputType == "Dictionary" {
        const input = getDictionary(ShortcutInput)
        const identifier = getValue(input, "cherri_functions")
        const valid = number(identifier)
        if valid == true {
            const function_name = getValue(input, "function")
            const function = "{function_name}"
            const args = getValue(input, "arguments")
            if function == "add" {
                const arg1 = getListItem(args, 0)
                const arg2 = getListItem(args, 1)
                const n1 = number(arg1)
                const n2 = number(arg2)
                const result = n1 + n2
                output("{result}")
            }
        }
    }
}

const operandOne = prompt("Operand 1", "Number", "2")
const operandTwo = prompt("Operand 2", "Number", "2")

const myFunctionCall = {
    "cherri_functions": 1,
    "function": "add",
    "arguments": ["{operandOne}", "{operandTwo}"]
}
const myFunctionReturn = runSelf(myFunctionCall)

alert(myFunctionReturn)

This has recently become possible through some focused work on this implementation and is tested to work.

This would allow custom actions to have their own scope.

We would want the definition for this to look like this:

action add(number n1, number n2) {
    const result = n1 + n2
    output("{result}")
}

add(2, 2)

So this will need to be generated based on custom action definitions and references.

Add to/Subtract from date not producing a valid Shortcut when the magnitude is a variable

Describe the bug
Add to date:

addSeconds(string date, integer magnitude)
addMinutes(string date, integer magnitude)
addHours(string date, integer magnitude)
addDays(string date, integer magnitude)
addWeeks(string date, integer magnitude)
addMonths(string date, integer magnitude)
addYears(string date, integer magnitude)

&

Subtract from date:

subtractSeconds(string date, integer magnitude)
subtractMinutes(string date, integer magnitude)
subtractHours(string date, integer magnitude)
subtractDays(string date, integer magnitude)
subtractWeeks(string date, integer magnitude)
subtractMonths(string date, integer magnitude)
subtractYears(string date, integer magnitude)

do not produce valid shortcuts when the magnitude is a variable.

To Reproduce

@d = date("October 5, 2022")
@a = 2
addDays(d, a)

Debug output
The compilation is successful, but below is a screenshot of the Shortcut.

Screenshot 2023-12-05 at 6 41 27 PM

Expected behavior

Screenshot 2023-12-05 at 6 43 15 PM

Screenshots
See above.

Version Information (please complete the following information):

  • macOS version (run uname -a): Darwin Michaels-MacBook-Air.local 23.2.0 Darwin Kernel Version 23.2.0: Fri Oct 13 09:28:08 PDT 2023; root:xnu-10002.60.54~14/RELEASE_ARM64_T8112 arm64
  • Golang version (run go version): go version go1.21.4 darwin/arm64

Additional context
N/A

`getListItem` and `getListItems` don't work with variables

Functions getListItem and getListItems don't work with variables, however, the underlying action supports this functionality.

Here is some code that produces the error:

@names = list("John", "Jane", "Joe")
@names_len = count(names)

@index = 0
@index_plus_1 = 1
@seen_names
repeat i for names_len {
  @index += 1
  @index_plus_1 += 1
  @seen_names += getListItems(names, index, index_plus_1)
}

Here is the error:

Parsing main.cherri...

Error: strconv.ParseInt: parsing "index": invalid syntax

###################
#   DEBUG PANIC   #
###################

### PARSING ###

Previous Character:
) 15:0

Current Character:
LF 15:0

Next Character:
} 15:0

Current Line: 
}
## TOKENS ##
1 | {variable names action {list [{" John} {" Jane} {" Joe}]}}
2 | {variable names_len action {count [{variable names}]}}
3 | {variable index 0123456789.- 0}
4 | {variable index_plus_1 0123456789.- 1}
5 | {variable seen_names  <nil>}
6 | {repeat  205158AF-02DB-4E06-8149-ADEB37257AC2 variable names_len}
7 | {variable i variable Repeat Index}
8 | {+= index 0123456789.- 1}
9 | {+= index_plus_1 0123456789.- 1}

## TOKEN CHARS ##
map[#define:[35 100 101 102 105 110 101] #import:[35 105 109 112 111 114 116] #question:[35 113 117 101 115 116 105 111 110] +=:[43 61] const:[99 111 110 115 116] false:[102 97 108 115 101] for :[102 111 114 32] nil:[110 105 108] repeat :[114 101 112 101 97 116 32] true:[116 114 117 101]]

## DEFINITIONS ##
Name: main
Color: -1263359489
Glyph: 61440
Inputs: []
Outputs: []
Workflows: []
No Input: { []}
macOS Only: false
Mininum Version: 900
iOS Version: 17.0

## VARIABLES ##
@index (Variable) = 0 (0123456789.-)
@index_plus_1 (Variable) = 1 (0123456789.-)
@seen_names (Variable) = (empty)
@i (Variable) = i (") (repeat item var)
@names (Variable) = {list [{" John} {" Jane} {" Joe}]} (action)
@names_len (Variable) = {count [{variable names}]} (action)

## MENUS ##
map[]

## IMPORT QUESTIONS ##
map[]

### PLIST GEN ###

## UUIDS ##
map[]

### CUSTOM ACTIONS ###


### INCLUDES ###

## INCLUDED ##
[]

## INCLUDES MAP ##
[]

#############################################################

panic: debug

goroutine 1 [running]:
main.panicDebug()
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/main.go:265 +0x10c
main.handle({0x104bcdfc8?, 0x1400011c5d0?})
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/main.go:211 +0x168
main.incrementValue({0x104ba5820?, 0x14000118190?})
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/action.go:378 +0x54
main.scriptingActions.func51({0x14000164300, 0x3, 0x14000126480?})
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/actions_std.go:3774 +0x3c
main.checkAction()
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/action.go:206 +0xb4
main.collectAction()
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/parser.go:1133 +0x1cc
main.collectValue(0x1400018da68, 0x1400019da78, 0xa)
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/parser.go:350 +0x320
main.collectVariableValue(0x0, 0x1400019da68, 0x1400019da78, 0x1400018da58, 0x1400019da98, 0x1400019da88)
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/parser.go:290 +0x1bc
main.collectVariable(0x0)
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/parser.go:503 +0x330
main.parse()
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/parser.go:169 +0x13c
main.initParse()
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/parser.go:50 +0x348
main.main()
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/main.go:62 +0x258```

Variable arguments to `killAllApps`, `hideAllApps`, and `quitAllApps` are treated as constants

Describe the bug
The app id that I set the variable to is used as the argument to the action (killAllApps, hideAllApps, or quitAllApps) instead of the variable.

To Reproduce

@e = "com.apple.mobilesafari"
killAllApps(e)
@e = "com.apple.mobilesafari"
hideAllApps(e)
@e = "com.apple.mobilesafari"
quitAllApps(e)

Debug output
There is no compile error, but this a screenshot of the problematic Shortcut

Screenshot 2023-12-05 at 8 24 23 PM

Expected behavior

Screenshot 2023-12-05 at 8 24 45 PM

Version Information (please complete the following information):

  • macOS version (run uname -a): Darwin Michaels-MacBook-Air.local 23.2.0 Darwin Kernel Version 23.2.0: Fri Oct 13 09:28:08 PDT 2023; root:xnu-10002.60.54~14/RELEASE_ARM64_T8112 arm64
  • Golang version (run go version): go version go1.21.4 darwin/arm64

`emailAddress`, `phoneNumber`, and `list` do not handle variables correctly

Describe the bug
When emailAddress, phoneNumber, or list are used with a variable the produced Shortcut treats the variable as some sort of literal.

To Reproduce

@e = "[email protected]"
emailAddress(e)

Debug output
The program compiles successfully, but here's an image of what happens

Screenshot 2023-12-05 at 6 57 53 PM

Expected behavior

Screenshot 2023-12-05 at 6 58 10 PM

Screenshots
See above

Version Information (please complete the following information):

  • macOS version (run uname -a): Darwin Michaels-MacBook-Air.local 23.2.0 Darwin Kernel Version 23.2.0: Fri Oct 13 09:28:08 PDT 2023; root:xnu-10002.60.54~14/RELEASE_ARM64_T8112 arm64
  • Golang version (run go version): go version go1.21.4 darwin/arm64

The `getCurrentWeather()` function produces an invalid Shortcut

Describe the bug
The getCurrentWeather() function produces a Shortcut with an invalid action. The action seems to be incompatible with the current version of Shortcuts.

To Reproduce

getCurrentWeather()

Debug output
N/A

Expected behavior
I expect the action produced in the Shortcut to be valid.

Screenshots

  • macOS (Sonoma 14.2)
    Screenshot 2023-11-02 at 3 06 07 AM
  • iOS (17.1)
    IMG_010FF01037D3-1

Version Information (please complete the following information):

  • macOS version: Darwin Michaels-MacBook-Air.local 23.2.0 Darwin Kernel Version 23.2.0: Fri Oct 13 09:28:08 PDT 2023; root:xnu-10002.60.54~14/RELEASE_ARM64_T8112 arm64
  • Golang version: go version go1.21.3 darwin/arm64

Additional context
N/A

Add Import Questions

This is a bit of a tough one because of the way it is implemented in the Shortcut plist, but not impossible.

Shortcuts Failing to sign on macOS 14.4

Describe the bug

When signing a Shortcut with the shortcuts binary on macOS through the Cherri compiler, when it attempts to sign the Shortcut produced by Cherri, it produces this output:

Error: Failed to sign Shortcut

shortcuts: ERROR: Unrecognized attribute string flag '?' in attribute string "T@"NSString",?,R,C" for property debugDescription
ERROR: Unrecognized attribute string flag '?' in attribute string "T@"NSString",?,R,C" for property debugDescription
ERROR: Unrecognized attribute string flag '?' in attribute string "T@"NSString",?,R,C" for property debugDescription
ERROR: Unrecognized attribute string flag '?' in attribute string "T@"NSString",?,R,C" for property debugDescription
ERROR: Unrecognized attribute string flag '?' in attribute string "T@"NSString",?,R,C" for property debugDescription
Error: The file “arr.shortcut” couldn’t be saved in the folder “cherri”.

To Reproduce

No code seems to trigger this specifically. Something about the general format of Shortcuts that Cherri currently creates is not compatible with the current version of macOS.

Debug output
Please use the --debug flag and copy the output.

Expected behavior

For the Shortcut to be signed.

Screenshots
If applicable, add screenshots to help explain your problem.

Version Information (please complete the following information):

Darwin Kernel Version 23.4.0

go version go1.22.1 darwin/arm64

url() action only accepts string

URL action actually accepts a text where you can embed variables inside. But current implementation of url() only works for literal strings.

So, this does not work:

@a = "http://google.com"
@b = url(a)

Currently, this gets generated with the code above:

Screen Shot 2023-09-04 at 2 11 27 PM

Issue with retrieving unitType enums from a list

Describe the bug
I run into a panic when I try to use a unitType enum that I retrieved from a list as an argument. This is similar to Issue #31

To Reproduce

@utlist = list("Length", "Angle")
@l = getListItem(utlist, 0)
@a = getListItem(utlist, 1)
@meas = measurement("2000", l, "meter")
@val = convertMeasurement(meas, l, "ft")

Debug output
Parsing custom actions... ### CUSTOM ACTIONS ###

done!
Parsing test.cherri...
panic: interface conversion: interface {} is main.action, not string

goroutine 1 [running]:
main.webActions.func11({0x14000104300, 0x3, 0x140000ae910?})
/Users/michaelogezi/Documents/projects/-cherri/cherri/actions_std.go:4926 +0x158
main.checkAction()
/Users/michaelogezi/Documents/projects/-cherri/cherri/action.go:204 +0x7c
main.collectAction()
/Users/michaelogezi/Documents/projects/-cherri/cherri/parser.go:1195 +0x270
main.collectValue(0x14000111790, 0x140001117a0, 0xa)
/Users/michaelogezi/Documents/projects/-cherri/cherri/parser.go:308 +0x4e4
main.collectVariableValue(0x0, 0x14000111790, 0x140001117a0, 0x140001117d0, 0x140001117c0)
/Users/michaelogezi/Documents/projects/-cherri/cherri/parser.go:241 +0x3c
main.collectVariable(0x0)
/Users/michaelogezi/Documents/projects/-cherri/cherri/parser.go:486 +0x6e8
main.parse()
/Users/michaelogezi/Documents/projects/-cherri/cherri/parser.go:148 +0x480
main.initParse()
/Users/michaelogezi/Documents/projects/-cherri/cherri/parser.go:50 +0x2f4
main.main()
/Users/michaelogezi/Documents/projects/-cherri/cherri/main.go:75 +0x35c
exit status 2

Expected behavior
I expect the retrieved enum to work as an argument.

Screenshots
N/A

Version Information (please complete the following information):

  • macOS version (run uname -a): Darwin Michaels-MacBook-Air.local 23.2.0 Darwin Kernel Version 23.2.0: Fri Oct 13 09:28:08 PDT 2023; root:xnu-10002.60.54~14/RELEASE_ARM64_T8112 arm64
  • Golang version (run go version): go version go1.21.4 darwin/arm64

Additional context
N/A

Convert a Shortcut from a file or iCloud link to Cherri code

Many Shortcuts languages before Cherri had this feature, so it is possible 😅

My original thoughts on this were that Cherri abstracts away some parts of creating Shortcuts for the sake of not having to put too much effort into writing a Shortcut, so I figured Cherri would not translate as naturally.

I figured that this would be preferred because converting and then having everything in one long file which may not come out right, would not be preferred to re-writing it, and along the way, finding ways that Cherri can improve the Shortcut or the maintainability of it since you can spread a Shortcut out into multiple files with includes.

However, it's not a great experience to not at least be able to generate a best guess of how a Shortcut would be written in Cherri. Instead having to re-write the entire Shortcut in Cherri. The developer can at least take the guess from there and tweak as needed.

Not saying I'm striving for guess quality but no decompilation will ever be 100% accurate.

`killApp`, `openApp`, `quitApp`, `hideApp`, and `splitApps` cause the compiler to crash when used with a variable.

To Reproduce

@e = "com.apple.mobilesafari"
quitApp(e)
@e = "com.apple.mobilesafari"
openApp(e)
@e = "com.apple.mobilesafari"
killApp(e)
@e = "com.apple.mobilesafari"
hideApp(e)
@e = "com.apple.mobilesafari"
@a = "com.apple.mail"
@s = "half"
splitApps(e, a, s)

Debug output

Parsing test.cherri...
### PARSING ###

Previous Character:
) 2:10

Current Character:
EMPTY 2:10

Current Line:
quitApp(e)
## TOKENS ##
1 | {variable e text com.apple.mobilesafari}
2 | {action quitApp action {quitApp [{variable com.apple.mobilesafari}]}}

## DEFINITIONS ##
Name: test
Color: -1263359489
Glyph: 61440
Inputs: []
Outputs: []
Workflows: []
No Input: { []}
macOS Only: false
Mininum Version: 900
iOS Version: 17.0

## VARIABLES ##
@e = com.apple.mobilesafari (text)

## MENUS ##
map[]

## IMPORT QUESTIONS ##
map[]

Done.

Generating plist...

Error: Undefined reference 'com'

###################
#   DEBUG PANIC   #
###################

### PARSING ###

Previous Character:
EMPTY 1:0

Current Character:
EMPTY 1:0

## TOKENS ##
1 | {variable e text com.apple.mobilesafari}
2 | {action quitApp action {quitApp [{variable com.apple.mobilesafari}]}}

## DEFINITIONS ##
Name: test
Color: -1263359489
Glyph: 61440
Inputs: []
Outputs: []
Workflows: []
No Input: { []}
macOS Only: false
Mininum Version: 900
iOS Version: 17.0

## VARIABLES ##
@e = com.apple.mobilesafari (text)

## MENUS ##
map[]

## IMPORT QUESTIONS ##
map[]

### PLIST GEN ###

## UUIDS ##
map[e:AE878BDA-B8A6-4FDA-90FC-FD68D8963B0A]

### CUSTOM ACTIONS ###


### INCLUDES ###

## INCLUDED ##
[]

## INCLUDES MAP ##
[]

#############################################################

panic: debug

goroutine 1 [running]:
main.panicDebug({0x0, 0x0})
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/main.go:320 +0x12c
main.exit({0x140000de2e0?, 0x18?})
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/main.go:393 +0x10c
main.makeAttachmentValues()
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/plist.go:634 +0x2b8
main.attachmentValues({0x104f07d2a, 0x10}, {0x140000b4180, 0x18}, {0x104f030c0, 0x6})
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/plist.go:593 +0x11c
main.paramValue({0x104f07d2a, 0x10}, {{0x104f03bfd?, 0x7?}, {0x104f4d600?, 0x140000a2140?}}, {0x104f0282f?, 0x104de4d20?}, {0x104f030c0?, 0x400000?})
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/plist.go:821 +0x154
main.argumentValue({0x104f07d2a, 0x10}, {0x140000c6220, 0x1, 0x200?}, 0x0)
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/plist.go:811 +0x310
main.scriptingActions.func32({0x140000c6220?, 0x140000a64e0?, 0x140000b0130?})
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/actions_std.go:3418 +0x40
main.actionParameters({0x140000c6220?, 0x1, 0x1})
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/action.go:124 +0x26c
main.plistAction({0x140000c6220, 0x1, 0x1}, 0x14000125708, 0x140001256d8)
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/action.go:92 +0x68
main.plistActions()
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/plistgen.go:178 +0x3b8
main.makePlist()
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/plistgen.go:36 +0x244
main.main()
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/[email protected]/main.go:77 +0x360

Version Information (please complete the following information):

  • macOS version (run uname -a): Darwin Michaels-MacBook-Air.local 23.2.0 Darwin Kernel Version 23.2.0: Fri Oct 13 09:28:08 PDT 2023; root:xnu-10002.60.54~14/RELEASE_ARM64_T8112 arm64
  • Golang version (run go version): go version go1.21.4 darwin/arm64

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.