fix: style fixes

This commit is contained in:
Guy C 2025-02-04 17:13:56 +00:00
parent 4602b75628
commit 057d625464

View File

@ -73,11 +73,15 @@ object parser {
) )
private lazy val `<pair-elem-type>` = private lazy val `<pair-elem-type>` =
(`<base-type>` <**> (`<array-type>` </> identity)) | (`<base-type>` <**> (`<array-type>` </> identity)) |
`<pair-type>` ~> ((`<pair-elems-type>` <**> `<array-type>`.explain("for a pair to contain a pair type, it must be an array or erased pair")) </> UntypedPairType) `<pair-type>` ~> ((`<pair-elems-type>` <**> `<array-type>`.explain(
"for a pair to contain a pair type, it must be an array or erased pair"
)) </> UntypedPairType)
// TODO: better explanation here? // TODO: better explanation here?
// Statements // Statements
private lazy val `<program>` = Program( private lazy val `<program>` = Program(
"begin" ~> many(atomic(`<type>`.label("function declaration") <~> `<ident>` <~ "(") <**> `<partial-func-decl>`).label("function declaration"), "begin" ~> many(
atomic(`<type>`.label("function declaration") <~> `<ident>` <~ "(") <**> `<partial-func-decl>`
).label("function declaration"),
`<stmt>`.label("main program body") <~ "end" `<stmt>`.label("main program body") <~ "end"
) )
private lazy val `<partial-func-decl>` = private lazy val `<partial-func-decl>` =
@ -126,7 +130,7 @@ object parser {
) | `<expr>`.label("valid expression") ) | `<expr>`.label("valid expression")
private lazy val `<pair-elem>` = private lazy val `<pair-elem>` =
Fst("fst" ~> `<lvalue>`.label("a valid pair")) Fst("fst" ~> `<lvalue>`.label("a valid pair"))
| Snd("snd" ~> `<lvalue>`.label("a valid pair")) | Snd("snd" ~> `<lvalue>`.label("a valid pair"))
private lazy val `<array-liter>` = ArrayLiter( private lazy val `<array-liter>` = ArrayLiter(
"[" ~> sepBy(`<expr>`, ",") <~ "]" "[" ~> sepBy(`<expr>`, ",") <~ "]"
) )