Print verbose errors in the tree walker
diff --git a/smali/src/main/antlr3/smaliTreeWalker.g b/smali/src/main/antlr3/smaliTreeWalker.g
index 326d5bd..6611064 100644
--- a/smali/src/main/antlr3/smaliTreeWalker.g
+++ b/smali/src/main/antlr3/smaliTreeWalker.g
@@ -52,6 +52,11 @@
@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 @@
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
{
diff --git a/smali/src/main/java/org/jf/smali/main.java b/smali/src/main/java/org/jf/smali/main.java
index 773c08a..ecd9cf9 100644
--- a/smali/src/main/java/org/jf/smali/main.java
+++ b/smali/src/main/java/org/jf/smali/main.java
@@ -318,7 +318,7 @@
treeStream.setTokenStream(tokens);
smaliTreeWalker dexGen = new smaliTreeWalker(treeStream);
-
+ dexGen.setVerboseErrors(verboseErrors);
dexGen.dexFile = dexFile;
dexGen.smali_file();