on master help sign in
Got tests working
commitdc1fadcbe9c5db9229358c13c31223ccf2721b8d authoriko <mail@iko.soy> dateFri 26 Jul 2024, 12:51 (2 years ago) parentfcef505
1 file changed+46−32
zod/luau/lib/lua/parser.hoon+46−32
zod/luau/lib/lua/parser.hoon+46−32
@@ -9,7 +9,6 @@ apex
99 %- punt
1010 ;~ plug
1111 hax
12− zap
1312 (star ;~(less (just '\0a') next))
1413 ==
1514 ::
@@ -105,21 +104,8 @@ apex
105104 |=([* =tape *] (crip tape))
106105 ;~ plug
107106 quot
108− (star ;~(less quot next))
109− quot
110− ==
111− --
112− ;~ pose
113− (parse-string '"')
114− (parse-string '\'')
115− ::
116− %+ cook |=(=tape (crip tape))
117− %- long-brackets
118− |* closing=rule
119− ;~ pfix
120− (punt nl)
121107 %- star
122− ;~ less closing
108+ ;~ less quot
123109 ;~ pose
124110 %+ cold '\07' (jest '\\a')
125111 %+ cold '\08' (jest '\\b')
@@ -132,7 +118,7 @@ apex
132118 %+ cold '"' (jest '\\"')
133119 %+ cold '\'' (jest '\\\'')
134120 %+ cold '\0a' (jest '\\\0a')
135− %+ cold '' ;~(pose (jest '\\z') (plus gaw))
121+ %+ cold '' ;~(plug (jest '\\z') gaw)
136122 ::
137123 ;~ pfix
138124 (jest '\\x')
@@ -159,6 +145,21 @@ apex
159145 next
160146 ==
161147 ==
148+ quot
149+ ==
150+ --
151+ ;~ pose
152+ (parse-string '"')
153+ (parse-string '\'')
154+ ::
155+ %+ cook |=(=tape (crip tape))
156+ %- long-brackets
157+ |* closing=rule
158+ ;~ pfix
159+ (punt nl)
160+ %- star
161+ ;~ less closing next
162+ ==
162163 ==
163164 ==
164165++ parse-table
@@ -317,7 +318,7 @@ apex
317318 |= =prefix-expr
318319 %+ cook
319320 |=([* =name] [%dot prefix-expr name])
320− ;~ plug
321+ ;~ (glue ws)
321322 dot
322323 parse-name
323324 ==
@@ -332,21 +333,29 @@ apex
332333 (cold [%break ~] (jest 'break'))
333334 ::
334335 %+ cook
335− |= [* cond=expr * body=blok *] [%while cond body]
336+ |= [* cond=expr * body=blok] [%while cond body]
336337 ;~ (glue wss)
337338 (jest 'while')
338339 parse-expr
339340 (jest 'do')
340− parse-blok
341− (jest 'end')
341+ ;< body=blok bind parse-blok
342+ ;~ pfix
343+ ?: (blok-is-empty body) ws wss
344+ (jest 'end')
345+ (easy body)
346+ ==
342347 ==
343348 ::
344349 %+ cook
345− |= [* body=blok * cond=expr] [%repeat body cond]
350+ |= [* body=blok cond=expr] [%repeat body cond]
346351 ;~ (glue wss)
347352 (jest 'repeat')
348− parse-blok
349− (jest 'until')
353+ ;< body=blok bind parse-blok
354+ ;~ pfix
355+ ?: (blok-is-empty body) ws wss
356+ (jest 'until')
357+ (easy body)
358+ ==
350359 parse-expr
351360 ==
352361 ::
@@ -603,18 +612,23 @@ apex
603612 ==
604613 ==
605614 ::
606− %- punt
607− %+ cook
608− |= [* =blok] blok
609− ;~ pfix
610− wss
611− ;~ (glue wss)
612− (jest 'else')
613− parse-blok
615+ ;< else-body=(unit blok) bind
616+ %- punt
617+ %+ cook
618+ |= [* =blok] blok
619+ ;~ pfix
620+ wss
621+ ;~ (glue wss)
622+ (jest 'else')
623+ parse-blok
624+ ==
614625 ==
626+ ;~ pfix
627+ ?~ else-body wss
628+ ?: (blok-is-empty u.else-body) ws wss
629+ (easy else-body)
615630 ==
616631 ::
617− wss
618632 (jest 'end')
619633 ==
620634++ parse-functioncall