-
Notifications
You must be signed in to change notification settings - Fork 261
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
Support for custom output #25
Comments
This would be pretty useful. I've been using JavaParser's SymbolSolver for this so far. If this isn't in-scope you can always try that out. |
@Col-E it is possible for the classes to have some weird characters that could potentially affect the symbol solver like |
As long as the AST is built it should work. I've not tested on obfuscated code if that's what you're asking. |
FWIW - the current internal api is https://github.com/leibnitz27/cfr/blob/master/src/org/benf/cfr/reader/util/output/Dumper.java which is more of a literal string stream than ITextOutput. It wouldn't be too tricky to convert usages to a similar api. (note that there's some state which is used to handle how types are viewed etc). However ..... I have a sneaky (ENTIRELY UNJUSTIFIED) feeling that the next logical step is basically to export a parse tree, rather than something like a string stream. The issue there (yak shaving time!) is that I don't want to use standard JDK parse tree types, because I am very attached to 'any version of java' with forwards compatibility. And I don't want to export the internal AST types, because they contain a great deal of hackery that isn't locked down. I'm tempted to bypass the intermediate stage. |
@leibnitz27 Would it be possible for you to add an option to set a custom dumper factory in CfrDriverImpl as seen here? |
@leibnitz27 could you add methods like "writeComment", "writeKeyword", "writeDelimiter", etc. like procyon's ITextOutput? This would be very useful for syntax highlighting |
@leibnitz27 also would it be possible to make objects for identifier like method, fields, variables instead of string? |
Alright, I'm making a fork for my attempt at this https://github.com/bytespy/cfr |
Cool - please bear in mind a few small things: I massively prefer not to expose internal APIs, because I really appreciate the freedom to screw with them (you might have noticed). So either implement an externally visible API in dumper, or expose to the outside world via an adaptor please. Also note that the dumper (effctively) carries a type registration burden, which really doesn't want to be exposed to the outside world. |
I ended up going for a 'token-stream-with-semantic-info' rather than an explicit interface. I don't want to expose the internal interface, and this fits better with my aim of keeping the external API compatible in both directions. There's an example in https://github.com/leibnitz27/cfr_client/blob/master/src/org/benf/cfr_client_example/WithTokenSink.java |
I am currently working on a RE tool that would like to use CFR as a decompilation backend. I would like support for custom output for writing type references, method references, etc. This would be useful for making hyperlinks in the frontend, etc.
An example could be found here: ITextOutput.java
The text was updated successfully, but these errors were encountered: