Esempio n. 1
0
            /// <summary>
            ///  When visit a step that is in a set value adds a <see cref="StepIsInSet"/>.
            /// </summary>
            /// <param name="context">The context<see cref="UserAgentTreeWalkerParser.StepIsInSetContext"/>.</param>
            /// <returns>null.</returns>
            public override object VisitStepIsInSet([NotNull] UserAgentTreeWalkerParser.StepIsInSetContext context)
            {
                this.FromHereItCannotBeInHashMapAnymore();

                var lookupSetName = context.set.Text;
                var lookupSet     = this.walkList.lookupSets.ContainsKey(lookupSetName) ? this.walkList.lookupSets[lookupSetName] : null;

                if (lookupSet is null)
                {
                    if (this.walkList.lookups.ContainsKey(lookupSetName))
                    {
                        lookupSet = new HashSet <string>(this.walkList.lookups[lookupSetName].Keys);
                    }
                }

                if (lookupSet is null)
                {
                    throw new InvalidParserConfigurationException($"Missing lookupSet \"{lookupSetName}\"");
                }

                this.Add(new StepIsInSet(lookupSetName, lookupSet));
                this.VisitNext(context.nextStep);
                return(null); // Void
            }
	/// <summary>
	/// Exit a parse tree produced by the <c>stepIsInSet</c>
	/// labeled alternative in <see cref="UserAgentTreeWalkerParser.path"/>.
	/// <para>The default implementation does nothing.</para>
	/// </summary>
	/// <param name="context">The parse tree.</param>
	public virtual void ExitStepIsInSet([NotNull] UserAgentTreeWalkerParser.StepIsInSetContext context) { }
 /// <summary>
 /// Visit a parse tree produced by the <c>stepIsInSet</c>
 /// labeled alternative in <see cref="UserAgentTreeWalkerParser.path"/>.
 /// <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 VisitStepIsInSet([NotNull] UserAgentTreeWalkerParser.StepIsInSetContext context)
 {
     return(VisitChildren(context));
 }