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

d2j-smali : no viable alternative at input ':' #16

Open
sealinglip opened this issue Jun 8, 2015 · 2 comments
Open

d2j-smali : no viable alternative at input ':' #16

sealinglip opened this issue Jun 8, 2015 · 2 comments
Labels

Comments

@sealinglip
Copy link

If a field is named as some special word, e.g. 'constructor', as the following shows

.field private final constructor:Lcom/google/mygson/internal/ObjectConstructor;

The small parser would complain as the title shows.

I think there should be some bug in the ANTLR rule 'sField', and perhaps other rules quote rule 'sAccList' are also the same.

sField : '.field' acc=sAccList (f=sFieldF|f=sFieldP) ('=' v=sFieldValue)?
(sAnnotation*
'.end field')?
;

As in the above-mentioned case, the token 'constructor' will be matched as a ACC because rule 'sAccList' is greedy and it will not go into the following rule to be matched as a field name.

I'm a newbie to ANTLR. It seems Apktool use the same rule to parse a field declaration, but it's surprising it works fine. And I also tried to change rule 'sAccList' into a nongreedy rule, but I failed.

I'm sorry I'm also a newbie to Github and I even don't know how to highlight the code snippet.
I hope the information above could help you!

@pxb1988 pxb1988 added the bug label Jun 8, 2015
@pxb1988
Copy link
Owner

pxb1988 commented Jun 8, 2015

yes, seams dex2jar is buggy on the 'constructor' var.

the different between dex2jar and smali is that the token sequence is different

  • for dex2jar, the token sequence is (6 tokens)
    .field private final constructor : Lcom/google/mygson/internal/ObjectConstructor;
  • and for smali the token sequence is (4 tokens)
    .field private final constructor:Lcom/google/mygson/internal/ObjectConstructor;

the constructor token is greedy eat by sAccList

pxb1988 added a commit that referenced this issue Jun 13, 2015
Fix issue #16
#16

--HG--
branch : 2.x
itlgl pushed a commit to itlgl/dex2jar that referenced this issue Nov 13, 2016
@ClockerZadq
Copy link

ClockerZadq commented Apr 4, 2017

The problem I'm seeing is referenced [here] (JesusFreke/smali#251) and I get that its not relevant to this but this tool and the ApkTool seem to be in disagreement.

I'm seeing this issue come up when using the ApkTool lib when attempting to re-build an APK. I'm using this tool to convert from dex to smali .The variable names in my source that are throwing the errors are: "views", "intent", "pending"... Will renaming my variables solve this issue?

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

No branches or pull requests

3 participants