Print verbose errors in the tree walker

This commit is contained in:
Ben Gruver 2012-09-25 19:56:35 -07:00
parent a59fe7e523
commit d317a0679d
2 changed files with 9 additions and 2 deletions

View File

@ -52,6 +52,11 @@ import org.jf.dexlib.Code.Format.*;
@members {
public DexFile dexFile;
public TypeIdItem classType;
private boolean verboseErrors = false;
public void setVerboseErrors(boolean verboseErrors) {
this.verboseErrors = verboseErrors;
}
private byte parseRegister_nibble(String register, int totalMethodRegisters, int methodParameterRegisters)
throws SemanticException {
@ -141,11 +146,13 @@ smali_file
classDataItem, $fields.staticFieldInitialValues);
};
catch [Exception ex] {
if (verboseErrors) {
ex.printStackTrace(System.err);
}
reportError(new SemanticException(input, ex));
}
header returns[TypeIdItem classType, int accessFlags, TypeIdItem superType, TypeListItem implementsList, StringIdItem sourceSpec]
: class_spec super_spec? implements_list source_spec
{

View File

@ -318,7 +318,7 @@ public class main {
treeStream.setTokenStream(tokens);
smaliTreeWalker dexGen = new smaliTreeWalker(treeStream);
dexGen.setVerboseErrors(verboseErrors);
dexGen.dexFile = dexFile;
dexGen.smali_file();