fubark / cyber

Fast and concurrent scripting.
https://cyberscript.dev
MIT License
1.18k stars 40 forks source link

Implement map block syntax. #13

Open gpanders opened 1 year ago

gpanders commented 1 year ago

Running the example from the docs in the playground:

colors = {}:
    red: 0xFF0000
    green: 0x00FF00
    blue: 0x0000FF
    dump func (c):
        print c.red
        print c.green
        print c.blue

    -- Nested map.
    darker {}: 
        red: 0xAA0000
        green: 0x00AA00
        blue: 0x0000AA

gives the following error:

ParseError: Expected end of line or file, got colon
main:1:12:
colors = {}:
^
fubark commented 1 year ago

Thanks for catching this. The documentation is ahead of the implementation, and this is one such case. You can expect this feature will land though. One thing that may change is the initializer syntax.