*/
public class StringLiteralDQ extends StringLiteral {
- public StringLiteralDQ(char[] token, int s, int e) {
- super(token, s, e);
- }
+ public StringLiteralDQ(char[] token, int s, int e) {
+ super(token, s, e);
+ }
- public StringLiteralDQ(int s, int e) {
- super(s, e);
- }
+ public StringLiteralDQ(int s, int e) {
+ super(s, e);
+ }
- public String toStringExpression() {
+ 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();
- }
+ // 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();
+ }
}
\ No newline at end of file