refactor: make missing return type message more precise
This commit is contained in:
parent
d32855cc29
commit
4738207523
@ -117,12 +117,17 @@ object parser {
|
||||
|
||||
// Statements
|
||||
private lazy val `<program>` = Program(
|
||||
"begin" ~> many(
|
||||
atomic(`<type>`.label("function declaration") <~> `<ident>` <~ "(") <**> `<partial-func-decl>`
|
||||
).label("function declaration"),
|
||||
(atomic(`<ident>` <~ "(").verifiedExplain("function is missing return type") | `<stmt>`.label(
|
||||
"begin" ~> (
|
||||
many(
|
||||
atomic(
|
||||
`<type>`.label("function declaration") <~> `<ident>` <~ "("
|
||||
) <**> `<partial-func-decl>`
|
||||
).label("function declaration") |
|
||||
atomic(`<ident>` <~ "(").verifiedExplain("function declaration is missing return type")
|
||||
),
|
||||
`<stmt>`.label(
|
||||
"main program body"
|
||||
)) <~ "end"
|
||||
) <~ "end"
|
||||
)
|
||||
private lazy val `<partial-func-decl>` =
|
||||
FuncDecl(
|
||||
|
Loading…
x
Reference in New Issue
Block a user