override fun parse()

in gdscript/src/main/kotlin/gdscript/parser/roots/GdClassVarParser.kt [13:36]


    override fun parse(b: GdPsiBuilder, l: Int, optional: Boolean): Boolean {
        if (!b.recursionGuard(l, "ClassVar")) return false
        if (!b.nextTokenIs(VAR, STATIC)) return optional

        b.enterSection(CLASS_VAR_DECL_TL)
        if (b.passToken(STATIC)) {
            // Separate check due to static being optional before FUNC as well
            if (b.nextTokenIs(NEW_LINE)) {
                b.pin(true)
                b.error(VAR.toString(), false)
                GdRecovery.topLevel(b, false)
                return b.exitSection(false)
            }
        }
        var ok = b.consumeToken(VAR, pin = true)
        ok = ok && b.mceIdentifier(VAR_NMI)

        ok = ok && GdTypedParser.parseWithAssignTypedAndExpr(b, l + 1, true)
        ok = ok && (parseGetSet(b, l + 1) || b.mceEndStmt())

        GdRecovery.topLevel(b, ok)

        return b.exitSection(ok, !ok && !b.pinned())
    }