Example #1
0
 public static void AddMatchRule(IMatchRule rule)
 {
     if (rule != null)
     {
         _matchRules.Add(rule);
     }
 }
Example #2
0
        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);
        }
Example #3
0
 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);
         }
     }
 }
Example #4
0
 /// <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);
                 }
             }
         }
     }
 }
Example #5
0
 public static void AddMatchRule(IMatchRule rule)
 {
     if (rule != null)
         _matchRules.Add(rule);
 }
Example #6
0
        /// <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);
        }
Example #7
0
 public virtual IEnumerable <string> GetNameList(IMatchRule rule)
 {
     GetNameList(names, rule);
     return(names);
 }
Example #8
0
 internal LexerRule(IMatchRule match, Func <SourceReader, (Token, SourceReader)> action)
Example #9
0
        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);
        }
Example #10
0
        internal IEndTagProperties CreateEndTagProperties(IPropertiesFactory factory, string tagContent, IMatchRule rule)
        {
            var endProperties = factory.CreateEndTagProperties(tagContent);

            ApplyInlineTagProperties(endProperties, rule);
            endProperties.DisplayText = GetDisplayName(tagContent);

            return(endProperties);
        }
Example #11
0
        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);
        }
Example #12
0
 private static void ApplyInlineTagProperties(IAbstractInlineTagProperties tagProperties, IMatchRule rule)
 {
     tagProperties.CanHide     = rule.CanHide;
     tagProperties.IsSoftBreak = rule.IsSoftBreak;
     tagProperties.IsWordStop  = rule.IsWordStop;
 }