Пример #1
0
 //Default constructor, creates default evaluator 
 public ExpressionEvaluator(ExpressionEvaluatorGrammar grammar) {
   Grammar = grammar;
   Language = new LanguageData(Grammar);
   Parser = new Parser(Language);
   Runtime = Grammar.CreateRuntime(Language);
   App = new ScriptApp(Runtime);
 }
Пример #2
0
 //Default constructor, creates default evaluator
 public ExpressionEvaluator(ExpressionEvaluatorGrammar grammar)
 {
     Grammar  = grammar;
     Language = new LanguageData(Grammar);
     Parser   = new Parser(Language);
     Runtime  = Grammar.CreateRuntime(Language);
     App      = new ScriptApp(Runtime);
 }
Пример #3
0
    public void TestNewScanner() {
      var grammar = new ExpressionEvaluatorGrammar();
      var language = new LanguageData(grammar); 
      var parser = new Parser(language); 
      var ctx = new ParsingContext(parser);
      PrefixBasedScanner scanner = new PrefixBasedScanner(language); 
      var src = @"
# this is comment
""0123"".Substring(1) + ""abcd"".Length + ""456""[1]    # expected '12345'
";
      var srcSegm = new TextSegment(src); 
      var segments = scanner.Scan(ctx, srcSegm).ToList();
      foreach (var segm in segments) {
        Debug.WriteLine(" Segment: " + segm.GetType().Name + ", " + segm.ToString());
      }
    }