本文整理汇总了C#中Match.Find方法的典型用法代码示例。如果您正苦于以下问题:C# Match.Find方法的具体用法?C# Match.Find怎么用?C# Match.Find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Match
的用法示例。
在下文中一共展示了Match.Find方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SingleDefinition
Parser SingleDefinition(Match match, bool isTerminal)
{
var terms = match.Find("term").ToArray();
if (terms.Length == 1)
return Term(terms[0], isTerminal);
else
{
var sequence = new SequenceParser(terms.Select(r => Term(r, isTerminal)));
if (!isTerminal)
sequence.Separator = separator;
return sequence;
}
}
示例2: DefinitionList
Parser DefinitionList(Match match, bool isTerminal)
{
var definitions = match.Find("single definition").ToList();
if (definitions.Count == 1)
return SingleDefinition(definitions[0], isTerminal);
if (definitions.Count == 0)
return null;
return new AlternativeParser(definitions.Select(r => SingleDefinition(r, isTerminal)));
}
示例3: Transform
public void Transform(Match match, MarkdownReplacementArgs args)
{
var reference = new ReferenceSection();
foreach (var refMatch in match.Find(reference.Name))
{
reference.AddReference(refMatch, args);
}
var count = match.Matches.Count;
for (int i = 0; i < count; i++)
{
var section = match.Matches[i];
var replacement = replacements.GetReplacement(section.Name);
replacement.Transform(section, args);
}
}
示例4: DefinitionList
Parser DefinitionList(Match match, bool isTerminal)
{
var definitions = match.Find("single definition").ToArray();
if (definitions.Length == 1)
return SingleDefinition(definitions[0], isTerminal);
else
return new AlternativeParser(definitions.Select(r => SingleDefinition(r, isTerminal)));
}
示例5: Sequence
Parser Sequence(Match m, string innerName, Func<Match, Parser> inner, bool addWhitespace = false)
{
var parsers = m.Find(innerName).Select(inner).ToArray();
if (addWhitespace || parsers.Length > 1)
{
var sep = definition.Separator;
var seq = new SequenceParser(parsers) { Separator = sep };
if (addWhitespace && sep != null)
{
seq.Items.Insert(0, sep);
seq.Items.Add(sep);
}
return seq;
}
return parsers.FirstOrDefault();
}
示例6: Alternative
static Parser Alternative(Match m, string innerName, Func<Match, Parser> inner)
{
var parsers = m.Find(innerName).Select(inner).ToArray();
if (parsers.Length > 1)
return new AlternativeParser(parsers);
return parsers.FirstOrDefault();
}