1 11 package org.eclipse.jdt.internal.compiler.ast; 12 13 import org.eclipse.jdt.internal.compiler.ASTVisitor; 14 import org.eclipse.jdt.internal.compiler.lookup.BlockScope; 15 16 public class ExtendedStringLiteral extends StringLiteral { 17 18 21 public ExtendedStringLiteral(StringLiteral str, CharLiteral character) { 22 23 super(str.source, str.sourceStart, str.sourceEnd, str.lineNumber); 24 extendWith(character); 25 } 26 27 30 public ExtendedStringLiteral(StringLiteral str1, StringLiteral str2) { 31 32 super(str1.source, str1.sourceStart, str1.sourceEnd, str1.lineNumber); 33 extendWith(str2); 34 } 35 36 39 public ExtendedStringLiteral extendWith(CharLiteral lit) { 40 41 int length = source.length; 43 System.arraycopy(source, 0, (source = new char[length + 1]), 0, length); 44 source[length] = lit.value; 45 sourceEnd = lit.sourceEnd; 47 return this; 48 } 49 50 53 public ExtendedStringLiteral extendWith(StringLiteral lit) { 54 55 int length = source.length; 57 System.arraycopy( 58 source, 59 0, 60 source = new char[length + lit.source.length], 61 0, 62 length); 63 System.arraycopy(lit.source, 0, source, length, lit.source.length); 64 sourceEnd = lit.sourceEnd; 66 return this; 67 } 68 69 public StringBuffer printExpression(int indent, StringBuffer output) { 70 71 return output.append("ExtendedStringLiteral{").append(source).append('}'); } 73 74 public void traverse(ASTVisitor visitor, BlockScope scope) { 75 76 visitor.visit(this, scope); 77 visitor.endVisit(this, scope); 78 } 79 } 80 | Popular Tags |