From 8a15d57b056cf84aa9b2ae0234bf5bc432b414c3 Mon Sep 17 00:00:00 2001 From: Nathanael Sensfelder Date: Tue, 19 Sep 2017 16:08:48 +0200 Subject: Removes the extra set of " that messed with regex. --- instr-to-kodkod/src/StringManager.java | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/instr-to-kodkod/src/StringManager.java b/instr-to-kodkod/src/StringManager.java index e94a7af..48cd8d6 100644 --- a/instr-to-kodkod/src/StringManager.java +++ b/instr-to-kodkod/src/StringManager.java @@ -58,7 +58,7 @@ public class StringManager final String str ) { - regexes.add(Pattern.compile(str)); + regexes.add(Pattern.compile(str.substring(1, (str.length() - 1)))); return get_string_as_relation(str); } @@ -73,13 +73,19 @@ public class StringManager { for (final Map.Entry c: candidates) { - if (p.matcher(c.getKey()).matches()) + String word; + + word = c.getKey(); + /* Remove the surounding "" */ + word = word.substring(1, (word.length() - 1)); + + if (p.matcher(word).matches()) { System.out.println ( "[D] \"" - + c.getValue() - + "\" matches pattern \"" + + word + + "\" MATCHES pattern \"" + p.pattern() + "\"." ); @@ -89,10 +95,23 @@ public class StringManager new String[] { c.getValue(), - TO_ID.get(p.pattern()) + TO_ID.get("\"" + p.pattern() + "\"") } ); } + /* + else + { + System.out.println + ( + "[D] \"" + + word + + "\" DOES NOT match pattern \"" + + p.pattern() + + "\"." + ); + } + */ } } } -- cgit v1.2.3-70-g09d2