Exemple #1
0
            public override object VisitSimpleSelectorSequence([NotNull] CssParser.SimpleSelectorSequenceContext context)
            {
                var item = context.GetChild(0);

                if (item is TerminalNodeImpl token)
                {
                    string text = token.Symbol.Text.Substring(1);
                    freqList.Increment(text);
                }
                return(base.VisitSimpleSelectorSequence(context));
            }
            public override object VisitClassName([NotNull] CssParser.ClassNameContext context)
            {
                var ident     = context.ident();
                var nameIdent = ident.Ident();

                if (nameIdent != null)
                {
                    string text = nameIdent.Symbol.Text;
                    freqList.Increment(text);
                }
                return(base.VisitClassName(context));
            }
Exemple #3
0
            public override object VisitHtmlAttribute([NotNull] HtmlParser.HtmlAttributeContext context)
            {
                var contextName = context.htmlAttributeName();
                var name        = contextName.GetText();

                bool isId = string.Equals("id", name, StringComparison.OrdinalIgnoreCase);

                if (isId)
                {
                    var mangerAttr = new HtmlAttributeManager(context);
                    freqList.Increment(mangerAttr.Value);
                }
                return(null);
            }
            public override object VisitHtmlAttribute([NotNull] HtmlParser.HtmlAttributeContext context)
            {
                var contextName = context.htmlAttributeName();
                var name        = contextName.GetText();

                bool isClass = string.Equals("class", name, StringComparison.OrdinalIgnoreCase);

                if (isClass)
                {
                    var mangerAttr = new HtmlAttributeManager(context);

                    foreach (var className in mangerAttr.Value.Split(' '))
                    {
                        freqList.Increment(className);
                    }
                }
                return(null);
            }