summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2026-07-11 17:11:54 +0100
committerMichael Williamson <mike@zwobble.org>2026-07-11 17:11:54 +0100
commiteb4ce8b7ebceac4bbf68b779b9f6d6f4439ddbba (patch)
treeb90df6f69f2a8b25f4d43e525b6351e0c3e6b4e4 /src
parent10317b0c2841591a85530a5c4c38cac0c4bf5fe8 (diff)
Add switch statement to Java AST
Diffstat (limited to 'src')
-rw-r--r--src/main/java/org/zwobble/hobgoblin/compiler/output/lang/java/JavaWriter.java28
-rw-r--r--src/main/java/org/zwobble/hobgoblin/compiler/output/lang/java/ast/JavaBlockStatement.java2
-rw-r--r--src/main/java/org/zwobble/hobgoblin/compiler/output/lang/java/ast/JavaSwitchRule.java44
-rw-r--r--src/main/java/org/zwobble/hobgoblin/compiler/output/lang/java/ast/JavaSwitchStatement.java48
-rw-r--r--src/test/java/org/zwobble/hobgoblin/compiler/output/lang/java/JavaWriterTests.java37
-rw-r--r--src/test/java/org/zwobble/hobgoblin/compiler/output/lang/java/ast/JavaSwitchRuleMatcher.java51
-rw-r--r--src/test/java/org/zwobble/hobgoblin/compiler/output/lang/java/ast/JavaSwitchStatementMatcher.java45
7 files changed, 254 insertions, 1 deletions
diff --git a/src/main/java/org/zwobble/hobgoblin/compiler/output/lang/java/JavaWriter.java b/src/main/java/org/zwobble/hobgoblin/compiler/output/lang/java/JavaWriter.java
index 0b24366..893e30b 100644
--- a/src/main/java/org/zwobble/hobgoblin/compiler/output/lang/java/JavaWriter.java
+++ b/src/main/java/org/zwobble/hobgoblin/compiler/output/lang/java/JavaWriter.java
@@ -419,6 +419,10 @@ public class JavaWriter implements AutoCloseable {
case JavaReturn returnStatement -> {
writeReturnStatement(returnStatement);
}
+
+ case JavaSwitchStatement switchStatement -> {
+ writeSwitchStatement(switchStatement);
+ }
}
}
@@ -530,6 +534,30 @@ public class JavaWriter implements AutoCloseable {
this.writer.write(";");
}
+ private void writeSwitchStatement(JavaSwitchStatement switchStatement) throws IOException {
+ this.writer.write("switch (");
+ this.writeTopLevelExpression(switchStatement.selectorExpression());
+ this.writer.write(") {");
+ this.writer.indent();
+ for (var rule : switchStatement.rules()) {
+ this.writer.newLine();
+ this.writer.write("case ");
+ this.writeTypeRef(rule.type());
+ this.writer.write(" ");
+ this.writeIdentifier(rule.variableName());
+ this.writer.write(" -> {");
+ this.writer.indent();
+ this.writer.newLine();
+ this.writeBlock(rule.body());
+ this.writer.dedent();
+ this.writer.newLine();
+ this.writer.write("}");
+ }
+ this.writer.dedent();
+ this.writer.newLine();
+ this.writer.write("}");
+ }
+
// == Expressions ==
void writeTopLevelExpression(JavaExpression expression) throws IOException {
diff --git a/src/main/java/org/zwobble/hobgoblin/compiler/output/lang/java/ast/JavaBlockStatement.java b/src/main/java/org/zwobble/hobgoblin/compiler/output/lang/java/ast/JavaBlockStatement.java
index dd5add4..6f6096d 100644
--- a/src/main/java/org/zwobble/hobgoblin/compiler/output/lang/java/ast/JavaBlockStatement.java
+++ b/src/main/java/org/zwobble/hobgoblin/compiler/output/lang/java/ast/JavaBlockStatement.java
@@ -5,7 +5,7 @@ package org.zwobble.hobgoblin.compiler.output.lang.java.ast;
// Custom area start: org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaBlockStatement imports
// Custom area end: org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaBlockStatement imports
-public sealed interface JavaBlockStatement permits org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaBasicForStatement, org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaEnhancedForStatement, org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaExpressionStatement, org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaIfStatement, org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaLocalVariableDeclaration, org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaReturn {
+public sealed interface JavaBlockStatement permits org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaBasicForStatement, org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaEnhancedForStatement, org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaExpressionStatement, org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaIfStatement, org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaLocalVariableDeclaration, org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaReturn, org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaSwitchStatement {
public interface Builder {
public org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaBlockStatement build();
diff --git a/src/main/java/org/zwobble/hobgoblin/compiler/output/lang/java/ast/JavaSwitchRule.java b/src/main/java/org/zwobble/hobgoblin/compiler/output/lang/java/ast/JavaSwitchRule.java
new file mode 100644
index 0000000..7d4b3c2
--- /dev/null
+++ b/src/main/java/org/zwobble/hobgoblin/compiler/output/lang/java/ast/JavaSwitchRule.java
@@ -0,0 +1,44 @@
+// Generated by hobgoblin.
+
+package org.zwobble.hobgoblin.compiler.output.lang.java.ast;
+
+// Custom area start: org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaSwitchRule imports
+// Custom area end: org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaSwitchRule imports
+
+public record JavaSwitchRule(org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaTypeRef type, org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaIdentifier variableName, org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaBlock body) {
+ public static org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaSwitchRule.Builder arbitrary() {
+ return new org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaSwitchRule.Builder(org.zwobble.hobgoblin.compiler.output.lang.java.ast.HobgoblinNativeAst.arbitraryJavaTypeRef(), org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaIdentifier.arbitrary().build(), org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaBlock.arbitrary().build());
+ }
+
+ public record Builder(org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaTypeRef type, org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaIdentifier variableName, org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaBlock body) {
+ public org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaSwitchRule build() {
+ return new org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaSwitchRule(type, variableName, body);
+ }
+
+ public org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaSwitchRule.Builder withType(org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaTypeRef type) {
+ return new org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaSwitchRule.Builder(type, variableName, body);
+ }
+
+ public org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaSwitchRule.Builder withVariableName(org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaIdentifier variableName) {
+ return new org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaSwitchRule.Builder(type, variableName, body);
+ }
+
+ public org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaSwitchRule.Builder withVariableName(org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaIdentifier.Builder variableName) {
+ return new org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaSwitchRule.Builder(type, variableName.build(), body);
+ }
+
+ public org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaSwitchRule.Builder withBody(org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaBlock body) {
+ return new org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaSwitchRule.Builder(type, variableName, body);
+ }
+
+ public org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaSwitchRule.Builder withBody(org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaBlock.Builder body) {
+ return new org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaSwitchRule.Builder(type, variableName, body.build());
+ }
+
+ // Custom area start: org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaSwitchRule.Builder body
+ // Custom area end: org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaSwitchRule.Builder body
+ }
+
+ // Custom area start: org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaSwitchRule body
+ // Custom area end: org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaSwitchRule body
+}
diff --git a/src/main/java/org/zwobble/hobgoblin/compiler/output/lang/java/ast/JavaSwitchStatement.java b/src/main/java/org/zwobble/hobgoblin/compiler/output/lang/java/ast/JavaSwitchStatement.java
new file mode 100644
index 0000000..62575e2
--- /dev/null
+++ b/src/main/java/org/zwobble/hobgoblin/compiler/output/lang/java/ast/JavaSwitchStatement.java
@@ -0,0 +1,48 @@
+// Generated by hobgoblin.
+
+package org.zwobble.hobgoblin.compiler.output.lang.java.ast;
+
+// Custom area start: org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaSwitchStatement imports
+// Custom area end: org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaSwitchStatement imports
+
+public record JavaSwitchStatement(org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaExpression selectorExpression, java.util.List<org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaSwitchRule> rules) implements org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaBlockStatement {
+ public static org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaSwitchStatement.Builder arbitrary() {
+ return new org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaSwitchStatement.Builder(org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaBooleanLiteral.arbitrary().build(), java.util.List.of());
+ }
+
+ public record Builder(org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaExpression selectorExpression, java.util.List<org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaSwitchRule> rules) implements org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaBlockStatement.Builder {
+ public org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaSwitchStatement build() {
+ return new org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaSwitchStatement(selectorExpression, rules);
+ }
+
+ public org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaSwitchStatement.Builder withSelectorExpression(org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaExpression selectorExpression) {
+ return new org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaSwitchStatement.Builder(selectorExpression, rules);
+ }
+
+ public org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaSwitchStatement.Builder withSelectorExpression(org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaExpression.Builder selectorExpression) {
+ return new org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaSwitchStatement.Builder(selectorExpression.build(), rules);
+ }
+
+ public org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaSwitchStatement.Builder withRules(java.util.List<org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaSwitchRule> rules) {
+ return new org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaSwitchStatement.Builder(selectorExpression, rules);
+ }
+
+ public org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaSwitchStatement.Builder addRule(org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaSwitchRule rule) {
+ var rules = new java.util.ArrayList<org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaSwitchRule>(this.rules);
+ rules.add(rule);
+ return new org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaSwitchStatement.Builder(selectorExpression, rules);
+ }
+
+ public org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaSwitchStatement.Builder addRule(org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaSwitchRule.Builder rule) {
+ var rules = new java.util.ArrayList<org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaSwitchRule>(this.rules);
+ rules.add(rule.build());
+ return new org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaSwitchStatement.Builder(selectorExpression, rules);
+ }
+
+ // Custom area start: org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaSwitchStatement.Builder body
+ // Custom area end: org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaSwitchStatement.Builder body
+ }
+
+ // Custom area start: org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaSwitchStatement body
+ // Custom area end: org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaSwitchStatement body
+}
diff --git a/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/java/JavaWriterTests.java b/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/java/JavaWriterTests.java
index b26b8f5..eab48ae 100644
--- a/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/java/JavaWriterTests.java
+++ b/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/java/JavaWriterTests.java
@@ -1070,6 +1070,43 @@ public class JavaWriterTests {
assertThat(string, equalTo("return 42;"));
}
+ // === Switch statements ===
+
+ @Test
+ public void switchStatement() throws IOException {
+ var java = new JavaSwitchStatement(
+ new JavaRef(JavaIdentifier.of("x")),
+ List.of(
+ new JavaSwitchRule(
+ JavaTypeRef.topLevel(JavaPackageName.of("org", "example"), JavaIdentifier.of("A")),
+ JavaIdentifier.of("a"),
+ new JavaBlock(List.of(
+ new JavaReturn(new JavaIntegerLiteral(0))
+ ))
+ ),
+ new JavaSwitchRule(
+ JavaTypeRef.topLevel(JavaPackageName.of("org", "example"), JavaIdentifier.of("B")),
+ JavaIdentifier.of("b"),
+ new JavaBlock(List.of(
+ new JavaReturn(new JavaIntegerLiteral(1))
+ ))
+ )
+ )
+ );
+
+ var string = write(writer -> writer.writeBlockStatement(java));
+
+ assertThat(string, equalTo("""
+ switch (x) {
+ case org.example.A a -> {
+ return 0;
+ }
+ case org.example.B b -> {
+ return 1;
+ }
+ }"""));
+ }
+
// == Expressions ==
// === Binary operations ===
diff --git a/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/java/ast/JavaSwitchRuleMatcher.java b/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/java/ast/JavaSwitchRuleMatcher.java
new file mode 100644
index 0000000..fc6f33d
--- /dev/null
+++ b/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/java/ast/JavaSwitchRuleMatcher.java
@@ -0,0 +1,51 @@
+// Generated by hobgoblin.
+
+package org.zwobble.hobgoblin.compiler.output.lang.java.ast;
+
+// Custom area start: org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaSwitchRuleMatcher imports
+// Custom area end: org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaSwitchRuleMatcher imports
+
+public class JavaSwitchRuleMatcher implements org.zwobble.precisely.Matcher<java.lang.Object> {
+ public static org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaSwitchRuleMatcher isJavaSwitchRule() {
+ return new org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaSwitchRuleMatcher(java.util.List.of());
+ }
+
+ private final java.util.List<org.zwobble.precisely.Matcher<? super org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaSwitchRule>> submatchers;
+
+ private JavaSwitchRuleMatcher(java.util.List<org.zwobble.precisely.Matcher<? super org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaSwitchRule>> submatchers) {
+ this.submatchers = submatchers;
+ }
+
+ public org.zwobble.precisely.MatchResult match(java.lang.Object actual) {
+ return this.toMatcher().match(actual);
+ }
+
+ public org.zwobble.precisely.TextTree describe() {
+ return this.toMatcher().describe();
+ }
+
+ private org.zwobble.precisely.Matcher<java.lang.Object> toMatcher() {
+ return org.zwobble.precisely.Matchers.instanceOf(org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaSwitchRule.class, this.submatchers);
+ }
+
+ public org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaSwitchRuleMatcher withType(org.zwobble.precisely.Matcher<? super org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaTypeRef> type) {
+ var submatchers = new java.util.ArrayList<org.zwobble.precisely.Matcher<? super org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaSwitchRule>>(this.submatchers);
+ submatchers.add(org.zwobble.precisely.Matchers.has("type", org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaSwitchRule::type, type));
+ return new org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaSwitchRuleMatcher(submatchers);
+ }
+
+ public org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaSwitchRuleMatcher withVariableName(org.zwobble.precisely.Matcher<? super org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaIdentifier> variableName) {
+ var submatchers = new java.util.ArrayList<org.zwobble.precisely.Matcher<? super org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaSwitchRule>>(this.submatchers);
+ submatchers.add(org.zwobble.precisely.Matchers.has("variableName", org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaSwitchRule::variableName, variableName));
+ return new org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaSwitchRuleMatcher(submatchers);
+ }
+
+ public org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaSwitchRuleMatcher withBody(org.zwobble.precisely.Matcher<? super org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaBlock> body) {
+ var submatchers = new java.util.ArrayList<org.zwobble.precisely.Matcher<? super org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaSwitchRule>>(this.submatchers);
+ submatchers.add(org.zwobble.precisely.Matchers.has("body", org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaSwitchRule::body, body));
+ return new org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaSwitchRuleMatcher(submatchers);
+ }
+
+ // Custom area start: org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaSwitchRuleMatcher body
+ // Custom area end: org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaSwitchRuleMatcher body
+}
diff --git a/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/java/ast/JavaSwitchStatementMatcher.java b/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/java/ast/JavaSwitchStatementMatcher.java
new file mode 100644
index 0000000..5cf7d28
--- /dev/null
+++ b/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/java/ast/JavaSwitchStatementMatcher.java
@@ -0,0 +1,45 @@
+// Generated by hobgoblin.
+
+package org.zwobble.hobgoblin.compiler.output.lang.java.ast;
+
+// Custom area start: org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaSwitchStatementMatcher imports
+// Custom area end: org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaSwitchStatementMatcher imports
+
+public class JavaSwitchStatementMatcher implements org.zwobble.precisely.Matcher<java.lang.Object> {
+ public static org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaSwitchStatementMatcher isJavaSwitchStatement() {
+ return new org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaSwitchStatementMatcher(java.util.List.of());
+ }
+
+ private final java.util.List<org.zwobble.precisely.Matcher<? super org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaSwitchStatement>> submatchers;
+
+ private JavaSwitchStatementMatcher(java.util.List<org.zwobble.precisely.Matcher<? super org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaSwitchStatement>> submatchers) {
+ this.submatchers = submatchers;
+ }
+
+ public org.zwobble.precisely.MatchResult match(java.lang.Object actual) {
+ return this.toMatcher().match(actual);
+ }
+
+ public org.zwobble.precisely.TextTree describe() {
+ return this.toMatcher().describe();
+ }
+
+ private org.zwobble.precisely.Matcher<java.lang.Object> toMatcher() {
+ return org.zwobble.precisely.Matchers.instanceOf(org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaSwitchStatement.class, this.submatchers);
+ }
+
+ public org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaSwitchStatementMatcher withSelectorExpression(org.zwobble.precisely.Matcher<? super org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaExpression> selectorExpression) {
+ var submatchers = new java.util.ArrayList<org.zwobble.precisely.Matcher<? super org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaSwitchStatement>>(this.submatchers);
+ submatchers.add(org.zwobble.precisely.Matchers.has("selectorExpression", org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaSwitchStatement::selectorExpression, selectorExpression));
+ return new org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaSwitchStatementMatcher(submatchers);
+ }
+
+ public org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaSwitchStatementMatcher withRules(org.zwobble.precisely.Matcher<? super java.util.List<org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaSwitchRule>> rules) {
+ var submatchers = new java.util.ArrayList<org.zwobble.precisely.Matcher<? super org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaSwitchStatement>>(this.submatchers);
+ submatchers.add(org.zwobble.precisely.Matchers.has("rules", org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaSwitchStatement::rules, rules));
+ return new org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaSwitchStatementMatcher(submatchers);
+ }
+
+ // Custom area start: org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaSwitchStatementMatcher body
+ // Custom area end: org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaSwitchStatementMatcher body
+}