summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathanael Sensfelder <SpamShield0@MultiAgentSystems.org>2017-07-26 14:46:31 +0200
committerNathanael Sensfelder <SpamShield0@MultiAgentSystems.org>2017-07-26 14:46:31 +0200
commit3ad54b3a7d54b40e2083dfeac71116e12b153bfa (patch)
treeceae8f32716e9a4ef8f38ae141bb0eab4702ac78
parent694d42f9ca5e6728dc1170a740264ee98bf5cbe5 (diff)
(Woops) Adds anonymous strings support.
-rw-r--r--instr-to-kodkod/src/StringManager.java17
1 files changed, 9 insertions, 8 deletions
diff --git a/instr-to-kodkod/src/StringManager.java b/instr-to-kodkod/src/StringManager.java
index 8e7182c..c0a2fa4 100644
--- a/instr-to-kodkod/src/StringManager.java
+++ b/instr-to-kodkod/src/StringManager.java
@@ -7,6 +7,8 @@ public class StringManager
{
private final Map<String, String> TO_ID;
private final VHDLType string_type;
+ private final String anon_string_prefix;
+ private int anon_string_count;
private static String cleanup_string (final String str)
{
@@ -17,6 +19,8 @@ public class StringManager
{
TO_ID = new HashMap<String, String>();
string_type = Main.get_model().get_string_type();
+ anon_string_prefix = "_string_"; /* TODO: use a program param. */
+ anon_string_count = 0;
}
@@ -25,20 +29,17 @@ public class StringManager
final String str
)
{
- final String id;
+ String id;
id = TO_ID.get(cleanup_string(str));
if (id == null)
{
- System.err.println
- (
- "[F] There is no mapping associated with the string \""
- + str
- + "\", and anonymous strings are not yet supported."
- );
+ id = (anon_string_prefix + anon_string_count);
- System.exit(-1);
+ string_type.add_member(id);
+
+ TO_ID.put(str, id);
}
else
{