public PGNException(string message, PGNToken token, ParserSource source = ParserSource.Parser) : base(message) { SourceComponent = source; Index = token.Index; PgnToken = token; }
public PGNException(string message, PGNToken token, ParserSource source, Exception innerException) : base(message, innerException) { SourceComponent = source; Index = token.Index; PgnToken = token; }
public PGNException(string message, int index, string token, ParserSource source, Exception innerException) : base(message, innerException) { SourceComponent = source; Index = index; Token = token; }
public ActionResult CreateParsingSource(ParserSource source) { if (db.Categories.Any(cat => cat.Id == source.CategoryId) && db.Markets.Any(m => m.Id == source.MarketId) && !db.ParserSources.Any(s => s.Url == source.Url)) { db.ParserSources.Add(source); db.SaveChanges(); return(RedirectToAction("Sources")); } ViewBag.ErrorMessage = "You typed wrong ids or URL!"; return(View("Error")); }
public double Calculate(string input) { Token EofToken = new Token { Type = TT.EOF }; var lexer = new CalculatorLexer(input); Src = new ParserSource <Token>(lexer, EofToken, lexer.Src.SourceFile) { TokenTypeToString = tt => ((TT)tt).ToString() }; var result = ExprSequence(); Src.Match((int)TT.EOF); return(result); }
public double Calculate(string input) { var lexer = new CalculatorLexer(input); _tokens.Clear(); Token t; while (((t = lexer.NextToken()).Type != TT.EOF)) { if ((t.Type != TT.Space)) { _tokens.Add(t); } } _src = new ParserSource <Token>(_tokens, new Token { Type = TT.EOF }) { TokenTypeToString = TokenTypeToString }; return(Expr()); }
private static async Task <IEnumerable <Product> > ParseAsync(ParserSource source) { // Download web request string url = source.Url; string responceBody = await(new HttpDownloader(url, null, null).GetPageAsync()); // Create an appropriate parser IClassParser <ParserInput, Product> parser; if (source.ParserId == 0) { parser = new HTMLParser <ParserInput, Product>(responceBody); } else { parser = new JsonParser <ParserInput, Product>(responceBody); } // Create an input ParserInput input = new ParserInput(source, source.Market); return(parser.Parse(input)); }
public ActionResult CreateParserSource(ParserSource parserSource) { try { if (ModelState.IsValid) { parserSourceRepository.Add(parserSource); marketRepository.Save(); return(RedirectToAction("AdminPanel")); } } catch (DataException) { //log } SelectList markets = new SelectList(marketRepository.GetAll(), "Id", "Name"); SelectList categories = new SelectList(categoryRepository.GetAll(), "Id", "Name"); ViewBag.Markets = markets; ViewBag.Categories = categories; return(View(parserSource)); }