Merge branch '6.0.x'

This commit is contained in:
Sam Brannen 2023-04-25 15:15:45 +02:00
commit b924b7b4c6
1 changed files with 7 additions and 8 deletions

View File

@ -71,8 +71,8 @@ final class ProfilesParser {
}
switch (token) {
case "(" -> {
Profiles contents = parseTokens(expression, tokens, Context.BRACKET);
if (context == Context.INVERT) {
Profiles contents = parseTokens(expression, tokens, Context.PARENTHESIS);
if (context == Context.NEGATE) {
return contents;
}
elements.add(contents);
@ -85,10 +85,10 @@ final class ProfilesParser {
assertWellFormed(expression, operator == null || operator == Operator.OR);
operator = Operator.OR;
}
case "!" -> elements.add(not(parseTokens(expression, tokens, Context.INVERT)));
case "!" -> elements.add(not(parseTokens(expression, tokens, Context.NEGATE)));
case ")" -> {
Profiles merged = merge(expression, elements, operator);
if (context == Context.BRACKET) {
if (context == Context.PARENTHESIS) {
return merged;
}
elements.clear();
@ -97,7 +97,7 @@ final class ProfilesParser {
}
default -> {
Profiles value = equals(token);
if (context == Context.INVERT) {
if (context == Context.NEGATE) {
return value;
}
elements.add(value);
@ -141,10 +141,9 @@ final class ProfilesParser {
}
private enum Operator {AND, OR}
private enum Operator { AND, OR }
private enum Context {NONE, INVERT, BRACKET}
private enum Context { NONE, NEGATE, PARENTHESIS }
private static class ParsedProfiles implements Profiles {