예제 #1
0
        /// <summary>
        /// When visiting the user agent node tries to find children skipping root node by name.
        /// Otherwise calls tries to get children using children visitor.
        /// </summary>
        /// <param name="context">The context of the current node <see cref="UserAgentParser.UserAgentContext"/>.</param>
        /// <returns>The found children as <see cref="IEnumerator{IParseTree}"/>.</returns>
        public override IEnumerator <IParseTree> VisitUserAgent([NotNull] UserAgentParser.UserAgentContext context)
        {
            using (var children = this.GetChildrenByName(context))
            {
                if (!children.MoveNext() && children.Current == null)
                {
                    return(this.VisitChildren(context));
                }

                return(children);
            }
        }
 /// <summary>
 /// When a user agent is found.
 /// </summary>
 /// <param name="context">The context node.</param>
 public override void EnterUserAgent([NotNull] UserAgentParser.UserAgentContext context)
 {
     // In case of a parse error the 'parsed' version of agent can be incomplete
     this.Inform(context, AGENT, context.Start.TokenSource.InputStream.ToString());
 }
 /// <summary>
 /// Visit a parse tree produced by <see cref="UserAgentParser.userAgent"/>.
 /// <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 VisitUserAgent([NotNull] UserAgentParser.UserAgentContext context)
 {
     return(VisitChildren(context));
 }
예제 #4
0
 /// <summary>
 /// Exit a parse tree produced by <see cref="UserAgentParser.userAgent"/>.
 /// <para>The default implementation does nothing.</para>
 /// </summary>
 /// <param name="context">The parse tree.</param>
 public virtual void ExitUserAgent([NotNull] UserAgentParser.UserAgentContext context)
 {
 }