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
- [ ] any string apart from the basic string with no escapes
- [ ] check if int fits in int or make it a float
- [ ] strip out comments before parsing

View File

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

View File

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