public static void Parse(IDatalogDataCollection minimalModels, string atomsList, bool two_stageParsing) { CommonTokenStream tokens = new CommonTokenStream(new IDLVLexer(CharStreams.fromString(atomsList))); IDLVParser parser = new IDLVParser(tokens); IDLVParserBaseVisitorImplementation visitor = new IDLVParserBaseVisitorImplementation(minimalModels); if (!two_stageParsing) { visitor.Visit(parser.output()); return; } parser.Interpreter.PredictionMode = PredictionMode.SLL; parser.RemoveErrorListeners(); parser.ErrorHandler = new BailErrorStrategy(); try { visitor.Visit(parser.output()); } catch (SystemException exception) { if (exception.GetBaseException() is RecognitionException) { tokens.Seek(0); parser.AddErrorListener(ConsoleErrorListener <object> .Instance); parser.ErrorHandler = new DefaultErrorStrategy(); parser.Interpreter.PredictionMode = PredictionMode.LL; visitor.Visit(parser.output()); } } }
private IDLVParserBaseVisitorImplementation(IDatalogDataCollection models) { this.models = models; this.modelCurrentlyBeingVisited = null; }
public static void ParseIDLV(IDatalogDataCollection minimalModels, string atomsList, bool two_stageParsing) { IDLVParserBaseVisitorImplementation.Parse(minimalModels, atomsList, two_stageParsing); }