private string Eat(IOverwriteBlockRule parser) { var block = Peek(); if (parser.Parse(block, out var value)) { _position++; return(value); } else { throw new Exception("error!"); } }
private Block Eat(IOverwriteBlockRule parser, out string value) { var block = Peek(); if (block == null) { throw new MarkdownFragmentsException($"Expect {parser.TokenName}, but end reached"); } if (parser.Parse(block, out value)) { _position++; return(block); } throw new MarkdownFragmentsException($"Expect {parser.TokenName}", block.Line); }