Skip to content

Commit

Permalink
bugfix: permit enum directives in modules
Browse files Browse the repository at this point in the history
  • Loading branch information
madmike200590 committed Sep 15, 2024
1 parent 712f263 commit be6854e
Showing 1 changed file with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public class ParseTreeVisitor extends ASPCore2BaseVisitor<Object> {
private final Map<String, PredicateInterpretation> 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.
Expand Down Expand Up @@ -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();
}

Expand Down Expand Up @@ -302,7 +303,9 @@ public List<Literal> 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;
}

Expand Down

0 comments on commit be6854e

Please sign in to comment.