feat: show exact statement which must be returning at the end of a function

This commit is contained in:
2025-02-02 00:00:09 +00:00
parent a71045867a
commit cb9796fa87
2 changed files with 15 additions and 9 deletions

View File

@@ -75,15 +75,15 @@ object parser {
// Statements
private lazy val `<program>` = Program(
"begin" ~> many(atomic(`<func>`)),
"begin" ~> many(`<func>`),
`<stmt>` <~ "end"
)
private lazy val `<func>` = FuncDecl(
`<type>`,
`<ident>` <~ "(",
atomic(`<type>`),
atomic(`<ident>`) <~ "(",
sepBy(`<param>`, ",") <~ ")" <~ "is",
`<stmt>` <~ "end"
)
`<stmt>`
) <~ "end"
private lazy val `<param>` = Param(`<type>`, `<ident>`)
private lazy val `<stmt>`: Parsley[NonEmptyList[Stmt]] =
sepBy1(`<basic-stmt>`, ";")