예제 #1
0
 public void runConformTest(
     String fileName, String fileContents, Parser parser, ASTCollector visitor, String expected) {
   CompilationUnit source = new CompilationUnit(fileContents.toCharArray(), fileName, null);
   CompilationResult compilationResult = new CompilationResult(source, 1, 1, 10);
   CompilationUnitDeclaration unit = parser.parse(source, compilationResult);
   assertEquals(0, compilationResult.problemCount);
   unit.traverse(visitor, unit.scope);
   String result = visitor.result();
   if (!expected.equals(result)) {
     System.out.println(getClass().getName() + '#' + getName());
     System.out.println("Expected:");
     System.out.println(expected);
     System.out.println("But was:");
     System.out.println(result);
     System.out.println("Cut and paste:");
     System.out.println(Util.displayString(result, INDENT, SHIFT));
   }
   assertEquals(expected, result);
 }
예제 #2
0
 public void endVisit(StringLiteralConcatenation literal, BlockScope scope) {
   this.collector.append("[ev SLC " + cut(literal.toString()) + "]\n");
   super.endVisit(literal, scope);
 }
예제 #3
0
 public void endVisit(StringLiteral stringLiteral, BlockScope scope) {
   this.collector.append("[ev SL " + cut(stringLiteral.toString()) + "]\n");
   super.endVisit(stringLiteral, scope);
 }
예제 #4
0
 public void endVisit(SingleNameReference singleNameReference, BlockScope scope) {
   this.collector.append("[ev SNR " + cut(singleNameReference.toString()) + "]\n");
   super.endVisit(singleNameReference, scope);
 }
예제 #5
0
 public void endVisit(ExtendedStringLiteral literal, BlockScope scope) {
   this.collector.append("[ev ESL " + cut(literal.toString()) + "]\n");
   super.endVisit(literal, scope);
 }
예제 #6
0
 public void endVisit(CharLiteral charLiteral, BlockScope scope) {
   this.collector.append("[ev CL " + cut(charLiteral.toString()) + "]\n");
   super.endVisit(charLiteral, scope);
 }
예제 #7
0
 public void endVisit(BinaryExpression binaryExpression, BlockScope scope) {
   this.collector.append("[ev BE " + cut(binaryExpression.toString()) + "]\n");
   super.endVisit(binaryExpression, scope);
 }