\usepackage{tabularx}
\usepackage{tikz}
\usepackage{tikz-qtree}
-\usetikzlibrary{shapes,snakes,trees}
+\usetikzlibrary{shapes,snakes,trees,arrows,shadows,positioning}
\usepackage{babel,textcomp,csquotes,ifimasterforside,varioref}
\usepackage[hidelinks]{hyperref}
\usepackage{cleveref}
\begin{figure}[h]
\centering
- \begin{tikzpicture}[scale=0.6]
- \tikzset{level distance=40pt}
+ \begin{tikzpicture}[scale=0.8,text centered]
+ \tikzset{level distance=50pt}
+ \tikzset{sibling distance=5pt}
\tikzset{edge from parent/.append style={thick}}
\tikzset{every tree node/.style={align=center}}
- \tikzset{every internal node/.style={ellipse,draw,fill=lightgray}}
+ \tikzset{every internal node/.style={rectangle,rounded
+ corners,draw,fill=lightgray,drop shadow}}
\tikzset{every leaf node/.style={draw=none,fill=none}}
\Tree [.\type{CompilationUnit} [.\type{[ PackageDeclaration ]} ]
[.\type{\{ ImportDeclaration \}*} ]
- [.\type{\{ AbstractTypeDeclaration \}+} ]
+ [.\type{\{ AbstractTypeDeclaration \}+} [.\node(site){\type{\{
+ BodyDeclaration \}*}}; ] ]
]
+ \begin{scope}[shift={(0,-5)}]
+ \Tree [.\node[xshift=-1cm](root){\type{MethodDeclaration}};
+ [.\node[yshift=-1.3cm]{\type{\{ IExtendedModifier \}*} \\ {\footnotesize
+ (Of type \type{Modifier} or \type{Annotation})}}; ]
+ [.\node[xshift=-1cm]{\type{\{ TypeParameter \}*}}; ]
+ [.\node[yshift=-1.3cm]{\type{\{ SingleVariableDeclaration \}*} \\
+ {\footnotesize (Parameters)}}; ]
+ [.{\type{\{ Name \}*} \\ {\footnotesize (Exceptions)}} ]
+ [.{\type{Type} \\ {\footnotesize (Return type)}} ]
+ [.{\type{[ Block ]} \\ {\footnotesize (Body)}} ]
+ ]
+ \end{scope}
+ \draw[->,>=triangle 45,shorten >=1pt](root.100)..controls +(north:1) and
+ +(west:5)..(site);
+
\end{tikzpicture}
\caption{The format of the abstract syntax tree in Eclipse.}
\label{fig:astEclipse}