From f6a2ac186bd7bdcd2a8cb6ddb845b4ba957344bd Mon Sep 17 00:00:00 2001 From: Alexander Milster Date: Fri, 18 Oct 2024 13:05:29 +0200 Subject: [PATCH 1/2] Small fix for the cpp semantics. Probably doesn't make a difference. --- languages/cpp/src/main/java/de/jplag/cpp/CPPListener.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/languages/cpp/src/main/java/de/jplag/cpp/CPPListener.java b/languages/cpp/src/main/java/de/jplag/cpp/CPPListener.java index 6bfa81c098..e2499d9644 100644 --- a/languages/cpp/src/main/java/de/jplag/cpp/CPPListener.java +++ b/languages/cpp/src/main/java/de/jplag/cpp/CPPListener.java @@ -100,10 +100,10 @@ class CPPListener extends AbstractAntlrListener { CPPListener() { - visit(ClassSpecifierContext.class, rule -> rule.classHead().Union() != null).map(UNION_BEGIN, UNION_END).withSemantics(CodeSemantics::new); + visit(ClassSpecifierContext.class, rule -> rule.classHead().Union() != null).map(UNION_BEGIN, UNION_END).addClassScope().withSemantics(CodeSemantics::createControl); mapClass(ClassKeyContext::Class, CLASS_BEGIN, CLASS_END); mapClass(ClassKeyContext::Struct, STRUCT_BEGIN, STRUCT_END); // structs are basically just classes - visit(EnumSpecifierContext.class).map(ENUM_BEGIN, ENUM_END).withSemantics(CodeSemantics::createControl); + visit(EnumSpecifierContext.class).map(ENUM_BEGIN, ENUM_END).addClassScope().withSemantics(CodeSemantics::createControl); visit(FunctionDefinitionContext.class).map(FUNCTION_BEGIN, FUNCTION_END).addLocalScope().withSemantics(CodeSemantics::createControl); From ea67fa4756a3d7de4821f4e9f7ac226650410a48 Mon Sep 17 00:00:00 2001 From: Alexander Milster Date: Fri, 18 Oct 2024 13:07:12 +0200 Subject: [PATCH 2/2] Spotless --- languages/cpp/src/main/java/de/jplag/cpp/CPPListener.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/languages/cpp/src/main/java/de/jplag/cpp/CPPListener.java b/languages/cpp/src/main/java/de/jplag/cpp/CPPListener.java index e2499d9644..9cea3eed7f 100644 --- a/languages/cpp/src/main/java/de/jplag/cpp/CPPListener.java +++ b/languages/cpp/src/main/java/de/jplag/cpp/CPPListener.java @@ -100,7 +100,8 @@ class CPPListener extends AbstractAntlrListener { CPPListener() { - visit(ClassSpecifierContext.class, rule -> rule.classHead().Union() != null).map(UNION_BEGIN, UNION_END).addClassScope().withSemantics(CodeSemantics::createControl); + visit(ClassSpecifierContext.class, rule -> rule.classHead().Union() != null).map(UNION_BEGIN, UNION_END).addClassScope() + .withSemantics(CodeSemantics::createControl); mapClass(ClassKeyContext::Class, CLASS_BEGIN, CLASS_END); mapClass(ClassKeyContext::Struct, STRUCT_BEGIN, STRUCT_END); // structs are basically just classes visit(EnumSpecifierContext.class).map(ENUM_BEGIN, ENUM_END).addClassScope().withSemantics(CodeSemantics::createControl);