From 1138c6cc5f05f38fed0912e8fd3aaee07768fa04 Mon Sep 17 00:00:00 2001
From: Roberto Natella <2117196+rnatella@users.noreply.github.com>
Date: Mon, 10 May 2021 19:47:26 +0200
Subject: [PATCH 1/2] Node labels in HTML for colored/bold font
---
src/main/ASTtoDOT.java | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/src/main/ASTtoDOT.java b/src/main/ASTtoDOT.java
index cbdb7af..17e6f39 100644
--- a/src/main/ASTtoDOT.java
+++ b/src/main/ASTtoDOT.java
@@ -20,7 +20,7 @@ public static String ASTtoDotParser(MyMethodNode m) {
ASTNode astNode = mn.astNode;
int hashcode = astNode.hashCode();
int nodeType = astNode.getNodeType();
- str += ("\"" + String.valueOf(hashcode) + "\" [ label=\""+buildLabel(mn)+"\" type=" + String.valueOf(nodeType) + " startLineNumber="
+ str += ("\"" + String.valueOf(hashcode) + "\" [ label=<"+buildLabel(mn)+"> type=" + String.valueOf(nodeType) + " startLineNumber="
+ String.valueOf(mn.startLineNum)+" endLineNumber="
+ String.valueOf(mn.endLineNum) + " ]\n");
}
@@ -41,6 +41,17 @@ public static String ASTtoDotParser(MyMethodNode m) {
public static String buildLabel(MyASTNode node) {
String contentString=node.astNode.toString().replace("\n", " ").replace("\"", "\\\"").replace(" ", " ");
String nodeType=ASTNode.nodeClassForType(node.astNode.getNodeType()).getName().replace("org.eclipse.jdt.core.dom.", "");
- return "("+contentString+","+nodeType+","+node.startLineNum+","+node.endLineNum+")";
+
+ nodeType = nodeType.replaceAll("(?$1");
+
+ if(nodeType.toLowerCase().contains("name")) {
+ nodeType = ""+nodeType+"";
+ }
+ else if(nodeType.toLowerCase().contains("literal")) {
+ nodeType = ""+nodeType+"";
+ }
+
+ return ""+nodeType+"
"+(contentString.length()>15 ? contentString.substring(0,15)+" ... "+contentString.substring(contentString.length()-2) : contentString);
+
}
}
From 8984119f7a6b5daecc03734384abedabecf6be75 Mon Sep 17 00:00:00 2001
From: Roberto Natella
Date: Sun, 2 Mar 2025 18:08:41 +0100
Subject: [PATCH 2/2] Esempio Simpsons
---
.classpath | 28 +++----
.project | 11 +++
.settings/org.eclipse.core.resources.prefs | 2 +
DemoAST.java | 19 +++++
bin/main/ASTGenerator.class | Bin 3810 -> 3844 bytes
bin/main/ASTtoDOT.class | Bin 2793 -> 3407 bytes
bin/main/Main.class | Bin 2230 -> 2144 bytes
output/DemoAST.java_bart.dot | 24 ++++++
output/DemoAST.java_homer.dot | 92 +++++++++++++++++++++
output/DemoAST.java_lisa.dot | 24 ++++++
src/main/ASTtoDOT.java | 3 +-
src/main/Main.java | 4 +-
12 files changed, 190 insertions(+), 17 deletions(-)
create mode 100644 .settings/org.eclipse.core.resources.prefs
create mode 100644 DemoAST.java
create mode 100644 output/DemoAST.java_bart.dot
create mode 100644 output/DemoAST.java_homer.dot
create mode 100644 output/DemoAST.java_lisa.dot
diff --git a/.classpath b/.classpath
index 27faf72..c3a5258 100644
--- a/.classpath
+++ b/.classpath
@@ -2,19 +2,19 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/.project b/.project
index e9d783a..e8e5cb4 100644
--- a/.project
+++ b/.project
@@ -14,4 +14,15 @@
org.eclipse.jdt.core.javanature
+
+
+ 1740856740019
+
+ 30
+
+ org.eclipse.core.resources.regexFilterMatcher
+ node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__
+
+
+
diff --git a/.settings/org.eclipse.core.resources.prefs b/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 0000000..99f26c0
--- /dev/null
+++ b/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+encoding/=UTF-8
diff --git a/DemoAST.java b/DemoAST.java
new file mode 100644
index 0000000..f404bcb
--- /dev/null
+++ b/DemoAST.java
@@ -0,0 +1,19 @@
+
+public class DemoAST {
+ int bart(int x) { return x+1; }
+ int lisa(int x) { return x+2; }
+
+ int homer(int x) {
+ int y, a, b;
+
+ if(x>0) {
+ y = 0;
+ } else {
+ a = bart(1);
+ b = lisa(2);
+ y = a + b;
+ }
+ return y;
+ }
+
+}
diff --git a/bin/main/ASTGenerator.class b/bin/main/ASTGenerator.class
index 4d0e9c32f4025a7dd833043f3d1d898a4bd3948b..60bc1ef995de80b98f7f28eca7861d69fe79f423 100644
GIT binary patch
delta 1641
zcma)6`EwLS6#jaz-kt5;P#}Q;q}IYfLK2oJ39w=yfM_HKn2;C&VaQIBfn+!APB8Ic
z5sBgf9<69l@ivMV0WuJR2r3>Z-dAZ^R`CZ|<*)u=e4Q+1X_c10^mM;|?|a|--kZK~
z>8|P8xj#;v0x%EX4`}C^k7EYIG`X1T!HT+i4SATwF;o7+X1ViGAOo%i(+g3|QN%EA
zv$4&Hwi}7oXq}z160HJr5S1HTll*xo5x4?Z%I&V)8F?rbD8qaPo;K~3RwB;e$*(ME
zQ0NNM<(K9#SL{uU|{S04ld`^A7$amEkYRWVy
z?8_s+21;1w^6H{O2eTc_EgI){Ft3O?Sa2GPYKBqXbPP*ko?_kOph7Lz4B%Jk>Fq}qx%sY$*^1Ly|b*_5{(KL+pblwp2>t3B8H>$;m1@ypJc(5P4^~x_~*L1IgyZb=A<|?my
z9qcI!sokEku=k|aP=TH!VF_1S1_hJCqT@L3;8Z^*)D$~7o!gJ#VVoWRiG%Y4
y6ew^BCgF@U!Yj+ZqSm-DnLxhAH`EZN%p|x+)G}JuAreO^bVdn#x!
delta 1688
zcma)6>2p(66#w09H+i{98J5BWWU3WN+muk13ZWv%qO}{+LM>I{C3&{5v`I-`E2tO|
zP!vV*;Zjt@wXP^jACw~01s4R|KRAwG_z(QbIM#F1Fo@$ge!27Rx##?T=lsq&Z|k%R
zS1D)yJbn_u4fy$>a*lZw6k|HawH9;Cbk4v`tIRQXS_#THN*TsU^XhO{f@%oVq7l>aSj8|=w^+POfa}Y)g`MW`i%l}G0*zNvDP)8
zA!KPhMCdm$6n1GwGE%3T?Wsh4Dxt43GKQH-E2u(1K@=#11F8B^eP)L4HwXDq2h14li>*vk&prk>V_Nnknd
zpiGnc29sfYsHFCCy$!JrJ#NnDXk;j*oK-998s}O`SzG&9VS$1s1blSdDbRw|){tvK
z)mVo8$+i+7m`Fwh>fO}HkYSJL?cBeXQ-rF%GfQi9_dl#YK^2`
z-_sS-=`I^oEdfca9`rJZj0DKLFffXaVS~U%N#G-bT0Pljw#$$Q1Rg|hm_gB#iF|}q
z;~{}8JPh6>l_vWj8?;&A5p1zqJVjGt*e38OwlH|~^*vf=MpA4ScpOhydpvV0Vt7*E
zDaq$;*D~#k2}Qy_EwD?%@-D5ro5s+OIy@s_Vb9@k!qo~+;S-Kw
z>c}PJ>V~Bo;(E7~Sm09x849{-Go<+Obxmn4P6>aGFE~zLxjq{+rrss+CBCwTeMPg+
z&=Az8%p$Ewaud;6oaZ?AH=^aEsA*lJux}5KQ7TyWn!0eAjgXC5;W1tt*M*sl%3(z7
zhfvjW6bquRa@A$yW_c_g#4?7cryswmo9zrYK?~Zy^
zw@Q%r$YV{^r}{?2{r%Xk`t#x0SX3E8g8c7|3RS4e0NPYht|~Ux*+>l_bLl2c_pQy@
z?pOH{Y*NJ_9(JHvRaCc)t$m=pW=pTfZ0x8E$gdrhLH7xz#W^9+(Bhg9Y={=f$en6I
zKGHup3A-8gj+muKFjnPxGu5`+Y8HLjXYm{u+-x$Q#|v;^Ds!R_d*Q@%T*Qlb2`((d
zdAy9(aH9dIu@A3+V-1bQe!L1VZBjp8g9korqoIEt9Z;|n-FO3ULf}{Wm%W8v1aJXU
z$+H(h{7$#G@eT^`ZkB$kf)W@7d5=KeCyNdD2<;%}U>qeJ#T-#iKR8Ykj1eq=_{R&!
z3VP#c;%McxJbA}v1peER*C3V)Oi0}D|HYl~uc=w{f>R>_~sxLEHEAuamv~ftf~Btdf>n$Qu=%RK*~!ACc-%)k6iu-NChdy
NDX9p4q-O_y`U~P7iH-mO
diff --git a/bin/main/ASTtoDOT.class b/bin/main/ASTtoDOT.class
index da24e0c7679d32d31cf43a1ff1faf0ae186a292c..9112cbd9ea443982d554f8c5326e02fb4b7b3fdf 100644
GIT binary patch
delta 825
zcmZ8fTTc^F5dKbE=ys_A77Bt~3K7z#*a|`*X{jNEK#e3CVvG}=GrOcH-9dz0BFRQ
zS$@^VLfV!s!ou^#SrJRq9?#)W)oHJ%ukAo@zn8-lgFO^g1L6JkJY1M|;udZ*@TxQ{
zi!rH9mKj>KSyrH(qqD~HgF!=g*NJ;*X2{7XN0sxE+AgLg4l@k4l$ewZ#herKc)-BL
zlvGAcq|yxgw5!=AquyQ)IzvI|3=!^_A}eZZbyOaas>2)>jdlVCL&Xvmav~$CqRinj
zgYb_fFE^J2n}-iW(1y!(wbm3dEFTQc0x)vY3hodQ3-0IwlTFCo%~+?ZjJb
z(Y7QL>dGW(TeY;UnxY_w9fmBo-|u%DFTZzU9evuk{Va3L+qjdgBOg{2pcaK_CB7X+
zID%pv$6j1Q39g|Olax;rKZi1Gpd8z%z(-UvhBC&ZidCRmyY9Hcvlz1JGT^J$!Z(c8
z2@}E%9XGq{blef{>zEx!*)oJv!ovlW5?CoLP|(rXJ%t)m^vD#In4;zXMJD>>5Bij>
zJ{`~VawpJWP(Ev3u8x1ZNGt{mXJjGf#DEer=
zIyAtKAP%Av_2{Q+0EZyck9+~m$RU+`cT9Z1MXJiNMEe*6BjqG*Z44G%MibzH?FRPof
z6trkpkS%(OdWh(1v^ku6&b{ZJkK9+1Pt5la*?cGeH7_
zM`w&O7lL06?ZEL9S8B}L)zq#e`%!9BmM4hm+8mQCGQ|>UR+wg;42NVnW`Yojj1MN6dO{h2Wpm?%9qwABoEM
xhWt{^h-O#s9gO1mD66K=>NE&&RV)4FbIpNH1=hHsg{Z%vbz6EV+G3c{{RK}pIxYYJ
diff --git a/bin/main/Main.class b/bin/main/Main.class
index a966787e7d6640b3031f0f14b14f5cb4bf4f387f..64acbc3498b0b9222a853fa1df6b609d16c5c7c9 100644
GIT binary patch
delta 40
vcmdlc_&{L7H5m~-{mi_A(h_}_)ZBc>;1Ip6#Ii&V1~EnkPQA?@jCt$;9kUD$
delta 138
zcmaDLuuX8nwR$K0(BjmhVtuFl^3**2)a0DZg5p%&^8BLg;)2BFRQ;^Pvc!VKBA^=m
zlGNgol*E!meUH?foc!?oqMQ^xkTeH_7$bur@#f^0mK2nh=(96OFfwfXpU4gXKQc0`
diff --git a/output/DemoAST.java_bart.dot b/output/DemoAST.java_bart.dot
new file mode 100644
index 0000000..c3217b7
--- /dev/null
+++ b/output/DemoAST.java_bart.dot
@@ -0,0 +1,24 @@
+digraph "DirectedGraph" {
+graph [label = "bart", labelloc=t, concentrate = true];
+"1686369710" [ label=<Method
Declaration
int bart(int x) ... } > type=31 startLineNumber=3 endLineNumber=3 ]
+"194706439" [ label=<Primitive
Type
int> type=39 startLineNumber=3 endLineNumber=3 ]
+"942518407" [ label=<Simple
Name
bart> type=42 startLineNumber=3 endLineNumber=3 ]
+"1943325854" [ label=<Single
Variable
Declaration
int x> type=44 startLineNumber=3 endLineNumber=3 ]
+"134310351" [ label=<Primitive
Type
int> type=39 startLineNumber=3 endLineNumber=3 ]
+"1411892748" [ label=<Simple
Name
x> type=42 startLineNumber=3 endLineNumber=3 ]
+"22805895" [ label=<Block
{ return x + 1 ... } > type=8 startLineNumber=3 endLineNumber=3 ]
+"1413378318" [ label=<Return
Statement
return x + 1; > type=41 startLineNumber=3 endLineNumber=3 ]
+"1475491159" [ label=<Infix
Expression
x + 1> type=27 startLineNumber=3 endLineNumber=3 ]
+"1024429571" [ label=<Simple
Name
x> type=42 startLineNumber=3 endLineNumber=3 ]
+"1667689440" [ label=<Number
Literal
1> type=34 startLineNumber=3 endLineNumber=3 ]
+"1686369710" -> "194706439"
+"1686369710" -> "942518407"
+"1686369710" -> "1943325854"
+"1943325854" -> "134310351"
+"1943325854" -> "1411892748"
+"1686369710" -> "22805895"
+"22805895" -> "1413378318"
+"1413378318" -> "1475491159"
+"1475491159" -> "1024429571"
+"1475491159" -> "1667689440"
+}
diff --git a/output/DemoAST.java_homer.dot b/output/DemoAST.java_homer.dot
new file mode 100644
index 0000000..3ffb8b6
--- /dev/null
+++ b/output/DemoAST.java_homer.dot
@@ -0,0 +1,92 @@
+digraph "DirectedGraph" {
+graph [label = "homer", labelloc=t, concentrate = true];
+"79290965" [ label=<Method
Declaration
int homer(int x ... } > type=31 startLineNumber=6 endLineNumber=17 ]
+"1582785598" [ label=<Primitive
Type
int> type=39 startLineNumber=6 endLineNumber=6 ]
+"322836221" [ label=<Simple
Name
homer> type=42 startLineNumber=6 endLineNumber=6 ]
+"1370651081" [ label=<Single
Variable
Declaration
int x> type=44 startLineNumber=6 endLineNumber=6 ]
+"450003680" [ label=<Primitive
Type
int> type=39 startLineNumber=6 endLineNumber=6 ]
+"2134991632" [ label=<Simple
Name
x> type=42 startLineNumber=6 endLineNumber=6 ]
+"480971771" [ label=<Block
{ int y, a, b; ... } > type=8 startLineNumber=6 endLineNumber=17 ]
+"1586845078" [ label=<Variable
Declaration
Statement
int y, a, b; > type=60 startLineNumber=7 endLineNumber=7 ]
+"1356728614" [ label=<Primitive
Type
int> type=39 startLineNumber=7 endLineNumber=7 ]
+"611563982" [ label=<Variable
Declaration
Fragment
y> type=59 startLineNumber=7 endLineNumber=7 ]
+"1615039080" [ label=<Simple
Name
y> type=42 startLineNumber=7 endLineNumber=7 ]
+"336484883" [ label=<Variable
Declaration
Fragment
a> type=59 startLineNumber=7 endLineNumber=7 ]
+"876213901" [ label=<Simple
Name
a> type=42 startLineNumber=7 endLineNumber=7 ]
+"230528013" [ label=<Variable
Declaration
Fragment
b> type=59 startLineNumber=7 endLineNumber=7 ]
+"1909546776" [ label=<Simple
Name
b> type=42 startLineNumber=7 endLineNumber=7 ]
+"392781299" [ label=<If
Statement
if (x > 0) { y ... } > type=25 startLineNumber=9 endLineNumber=15 ]
+"1822383117" [ label=<Infix
Expression
x > 0> type=27 startLineNumber=9 endLineNumber=9 ]
+"233021551" [ label=<Simple
Name
x> type=42 startLineNumber=9 endLineNumber=9 ]
+"1991313236" [ label=<Number
Literal
0> type=34 startLineNumber=9 endLineNumber=9 ]
+"736778932" [ label=<Block
{ y=0; } > type=8 startLineNumber=9 endLineNumber=11 ]
+"1032000752" [ label=<Expression
Statement
y=0; > type=21 startLineNumber=10 endLineNumber=10 ]
+"770911223" [ label=<Assignment
y=0> type=7 startLineNumber=10 endLineNumber=10 ]
+"1392906938" [ label=<Simple
Name
y> type=42 startLineNumber=10 endLineNumber=10 ]
+"708890004" [ label=<Number
Literal
0> type=34 startLineNumber=10 endLineNumber=10 ]
+"255944888" [ label=<Block
{ a=bart(1); ... } > type=8 startLineNumber=11 endLineNumber=15 ]
+"1004095028" [ label=<Expression
Statement
a=bart(1); > type=21 startLineNumber=12 endLineNumber=12 ]
+"1487470647" [ label=<Assignment
a=bart(1)> type=7 startLineNumber=12 endLineNumber=12 ]
+"1948863195" [ label=<Simple
Name
a> type=42 startLineNumber=12 endLineNumber=12 ]
+"1890187342" [ label=<Method
Invocation
bart(1)> type=32 startLineNumber=12 endLineNumber=12 ]
+"19986569" [ label=<Simple
Name
bart> type=42 startLineNumber=12 endLineNumber=12 ]
+"294184992" [ label=<Number
Literal
1> type=34 startLineNumber=12 endLineNumber=12 ]
+"793315160" [ label=<Expression
Statement
b=lisa(2); > type=21 startLineNumber=13 endLineNumber=13 ]
+"270397815" [ label=<Assignment
b=lisa(2)> type=7 startLineNumber=13 endLineNumber=13 ]
+"376416077" [ label=<Simple
Name
b> type=42 startLineNumber=13 endLineNumber=13 ]
+"1089504328" [ label=<Method
Invocation
lisa(2)> type=32 startLineNumber=13 endLineNumber=13 ]
+"660879561" [ label=<Simple
Name
lisa> type=42 startLineNumber=13 endLineNumber=13 ]
+"1485697819" [ label=<Number
Literal
2> type=34 startLineNumber=13 endLineNumber=13 ]
+"867398280" [ label=<Expression
Statement
y=a + b; > type=21 startLineNumber=14 endLineNumber=14 ]
+"2007331442" [ label=<Assignment
y=a + b> type=7 startLineNumber=14 endLineNumber=14 ]
+"1904324159" [ label=<Simple
Name
y> type=42 startLineNumber=14 endLineNumber=14 ]
+"1176735295" [ label=<Infix
Expression
a + b> type=27 startLineNumber=14 endLineNumber=14 ]
+"1848415041" [ label=<Simple
Name
a> type=42 startLineNumber=14 endLineNumber=14 ]
+"843467284" [ label=<Simple
Name
b> type=42 startLineNumber=14 endLineNumber=14 ]
+"1313532469" [ label=<Return
Statement
return y; > type=41 startLineNumber=16 endLineNumber=16 ]
+"339924917" [ label=<Simple
Name
y> type=42 startLineNumber=16 endLineNumber=16 ]
+"79290965" -> "1582785598"
+"79290965" -> "322836221"
+"79290965" -> "1370651081"
+"1370651081" -> "450003680"
+"1370651081" -> "2134991632"
+"79290965" -> "480971771"
+"480971771" -> "1586845078"
+"1586845078" -> "1356728614"
+"1586845078" -> "611563982"
+"611563982" -> "1615039080"
+"1586845078" -> "336484883"
+"336484883" -> "876213901"
+"1586845078" -> "230528013"
+"230528013" -> "1909546776"
+"480971771" -> "392781299"
+"392781299" -> "1822383117"
+"1822383117" -> "233021551"
+"1822383117" -> "1991313236"
+"392781299" -> "736778932"
+"736778932" -> "1032000752"
+"1032000752" -> "770911223"
+"770911223" -> "1392906938"
+"770911223" -> "708890004"
+"392781299" -> "255944888"
+"255944888" -> "1004095028"
+"1004095028" -> "1487470647"
+"1487470647" -> "1948863195"
+"1487470647" -> "1890187342"
+"1890187342" -> "19986569"
+"1890187342" -> "294184992"
+"255944888" -> "793315160"
+"793315160" -> "270397815"
+"270397815" -> "376416077"
+"270397815" -> "1089504328"
+"1089504328" -> "660879561"
+"1089504328" -> "1485697819"
+"255944888" -> "867398280"
+"867398280" -> "2007331442"
+"2007331442" -> "1904324159"
+"2007331442" -> "1176735295"
+"1176735295" -> "1848415041"
+"1176735295" -> "843467284"
+"480971771" -> "1313532469"
+"1313532469" -> "339924917"
+}
diff --git a/output/DemoAST.java_lisa.dot b/output/DemoAST.java_lisa.dot
new file mode 100644
index 0000000..f51929f
--- /dev/null
+++ b/output/DemoAST.java_lisa.dot
@@ -0,0 +1,24 @@
+digraph "DirectedGraph" {
+graph [label = "lisa", labelloc=t, concentrate = true];
+"1157058691" [ label=<Method
Declaration
int lisa(int x) ... } > type=31 startLineNumber=4 endLineNumber=4 ]
+"40472007" [ label=<Primitive
Type
int> type=39 startLineNumber=4 endLineNumber=4 ]
+"1138193439" [ label=<Simple
Name
lisa> type=42 startLineNumber=4 endLineNumber=4 ]
+"398110318" [ label=<Single
Variable
Declaration
int x> type=44 startLineNumber=4 endLineNumber=4 ]
+"1765250898" [ label=<Primitive
Type
int> type=39 startLineNumber=4 endLineNumber=4 ]
+"670971910" [ label=<Simple
Name
x> type=42 startLineNumber=4 endLineNumber=4 ]
+"1601292138" [ label=<Block
{ return x + 2 ... } > type=8 startLineNumber=4 endLineNumber=4 ]
+"494586676" [ label=<Return
Statement
return x + 2; > type=41 startLineNumber=4 endLineNumber=4 ]
+"1218593486" [ label=<Infix
Expression
x + 2> type=27 startLineNumber=4 endLineNumber=4 ]
+"508198356" [ label=<Simple
Name
x> type=42 startLineNumber=4 endLineNumber=4 ]
+"1330754528" [ label=<Number
Literal
2> type=34 startLineNumber=4 endLineNumber=4 ]
+"1157058691" -> "40472007"
+"1157058691" -> "1138193439"
+"1157058691" -> "398110318"
+"398110318" -> "1765250898"
+"398110318" -> "670971910"
+"1157058691" -> "1601292138"
+"1601292138" -> "494586676"
+"494586676" -> "1218593486"
+"1218593486" -> "508198356"
+"1218593486" -> "1330754528"
+}
diff --git a/src/main/ASTtoDOT.java b/src/main/ASTtoDOT.java
index 17e6f39..c16239e 100644
--- a/src/main/ASTtoDOT.java
+++ b/src/main/ASTtoDOT.java
@@ -4,6 +4,7 @@
import structure.MyASTNode;
import structure.MyMethodNode;
+import static org.apache.commons.lang.StringEscapeUtils.escapeHtml;
public class ASTtoDOT {
@@ -51,7 +52,7 @@ else if(nodeType.toLowerCase().contains("literal")) {
nodeType = ""+nodeType+"";
}
- return ""+nodeType+"
"+(contentString.length()>15 ? contentString.substring(0,15)+" ... "+contentString.substring(contentString.length()-2) : contentString);
+ return ""+nodeType+"
"+(contentString.length()>15 ? escapeHtml(contentString.substring(0,15))+" ... "+escapeHtml(contentString.substring(contentString.length()-2)) : escapeHtml(contentString));
}
}
diff --git a/src/main/Main.java b/src/main/Main.java
index 916469b..976201e 100644
--- a/src/main/Main.java
+++ b/src/main/Main.java
@@ -16,8 +16,8 @@ public class Main {
* @throws IOException
*/
public static void main(String[] args) throws IOException {
- String FilePath = "PATH/HelloWorld.java";
- String outputDir = "PATH/output/";
+ String FilePath = "./input/DemoAST.java";
+ String outputDir = "./output/";
File f = new File(FilePath);
ASTGenerator astGenerator = new ASTGenerator(f);
List methodNodeList = astGenerator.getMethodNodeList();