feat: detect pointer operators

This commit is contained in:
Gleb Koval 2025-02-07 15:40:49 +00:00
parent 959c556eae
commit d32855cc29
Signed by: cyclane
GPG Key ID: 15E168A8B332382C

View File

@ -91,7 +91,8 @@ object parser {
`<ident-or-array-elem>`,
Parens("(" ~> `<expr>` <~ ")")
)
private val `<ident>` = Ident(ident)
private val `<ident>` =
Ident(ident) | some("*" | "&").verifiedExplain("pointer operators are not allowed")
private lazy val `<ident-or-array-elem>` =
`<ident>` <**> (`<array-indices>` </> identity)
private val `<array-indices>` = ArrayElem(some("[" ~> `<expr>` <~ "]"))