Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
khlee12 opened this issue Jul 14, 2016 · 0 comments
Open

Comments

@khlee12
Copy link
Contributor

khlee12 commented Jul 14, 2016

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に修正するとマッパーが正常に動きます。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant