on master help sign in
break and goto
4ed8acbiko
zod/luau/TODO.md+1
@@ -3,3 +3,4 @@
3- [ ] functioncall
3- [ ] functioncall
4- [ ] any string apart from the basic string with no escapes
4- [ ] any string apart from the basic string with no escapes
5- [ ] check if int fits in int or make it a float
5- [ ] check if int fits in int or make it a float
6+- [ ] strip out comments before parsing
zod/luau/lib/lua.hoon+18
@@ -465,7 +465,9 @@
465 [%blok blok]
465 [%blok blok]
466 [%asmnt varlist exprlist]
466 [%asmnt varlist exprlist]
467 [%label label]
467 [%label label]
468+ [%goto label]
468 [%func-call functioncall]
469 [%func-call functioncall]
470+ [%break ~]
469 [%empty ~]
471 [%empty ~]
470 ==
472 ==
471++ parse-stat
473++ parse-stat
@@ -474,6 +476,15 @@
474 ;~ pose
476 ;~ pose
475 (cold [%empty ~] (just ';'))
477 (cold [%empty ~] (just ';'))
476 ::
478 ::
479+ (cold [%break ~] (jest 'break'))
480+ ::
481+ %+ cook
482+ |= [* =label] [%goto label]
483+ ;~ (glue ws)
484+ (jest 'goto')
485+ parse-name
486+ ==
487+ ::
477 %+ cook
488 %+ cook
478 |= =label [%label label]
489 |= =label [%label label]
479 parse-label
490 parse-label
@@ -513,6 +524,13 @@
513 ==
524 ==
514 %label (print-label +.stat)
525 %label (print-label +.stat)
515 %func-call (print-functioncall +.stat)
526 %func-call (print-functioncall +.stat)
527+ %break "break"
528+ %goto
529+ %- zing
530+ :~
531+ "goto "
532+ (trip +.stat)
533+ ==
516 ==
534 ==
517:: functioncall
535:: functioncall
518::
536::
zod/luau/tests/foo.lua+4
@@ -55,3 +55,7 @@ print('the way of the future')
55print 'hello'
55print 'hello'
56
56
57h{key1 = 'Sonmi~451'}
57h{key1 = 'Sonmi~451'}
58+
59+goto helli
60+
61+break