1 /*******************************************************************************
 
   2  * Copyright (c) 2000, 2003 IBM Corporation and others.
 
   3  * All rights reserved. This program and the accompanying materials 
 
   4  * are made available under the terms of the Common Public License v1.0
 
   5  * which accompanies this distribution, and is available at
 
   6  * http://www.eclipse.org/legal/cpl-v10.html
 
   9  *     IBM Corporation - initial API and implementation
 
  10  *******************************************************************************/
 
  11 package net.sourceforge.phpeclipse.internal.compiler.ast;
 
  15  * double quoted string literal
 
  17 public class StringLiteralDQ extends StringLiteral {
 
  19   public StringLiteralDQ(char[] token, int s, int e) {
 
  23   public StringLiteralDQ(int s, int e) {
 
  27   public String toStringExpression() {
 
  29     // handle some special char.....
 
  30     StringBuffer result = new StringBuffer("\""); //$NON-NLS-1$
 
  31     for (int i = 0; i < source.length; i++) {
 
  34         result.append("\\b"); //$NON-NLS-1$
 
  37         result.append("\\t"); //$NON-NLS-1$
 
  40         result.append("\\n"); //$NON-NLS-1$
 
  43         result.append("\\f"); //$NON-NLS-1$
 
  46         result.append("\\r"); //$NON-NLS-1$
 
  49         result.append("\\\""); //$NON-NLS-1$
 
  52         result.append("\\'"); //$NON-NLS-1$
 
  54       case '\\': //take care not to display the escape as a potential real char
 
  55         result.append("\\\\"); //$NON-NLS-1$
 
  58         result.append(source[i]);
 
  61     result.append("\""); //$NON-NLS-1$
 
  62     return result.toString();