private static Condition CreateCondtion(Grammar grammar, CilCondition cilCondition)
        {
            var result = new Condition(cilCondition.ConditionType.FullName)
            {
                Joint = { cilCondition }
            };

            InitContextProvider(grammar, cilCondition.ContextProvider, result.ContextProvider);
            return(result);
        }
Beispiel #2
0
        public void AddCondition(Type conditionType)
        {
            if (conditions.Any(mode => object.Equals(mode.ConditionType, conditionType)))
            {
                return;
            }

            var condition = new CilCondition(conditionType);

            conditions.Add(condition);

            processedConditions.Push(condition);

            foreach (var meta in MetadataParser.EnumerateAndBind(conditionType))
            {
                AddMeta(meta);
            }

            if (processedConditions.Count == 1)
            {
                var implicitLiterals =
                    (from t in terminals
                     where t.HasLiteral
                     select t.Literal)
                    .Except(
                        from cond in conditions
                        from matcher in cond.Matchers
                        where matcher.Pattern.IsLiteral
                        select matcher.Pattern.Literal)
                    .ToArray();

                foreach (var literal in implicitLiterals)
                {
                    condition.AddImplicitLiteralMatcher(literal);
                }
            }

            processedConditions.Pop();
        }
        public void AddCondition(Type conditionType)
        {
            if (conditions.Any(mode => object.Equals(mode.ConditionType, conditionType)))
            {
                return;
            }

            var condition = new CilCondition(conditionType);

            conditions.Add(condition);

            processedConditions.Push(condition);

            foreach (var meta in MetadataParser.EnumerateAndBind(conditionType))
            {
                AddMeta(meta);
            }

            if (processedConditions.Count == 1)
            {
                var implicitLiterals =
                    (from t in terminals
                     where t.HasLiteral
                     select t.Literal)
                    .Except(
                        from cond in conditions
                        from matcher in cond.Matchers
                        where matcher.Pattern.IsLiteral
                        select matcher.Pattern.Literal)
                        .ToArray();

                foreach (var literal in implicitLiterals)
                {
                    condition.AddImplicitLiteralMatcher(literal);
                }
            }

            processedConditions.Pop();
        }
        private static Condition CreateCondtion(Grammar grammar, CilCondition cilCondition)
        {
            var result = new Condition(cilCondition.ConditionType.FullName)
            {
                Joint = { cilCondition }
            };

            InitContextProvider(grammar, cilCondition.ContextProvider, result.ContextProvider);
            return result;
        }