Пример #1
0
        public DisjunctionRule(
            string?ruleName,
            IRuleOutput?ruleOutput,
            IEnumerable <TaggedRule> rules,
            bool?hasInterleave   = null,
            bool?isRecursive     = null,
            bool?isCaseSensitive = null)
            : base(
                ruleName,
                ruleOutput,
                hasInterleave,
                isRecursive,
                isCaseSensitive)
        {
            if (rules == null || rules.Count() == 0)
            {
                throw new ArgumentNullException(nameof(rules));
            }

            _rules = new TaggedRuleCollection(rules);
            if (!_rules.DoAllHaveNames && !_rules.DoAllNotHaveNames)
            {
                throw new ParsingException(
                          "Can't have both named & unnamed rule match in one disjunction rule");
            }
        }
Пример #2
0
        public SequenceRule(
            string?ruleName,
            IRuleOutput?ruleOutput,
            IEnumerable <TaggedRule> rules,
            bool?hasInterleave   = null,
            bool?isRecursive     = null,
            bool?isCaseSensitive = null)
            : base(
                ruleName,
                ruleOutput,
                hasInterleave,
                isRecursive,
                isCaseSensitive)
        {
            if (rules == null || !rules.Any())
            {
                throw new ArgumentNullException(nameof(rules));
            }

            _rules = new TaggedRuleCollection(rules);
        }