[Nice-commit] Nice/src/bossa/syntax StringConstantExp.java,1.8,1.9
Brought to you by:
bonniot
From: <ar...@us...> - 2003-10-01 18:11:44
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1:/tmp/cvs-serv8204/F:/nice/src/bossa/syntax Modified Files: StringConstantExp.java Log Message: Implemented muli line string literals. Index: StringConstantExp.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/StringConstantExp.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** StringConstantExp.java 24 Jul 2003 17:52:09 -0000 1.8 --- StringConstantExp.java 1 Oct 2003 18:11:39 -0000 1.9 *************** *** 25,30 **** --- 25,39 ---- public StringConstantExp(String value) { + this(value, false); + } + + public StringConstantExp(String value, boolean multiline) + { className = stringName; this.escapedValue = value; + this.multiline = multiline; + if (multiline) + value = escapeEOL(value); + this.value=unescape(value); } *************** *** 88,91 **** --- 97,120 ---- } + static String escapeEOL(String s) + { + StringBuffer sb = new StringBuffer(); + int n = s.length(); + for (int i = 0; i < n; i++) { + char c = s.charAt(i); + if (c == '\n') + sb.append("\\n"); + else if (c == '\r') + { + sb.append("\\n"); + if (s.charAt(i+1) == '\n') + i++; + } + else + sb.append(c); + } + return sb.toString(); + } + public String toString() { *************** *** 94,96 **** --- 123,126 ---- String escapedValue; + boolean multiline; } |