예제 #1
0
        /// <summary>
        /// Visit a parse tree produced by <see cref="CodeQueryParser.selectorAttribute" />.
        /// <para>
        /// The default implementation returns the result of calling <see cref="AbstractParseTreeVisitor{Result}.VisitChildren(IRuleNode)" />
        /// on <paramref name="context" />.
        /// </para>
        /// </summary>
        /// <param name="context">The parse tree.</param>
        /// <returns></returns>
        /// <return>The visitor result.</return>
        public override Object VisitSelectorAttribute(CodeQueryParser.SelectorAttributeContext context)
        {
            var name  = context.AttributeName.Text;
            var value = context.AttributeValue
                        .Safe(attributeValue => attributeValue.Accept(this) as ConstantElement);

            return(SelectorFactory.CreateAttributeSelector(name, value));
        }
예제 #2
0
        public override CodeQueryVisitor VisitSelectorAttribute(CodeQueryParser.SelectorAttributeContext context)
        {
            context.AttributeValue.Accept(this);
            if (!_constants.Any())
            {
                throw new Exception("Invalid selectorElement attribute!");
            }

            _selectorBuilder.CreateSelectorAttribute(context.AttributeName.Text, _constants.Pop());

            return(base.VisitSelectorAttribute(context));
        }
 /// <summary>
 /// Visit a parse tree produced by <see cref="CodeQueryParser.selectorAttribute"/>.
 /// <para>
 /// The default implementation returns the result of calling <see cref="AbstractParseTreeVisitor{Result}.VisitChildren(IRuleNode)"/>
 /// on <paramref name="context"/>.
 /// </para>
 /// </summary>
 /// <param name="context">The parse tree.</param>
 /// <return>The visitor result.</return>
 public virtual Result VisitSelectorAttribute([NotNull] CodeQueryParser.SelectorAttributeContext context)
 {
     return(VisitChildren(context));
 }
 /// <summary>
 /// Exit a parse tree produced by <see cref="CodeQueryParser.selectorAttribute"/>.
 /// <para>The default implementation does nothing.</para>
 /// </summary>
 /// <param name="context">The parse tree.</param>
 public virtual void ExitSelectorAttribute([NotNull] CodeQueryParser.SelectorAttributeContext context)
 {
 }