internal void CalculateDerivative() { input = new AntlrInputStream(this.Payload); lexer = new ShapPangLexer(input); tokens = new CommonTokenStream(lexer); parser = new ShapPangParser(tokens); visitor = new ShapExecutionVisitor(this, new ParsingContext() { ElementScope = this.Element }); parser.AddErrorListener(new ShapPangErrorListener()); ShapPangParser.DerivationdeclarationContext context = parser.derivationdeclaration(); visitor.VisitDerivationdeclaration(context); Calculated = true; }
/// <summary> /// Installs this scenario's markup. This will inflate the list of givens, elements and available /// derivatives. /// </summary> /// <param name="markup">The calculation markup to be used in this scenario.</param> public void InstallMarkup(string markup) { parseContext.Scenario = this; Markup = markup; input = new AntlrInputStream(markup); lexer = new ShapPangLexer(input); tokens = new CommonTokenStream(lexer); parser = new ShapPangParser(tokens); visitor = new ShapDiscoveryVisitor(parseContext); parser.AddErrorListener(new ShapPangErrorListener()); ShapPangParser.CompileUnitContext context = parser.compileUnit(); if (parser.NumberOfSyntaxErrors != 0) { throw new Exception("Parsing failed"); } visitor.VisitCompileUnit(context); }
/// <summary> /// Installs this scenario's markup. This will inflate the list of givens, elements and available /// derivatives. /// </summary> /// <param name="markup">The calculation markup to be used in this scenario.</param> public void InstallMarkup(string markup) { parseContext.Scenario = this; Markup = markup; input = new AntlrInputStream(markup); lexer = new ShapPangLexer(input); tokens = new CommonTokenStream(lexer); parser = new ShapPangParser(tokens); visitor = new ShapDiscoveryVisitor(parseContext); parser.AddErrorListener(new ShapPangErrorListener()); ShapPangParser.CompileUnitContext context = parser.compileUnit(); if (parser.NumberOfSyntaxErrors != 0) throw new Exception("Parsing failed"); visitor.VisitCompileUnit(context); }