Ejemplo n.º 1
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());
      }
    }
Ejemplo n.º 2
0
 public abstract IEnumerable<SourceSegment> Scan(ParsingContext context, TextSegment segment);
Ejemplo n.º 3
0
 public override IEnumerable<SourceSegment> Scan(ParsingContext context, TextSegment segment) {
   return null;
 }
Ejemplo n.º 4
0
 public virtual IEnumerable<SourceSegment> Scan(ParsingContext context, TextSegment segment){
   var token = TryMatch(context, segment);
   if (token != null) {
     yield return token;
   }
 }
Ejemplo n.º 5
0
    }//method

    #endregion

    private List<Terminal> FindTermsByPrefix(TextSegment segment) {
      return null; 
    }
Ejemplo n.º 6
0
 public IEnumerable<SourceSegment> Scan(ParsingContext context, TextSegment segment) {
   return null; 
 }//method