Skip to content

Commit 43c70f1

Browse files
authored
Update SMTResultParser.java
1 parent 32d9f0b commit 43c70f1

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

solver/src/main/java/org/evomaster/solver/smtlib/SMTResultParser.java

+10-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ public static Map<String, SMTLibValue> parseZ3Response(String z3Response) {
5555
continue;
5656
}
5757

58-
buffer.append(line.trim()).append(" ");
58+
String sanitizedLine = line.trim().replaceAll("\\(-\\s+(\\d+)\\)", "(-$1)"); // Remove spaces for negative numbers, example: (- 321)
59+
buffer.append(sanitizedLine).append(" ");
5960

6061
// Check if the buffer contains a complete expression
6162
Matcher composedMatcher = composedTypePattern.matcher(buffer.toString());
@@ -100,6 +101,14 @@ else if (valueMatcher.find()) {
100101
* @return an SMTLibValue representing the parsed value
101102
*/
102103
private static SMTLibValue parseValue(String value) {
104+
if (value.startsWith("(")) {
105+
// If it is a negative number in parentheses
106+
value = value.substring(1).trim(); // Remove parentheses
107+
}
108+
if (value.endsWith(")")) {
109+
// If it is a negative number in parentheses
110+
value = value.substring(0, value.length() - 1).trim(); // Remove parentheses
111+
}
103112
if (value.startsWith("\"") && value.endsWith("\"")) {
104113
// If it is a string
105114
return new StringValue(value.substring(1, value.length() - 1)); // Remove quotes

0 commit comments

Comments
 (0)