Exemple #1
0
        /// <summary>
        /// Resolves the class selectors.
        /// </summary>
        protected virtual IEnumerable <Regex> ResolveClassSelectors(TypeSelectorElement selector)
        {
            return(selector.ClassSelectors.Select <ClassSelectorElement, Regex>(classSelector => {
                var regularClassSelector = classSelector as RegularExpressionClassSelectorElement;
                if (regularClassSelector != null)
                {
                    return regularClassSelector.Regex;
                }

                var rawClassSelector = classSelector as RawClassSelectorElement;
                if (rawClassSelector != null)
                {
                    return new Regex(rawClassSelector.Name);
                }

                throw new NotSupportedException(String.Format("Not supported class selector element: {0}.", classSelector.GetType().FullName));
            }));
        }
Exemple #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="UnarySelectorElement"/> class.
 /// </summary>
 public UnarySelectorElement(TypeSelectorElement typeSelectorElement)
 {
     TypeSelectorElement = typeSelectorElement;
 }
Exemple #3
0
 protected IEnumerable <SelectorAttribute> ResolverAttributes(TypeSelectorElement typeSelectorElement)
 {
     return(typeSelectorElement.Attributes
            .Select(attribute => new SelectorAttribute(attribute.Name, attribute.Value.Value)));
 }
Exemple #4
0
 protected IEnumerable <ModifierBase> ResolveModifiers(TypeSelectorElement typeSelectorElement)
 {
     return(typeSelectorElement.Modifiers
            .Select(resolveModifier));
 }
Exemple #5
0
 protected SelectorDescriptor ResolveSelectorDescriptor(TypeSelectorElement typeSelectorElement)
 {
     return(DescriptorRepository.GetSelectorDescriptors()
            .SingleOrDefault(s => NameMatcher.Match(s.Value, typeSelectorElement.Name)));
 }