Skip to content
This repository was archived by the owner on Nov 25, 2025. It is now read-only.
This repository was archived by the owner on Nov 25, 2025. It is now read-only.

Java8Mapper-visitArrayAccess_lfno_primaryのinvokingState番号の修正 #30

Description

@khlee12
arrayAccess_lfno_primary=>UniFieldAccess
    :   (   expressionName$receiver '[' expression$index ']'
        |   primaryNoNewArray_lfno_primary_lfno_arrayAccess_lfno_primary$receiver '[' expression$index ']'
        )
        (   primaryNoNewArray_lfno_primary_lf_arrayAccess_lfno_primary$receiver '[' expression$index ']'
        )*
    ;

UMGで生成されたマッパーは以下です。

override public visitArrayAccess_lfno_primary(Java8Parser.ArrayAccess_lfno_primaryContext ctx) {
        val map = newHashMap
        val none = newArrayList
        map.put("none", none)
        val receiver = newArrayList
        map.put("receiver", receiver)
        val index = newArrayList
        map.put("index", index)
        ctx.children.forEach [
            if (it instanceof RuleContext) {
                switch it.invokingState {
                    case 2105: {
                        receiver += it.visit
                    }
                    case 2307: {
                        index += it.visit
                    }
                    case 2347: {
                        receiver += it.visit
                    }
                    case 2350: {
                        index += it.visit
                    }
                    case 2360: {
                        receiver += it.visit
                    }
                    case 2362: {
                        index += it.visit
                    }
                    default: {
                        none += it.visit
                    }
                }
            } else if (it instanceof TerminalNode) {
                switch it.symbol.type {
                    default: {
                        none += it.visit
                    }
                }
            }
        ]
        map.castTo(UniFieldAccess)
    }

ここの

case 2347: {
    receiver += it.visit
}

invokingStateが間違ってて、
23472348に修正するとマッパーが正常に動きます。

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions