refactor: scaladocs-style commenting added in parser

This commit is contained in:
Guy C 2025-02-07 15:37:55 +00:00
parent c6b57be2c3
commit f9e5ae4d98

View File

@ -47,7 +47,8 @@ object parser {
enum LabelType:
case Expr
case Pair
// Lexer-backed errorBuilder
implicit val builder: ErrorBuilder[String] = new DefaultErrorBuilder with LexToken {
def tokens = errTokens
}
@ -151,8 +152,7 @@ object parser {
)
| While("while" ~> `<expr>`.labelWithType(LabelType.Expr) <~ "do", `<stmt>` <~ "done")
| Block("begin" ~> `<stmt>` <~ "end")
| VarDecl(`<type>`, `<ident>` <~ "=", `<rvalue>`.label("valid initial value for variable"))
// TODO: Can we inline the name of the variable in the message
| VarDecl(`<type>`, `<ident>` <~ "=", `<rvalue>`)
| Assign(`<lvalue>` <~ "=", `<rvalue>`)
private lazy val `<lvalue>`: Parsley[LValue] =
`<pair-elem>` | `<ident-or-array-elem>`