summaryrefslogtreecommitdiff
path: root/BCT
diff options
context:
space:
mode:
authorGravatar qadeer <qadeer@microsoft.com>2012-03-12 00:45:16 -0700
committerGravatar qadeer <qadeer@microsoft.com>2012-03-12 00:45:16 -0700
commitd82d1610ccf458031352284830c3bef02b6edda9 (patch)
treedbc4c5b5f9dfc9c50a50e5e807aafa02b82fc6d2 /BCT
parent8b05d9558e661953b021f0d86e22d352b1227cc8 (diff)
updated Boogie strings so that they can refer to \" (and more)
fixed BCT :value
Diffstat (limited to 'BCT')
-rw-r--r--BCT/BytecodeTranslator/Sink.cs6
1 files changed, 3 insertions, 3 deletions
diff --git a/BCT/BytecodeTranslator/Sink.cs b/BCT/BytecodeTranslator/Sink.cs
index d89f1bfd..b1a8f1a4 100644
--- a/BCT/BytecodeTranslator/Sink.cs
+++ b/BCT/BytecodeTranslator/Sink.cs
@@ -323,6 +323,9 @@ namespace BytecodeTranslator {
}
public Bpl.Constant FindOrCreateConstant(string str) {
+ str = str.Replace("\n", "\\n");
+ str = str.Replace("\r", "\\r");
+ str = str.Replace("\"", "\\\"");
Bpl.Constant c;
if (!this.declaredStringConstants.TryGetValue(str, out c)) {
var tok = Bpl.Token.NoToken;
@@ -330,9 +333,6 @@ namespace BytecodeTranslator {
var name = "$string_literal_" + TranslationHelper.TurnStringIntoValidIdentifier(str) + "_" + declaredStringConstants.Count;
var tident = new Bpl.TypedIdent(tok, name, t);
c = new Bpl.Constant(tok, tident, true);
- str = str.Replace("\n", "\\n");
- str = str.Replace("\r", "\\r");
- str = str.Replace("\"", "\u0022");
var attrib = new Bpl.QKeyValue(Bpl.Token.NoToken, "value", new List<object> { str, }, null);
c.Attributes = attrib;
this.declaredStringConstants.Add(str, c);