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.phpdt.internal.compiler.ast;
15 * single quoted string literal
17 public class StringLiteralSQ extends StringLiteral {
18 public StringLiteralSQ(char[] token, int s, int e) {
22 public StringLiteralSQ(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
56 result.append("\\\\"); //$NON-NLS-1$
59 result.append(source[i]);
62 result.append("\'"); //$NON-NLS-1$
63 return result.toString();