[Swift-commit] r6132 - in branches/release-0.94: . resources src/org/griphyn/vdl/engine
hategan at ci.uchicago.edu
hategan at ci.uchicago.edu
Sun Jan 6 01:46:02 CST 2013
Author: hategan
Date: 2013-01-06 01:45:59 -0600 (Sun, 06 Jan 2013)
New Revision: 6132
Modified:
branches/release-0.94/
branches/release-0.94/resources/swiftscript.g
branches/release-0.94/src/org/griphyn/vdl/engine/Karajan.java
Log:
merged escaping of "<", ">", quote, and "&" from trunk
Property changes on: branches/release-0.94
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/release-0.93:4761-5122
+ /branches/release-0.93:4761-5122
/trunk:6103-6104
Modified: branches/release-0.94/resources/swiftscript.g
===================================================================
--- branches/release-0.94/resources/swiftscript.g 2013-01-04 20:01:38 UTC (rev 6131)
+++ branches/release-0.94/resources/swiftscript.g 2013-01-06 07:45:59 UTC (rev 6132)
@@ -1147,7 +1147,7 @@
| s:STRING_LITERAL
{
code=template("sConst");
- code.setAttribute("value",quote(s.getText()));
+ code.setAttribute("value",quote(escape(s.getText())));
}
| t:"true"
{
Modified: branches/release-0.94/src/org/griphyn/vdl/engine/Karajan.java
===================================================================
--- branches/release-0.94/src/org/griphyn/vdl/engine/Karajan.java 2013-01-04 20:01:38 UTC (rev 6131)
+++ branches/release-0.94/src/org/griphyn/vdl/engine/Karajan.java 2013-01-06 07:45:59 UTC (rev 6132)
@@ -1606,7 +1606,7 @@
for (String key : stringInternMap.keySet()) {
String variableName = stringInternMap.get(key);
StringTemplate st = template("sConst");
- st.setAttribute("innervalue",escapeQuotes(key));
+ st.setAttribute("innervalue",escapeQuotesAndMarkup(key));
StringTemplate vt = template("globalConstant");
vt.setAttribute("name",variableName);
vt.setAttribute("expr",st);
@@ -1638,6 +1638,30 @@
return in.replaceAll("\"", """);
}
+ String escapeQuotesAndMarkup(String in) {
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0; i < in.length(); i++) {
+ char c = in.charAt(i);
+ switch (c) {
+ case '<':
+ sb.append("<");
+ break;
+ case '>':
+ sb.append(">");
+ break;
+ case '"':
+ sb.append(""");
+ break;
+ case '&':
+ sb.append("&");
+ break;
+ default:
+ sb.append(c);
+ }
+ }
+ return sb.toString();
+ }
+
public static String normalize(String type) {
return org.griphyn.vdl.type.Types.normalize(type);
}
More information about the Swift-commit
mailing list