private List <Rule> GetParentChain(Rule childRule)
        {
            var isPseudoState     = ConverterUtils.IsPseudoSelector(childRule.SelectorName);
            var childMainRuleName = ConverterUtils.GetNoPseudoSelector(childRule.SelectorName);
            var parentChain       = new List <Rule>();
            var parentRule        = GetParentRule(childMainRuleName);

            while (parentRule != null)
            {
                if (isPseudoState)
                {
                    // Fetch the corresponding pseudo state rule in the parent:
                    var  extendedParentRuleName = childRule.SelectorName.Replace(childMainRuleName, parentRule.SelectorName);
                    Rule extentedParentRule;
                    if (Rules.TryGetValue(extendedParentRuleName, out extentedParentRule))
                    {
                        parentChain.Add(extentedParentRule);
                    }
                }
                else
                {
                    parentChain.Add(parentRule);
                }
                parentRule = GetParentRule(parentRule.SelectorName);
            }

            return(parentChain);
        }
 private void RecordIfPseudoStateRule(Rule rule)
 {
     if (ConverterUtils.IsPseudoSelector(rule.SelectorName))
     {
         var  mainRuleName = ConverterUtils.GetNoPseudoSelector(rule.SelectorName);
         Rule mainRule;
         if (Rules.TryGetValue(mainRuleName, out mainRule))
         {
             mainRule.PseudoStateRules.Add(rule.SelectorName);
         }
         else if (Options.ThrowIfCannotResolve)
         {
             throw new Exception("Cannot resolve main rule: " + mainRuleName);
         }
     }
 }