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