Convert a java regular expression pattern into a graph.
/usr/bin/dot
should be available. It could be installed using:
$ sudo apt install graphviz
OR
$ brew install graphviz
$ ./gradlew build
Using the command line:
$ ./gradlew run
Then open http://localhost:9000/ in your browser.
It's also possible to define customized server port and Graphviz dot path:
$ ./gradlew run -Dport=8080 -Ddot=./path-to-dot/dot
OR
$ export GRAPHVIZ_DOT="./path-to-dot/dot"
$ ./gradlew run -Dport=8080
( using an IDE, execute com.auzeill.regex.graph.Server
main()
)
$ ./gradlew run -Dgenerate=regex-list.txt
The regex list file format is, one line per images: <target_file_name>::<quoted_regex>
- target_file_name: end with ".png"
- type: L|P|T|A|TA(,left-margin,right-margin,top-margin,bottom-margin)?
- For example A or TA,10,10,50,30
- L: Create the legend
- P: JVM Pattern
- T: AST Tree
- A: Automaton States
- TA: AST Tree + Automaton States
- ,left-margin,right-margin,top-margin,bottom-margin: crop a portion of the generated image
- quoted_regex: "..."
for example:
# this is a comment
a-start.png:A:"a*"
a-plus.png:TA,10,10,50,30:"a+"
$ ./gradlew test
Or to fix automatically the content of all src/test/resources/**/*.dot
files:
$ ./gradlew test -DfixTest=true