public override IEnumerable <RegexMatch> SimpleMatchings(StringPointer str, MatingContext context) { foreach (var match in _content.HeadMatches(str, context)) { yield return(new CompositeMatch(this, str, match)); } }
public override IEnumerable <RegexMatch> SimpleMatchings(StringPointer str, MatingContext context) { if (str.Length > 0 && _content.All(c => c.HeadMatch(str, context) == null)) { yield return(new AtomicMatch(this, str, 1)); } }
public override IEnumerable <RegexMatch> SimpleMatchings(StringPointer str, MatingContext context) { if (str.Pointer == 0) { yield return(new PositionMatch(this, str)); } }
public override IEnumerable <RegexMatch> SimpleMatchings(StringPointer str, MatingContext context) { if (str.Value().Length > 0) { yield return(new AtomicMatch(this, str, 1)); } }
public override IEnumerable <RegexMatch> SimpleMatchings(StringPointer str, MatingContext context) { foreach (var match in context.NamedRegexes[_targetLabel].SimpleMatchings(str, context)) { yield return(new CompositeMatch(this, str, match)); } }
public override IEnumerable <RegexMatch> SimpleMatchings(StringPointer str, MatingContext context) { foreach (var match in _arg.SimpleMatchings(str, context)) { yield break; } yield return(new PositionMatch(this, str)); }
public override IEnumerable <RegexMatch> SimpleMatchings(StringPointer str, MatingContext context) { //NamedはMatchTreeに影響しない if (!context.NamedRegexes.ContainsKey(_label)) { context.NamedRegexes.Add(_label, this); } return(_content.HeadMatches(str, context)); }
public override IEnumerable <RegexMatch> SimpleMatchings(StringPointer str, MatingContext context) { var matches = _content.HeadMatches(str, context).ToList(); for (int i = 0; i < matches.Count; i++) { yield return(matches[matches.Count - 1 - i]); } }
public override IEnumerable <RegexMatch> SimpleMatchings(StringPointer str, MatingContext context) { var match = _target.HeadMatch(str, context); if (match != null) { yield return(new CompositeMatch(this, str, match)); } yield return(new PositionMatch(this, str)); }
public override IEnumerable <RegexMatch> SimpleMatchings(StringPointer str, MatingContext context) { foreach (var targetMatch in _target.SimpleMatchings(str, context)) { var nextPos = str.RawStr.Substring(0, str.Pointer); //ここより前の文字列 var conditionMatch = _condition.TailMatches((StringPointer)nextPos, context).FirstOrDefault(); //条件の直前へのマッチ if (conditionMatch != null) { yield return(new CompositeMatch(this, str, targetMatch)); } } }
public override IEnumerable <RegexMatch> SimpleMatchings(StringPointer str, MatingContext context) { foreach (var targetMatch in _target.SimpleMatchings(str, context)) { var nextPos = str.SubString(targetMatch.Length); var conditionMatch = _condition.SimpleMatchings(nextPos, context).FirstOrDefault(); if (conditionMatch == null) { yield return(new CompositeMatch(this, str, targetMatch)); } } }
public override IEnumerable <RegexMatch> SimpleMatchings(StringPointer str, MatingContext context) { foreach (var selfMatch in _target.HeadMatches(str, context)) { var next = str.SubString(selfMatch.Length); foreach (var nextMatch in SimpleMatchings(next, context)) { var list = new List <RegexMatch>(); list.Add(selfMatch); var composite = (CompositeMatch)nextMatch; list.AddRange(composite.Matches); yield return(new CompositeMatch(this, str, list.ToArray())); } yield return(new CompositeMatch(this, str, selfMatch)); } }
private IEnumerable <RegexMatch> Sm(StringPointer str, MatingContext context, int minCount, int maxCount) { if (maxCount == 0) { yield return(new PositionMatch(this, str)); yield break; } foreach (var selfMatch in _target.HeadMatches(str, context)) { var next = str.SubString(selfMatch.Length); foreach (var targetMatch in Sm(next, context, minCount - 1, maxCount - 1)) { var composite = targetMatch as CompositeMatch; var list = new List <RegexMatch>(); list.Add(selfMatch); if (composite != null) { list.AddRange(composite.Matches); } else { break; } yield return(new CompositeMatch(this, str, list.ToArray())); } if (minCount <= 1) { yield return(new CompositeMatch(this, str, selfMatch)); } } if (minCount <= 0) { yield return(new PositionMatch(this, str)); } }
public override IEnumerable <RegexMatch> SimpleMatchings(StringPointer str, MatingContext context)//TODO:fix { foreach (var selfMatch in _target.HeadMatches(str, context)) { var next = str.SubString(selfMatch.Length); foreach (var targetMatch in SimpleMatchings(next, context)) { var composite = targetMatch as CompositeMatch; var list = new List <RegexMatch>(); list.Add(selfMatch); if (composite != null) { list.AddRange(composite.Matches); } else { break; } yield return(new CompositeMatch(this, str, list.ToArray())); } yield return(new CompositeMatch(this, str, selfMatch)); } yield return(new PositionMatch(this, str)); }
public override IEnumerable <RegexMatch> SimpleMatchings(StringPointer str, MatingContext context) { return(Sm(str, context, _minCount, _maxCount)); }
public override IEnumerable <RegexMatch> SimpleMatchings(StringPointer str, MatingContext context) { throw new NotImplementedException(); }
public sealed override IEnumerable <RegexMatch> SimpleMatchings(StringPointer str, MatingContext context) { if (str.Length == 0) { yield break; } var sub = str.Value()[0]; if (CheckChar(sub)) { yield return(new AtomicMatch(this, str, 1)); } }