예제 #1
0
 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;
 }
예제 #2
0
 /// <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);
 }
예제 #3
0
 /// <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);
 }