This refactors everything using an IndentingWriter to use a BaksmaliWriter
instead, but the usages of ReferenceUtil and EncodedValue aren't refactored
yet.
Those were never really a good fit for IndentingWriter anyway, they had
nothing to do with that class's functionality.
They'll be removed from IndentingWriter once all the usages are switched.
This will be a more unified way to get/write out human-readable strings for
individual "things" from a dex file. The goal is to replace things like
ReferenceUtil, EncodedValueUtils, etc.
Some unicode characters are considered equivalent for filename purposes on mac.
This adds logic to treat these collisions the same way as case sensitivy
collisions are currently handled -- by adding a numeric suffix to the
file/directory anytime there is a collision.
See pull request #789 for more information.
Starting from JFlex 1.8.0, `yychar` is a long.
However, it is used to build an antlr `CommonToken` which takes an int.
Hence, explicit casting is needed.
I propose to cast the `yychar` with `java.lang.Math.toIntExact()` which throw an ArithmeticException in case of overflow.
This is acceptable because the previous code would have returned an overflowed (negative) position.
See https://github.com/jflex-de/jflex/pull/605 for details.
Previously, if you needed to provide a custom dex file rewriter, you
would have to override the DexRewriter class. This provides a more
consistent interface, allowing the dex file rewriter to be specified in
the module.
This adds a new rewriteUnwrappedType to the TypeRewriter class, which
gets called with the unwrapped type for array types, with the potentially
modified return value automatically being re-array-ified.
It was mis-lexing the case when a class descriptor is immediately
followed by a primitive type. The primitive type was being lexed as
PARAM_LIST_OR_ID_PRIMITIVE_TYPE instead of PRIMITIVE_TYPE.
The root cause was due to an incorrect state change. Since the
CLASS_DESCRIPTOR state can be started from within the PARAM_LIST state,
but when the CLASS_DESCRIPTOR state ends it just went back to YYINITIAL,
instead of going back to PARAM_LIST.
This adds a state stack to track these state changes
This unifies the handling of simple names between class descriptors and
member names, and ensures that spaces are only allowed for the appropriate
api levels in both cases
DEX format allows Unicode space characters in SimpleName since version 040.
Allowed space characters include everything in Unicode category 'Zs':
0x20, 0xa0, 0x1680, 0x2000..0x200a, 0x202f, 0x205f, 0x3000
Smali now supports symtax `method with spaces` (spaces are allowed in
backtick-quoted names).