fubark / cyber

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

Implement Match block range case. #32

Open sts10 opened 1 year ago

sts10 commented 1 year ago

The matching example from Docs throws an error in the online playground.

val = 1000
match val:
    0..100: print 'at or between 0 and 99'
    100: print 'val is 100'
    200:
        print 'val is 200'
    300, 400:
        print 'combined case'
    else:
        print 'val is {val}'

The error I get is:

ParseError: Expected comma or colon.
main:3:6:
0..100: print 'at or between 0 and 99'
^
fubark commented 1 year ago

The match block was only recently implemented and doesn't handle the range case atm.