break and goto

This commit is contained in:
iko 2024-05-18 13:33:29 +03:00
parent 907ae4d250
commit 4ed8acbbb1
Signed by untrusted user: iko
GPG Key ID: 82C257048D1026F2
3 changed files with 23 additions and 0 deletions

View File

@ -3,3 +3,4 @@
- [ ] functioncall - [ ] functioncall
- [ ] any string apart from the basic string with no escapes - [ ] any string apart from the basic string with no escapes
- [ ] check if int fits in int or make it a float - [ ] check if int fits in int or make it a float
- [ ] strip out comments before parsing

View File

@ -465,7 +465,9 @@
[%blok blok] [%blok blok]
[%asmnt varlist exprlist] [%asmnt varlist exprlist]
[%label label] [%label label]
[%goto label]
[%func-call functioncall] [%func-call functioncall]
[%break ~]
[%empty ~] [%empty ~]
== ==
++ parse-stat ++ parse-stat
@ -474,6 +476,15 @@
;~ pose ;~ pose
(cold [%empty ~] (just ';')) (cold [%empty ~] (just ';'))
:: ::
(cold [%break ~] (jest 'break'))
::
%+ cook
|= [* =label] [%goto label]
;~ (glue ws)
(jest 'goto')
parse-name
==
::
%+ cook %+ cook
|= =label [%label label] |= =label [%label label]
parse-label parse-label
@ -513,6 +524,13 @@
== ==
%label (print-label +.stat) %label (print-label +.stat)
%func-call (print-functioncall +.stat) %func-call (print-functioncall +.stat)
%break "break"
%goto
%- zing
:~
"goto "
(trip +.stat)
==
== ==
:: functioncall :: functioncall
:: ::

View File

@ -55,3 +55,7 @@ print('the way of the future')
print 'hello' print 'hello'
h{key1 = 'Sonmi~451'} h{key1 = 'Sonmi~451'}
goto helli
break