on master help sign in
Got tests working
dc1fadciko
zod/luau/lib/lua/parser.hoon+46−32
@@ -9,7 +9,6 @@ apex
9 %- punt
9 %- punt
10 ;~ plug
10 ;~ plug
11 hax
11 hax
12− zap
13 (star ;~(less (just '\0a') next))
12 (star ;~(less (just '\0a') next))
14 ==
13 ==
15 ::
14 ::
@@ -105,21 +104,8 @@ apex
105 |=([* =tape *] (crip tape))
104 |=([* =tape *] (crip tape))
106 ;~ plug
105 ;~ plug
107 quot
106 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)
121 %- star
107 %- star
122− ;~ less closing
108+ ;~ less quot
123 ;~ pose
109 ;~ pose
124 %+ cold '\07' (jest '\\a')
110 %+ cold '\07' (jest '\\a')
125 %+ cold '\08' (jest '\\b')
111 %+ cold '\08' (jest '\\b')
@@ -132,7 +118,7 @@ apex
132 %+ cold '"' (jest '\\"')
118 %+ cold '"' (jest '\\"')
133 %+ cold '\'' (jest '\\\'')
119 %+ cold '\'' (jest '\\\'')
134 %+ cold '\0a' (jest '\\\0a')
120 %+ cold '\0a' (jest '\\\0a')
135− %+ cold '' ;~(pose (jest '\\z') (plus gaw))
121+ %+ cold '' ;~(plug (jest '\\z') gaw)
136 ::
122 ::
137 ;~ pfix
123 ;~ pfix
138 (jest '\\x')
124 (jest '\\x')
@@ -159,6 +145,21 @@ apex
159 next
145 next
160 ==
146 ==
161 ==
147 ==
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+ ==
162 ==
163 ==
163 ==
164 ==
164++ parse-table
165++ parse-table
@@ -317,7 +318,7 @@ apex
317 |= =prefix-expr
318 |= =prefix-expr
318 %+ cook
319 %+ cook
319 |=([* =name] [%dot prefix-expr name])
320 |=([* =name] [%dot prefix-expr name])
320− ;~ plug
321+ ;~ (glue ws)
321 dot
322 dot
322 parse-name
323 parse-name
323 ==
324 ==
@@ -332,21 +333,29 @@ apex
332 (cold [%break ~] (jest 'break'))
333 (cold [%break ~] (jest 'break'))
333 ::
334 ::
334 %+ cook
335 %+ cook
335− |= [* cond=expr * body=blok *] [%while cond body]
336+ |= [* cond=expr * body=blok] [%while cond body]
336 ;~ (glue wss)
337 ;~ (glue wss)
337 (jest 'while')
338 (jest 'while')
338 parse-expr
339 parse-expr
339 (jest 'do')
340 (jest 'do')
340− parse-blok
341+ ;< body=blok bind parse-blok
342+ ;~ pfix
343+ ?: (blok-is-empty body) ws wss
341− (jest 'end')
344+ (jest 'end')
345+ (easy body)
346+ ==
342 ==
347 ==
343 ::
348 ::
344 %+ cook
349 %+ cook
345− |= [* body=blok * cond=expr] [%repeat body cond]
350+ |= [* body=blok cond=expr] [%repeat body cond]
346 ;~ (glue wss)
351 ;~ (glue wss)
347 (jest 'repeat')
352 (jest 'repeat')
348− parse-blok
353+ ;< body=blok bind parse-blok
354+ ;~ pfix
355+ ?: (blok-is-empty body) ws wss
349− (jest 'until')
356+ (jest 'until')
357+ (easy body)
358+ ==
350 parse-expr
359 parse-expr
351 ==
360 ==
352 ::
361 ::
@@ -603,18 +612,23 @@ apex
603 ==
612 ==
604 ==
613 ==
605 ::
614 ::
615+ ;< else-body=(unit blok) bind
606− %- punt
616+ %- punt
607− %+ cook
617+ %+ cook
608− |= [* =blok] blok
618+ |= [* =blok] blok
609− ;~ pfix
619+ ;~ pfix
610− wss
620+ wss
611− ;~ (glue wss)
621+ ;~ (glue wss)
612− (jest 'else')
622+ (jest 'else')
613− parse-blok
623+ parse-blok
624+ ==
614 ==
625 ==
626+ ;~ pfix
627+ ?~ else-body wss
628+ ?: (blok-is-empty u.else-body) ws wss
629+ (easy else-body)
615 ==
630 ==
616 ::
631 ::
617− wss
618 (jest 'end')
632 (jest 'end')
619 ==
633 ==
620++ parse-functioncall
634++ parse-functioncall