public static void AddMatchRule(IMatchRule rule) { if (rule != null) { _matchRules.Add(rule); } }
private static RegexMatch CreateRegexMatch(IMatchRule rule, Capture tagMatch, int index, RegexMatch.TagType tagType) { var regexMatch = new RegexMatch { Type = tagType, Value = tagMatch.Value, Index = index, Rule = rule }; return(regexMatch); }
public virtual void GetNameList(List <string> names, IMatchRule rule) { if (rule == null || rule.IsMatch(this)) { names.Add(this.Name); } if (children != null && children.Count > 0) { foreach (Component child in children) { child.GetNameList(names, rule); } } }
/// <summary> /// 演示用的补充方法:实现迭代器,并且对容器对象实现隐性递归 /// </summary> /// <returns></returns> public virtual IEnumerable <Component> Enumerate(IMatchRule rule) { if ((rule == null) || (rule.IsMatch(this))) { yield return(this); } if ((children != null) && (children.Count > 0)) { foreach (Component child in children) { foreach (Component item in child.Enumerate(rule)) { if ((rule == null) || (rule.IsMatch(item))) { yield return(item); } } } } }
public static void AddMatchRule(IMatchRule rule) { if (rule != null) _matchRules.Add(rule); }
/// <summary> /// Initializes a new instance of the <see cref="T:System.Object"/> class. /// </summary> public PartCheck(int id, string customer, string partType, /*int mode,*/ string valueType, int needSave, int needCheck, IMatchRule matchRule) { _id = id; _customer = customer; _partType = partType; //_mode = mode; _valueType = valueType; _needSave = needSave; _needCheck = needCheck; _matchRule = matchRule; this._tracker.MarkAsAdded(this); }
public virtual IEnumerable <string> GetNameList(IMatchRule rule) { GetNameList(names, rule); return(names); }
internal LexerRule(IMatchRule match, Func <SourceReader, (Token, SourceReader)> action)
internal IPlaceholderTagProperties CreatePlaceholderTagProperties(IPropertiesFactory factory, string tagContent, IMatchRule rule) { var placeholderProps = factory.CreatePlaceholderTagProperties(tagContent); ApplyInlineTagProperties(placeholderProps, rule); placeholderProps.DisplayText = GetDisplayName(tagContent); placeholderProps.SegmentationHint = rule.SegmentationHint; placeholderProps.TagContent = tagContent; if (!string.IsNullOrEmpty(rule.TextEquivalent)) { placeholderProps.TextEquivalent = rule.TextEquivalent; } return(placeholderProps); }
internal IEndTagProperties CreateEndTagProperties(IPropertiesFactory factory, string tagContent, IMatchRule rule) { var endProperties = factory.CreateEndTagProperties(tagContent); ApplyInlineTagProperties(endProperties, rule); endProperties.DisplayText = GetDisplayName(tagContent); return(endProperties); }
internal IStartTagProperties CreateStartTagProperties(IPropertiesFactory factory, string tagContent, IMatchRule rule) { var startProperties = factory.CreateStartTagProperties(tagContent); ApplyInlineTagProperties(startProperties, rule); startProperties.DisplayText = GetDisplayName(tagContent); startProperties.Formatting = FormattingInflator.InflateFormatting(rule.Formatting); startProperties.SegmentationHint = rule.SegmentationHint; return(startProperties); }
private static void ApplyInlineTagProperties(IAbstractInlineTagProperties tagProperties, IMatchRule rule) { tagProperties.CanHide = rule.CanHide; tagProperties.IsSoftBreak = rule.IsSoftBreak; tagProperties.IsWordStop = rule.IsWordStop; }