public void Initialize(MarkdownGrammar grammar) { this.grammar = grammar; sharedReplacements = GetReplacements().ToArray(); sharedReplacementParser = new ReplacementParser(grammar); sharedReplacementParser.Add(sharedReplacements); replacements = new ReplacementParser(grammar); replacements.Add(sharedReplacements, false); replacements.Add(Terminals.AnyChar); Inner = +replacements; SetError <Parser>(false); }
public ReplacementParser ReplacementsExcept <T>() where T : IMarkdownReplacement { var rep = new ReplacementParser(grammar); rep.Add(sharedReplacements.Where(r => !(r is T)), false); return(rep); }
public MarkdownGrammar() : base("markdown") { EnableMatchEvents = false; indent = new RepeatParser(Terms.indent, 1, 1); prefix = new RepeatParser(Terms.indent, 0, 0); prefixsp = new RepeatParser(Terms.sporht, 0, 0); encoding = new MarkdownEncoding(); encoding.Initialize(this); replacementsOnly = new ReplacementParser(this); replacements = new ReplacementParser(this); var reps = GetReplacements().ToArray(); replacementsOnly.Add(reps, false); replacements.Add(reps, true); replacements.Add(Terminals.AnyChar); this.Inner = -replacements; SetError <Parser>(false); }