*** empty log message ***
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / internal / compiler / ast / StringLiteral.java
index 1dbc794..ca22a4c 100644 (file)
@@ -10,6 +10,9 @@
  ******************************************************************************/
 package net.sourceforge.phpdt.internal.compiler.ast;
 
+import java.util.List;
+import java.util.ArrayList;
+
 //import net.sourceforge.phpdt.internal.compiler.IAbstractSyntaxTreeVisitor;
 //import net.sourceforge.phpdt.internal.compiler.codegen.CodeStream;
 //import net.sourceforge.phpdt.internal.compiler.impl.Constant;
@@ -19,7 +22,7 @@ package net.sourceforge.phpdt.internal.compiler.ast;
 public class StringLiteral extends Literal {
   char[] source;
 
-  public StringLiteral(char[] token, int s) {
+  public StringLiteral(final char[] token, final int s) {
     super(s, s + token.length);
     source = token;
   }
@@ -31,12 +34,12 @@ public class StringLiteral extends Literal {
    * @param e sourceend
    * @deprecated
    */
-  public StringLiteral(char[] token, int s, int e) {
+  public StringLiteral(final char[] token, final int s, final int e) {
     super(s, e);
     source = token;
   }
 
-  public StringLiteral(int s, int e) {
+  public StringLiteral(final int s, final int e) {
     super(s, e);
   }
 
@@ -51,41 +54,49 @@ public class StringLiteral extends Literal {
    * Return the expression as String.
    * @return the expression
    */
+  /* public String toStringExpression() {
+     // handle some special char.....
+     StringBuffer result = new StringBuffer("\""); //$NON-NLS-1$
+     for (int i = 0; i < source.length; i++) {
+       switch (source[i]) {
+         case '\b':
+           result.append("\\b"); //$NON-NLS-1$
+           break;
+         case '\t':
+           result.append("\\t"); //$NON-NLS-1$
+           break;
+         case '\n':
+           result.append("\\n"); //$NON-NLS-1$
+           break;
+         case '\f':
+           result.append("\\f"); //$NON-NLS-1$
+           break;
+         case '\r':
+           result.append("\\r"); //$NON-NLS-1$
+           break;
+         case '\"':
+           result.append("\\\""); //$NON-NLS-1$
+           break;
+         case '\'':
+           result.append("\\'"); //$NON-NLS-1$
+           break;
+         case '\\': //take care not to display the escape as a potential real char
+           result.append("\\\\"); //$NON-NLS-1$
+           break;
+         default :
+           result.append(source[i]);
+       }
+     }
+     result.append("\""); //$NON-NLS-1$
+     return result.toString();
+   } */
+
+  /**
+   * Return the expression as String.
+   * @return the expression
+   */
   public String toStringExpression() {
-    // handle some special char.....
-    StringBuffer result = new StringBuffer("\""); //$NON-NLS-1$
-    for (int i = 0; i < source.length; i++) {
-      switch (source[i]) {
-        case '\b':
-          result.append("\\b"); //$NON-NLS-1$
-          break;
-        case '\t':
-          result.append("\\t"); //$NON-NLS-1$
-          break;
-        case '\n':
-          result.append("\\n"); //$NON-NLS-1$
-          break;
-        case '\f':
-          result.append("\\f"); //$NON-NLS-1$
-          break;
-        case '\r':
-          result.append("\\r"); //$NON-NLS-1$
-          break;
-        case '\"':
-          result.append("\\\""); //$NON-NLS-1$
-          break;
-        case '\'':
-          result.append("\\'"); //$NON-NLS-1$
-          break;
-        case '\\': //take care not to display the escape as a potential real char
-          result.append("\\\\"); //$NON-NLS-1$
-          break;
-        default :
-          result.append(source[i]);
-      }
-    }
-    result.append("\""); //$NON-NLS-1$
-    return result.toString();
+    return new String(source);
   }
 
   /**