public static Parser CreateParser(this XElement block, Context ctx) { var lexer = new MapReduce.Lexer.Lexer(block); var results = lexer.Lex(); TokenBuffer buffer = new TokenBuffer(results); ctx.TokenBuffer = buffer; Parser parser = new Parser(ctx); return parser; }
public static Parser CreateParser(this string xml, string block) { XDocument _xDoc = _xDoc = XDocument.Parse(xml); XElement source = _xDoc.Element(block); var lexer = new MapReduce.Lexer.Lexer(source); var results = lexer.Lex().ToList(); TokenBuffer buffer = new TokenBuffer(results); MapReduce.Parser.Context ctx = new MapReduce.Parser.Context(buffer); Parser parser = new Parser(ctx); return parser; }