3
0
Mirror von https://github.com/IntellectualSites/FastAsyncWorldEdit.git synchronisiert 2024-11-07 20:10:06 +01:00

Add workaround for when expressions are parsed in masks/patterns where '&&' is used

Fixes #1517
Dieser Commit ist enthalten in:
dordsor21 2022-01-05 17:46:18 +00:00
Ursprung 0408cd0575
Commit 722c411219
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 1E53E88969FFCF0B

Datei anzeigen

@ -33,12 +33,14 @@ public abstract class FaweParser<T> extends InputParser<T> implements AliasedPar
List<String> inputs = new ArrayList<>(); List<String> inputs = new ArrayList<>();
List<Boolean> and = new ArrayList<>(); List<Boolean> and = new ArrayList<>();
int last = 0; int last = 0;
outer: boolean expression = false;
for (int i = 0; i < toParse.length(); i++) { for (int i = 0; i < toParse.length(); i++) {
char c = toParse.charAt(i); char c = toParse.charAt(i);
switch (c) { switch (c) {
case ',': case ',', '&' -> {
case '&': if (expression) {
continue;
}
String result = toParse.substring(last, i); String result = toParse.substring(last, i);
if (!result.isEmpty()) { if (!result.isEmpty()) {
inputs.add(result); inputs.add(result);
@ -47,8 +49,9 @@ public abstract class FaweParser<T> extends InputParser<T> implements AliasedPar
throw new InputParseException(Caption.of("fawe.error.parse.invalid-dangling-character", c)); throw new InputParseException(Caption.of("fawe.error.parse.invalid-dangling-character", c));
} }
last = i + 1; last = i + 1;
continue outer; }
default: case '=' -> expression = true;
default -> {
if (c == '[') { if (c == '[') {
int next = StringMan.findMatchingBracket(toParse, i); int next = StringMan.findMatchingBracket(toParse, i);
if (next != -1) { if (next != -1) {
@ -57,6 +60,8 @@ public abstract class FaweParser<T> extends InputParser<T> implements AliasedPar
toParse += "]"; toParse += "]";
i = toParse.length(); i = toParse.length();
} }
expression = false;
}
} }
} }
} }