1 /*******************************************************************************
2 * Copyright (c) 2000, 2001, 2002 International Business Machines Corp. and others.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Common Public License v0.5
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/cpl-v05.html
9 * IBM Corporation - initial API and implementation
10 ******************************************************************************/
11 package net.sourceforge.phpdt.internal.compiler.ast;
13 //import net.sourceforge.phpdt.internal.compiler.IAbstractSyntaxTreeVisitor;
14 //import net.sourceforge.phpdt.internal.compiler.codegen.CodeStream;
15 //import net.sourceforge.phpdt.internal.compiler.impl.Constant;
16 //import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
17 //import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
19 public class StringLiteral {
21 public int sourceStart, sourceEnd;
23 public StringLiteral(char[] token, int s, int e) {
28 public StringLiteral(int s, int e) {
34 * source method comment.
36 public char[] source() {
39 public String toStringExpression() {
41 // handle some special char.....
42 StringBuffer result = new StringBuffer("\""); //$NON-NLS-1$
43 for (int i = 0; i < source.length; i++) {
46 result.append("\\b"); //$NON-NLS-1$
49 result.append("\\t"); //$NON-NLS-1$
52 result.append("\\n"); //$NON-NLS-1$
55 result.append("\\f"); //$NON-NLS-1$
58 result.append("\\r"); //$NON-NLS-1$
61 result.append("\\\""); //$NON-NLS-1$
64 result.append("\\'"); //$NON-NLS-1$
66 case '\\' : //take care not to display the escape as a potential real char
67 result.append("\\\\"); //$NON-NLS-1$
70 result.append(source[i]);
73 result.append("\""); //$NON-NLS-1$
74 return result.toString();
78 * @deprecated - use field instead
80 public int sourceEnd() {
85 * @deprecated - use field instead
87 public int sourceStart() {