Clover coverage report - DynamicJava Test Coverage (dynamicjava-20130622-r5436)
Coverage timestamp: Sat Jun 22 2013 03:01:29 CDT
file stats: LOC: 1,741   Methods: 111
NCLOC: 1,155   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
DisplayVisitor.java 0% 0% 0% 0%
coverage
 1    /*
 2    * DynamicJava - Copyright (C) 1999-2001
 3    *
 4    * Permission is hereby granted, free of charge, to any person obtaining a
 5    * copy of this software and associated documentation files
 6    * (the "Software"), to deal in the Software without restriction, including
 7    * without limitation the rights to use, copy, modify, merge, publish,
 8    * distribute, sublicense, and/or sell copies of the Software, and to permit
 9    * persons to whom the Software is furnished to do so, subject to the
 10    * following conditions:
 11    * The above copyright notice and this permission notice shall be included
 12    * in all copies or substantial portions of the Software.
 13    *
 14    * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
 15    * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 16    * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
 17    * IN NO EVENT SHALL DYADE BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 18    * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 19    * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
 20    * DEALINGS IN THE SOFTWARE.
 21    *
 22    * Except as contained in this notice, the name of Dyade shall not be
 23    * used in advertising or otherwise to promote the sale, use or other
 24    * dealings in this Software without prior written authorization from
 25    * Dyade.
 26    *
 27    */
 28   
 29    package koala.dynamicjava.util;
 30   
 31    import java.io.*;
 32   
 33    import koala.dynamicjava.tree.*;
 34    import koala.dynamicjava.tree.visitor.*;
 35   
 36    /**
 37    * This tree visitor displays the nodes of the tree on
 38    * a given stream
 39    *
 40    * @author Stephane Hillion
 41    * @version 1.0 - 1999/04/24
 42    */
 43   
 44    public class DisplayVisitor extends AbstractVisitor<Void> {
 45    /**
 46    * The output stream
 47    */
 48    private PrintStream out;
 49   
 50    /**
 51    * The current indentation
 52    */
 53    private String indentation;
 54   
 55    /**
 56    * Creates a new display visitor
 57    * @param os the output tree
 58    */
 59  0 public DisplayVisitor(OutputStream os) {
 60  0 out = new PrintStream(os);
 61  0 indentation = "";
 62    }
 63   
 64    /**
 65    * Visits a PackageDeclaration
 66    * @param node the node to visit
 67    * @return null
 68    */
 69  0 @Override public Void visit(PackageDeclaration node) {
 70  0 print("l."+node.getSourceInfo().getStartLine()+" PackageDeclaration "+node.getName()+" {");
 71  0 displayProperties(node);
 72  0 print("}");
 73  0 return null;
 74    }
 75   
 76    /**
 77    * Visits an ImportDeclaration
 78    * @param node the node to visit
 79    * @return null
 80    */
 81  0 @Override public Void visit(ImportDeclaration node) {
 82  0 print("l."+node.getSourceInfo().getStartLine()+" ImportDeclaration "+node.getName()
 83  0 +(node.isPackage() ? ".*" : "")+" {");
 84  0 displayProperties(node);
 85  0 print("}");
 86  0 return null;
 87    }
 88   
 89    /**
 90    * Visits an EmptyStatement
 91    * @param node the node to visit
 92    */
 93  0 @Override public Void visit(EmptyStatement node) {
 94  0 print("l."+node.getSourceInfo().getStartLine()+" EmptyStatement {");
 95  0 displayProperties(node);
 96  0 print("}");
 97  0 return null;
 98    }
 99   
 100  0 @Override public Void visit(ExpressionStatement node) {
 101  0 print("l."+node.getSourceInfo().getStartLine()+" ExpressionStatement {");
 102  0 print("expression:");
 103  0 indent();
 104  0 node.getExpression().acceptVisitor(this);
 105  0 print("hasSemicolon:" + node.getHasSemicolon());
 106  0 displayProperties(node);
 107  0 print("}");
 108  0 return null;
 109    }
 110   
 111    /**
 112    * Visits a WhileStatement
 113    * @param node the node to visit
 114    */
 115  0 @Override public Void visit(WhileStatement node) {
 116  0 print("l."+node.getSourceInfo().getStartLine()+" WhileStatement {");
 117  0 print("condition:");
 118  0 indent();
 119  0 node.getCondition().acceptVisitor(this);
 120  0 unindent();
 121  0 print("body:");
 122  0 indent();
 123  0 node.getBody().acceptVisitor(this);
 124  0 unindent();
 125  0 displayProperties(node);
 126  0 print("}");
 127  0 return null;
 128    }
 129   
 130    /**
 131    * Visits a ForStatement
 132    * @param node the node to visit
 133    */
 134  0 @Override public Void visit(ForStatement node) {
 135  0 print("l."+node.getSourceInfo().getStartLine()+" ForStatement {");
 136  0 print("initialization:");
 137  0 if (node.getInitialization() != null) {
 138  0 indent();
 139  0 for (Node n : node.getInitialization()) {
 140  0 n.acceptVisitor(this);
 141    }
 142  0 unindent();
 143    }
 144  0 print("condition:");
 145  0 if (node.getCondition() != null) {
 146  0 indent();
 147  0 node.getCondition().acceptVisitor(this);
 148  0 unindent();
 149    }
 150  0 print("update:");
 151  0 if (node.getUpdate() != null) {
 152  0 indent();
 153  0 for (Node n : node.getUpdate()) {
 154  0 n.acceptVisitor(this);
 155    }
 156  0 unindent();
 157    }
 158  0 print("body:");
 159  0 indent();
 160  0 node.getBody().acceptVisitor(this);
 161  0 unindent();
 162  0 displayProperties(node);
 163  0 print("}");
 164  0 return null;
 165    }
 166   
 167    /**
 168    * Visits a DoStatement
 169    * @param node the node to visit
 170    */
 171  0 @Override public Void visit(DoStatement node) {
 172  0 print("l."+node.getSourceInfo().getStartLine()+" DoStatement {");
 173  0 print("condition:");
 174  0 indent();
 175  0 node.getCondition().acceptVisitor(this);
 176  0 unindent();
 177  0 print("body:");
 178  0 indent();
 179  0 node.getBody().acceptVisitor(this);
 180  0 unindent();
 181  0 displayProperties(node);
 182  0 print("}");
 183  0 return null;
 184    }
 185   
 186    /**
 187    * Visits a SwitchStatement
 188    * @param node the node to visit
 189    */
 190  0 @Override public Void visit(SwitchStatement node) {
 191  0 print("l."+node.getSourceInfo().getStartLine()+" SwitchStatement {");
 192  0 print("selector:");
 193  0 indent();
 194  0 node.getSelector().acceptVisitor(this);
 195  0 unindent();
 196  0 print("bindings:");
 197  0 indent();
 198  0 for (Node n : node.getBindings()) {
 199  0 n.acceptVisitor(this);
 200    }
 201  0 unindent();
 202  0 displayProperties(node);
 203  0 print("}");
 204  0 return null;
 205    }
 206   
 207    /**
 208    * Visits a SwitchBlock
 209    * @param node the node to visit
 210    */
 211  0 @Override public Void visit(SwitchBlock node) {
 212  0 print("l."+node.getSourceInfo().getStartLine()+" SwitchBlock {");
 213  0 print("expression:");
 214  0 indent();
 215  0 if (node.getExpression() != null) {
 216  0 node.getExpression().acceptVisitor(this);
 217    } else {
 218  0 print("default");
 219    }
 220  0 unindent();
 221  0 print("statements:");
 222  0 indent();
 223  0 if (node.getStatements() != null) {
 224  0 for (Node n : node.getStatements()) {
 225  0 n.acceptVisitor(this);
 226    }
 227    }
 228  0 unindent();
 229  0 displayProperties(node);
 230  0 print("}");
 231  0 return null;
 232    }
 233   
 234    /**
 235    * Visits a LabeledStatement
 236    * @param node the node to visit
 237    */
 238  0 @Override public Void visit(LabeledStatement node) {
 239  0 print("l."+node.getSourceInfo().getStartLine()+" LabeledStatement {");
 240  0 print("label:");
 241  0 indent();
 242  0 print(node.getLabel());
 243  0 unindent();
 244  0 print("statement:");
 245  0 indent();
 246  0 node.getStatement().acceptVisitor(this);
 247  0 unindent();
 248  0 displayProperties(node);
 249  0 print("}");
 250  0 return null;
 251    }
 252   
 253    /**
 254    * Visits a BreakStatement
 255    * @param node the node to visit
 256    */
 257  0 @Override public Void visit(BreakStatement node) {
 258  0 print("l."+node.getSourceInfo().getStartLine()+" BreakStatement {");
 259  0 print("label:");
 260  0 indent();
 261  0 print(node.getLabel());
 262  0 unindent();
 263  0 displayProperties(node);
 264  0 print("}");
 265  0 return null;
 266    }
 267   
 268    /**
 269    * Visits a TryStatement
 270    * @param node the node to visit
 271    */
 272  0 @Override public Void visit(TryStatement node) {
 273  0 print("l."+node.getSourceInfo().getStartLine()+" TryStatement {");
 274  0 print("tryBlock:");
 275  0 indent();
 276  0 node.getTryBlock().acceptVisitor(this);
 277  0 unindent();
 278  0 print("catchStatements:");
 279  0 indent();
 280  0 for (Node n : node.getCatchStatements()) {
 281  0 n.acceptVisitor(this);
 282    }
 283  0 unindent();
 284  0 print("finallyBlock:");
 285  0 indent();
 286  0 if (node.getFinallyBlock() != null) {
 287  0 node.getFinallyBlock().acceptVisitor(this);
 288    }
 289  0 unindent();
 290  0 displayProperties(node);
 291  0 print("}");
 292  0 return null;
 293    }
 294   
 295    /**
 296    * Visits a CatchStatement
 297    * @param node the node to visit
 298    */
 299  0 @Override public Void visit(CatchStatement node) {
 300  0 print("l."+node.getSourceInfo().getStartLine()+" CatchStatement {");
 301  0 print("exception:");
 302  0 indent();
 303  0 node.getException().acceptVisitor(this);
 304  0 unindent();
 305  0 print("block:");
 306  0 indent();
 307  0 node.getBlock().acceptVisitor(this);
 308  0 unindent();
 309  0 displayProperties(node);
 310  0 print("}");
 311  0 return null;
 312    }
 313   
 314    /**
 315    * Visits a ThrowStatement
 316    * @param node the node to visit
 317    */
 318  0 @Override public Void visit(ThrowStatement node) {
 319  0 print("l."+node.getSourceInfo().getStartLine()+" ThrowStatement {");
 320  0 print("expression:");
 321  0 indent();
 322  0 node.getExpression().acceptVisitor(this);
 323  0 unindent();
 324  0 displayProperties(node);
 325  0 print("}");
 326  0 return null;
 327    }
 328   
 329    /**
 330    * Visits a ReturnStatement
 331    * @param node the node to visit
 332    */
 333  0 @Override public Void visit(ReturnStatement node) {
 334  0 print("l."+node.getSourceInfo().getStartLine()+" ReturnStatement {");
 335  0 print("expression:");
 336  0 indent();
 337    //Bug fix to allow for "return;"
 338  0 if( node.getExpression() != null )
 339  0 node.getExpression().acceptVisitor(this);
 340    else
 341  0 print("null");
 342  0 unindent();
 343  0 displayProperties(node);
 344  0 print("}");
 345  0 return null;
 346    }
 347   
 348    /**
 349    * Visits a SynchronizedStatement
 350    * @param node the node to visit
 351    */
 352  0 @Override public Void visit(SynchronizedStatement node) {
 353  0 print("l."+node.getSourceInfo().getStartLine()+" SynchronizedStatement {");
 354  0 print("lock:");
 355  0 indent();
 356  0 node.getLock().acceptVisitor(this);
 357  0 unindent();
 358  0 print("body:");
 359  0 indent();
 360  0 node.getBody().acceptVisitor(this);
 361  0 unindent();
 362  0 displayProperties(node);
 363  0 print("}");
 364  0 return null;
 365    }
 366   
 367    /**
 368    * Visits a ContinueStatement
 369    * @param node the node to visit
 370    */
 371  0 @Override public Void visit(ContinueStatement node) {
 372  0 print("l."+node.getSourceInfo().getStartLine()+" ContinueStatement {");
 373  0 print("label:");
 374  0 indent();
 375  0 print(node.getLabel());
 376  0 unindent();
 377  0 displayProperties(node);
 378  0 print("}");
 379  0 return null;
 380    }
 381   
 382    /**
 383    * Visits an IfThenStatement
 384    * @param node the node to visit
 385    */
 386  0 @Override public Void visit(IfThenStatement node) {
 387  0 print("l."+node.getSourceInfo().getStartLine()+" IfThenStatement {");
 388  0 print("condition:");
 389  0 indent();
 390  0 node.getCondition().acceptVisitor(this);
 391  0 unindent();
 392  0 print("thenStatement:");
 393  0 indent();
 394  0 node.getThenStatement().acceptVisitor(this);
 395  0 unindent();
 396  0 displayProperties(node);
 397  0 print("}");
 398  0 return null;
 399    }
 400   
 401    /**
 402    * Visits an IfThenElseStatement
 403    * @param node the node to visit
 404    */
 405  0 @Override public Void visit(IfThenElseStatement node) {
 406  0 print("l."+node.getSourceInfo().getStartLine()+" IfThenElseStatement {");
 407  0 print("condition:");
 408  0 indent();
 409  0 node.getCondition().acceptVisitor(this);
 410  0 unindent();
 411  0 print("thenStatement:");
 412  0 indent();
 413  0 node.getThenStatement().acceptVisitor(this);
 414  0 unindent();
 415  0 print("elseStatement:");
 416  0 indent();
 417  0 node.getElseStatement().acceptVisitor(this);
 418  0 unindent();
 419  0 displayProperties(node);
 420  0 print("}");
 421  0 return null;
 422    }
 423   
 424    /**
 425    * Visits a Literal
 426    * @param node the node to visit
 427    */
 428  0 @Override public Void visit(Literal node) {
 429  0 print("l."+node.getSourceInfo().getStartLine()+" Literal ("+
 430    node.getType()+") <"+node.getValue()+"> {");
 431  0 displayProperties(node);
 432  0 print("}");
 433  0 return null;
 434    }
 435   
 436    /**
 437    * Visits a ThisExpression
 438    * @param node the node to visit
 439    */
 440  0 @Override public Void visit(ThisExpression node) {
 441  0 print("l."+node.getSourceInfo().getStartLine()+" ThisExpression {");
 442  0 print("className:");
 443  0 indent();
 444  0 print(node.getClassName().toString());
 445  0 unindent();
 446  0 displayProperties(node);
 447  0 print("}");
 448  0 return null;
 449    }
 450   
 451    /**
 452    * Visits a AmbiguousName
 453    * @param node the node to visit
 454    */
 455  0 @Override public Void visit(AmbiguousName node) {
 456  0 print("l."+node.getSourceInfo().getStartLine()+" AmbiguousName {");
 457  0 print("representation:");
 458  0 indent();
 459  0 print(node.getRepresentation());
 460  0 unindent();
 461  0 displayProperties(node);
 462  0 print("}");
 463  0 return null;
 464    }
 465   
 466    /**
 467    * Visits an ObjectFieldAccess
 468    * @param node the node to visit
 469    */
 470  0 @Override public Void visit(ObjectFieldAccess node) {
 471  0 print("l."+node.getSourceInfo().getStartLine()+" ObjectFieldAccess {");
 472  0 print("expression:");
 473  0 indent();
 474  0 node.getExpression().acceptVisitor(this);
 475  0 unindent();
 476  0 print("fieldName:");
 477  0 indent();
 478  0 print(node.getFieldName());
 479  0 unindent();
 480  0 displayProperties(node);
 481  0 print("}");
 482  0 return null;
 483    }
 484   
 485    /**
 486    * Visits a StaticFieldAccess
 487    * @param node the node to visit
 488    */
 489  0 @Override public Void visit(StaticFieldAccess node) {
 490  0 print("l."+node.getSourceInfo().getStartLine()+" StaticFieldAccess {");
 491  0 print("fieldType:");
 492  0 indent();
 493  0 node.getFieldType().acceptVisitor(this);
 494  0 unindent();
 495  0 print("fieldName:");
 496  0 indent();
 497  0 print(node.getFieldName());
 498  0 unindent();
 499  0 displayProperties(node);
 500  0 print("}");
 501  0 return null;
 502    }
 503   
 504    /**
 505    * Visits a ArrayAccess
 506    * @param node the node to visit
 507    */
 508  0 @Override public Void visit(ArrayAccess node) {
 509  0 print("l."+node.getSourceInfo().getStartLine()+" ArrayAccess {");
 510  0 print("expression:");
 511  0 indent();
 512  0 node.getExpression().acceptVisitor(this);
 513  0 unindent();
 514  0 print("cellNumber:");
 515  0 indent();
 516  0 node.getCellNumber().acceptVisitor(this);
 517  0 unindent();
 518  0 displayProperties(node);
 519  0 print("}");
 520  0 return null;
 521    }
 522   
 523    /**
 524    * Visits a SimpleFieldAccess
 525    * @param node the node to visit
 526    */
 527  0 @Override public Void visit(SimpleFieldAccess node) {
 528  0 print(indentation+"l."+node.getSourceInfo().getStartLine()+" SimpleFieldAccess {");
 529  0 print("fieldName:");
 530  0 indent();
 531  0 print(node.getFieldName());
 532  0 unindent();
 533  0 displayProperties(node);
 534  0 print("}");
 535  0 return null;
 536    }
 537   
 538    /**
 539    * Visits a SuperFieldAccess
 540    * @param node the node to visit
 541    */
 542  0 @Override public Void visit(SuperFieldAccess node) {
 543  0 print(indentation+"l."+node.getSourceInfo().getStartLine()+" SuperFieldAccess {");
 544  0 print("fieldName:");
 545  0 indent();
 546  0 print(node.getFieldName());
 547  0 unindent();
 548  0 displayProperties(node);
 549  0 print("}");
 550  0 return null;
 551    }
 552   
 553    /**
 554    * Visits a ObjectMethodCall
 555    * @param node the node to visit
 556    */
 557  0 @Override public Void visit(ObjectMethodCall node) {
 558  0 print("l."+node.getSourceInfo().getStartLine()+" ObjectMethodCall {");
 559  0 print("expression:");
 560  0 indent();
 561  0 if (node.getExpression() != null) {
 562  0 node.getExpression().acceptVisitor(this);
 563    } else {
 564  0 print("null");
 565    }
 566  0 unindent();
 567  0 print("methodName:");
 568  0 indent();
 569  0 print(node.getMethodName());
 570  0 unindent();
 571  0 print("arguments:");
 572  0 indent();
 573  0 if (node.getArguments() != null) {
 574  0 for (Node n : node.getArguments()) {
 575  0 n.acceptVisitor(this);
 576    }
 577    }
 578  0 unindent();
 579  0 displayProperties(node);
 580  0 print("}");
 581  0 return null;
 582    }
 583   
 584    /**
 585    * Visits a SimpleMethodCall
 586    * @param node the node to visit
 587    */
 588  0 @Override public Void visit(SimpleMethodCall node) {
 589  0 print("l."+node.getSourceInfo().getStartLine()+" SimpleMethodCall {");
 590  0 print("methodName:");
 591  0 indent();
 592  0 print(node.getMethodName());
 593  0 unindent();
 594  0 print("arguments:");
 595  0 indent();
 596  0 if (node.getArguments() != null) {
 597  0 for (Node n : node.getArguments()) {
 598  0 n.acceptVisitor(this);
 599    }
 600    }
 601  0 unindent();
 602  0 displayProperties(node);
 603  0 print("}");
 604  0 return null;
 605    }
 606   
 607    /**
 608    * Visits a StaticMethodCall
 609    * @param node the node to visit
 610    */
 611  0 @Override public Void visit(StaticMethodCall node) {
 612  0 print("l."+node.getSourceInfo().getStartLine()+" StaticMethodCall {");
 613  0 print("methodType:");
 614  0 indent();
 615  0 node.getMethodType().acceptVisitor(this);
 616  0 unindent();
 617  0 print("methodName:");
 618  0 indent();
 619  0 print(node.getMethodName());
 620  0 unindent();
 621  0 print("arguments:");
 622  0 indent();
 623  0 if (node.getArguments() != null) {
 624  0 for (Node n : node.getArguments()) {
 625  0 n.acceptVisitor(this);
 626    }
 627    }
 628  0 unindent();
 629  0 displayProperties(node);
 630  0 print("}");
 631  0 return null;
 632    }
 633   
 634    /**
 635    * Visits a ConstructorCall
 636    * @param node the node to visit
 637    */
 638  0 @Override public Void visit(ConstructorCall node) {
 639  0 print("l."+node.getSourceInfo().getStartLine()+" ConstructorCall {");
 640  0 print("expression:");
 641  0 indent();
 642  0 if (node.getExpression() != null) {
 643  0 node.getExpression().acceptVisitor(this);
 644    }
 645  0 unindent();
 646  0 print("arguments:");
 647  0 indent();
 648  0 if (node.getArguments() != null) {
 649  0 for (Node n : node.getArguments()) {
 650  0 n.acceptVisitor(this);
 651    }
 652    }
 653  0 unindent();
 654  0 print("isSuper:");
 655  0 indent();
 656  0 print((node.isSuper()) ? "true" : "false");
 657  0 unindent();
 658  0 displayProperties(node);
 659  0 print("}");
 660  0 return null;
 661    }
 662   
 663    /**
 664    * Visits a SuperMethodCall
 665    * @param node the node to visit
 666    */
 667  0 @Override public Void visit(SuperMethodCall node) {
 668  0 print("l."+node.getSourceInfo().getStartLine()+" SuperMethodCall {");
 669  0 print("methodName:");
 670  0 indent();
 671  0 print(node.getMethodName());
 672  0 unindent();
 673  0 print("arguments:");
 674  0 indent();
 675  0 if (node.getArguments() != null) {
 676  0 for (Node n : node.getArguments()) {
 677  0 n.acceptVisitor(this);
 678    }
 679    }
 680  0 unindent();
 681  0 displayProperties(node);
 682  0 print("}");
 683  0 return null;
 684    }
 685   
 686    /**
 687    * Visits a BooleanTypeName
 688    * @param node the node to visit
 689    */
 690  0 @Override public Void visit(BooleanTypeName node) {
 691  0 handlePrimitiveTypeName(node, "boolean");
 692  0 return null;
 693    }
 694   
 695    /**
 696    * Visits a ByteTypeName
 697    * @param node the node to visit
 698    */
 699  0 @Override public Void visit(ByteTypeName node) {
 700  0 handlePrimitiveTypeName(node, "byte");
 701  0 return null;
 702    }
 703   
 704    /**
 705    * Visits a ShortTypeName
 706    * @param node the node to visit
 707    */
 708  0 @Override public Void visit(ShortTypeName node) {
 709  0 handlePrimitiveTypeName(node, "short");
 710  0 return null;
 711    }
 712   
 713    /**
 714    * Visits a CharTypeName
 715    * @param node the node to visit
 716    */
 717  0 @Override public Void visit(CharTypeName node) {
 718  0 handlePrimitiveTypeName(node, "char");
 719  0 return null;
 720    }
 721   
 722    /**
 723    * Visits a IntTypeName
 724    * @param node the node to visit
 725    */
 726  0 @Override public Void visit(IntTypeName node) {
 727  0 handlePrimitiveTypeName(node, "int");
 728  0 return null;
 729    }
 730   
 731    /**
 732    * Visits a LongTypeName
 733    * @param node the node to visit
 734    */
 735  0 @Override public Void visit(LongTypeName node) {
 736  0 handlePrimitiveTypeName(node, "long");
 737  0 return null;
 738    }
 739   
 740    /**
 741    * Visits a FloatTypeName
 742    * @param node the node to visit
 743    */
 744  0 @Override public Void visit(FloatTypeName node) {
 745  0 handlePrimitiveTypeName(node, "float");
 746  0 return null;
 747    }
 748   
 749    /**
 750    * Visits a DoubleTypeName
 751    * @param node the node to visit
 752    */
 753  0 @Override public Void visit(DoubleTypeName node) {
 754  0 handlePrimitiveTypeName(node, "double");
 755  0 return null;
 756    }
 757   
 758    /**
 759    * Visits a VoidTypeName
 760    * @param node the node to visit
 761    */
 762  0 @Override public Void visit(VoidTypeName node) {
 763  0 handlePrimitiveTypeName(node, "void");
 764  0 return null;
 765    }
 766   
 767  0 private void handlePrimitiveTypeName(PrimitiveTypeName node, String name) {
 768  0 print("l."+node.getSourceInfo().getStartLine()+" PrimitiveTypeName <"+name+">");
 769  0 displayProperties(node);
 770    }
 771   
 772    /**
 773    * Visits a ReferenceTypeName
 774    * @param node the node to visit
 775    */
 776  0 @Override public Void visit(ReferenceTypeName node) {
 777  0 print("l."+node.getSourceInfo().getStartLine()+" ReferenceTypeName {");
 778  0 print("representation:");
 779  0 indent();
 780  0 print(node.getRepresentation());
 781  0 unindent();
 782  0 displayProperties(node);
 783  0 print("}");
 784  0 return null;
 785    }
 786   
 787    /**
 788    * Visits a ArrayTypeName
 789    * @param node the node to visit
 790    */
 791  0 @Override public Void visit(ArrayTypeName node) {
 792  0 print("l."+node.getSourceInfo().getStartLine()+" ArrayTypeName {");
 793  0 if (node.getElementType() != null) {
 794  0 print("elementType:");
 795  0 node.getElementType().acceptVisitor(this);
 796    }
 797  0 displayProperties(node);
 798  0 print("}");
 799  0 return null;
 800    }
 801   
 802    /**
 803    * Visits a TypeExpression
 804    * @param node the node to visit
 805    */
 806  0 @Override public Void visit(TypeExpression node) {
 807  0 print("l."+node.getSourceInfo().getStartLine()+" TypeExpression {");
 808  0 print("type:");
 809  0 indent();
 810  0 node.getType().acceptVisitor(this);
 811  0 unindent();
 812  0 displayProperties(node);
 813  0 print("}");
 814  0 return null;
 815    }
 816   
 817    /**
 818    * Visits a PostIncrement
 819    * @param node the node to visit
 820    */
 821  0 @Override public Void visit(PostIncrement node) {
 822  0 displayUnary(node);
 823  0 return null;
 824    }
 825   
 826    /**
 827    * Visits a PostDecrement
 828    * @param node the node to visit
 829    */
 830  0 @Override public Void visit(PostDecrement node) {
 831  0 displayUnary(node);
 832  0 return null;
 833    }
 834   
 835    /**
 836    * Visits a PreIncrement
 837    * @param node the node to visit
 838    */
 839  0 @Override public Void visit(PreIncrement node) {
 840  0 displayUnary(node);
 841  0 return null;
 842    }
 843   
 844    /**
 845    * Visits a PreDecrement
 846    * @param node the node to visit
 847    */
 848  0 @Override public Void visit(PreDecrement node) {
 849  0 displayUnary(node);
 850  0 return null;
 851    }
 852   
 853    /**
 854    * Visits a ArrayInitializer
 855    * @param node the node to visit
 856    */
 857  0 @Override public Void visit(ArrayInitializer node) {
 858  0 print("l."+node.getSourceInfo().getStartLine()+" ArrayInitializer {");
 859  0 print("cells:");
 860  0 indent();
 861  0 for (Node n : node.getCells()) {
 862  0 n.acceptVisitor(this);
 863    }
 864  0 unindent();
 865  0 print("elementType:");
 866  0 indent();
 867  0 node.getElementType().acceptVisitor(this);
 868  0 unindent();
 869  0 displayProperties(node);
 870  0 print("}");
 871  0 return null;
 872    }
 873   
 874    /**
 875    * Visits an ArrayAllocation
 876    * @param node the node to visit
 877    */
 878  0 @Override public Void visit(ArrayAllocation node) {
 879  0 print("l."+node.getSourceInfo().getStartLine()+" ArrayAllocation {");
 880  0 print("elementType:");
 881  0 indent();
 882  0 node.getElementType().acceptVisitor(this);
 883  0 unindent();
 884  0 print("dimension:");
 885  0 indent();
 886  0 print(""+node.getDimension());
 887  0 unindent();
 888  0 print("sizes:");
 889  0 indent();
 890  0 for (Node n : node.getSizes()) {
 891  0 n.acceptVisitor(this);
 892    }
 893  0 unindent();
 894  0 print("initialization:");
 895  0 indent();
 896  0 if (node.getInitialization() != null) {
 897  0 node.getInitialization().acceptVisitor(this);
 898    }
 899  0 unindent();
 900  0 displayProperties(node);
 901  0 print("}");
 902  0 return null;
 903    }
 904   
 905    /**
 906    * Visits an SimpleAllocation
 907    * @param node the node to visit
 908    */
 909  0 @Override public Void visit(SimpleAllocation node) {
 910  0 print("l."+node.getSourceInfo().getStartLine()+" SimpleAllocation {");
 911  0 print("creationType:");
 912  0 indent();
 913  0 node.getCreationType().acceptVisitor(this);
 914  0 unindent();
 915  0 print("arguments:");
 916  0 indent();
 917  0 if (node.getArguments() != null) {
 918  0 for (Node n : node.getArguments()) {
 919  0 n.acceptVisitor(this);
 920    }
 921    }
 922  0 unindent();
 923  0 displayProperties(node);
 924  0 print("}");
 925  0 return null;
 926    }
 927   
 928    /**
 929    * Visits an AnonymousAllocation
 930    * @param node the node to visit
 931    */
 932  0 @Override public Void visit(AnonymousAllocation node) {
 933  0 print("l."+node.getSourceInfo().getStartLine()+" AnonymousAllocation {");
 934  0 print("creationType:");
 935  0 indent();
 936  0 node.getCreationType().acceptVisitor(this);
 937  0 unindent();
 938  0 print("arguments:");
 939  0 indent();
 940  0 if (node.getArguments() != null) {
 941  0 for (Node n : node.getArguments()) {
 942  0 n.acceptVisitor(this);
 943    }
 944    }
 945  0 unindent();
 946  0 print("members:");
 947  0 indent();
 948  0 for (Node n : node.getMembers()) {
 949  0 n.acceptVisitor(this);
 950    }
 951  0 unindent();
 952  0 displayProperties(node);
 953  0 print("}");
 954  0 return null;
 955    }
 956   
 957    /**
 958    * Visits an InnerAllocation
 959    * @param node the node to visit
 960    */
 961  0 @Override public Void visit(InnerAllocation node) {
 962  0 print("l."+node.getSourceInfo().getStartLine()+" InnerAllocation {");
 963  0 print("expression:");
 964  0 indent();
 965  0 node.getExpression().acceptVisitor(this);
 966  0 unindent();
 967  0 print("className:");
 968  0 indent();
 969  0 print(node.getClassName());
 970  0 unindent();
 971  0 print("arguments:");
 972  0 indent();
 973  0 if (node.getArguments() != null) {
 974  0 for (Node n : node.getArguments()) {
 975  0 n.acceptVisitor(this);
 976    }
 977    }
 978  0 unindent();
 979  0 displayProperties(node);
 980  0 print("}");
 981  0 return null;
 982    }
 983   
 984    /**
 985    * Visits an AnonymousInnerAllocation
 986    * @param node the node to visit
 987    */
 988  0 @Override public Void visit(AnonymousInnerAllocation node) {
 989  0 print("l."+node.getSourceInfo().getStartLine()+" AnonymousInnerAllocation {");
 990  0 print("expression:");
 991  0 indent();
 992  0 node.getExpression().acceptVisitor(this);
 993  0 unindent();
 994  0 print("creationType:");
 995  0 indent();
 996  0 print(node.getClassName());
 997  0 unindent();
 998  0 print("arguments:");
 999  0 indent();
 1000  0 if (node.getArguments() != null) {
 1001  0 for (Node n : node.getArguments()) {
 1002  0 n.acceptVisitor(this);
 1003    }
 1004    }
 1005  0 unindent();
 1006  0 print("members:");
 1007  0 indent();
 1008  0 for (Node n : node.getMembers()) {
 1009  0 n.acceptVisitor(this);
 1010    }
 1011  0 unindent();
 1012  0 displayProperties(node);
 1013  0 print("}");
 1014  0 return null;
 1015    }
 1016   
 1017    /**
 1018    * Visits a CastExpression
 1019    * @param node the node to visit
 1020    */
 1021  0 @Override public Void visit(CastExpression node) {
 1022  0 print("l."+node.getSourceInfo().getStartLine()+" CastExpression {");
 1023  0 print("targetType:");
 1024  0 indent();
 1025  0 node.getTargetType().acceptVisitor(this);
 1026  0 unindent();
 1027  0 print("expression:");
 1028  0 indent();
 1029  0 node.getExpression().acceptVisitor(this);
 1030  0 unindent();
 1031  0 displayProperties(node);
 1032  0 print("}");
 1033  0 return null;
 1034    }
 1035   
 1036    /**
 1037    * Visits a NotExpression
 1038    * @param node the node to visit
 1039    */
 1040  0 @Override public Void visit(NotExpression node) {
 1041  0 displayUnary(node);
 1042  0 return null;
 1043    }
 1044   
 1045    /**
 1046    * Visits a ComplementExpression
 1047    * @param node the node to visit
 1048    */
 1049  0 @Override public Void visit(ComplementExpression node) {
 1050  0 displayUnary(node);
 1051  0 return null;
 1052    }
 1053   
 1054    /**
 1055    * Visits a PlusExpression
 1056    * @param node the node to visit
 1057    */
 1058  0 @Override public Void visit(PlusExpression node) {
 1059  0 displayUnary(node);
 1060  0 return null;
 1061    }
 1062   
 1063    /**
 1064    * Visits a MinusExpression
 1065    * @param node the node to visit
 1066    */
 1067  0 @Override public Void visit(MinusExpression node) {
 1068  0 displayUnary(node);
 1069  0 return null;
 1070    }
 1071   
 1072    /**
 1073    * Visits a MultiplyExpression
 1074    * @param node the node to visit
 1075    */
 1076  0 @Override public Void visit(MultiplyExpression node) {
 1077  0 displayBinary(node);
 1078  0 return null;
 1079    }
 1080   
 1081    /**
 1082    * Visits a DivideExpression
 1083    * @param node the node to visit
 1084    */
 1085  0 @Override public Void visit(DivideExpression node) {
 1086  0 displayBinary(node);
 1087  0 return null;
 1088    }
 1089   
 1090    /**
 1091    * Visits a RemainderExpression
 1092    * @param node the node to visit
 1093    */
 1094  0 @Override public Void visit(RemainderExpression node) {
 1095  0 displayBinary(node);
 1096  0 return null;
 1097    }
 1098   
 1099    /**
 1100    * Visits a AddExpression
 1101    * @param node the node to visit
 1102    */
 1103  0 @Override public Void visit(AddExpression node) {
 1104  0 displayBinary(node);
 1105  0 return null;
 1106    }
 1107   
 1108    /**
 1109    * Visits a SubtractExpression
 1110    * @param node the node to visit
 1111    */
 1112  0 @Override public Void visit(SubtractExpression node) {
 1113  0 displayBinary(node);
 1114  0 return null;
 1115    }
 1116   
 1117    /**
 1118    * Visits a ShiftLeftExpression
 1119    * @param node the node to visit
 1120    */
 1121  0 @Override public Void visit(ShiftLeftExpression node) {
 1122  0 displayBinary(node);
 1123  0 return null;
 1124    }
 1125   
 1126    /**
 1127    * Visits a ShiftRightExpression
 1128    * @param node the node to visit
 1129    */
 1130  0 @Override public Void visit(ShiftRightExpression node) {
 1131  0 displayBinary(node);
 1132  0 return null;
 1133    }
 1134   
 1135    /**
 1136    * Visits a UnsignedShiftRightExpression
 1137    * @param node the node to visit
 1138    */
 1139  0 @Override public Void visit(UnsignedShiftRightExpression node) {
 1140  0 displayBinary(node);
 1141  0 return null;
 1142    }
 1143   
 1144    /**
 1145    * Visits a LessExpression
 1146    * @param node the node to visit
 1147    */
 1148  0 @Override public Void visit(LessExpression node) {
 1149  0 displayBinary(node);
 1150  0 return null;
 1151    }
 1152   
 1153    /**
 1154    * Visits a GreaterExpression
 1155    * @param node the node to visit
 1156    */
 1157  0 @Override public Void visit(GreaterExpression node) {
 1158  0 displayBinary(node);
 1159  0 return null;
 1160    }
 1161   
 1162    /**
 1163    * Visits a LessOrEqualExpression
 1164    * @param node the node to visit
 1165    */
 1166  0 @Override public Void visit(LessOrEqualExpression node) {
 1167  0 displayBinary(node);
 1168  0 return null;
 1169    }
 1170   
 1171    /**
 1172    * Visits a GreaterOrEqualExpression
 1173    * @param node the node to visit
 1174    */
 1175  0 @Override public Void visit(GreaterOrEqualExpression node) {
 1176  0 displayBinary(node);
 1177  0 return null;
 1178    }
 1179   
 1180    /**
 1181    * Visits a InstanceOfExpression
 1182    * @param node the node to visit
 1183    */
 1184  0 @Override public Void visit(InstanceOfExpression node) {
 1185  0 print("l."+node.getSourceInfo().getStartLine()+" InstanceOfExpression {");
 1186  0 print("expression:");
 1187  0 indent();
 1188  0 node.getExpression().acceptVisitor(this);
 1189  0 unindent();
 1190  0 print("referenceType:");
 1191  0 indent();
 1192  0 node.getReferenceType().acceptVisitor(this);
 1193  0 unindent();
 1194  0 displayProperties(node);
 1195  0 print("}");
 1196  0 return null;
 1197    }
 1198   
 1199    /**
 1200    * Visits a EqualExpression
 1201    * @param node the node to visit
 1202    */
 1203  0 @Override public Void visit(EqualExpression node) {
 1204  0 displayBinary(node);
 1205  0 return null;
 1206    }
 1207   
 1208    /**
 1209    * Visits a NotEqualExpression
 1210    * @param node the node to visit
 1211    */
 1212  0 @Override public Void visit(NotEqualExpression node) {
 1213  0 displayBinary(node);
 1214  0 return null;
 1215    }
 1216   
 1217    /**
 1218    * Visits a BitAndExpression
 1219    * @param node the node to visit
 1220    */
 1221  0 @Override public Void visit(BitAndExpression node) {
 1222  0 displayBinary(node);
 1223  0 return null;
 1224    }
 1225   
 1226    /**
 1227    * Visits a ExclusiveOrExpression
 1228    * @param node the node to visit
 1229    */
 1230  0 @Override public Void visit(ExclusiveOrExpression node) {
 1231  0 displayBinary(node);
 1232  0 return null;
 1233    }
 1234   
 1235    /**
 1236    * Visits a BitOrExpression
 1237    * @param node the node to visit
 1238    */
 1239  0 @Override public Void visit(BitOrExpression node) {
 1240  0 displayBinary(node);
 1241  0 return null;
 1242    }
 1243   
 1244    /**
 1245    * Visits an AndExpression
 1246    * @param node the node to visit
 1247    */
 1248  0 @Override public Void visit(AndExpression node) {
 1249  0 displayBinary(node);
 1250  0 return null;
 1251    }
 1252   
 1253    /**
 1254    * Visits an OrExpression
 1255    * @param node the node to visit
 1256    */
 1257  0 @Override public Void visit(OrExpression node) {
 1258  0 displayBinary(node);
 1259  0 return null;
 1260    }
 1261   
 1262    /**
 1263    * Visits a ConditionalExpression
 1264    * @param node the node to visit
 1265    */
 1266  0 @Override public Void visit(ConditionalExpression node) {
 1267  0 print("l."+node.getSourceInfo().getStartLine()+" ConditionalExpression {");
 1268  0 print("conditionExpression:");
 1269  0 indent();
 1270  0 node.getConditionExpression().acceptVisitor(this);
 1271  0 unindent();
 1272  0 print("ifTrueExpression:");
 1273  0 indent();
 1274  0 node.getIfTrueExpression().acceptVisitor(this);
 1275  0 unindent();
 1276  0 print("ifFalseExpression:");
 1277  0 indent();
 1278  0 node.getIfFalseExpression().acceptVisitor(this);
 1279  0 unindent();
 1280  0 displayProperties(node);
 1281  0 print("}");
 1282  0 return null;
 1283    }
 1284   
 1285    /**
 1286    * Visits an SimpleAssignExpression
 1287    * @param node the node to visit
 1288    */
 1289  0 @Override public Void visit(SimpleAssignExpression node) {
 1290  0 displayBinary(node);
 1291  0 return null;
 1292    }
 1293   
 1294    /**
 1295    * Visits an MultiplyAssignExpression
 1296    * @param node the node to visit
 1297    */
 1298  0 @Override public Void visit(MultiplyAssignExpression node) {
 1299  0 displayBinary(node);
 1300  0 return null;
 1301    }
 1302   
 1303    /**
 1304    * Visits an DivideAssignExpression
 1305    * @param node the node to visit
 1306    */
 1307  0 @Override public Void visit(DivideAssignExpression node) {
 1308  0 displayBinary(node);
 1309  0 return null;
 1310    }
 1311   
 1312    /**
 1313    * Visits an RemainderAssignExpression
 1314    * @param node the node to visit
 1315    */
 1316  0 @Override public Void visit(RemainderAssignExpression node) {
 1317  0 displayBinary(node);
 1318  0 return null;
 1319    }
 1320   
 1321    /**
 1322    * Visits an AddAssignExpression
 1323    * @param node the node to visit
 1324    */
 1325  0 @Override public Void visit(AddAssignExpression node) {
 1326  0 displayBinary(node);
 1327  0 return null;
 1328    }
 1329   
 1330    /**
 1331    * Visits an SubtractAssignExpression
 1332    * @param node the node to visit
 1333    */
 1334  0 @Override public Void visit(SubtractAssignExpression node) {
 1335  0 displayBinary(node);
 1336  0 return null;
 1337    }
 1338   
 1339    /**
 1340    * Visits an ShiftLeftAssignExpression
 1341    * @param node the node to visit
 1342    */
 1343  0 @Override public Void visit(ShiftLeftAssignExpression node) {
 1344  0 displayBinary(node);
 1345  0 return null;
 1346    }
 1347   
 1348    /**
 1349    * Visits an ShiftRightAssignExpression
 1350    * @param node the node to visit
 1351    */
 1352  0 @Override public Void visit(ShiftRightAssignExpression node) {
 1353  0 displayBinary(node);
 1354  0 return null;
 1355    }
 1356   
 1357    /**
 1358    * Visits an UnsignedShiftRightAssignExpression
 1359    * @param node the node to visit
 1360    */
 1361  0 @Override public Void visit(UnsignedShiftRightAssignExpression node) {
 1362  0 displayBinary(node);
 1363  0 return null;
 1364    }
 1365   
 1366    /**
 1367    * Visits a BitAndAssignExpression
 1368    * @param node the node to visit
 1369    */
 1370  0 @Override public Void visit(BitAndAssignExpression node) {
 1371  0 displayBinary(node);
 1372  0 return null;
 1373    }
 1374   
 1375    /**
 1376    * Visits a ExclusiveOrAssignExpression
 1377    * @param node the node to visit
 1378    */
 1379  0 @Override public Void visit(ExclusiveOrAssignExpression node) {
 1380  0 displayBinary(node);
 1381  0 return null;
 1382    }
 1383   
 1384    /**
 1385    * Visits a BitOrAssignExpression
 1386    * @param node the node to visit
 1387    */
 1388  0 @Override public Void visit(BitOrAssignExpression node) {
 1389  0 displayBinary(node);
 1390  0 return null;
 1391    }
 1392   
 1393    /**
 1394    * Visits a BlockStatement
 1395    * @param node the node to visit
 1396    */
 1397  0 @Override public Void visit(BlockStatement node) {
 1398  0 print("l."+node.getSourceInfo().getStartLine()+" BlockStatement {");
 1399  0 print("statements:");
 1400  0 indent();
 1401  0 for (Node n : node.getStatements()) {
 1402  0 n.acceptVisitor(this);
 1403    }
 1404  0 unindent();
 1405  0 displayProperties(node);
 1406  0 print("}");
 1407  0 return null;
 1408    }
 1409   
 1410    /**
 1411    * Visits a ClassDeclaration
 1412    * @param node the node to visit
 1413    */
 1414  0 @Override public Void visit(ClassDeclaration node) {
 1415  0 print("l."+node.getSourceInfo().getStartLine()+" ClassDeclaration {");
 1416  0 print("name:");
 1417  0 indent();
 1418  0 print(node.getName());
 1419  0 unindent();
 1420  0 print("superclass:");
 1421  0 indent();
 1422  0 node.getSuperclass().acceptVisitor(this);
 1423  0 unindent();
 1424  0 print("interfaces:");
 1425  0 indent();
 1426  0 if (node.getInterfaces() != null) {
 1427  0 for (Node n : node.getInterfaces()) {
 1428  0 n.acceptVisitor(this);
 1429    }
 1430    }
 1431  0 unindent();
 1432  0 print("members:");
 1433  0 indent();
 1434  0 for (Node n : node.getMembers()) {
 1435  0 n.acceptVisitor(this);
 1436    }
 1437  0 unindent();
 1438  0 displayProperties(node);
 1439  0 print("}");
 1440  0 return null;
 1441    }
 1442   
 1443    /**
 1444    * Visits an InterfaceDeclaration
 1445    * @param node the node to visit
 1446    */
 1447  0 @Override public Void visit(InterfaceDeclaration node) {
 1448  0 print("l."+node.getSourceInfo().getStartLine()+" InterfaceDeclaration {");
 1449  0 print("name:");
 1450  0 indent();
 1451  0 print(node.getName());
 1452  0 unindent();
 1453  0 print("interfaces:");
 1454  0 indent();
 1455  0 if (node.getInterfaces() != null) {
 1456  0 for (Node n : node.getInterfaces()) {
 1457  0 n.acceptVisitor(this);
 1458    }
 1459    }
 1460  0 unindent();
 1461  0 print("members:");
 1462  0 indent();
 1463  0 for (Node n : node.getMembers()) {
 1464  0 n.acceptVisitor(this);
 1465    }
 1466  0 unindent();
 1467  0 displayProperties(node);
 1468  0 print("}");
 1469  0 return null;
 1470    }
 1471   
 1472    /**
 1473    * Visits a ConstructorDeclaration
 1474    * @param node the node to visit
 1475    */
 1476  0 @Override public Void visit(ConstructorDeclaration node) {
 1477  0 print("l."+node.getSourceInfo().getStartLine()+" ConstructorDeclaration {");
 1478  0 print("modifiers:");
 1479  0 indent();
 1480  0 node.getModifiers().acceptVisitor(this);
 1481  0 unindent();
 1482  0 print("name:");
 1483  0 indent();
 1484  0 print(node.getName());
 1485  0 unindent();
 1486  0 print("parameters:");
 1487  0 indent();
 1488  0 for (Node n : node.getParameters()) {
 1489  0 n.acceptVisitor(this);
 1490    }
 1491  0 unindent();
 1492  0 print("exceptions:");
 1493  0 indent();
 1494  0 for (Node n : node.getExceptions()) {
 1495  0 n.acceptVisitor(this);
 1496    }
 1497  0 unindent();
 1498  0 print("constructorInvocation:");
 1499  0 indent();
 1500  0 if (node.getConstructorCall() != null) {
 1501  0 node.getConstructorCall().acceptVisitor(this);
 1502    }
 1503  0 unindent();
 1504  0 print("statements:");
 1505  0 indent();
 1506  0 for (Node n : node.getStatements()) {
 1507  0 n.acceptVisitor(this);
 1508    }
 1509  0 unindent();
 1510  0 displayProperties(node);
 1511  0 print("}");
 1512  0 return null;
 1513    }
 1514   
 1515    /**
 1516    * Visits a MethodDeclaration
 1517    * @param node the node to visit
 1518    */
 1519  0 @Override public Void visit(MethodDeclaration node) {
 1520  0 print("l."+node.getSourceInfo().getStartLine()+" MethodDeclaration {");
 1521  0 print("modifiers:");
 1522  0 indent();
 1523  0 node.getModifiers().acceptVisitor(this);
 1524  0 unindent();
 1525  0 print("returnType:");
 1526  0 indent();
 1527  0 node.getReturnType().acceptVisitor(this);
 1528  0 unindent();
 1529  0 print("name:");
 1530  0 indent();
 1531  0 print(node.getName());
 1532  0 unindent();
 1533  0 print("parameters:");
 1534  0 indent();
 1535  0 for (Node n : node.getParameters()) {
 1536  0 n.acceptVisitor(this);
 1537    }
 1538  0 unindent();
 1539  0 print("exceptions:");
 1540  0 indent();
 1541  0 for (Node n : node.getExceptions()) {
 1542  0 n.acceptVisitor(this);
 1543    }
 1544  0 unindent();
 1545  0 print("body:");
 1546  0 indent();
 1547  0 if (node.getBody() != null) {
 1548  0 node.getBody().acceptVisitor(this);
 1549    }
 1550  0 unindent();
 1551  0 displayProperties(node);
 1552  0 print("}");
 1553  0 return null;
 1554    }
 1555   
 1556    /**
 1557    * Visits a FormalParameter
 1558    * @param node the node to visit
 1559    */
 1560  0 @Override public Void visit(FormalParameter node) {
 1561  0 print("l."+node.getSourceInfo().getStartLine()+" FormalParameter {");
 1562  0 print("modifiers:");
 1563  0 indent();
 1564  0 node.getModifiers().acceptVisitor(this);
 1565  0 unindent();
 1566  0 print("type:");
 1567  0 indent();
 1568  0 node.getType().acceptVisitor(this);
 1569  0 unindent();
 1570  0 print("name:");
 1571  0 indent();
 1572  0 print(node.getName());
 1573  0 unindent();
 1574  0 displayProperties(node);
 1575  0 print("}");
 1576  0 return null;
 1577    }
 1578   
 1579    /**
 1580    * Visits a FieldDeclaration
 1581    * @param node the node to visit
 1582    */
 1583  0 @Override public Void visit(FieldDeclaration node) {
 1584  0 print("l."+node.getSourceInfo().getStartLine()+" FieldDeclaration {");
 1585  0 print("modifiers:");
 1586  0 indent();
 1587  0 node.getModifiers().acceptVisitor(this);
 1588  0 unindent();
 1589  0 print("type:");
 1590  0 indent();
 1591  0 node.getType().acceptVisitor(this);
 1592  0 unindent();
 1593  0 print("name:");
 1594  0 indent();
 1595  0 print(node.getName());
 1596  0 unindent();
 1597  0 print("initializer:");
 1598  0 indent();
 1599  0 if (node.getInitializer() != null) {
 1600  0 node.getInitializer().acceptVisitor(this);
 1601    }
 1602  0 unindent();
 1603  0 displayProperties(node);
 1604  0 print("}");
 1605  0 return null;
 1606    }
 1607   
 1608    /**
 1609    * Visits a VariableDeclaration
 1610    * @param node the node to visit
 1611    */
 1612  0 @Override public Void visit(VariableDeclaration node) {
 1613  0 print("l."+node.getSourceInfo().getStartLine()+" VariableDeclaration {");
 1614  0 print("modifiers:");
 1615  0 indent();
 1616  0 node.getModifiers().acceptVisitor(this);
 1617  0 unindent();
 1618  0 print("type:");
 1619  0 indent();
 1620  0 node.getType().acceptVisitor(this);
 1621  0 unindent();
 1622  0 print("name:");
 1623  0 indent();
 1624  0 print(node.getName());
 1625  0 unindent();
 1626  0 print("initializer:");
 1627  0 indent();
 1628  0 if (node.getInitializer() != null) {
 1629  0 node.getInitializer().acceptVisitor(this);
 1630    }
 1631  0 unindent();
 1632  0 displayProperties(node);
 1633  0 print("}");
 1634  0 return null;
 1635    }
 1636   
 1637    /**
 1638    * Visits a ClassInitializer
 1639    * @param node the node to visit
 1640    */
 1641  0 @Override public Void visit(ClassInitializer node) {
 1642  0 print("l."+node.getSourceInfo().getStartLine()+" ClassInitializer {");
 1643  0 print("block:");
 1644  0 indent();
 1645  0 node.getBlock().acceptVisitor(this);
 1646  0 unindent();
 1647  0 displayProperties(node);
 1648  0 print("}");
 1649  0 return null;
 1650    }
 1651   
 1652    /**
 1653    * Visits a InstanceInitializer
 1654    * @param node the node to visit
 1655    */
 1656  0 @Override public Void visit(InstanceInitializer node) {
 1657  0 print("l."+node.getSourceInfo().getStartLine()+" InstanceInitializer {");
 1658  0 print("block:");
 1659  0 indent();
 1660  0 node.getBlock().acceptVisitor(this);
 1661  0 unindent();
 1662  0 displayProperties(node);
 1663  0 print("}");
 1664  0 return null;
 1665    }
 1666   
 1667  0 @Override public Void visit(ModifierSet mods) {
 1668  0 for (Annotation ann : mods.getAnnotations()) {
 1669  0 ann.acceptVisitor(this);
 1670  0 print(" ");
 1671    }
 1672  0 for (ModifierSet.Modifier m : mods.getFlags()) {
 1673  0 print(m.getName() + " ");
 1674    }
 1675  0 return null;
 1676    }
 1677   
 1678    /**
 1679    * Displays an unary expression
 1680    */
 1681  0 private void displayUnary(UnaryExpression ue) {
 1682  0 print("l."+ue.getSourceInfo().getStartLine()+" "+ue.getClass().getName()+" {");
 1683  0 print("expression:");
 1684  0 indent();
 1685  0 ue.getExpression().acceptVisitor(this);
 1686  0 unindent();
 1687  0 displayProperties(ue);
 1688  0 print("}");
 1689    }
 1690   
 1691    /**
 1692    * Displays a binary expression
 1693    */
 1694  0 private void displayBinary(BinaryExpression be) {
 1695  0 print("l."+be.getSourceInfo().getStartLine()+" "+be.getClass().getName()+" {");
 1696  0 print("leftExpression:");
 1697  0 indent();
 1698  0 be.getLeftExpression().acceptVisitor(this);
 1699  0 unindent();
 1700  0 print("rightExpression:");
 1701  0 indent();
 1702  0 be.getRightExpression().acceptVisitor(this);
 1703  0 unindent();
 1704  0 displayProperties(be);
 1705  0 print("}");
 1706    }
 1707   
 1708    /**
 1709    * Displays the properties of a node
 1710    */
 1711  0 private void displayProperties(Node node) {
 1712  0 boolean first = true;
 1713  0 for (String prop : node.getProperties()) {
 1714  0 if (first) { print("properties:"); first = false; }
 1715  0 indent();
 1716  0 print(prop+": "+node.getProperty(prop));
 1717  0 unindent();
 1718    }
 1719    }
 1720   
 1721    /**
 1722    * Adds a level of indentation
 1723    */
 1724  0 private void indent() {
 1725  0 indentation += " ";
 1726    }
 1727   
 1728    /**
 1729    * Removes a level of indentation
 1730    */
 1731  0 private void unindent() {
 1732  0 indentation = indentation.substring(0, indentation.length()-2);
 1733    }
 1734   
 1735    /**
 1736    * Prints an indented line
 1737    */
 1738  0 private void print(String s) {
 1739  0 out.println(indentation+s);
 1740    }
 1741    }