3 using Antlr4.Runtime.Atn;
13 this.answerSets = answerSets;
18 answerSets.AddAnswerSet();
20 return VisitChildren(context);
25 answerSets.AddAnswerSet();
27 return VisitChildren(context);
30 public override object VisitWitness(DLVParser.WitnessContext context)
32 answerSets.AddAnswerSet();
34 return VisitChildren(context);
39 answerSets.StoreCost(Int32.Parse(context.INTEGER_CONSTANT()[1].GetText()), Int32.Parse(context.INTEGER_CONSTANT()[0].GetText()));
46 answerSets.StoreAtom(context.GetText());
51 public static void Parse(
IASPDataCollection answerSets,
string atomsList,
bool two_stageParsing)
53 CommonTokenStream tokens =
new CommonTokenStream(
new DLVLexer(CharStreams.fromstring(atomsList)));
54 DLVParser parser =
new DLVParser(tokens);
57 if (!two_stageParsing)
59 visitor.Visit(parser.output());
64 parser.Interpreter.PredictionMode = PredictionMode.SLL;
66 parser.RemoveErrorListeners();
68 parser.ErrorHandler =
new BailErrorStrategy();
72 visitor.Visit(parser.output());
74 catch (SystemException exception)
76 if (exception.GetBaseException() is RecognitionException)
79 parser.AddErrorListener(ConsoleErrorListener<object>.Instance);
81 parser.ErrorHandler =
new DefaultErrorStrategy();
82 parser.Interpreter.PredictionMode = PredictionMode.LL;
84 visitor.Visit(parser.output());