From be6854ec89c336722ee0bf9ec8df8024ec62a860 Mon Sep 17 00:00:00 2001 From: Michael Langowski Date: Sun, 15 Sep 2024 17:32:03 +0200 Subject: [PATCH] bugfix: permit enum directives in modules --- .../tuwien/kr/alpha/core/parser/ParseTreeVisitor.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/alpha-core/src/main/java/at/ac/tuwien/kr/alpha/core/parser/ParseTreeVisitor.java b/alpha-core/src/main/java/at/ac/tuwien/kr/alpha/core/parser/ParseTreeVisitor.java index a28df0d9f..0fc248b81 100644 --- a/alpha-core/src/main/java/at/ac/tuwien/kr/alpha/core/parser/ParseTreeVisitor.java +++ b/alpha-core/src/main/java/at/ac/tuwien/kr/alpha/core/parser/ParseTreeVisitor.java @@ -71,7 +71,7 @@ public class ParseTreeVisitor extends ASPCore2BaseVisitor { private final Map externals; private final boolean acceptVariables; - private InlineDirectives inlineDirectives; + //private InlineDirectives inlineDirectives; /* * Since verifiers for tests are ASP programs in themselves, we need to parse nested programs. @@ -156,10 +156,11 @@ public InputProgram visitProgram(ASPCore2Parser.ProgramContext ctx) { if (ctx.statements() == null) { return Programs.emptyProgram(); } - inlineDirectives = Programs.newInlineDirectives(); + + //inlineDirectives = Programs.newInlineDirectives(); currentLevelProgramBuilder = Programs.builder(); visitStatements(ctx.statements()); - currentLevelProgramBuilder.addInlineDirectives(inlineDirectives); + //currentLevelProgramBuilder.addInlineDirectives(inlineDirectives); return currentLevelProgramBuilder.build(); } @@ -302,7 +303,9 @@ public List visitNaf_literals(ASPCore2Parser.Naf_literalsContext ctx) { @Override public Object visitDirective_enumeration(ASPCore2Parser.Directive_enumerationContext ctx) { // directive_enumeration : DIRECTIVE_ENUM id DOT; - inlineDirectives.addDirective(InlineDirectives.DIRECTIVE.enum_predicate_is, visitId(ctx.id())); + InlineDirectives directives = Programs.newInlineDirectives(); + directives.addDirective(InlineDirectives.DIRECTIVE.enum_predicate_is, visitId(ctx.id())); + currentLevelProgramBuilder.addInlineDirectives(directives); return null; }