Get set of patches to transform one Python3 code into another
There are two ways to get jar of application:
- With all dependencies in box
gradle fatJar
- Only with application code
gradle jar
To start API server run
java -jar path/to/build/amorph.jar
To test API checkout small demo app at the root of your localhost
There is only one API endpoint - for computing diff between two Python3 codes
Parameters:
src
source codedst
destination code to convert source into
Response:
JSON array of patches to apply to source tree. All positions are referring to src
code. There are 3 types of patches that are plain JSON objects with following fields:
type
=="delete"
start
- position to start delete fromstop
- position after last character to delete
type
=="insert"
text
- code piece to insertpos
- position to inserttext
into
Synonym for replace
type
=="update"
start
- position to start replace fromstop
- position after last character to replacetext
- value to replace text in range with
NOTE pos
of insert patch can refer to position further than string length. In this case append to the end is requested
Amorph-java is based ANTLR4 and rewritten version of Gumtree
MIT