Commit aa05f548 authored by Pim Wijn's avatar Pim Wijn
Browse files

Fixed problem with syntax errors differently

parent 8d8f1727
...@@ -1819,16 +1819,13 @@ public class LTSminPrinter { ...@@ -1819,16 +1819,13 @@ public class LTSminPrinter {
private static int generateMaybe(StringWriter w, Expression e, LTSminPointer state) { private static int generateMaybe(StringWriter w, Expression e, LTSminPointer state) {
if (e == null) return 0; if (e == null) return 0;
if (e instanceof LTSminIdentifier) { if (e instanceof LTSminIdentifier) {
} else if (e instanceof Identifier) { } else if (e instanceof Identifier) {
Identifier id = (Identifier) e; Identifier id = (Identifier) e;
generateMaybe(w, id.getArrayExpr(), state); generateMaybe(w, id.getArrayExpr(), state);
generateMaybe(w, id.getSub(), state); generateMaybe(w, id.getSub(), state);
if (id.getArrayExpr() != null) { if (id.getArrayExpr() != null) {
if (w.options.total) { w.append(" || ");
w.append(" || ");
}
generateExpression(w, id.getArrayExpr(), state); generateExpression(w, id.getArrayExpr(), state);
w.append(" < 0 || "); w.append(" < 0 || ");
...@@ -2097,6 +2094,7 @@ public class LTSminPrinter { ...@@ -2097,6 +2094,7 @@ public class LTSminPrinter {
w.append("(0"); w.append("(0");
} else { } else {
w.append("("); w.append("(");
maybe = maybe.replaceFirst(" \\|\\|", "");
} }
w.append(maybe); w.append(maybe);
w.append(") ? 2 :").appendLine(); w.append(") ? 2 :").appendLine();
...@@ -2110,6 +2108,7 @@ public class LTSminPrinter { ...@@ -2110,6 +2108,7 @@ public class LTSminPrinter {
private static void generateBoundsChecks(StringWriter w, LTSminModel model, Expression e) { private static void generateBoundsChecks(StringWriter w, LTSminModel model, Expression e) {
StringWriter w2 = new StringWriter(w.options); StringWriter w2 = new StringWriter(w.options);
generateMaybe(w2, e, out(model)); generateMaybe(w2, e, out(model));
if (w2.length() > 0) { if (w2.length() > 0) {
if (w.options.total) { if (w.options.total) {
w.appendPrefix(); w.appendPrefix();
...@@ -2117,7 +2116,7 @@ public class LTSminPrinter { ...@@ -2117,7 +2116,7 @@ public class LTSminPrinter {
w.appendPostfix(); w.appendPostfix();
} else { } else {
w.appendPrefix(); w.appendPrefix();
w.append("assert( !("+ w2.toString() +") );"); w.append("assert( !("+ w2.toString().replaceFirst(" \\|\\|", "") +") );");
w.appendPostfix(); w.appendPostfix();
} }
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment