Ejemplo n.º 1
0
        /// <summary>
        ///     Accept a visit from an implementor of <see cref="ILSLValidatorNodeVisitor{T}" />
        /// </summary>
        /// <typeparam name="T">The visitors return type.</typeparam>
        /// <param name="visitor">The visitor instance.</param>
        /// <returns>The value returned from this method in the visitor used to visit this node.</returns>
        /// <exception cref="ArgumentNullException"><paramref name="visitor"/> is <c>null</c>.</exception>
        public T AcceptVisitor <T>(ILSLValidatorNodeVisitor <T> visitor)
        {
            if (visitor == null)
            {
                throw new ArgumentNullException("visitor");
            }

            if (IsGlobal)
            {
                return(visitor.VisitGlobalVariableReference(this));
            }
            if (IsLocal)
            {
                return(visitor.VisitLocalVariableReference(this));
            }
            if (IsParameter)
            {
                return(visitor.VisitParameterVariableReference(this));
            }
            if (IsLibraryConstant)
            {
                return(visitor.VisitLibraryConstantVariableReference(this));
            }

            throw new InvalidOperationException(typeof(LSLVariableNode).Name +
                                                " could not be visited, its state is invalid");
        }
Ejemplo n.º 2
0
        /// <summary>
        ///     Accept a visit from an implementor of <see cref="ILSLValidatorNodeVisitor{T}" />
        /// </summary>
        /// <typeparam name="T">The visitors return type.</typeparam>
        /// <param name="visitor">The visitor instance.</param>
        /// <returns>The value returned from this method in the visitor used to visit this node.</returns>
        /// <exception cref="ArgumentNullException"><paramref name="visitor"/> is <c>null</c>.</exception>
        public T AcceptVisitor <T>(ILSLValidatorNodeVisitor <T> visitor)
        {
            if (visitor == null)
            {
                throw new ArgumentNullException("visitor");
            }

            if (ListType == LSLExpressionListType.ForLoopAfterthoughts)
            {
                return(visitor.VisitForLoopAfterthoughts(this));
            }

            if (ListType == LSLExpressionListType.LibraryFunctionCallParameters)
            {
                return(visitor.VisitLibraryFunctionCallParameters(this));
            }

            if (ListType == LSLExpressionListType.UserFunctionCallParameters)
            {
                return(visitor.VisitUserFunctionCallParameters(this));
            }

            if (ListType == LSLExpressionListType.ListInitializer)
            {
                return(visitor.VisitListLiteralInitializerList(this));
            }

            if (ListType == LSLExpressionListType.ForLoopInitExpressions)
            {
                return(visitor.VisitForLoopInitExpressions(this));
            }

            throw new InvalidOperationException("Visit " + typeof(LSLExpressionListNode) +
                                                ", unknown LSLExpressionListType.");
        }
Ejemplo n.º 3
0
        /// <summary>
        ///     Accept a visit from an implementor of <see cref="ILSLValidatorNodeVisitor{T}" />
        /// </summary>
        /// <typeparam name="T">The visitors return type.</typeparam>
        /// <param name="visitor">The visitor instance.</param>
        /// <returns>The value returned from this method in the visitor used to visit this node.</returns>
        /// <exception cref="ArgumentNullException"><paramref name="visitor"/> is <c>null</c>.</exception>
        public T AcceptVisitor <T>(ILSLValidatorNodeVisitor <T> visitor)
        {
            if (visitor == null)
            {
                throw new ArgumentNullException("visitor");
            }

            return(visitor.VisitIfStatement(this));
        }
Ejemplo n.º 4
0
        /// <summary>
        ///     Accept a visit from an implementor of <see cref="ILSLValidatorNodeVisitor{T}" />
        /// </summary>
        /// <typeparam name="T">The visitors return type.</typeparam>
        /// <param name="visitor">The visitor instance.</param>
        /// <returns>The value returned from this method in the visitor used to visit this node.</returns>
        /// <exception cref="ArgumentNullException"><paramref name="visitor"/> is <c>null</c>.</exception>
        public T AcceptVisitor <T>(ILSLValidatorNodeVisitor <T> visitor)
        {
            if (visitor == null)
            {
                throw new ArgumentNullException("visitor");
            }

            return(IsGlobal ? visitor.VisitGlobalVariableDeclaration(this) : visitor.VisitLocalVariableDeclaration(this));
        }
Ejemplo n.º 5
0
        /// <summary>
        ///     Accept a visit from an implementor of <see cref="ILSLValidatorNodeVisitor{T}" />
        /// </summary>
        /// <typeparam name="T">The visitors return type.</typeparam>
        /// <param name="visitor">The visitor instance.</param>
        /// <returns>The value returned from this method in the visitor used to visit this node.</returns>
        /// <exception cref="ArgumentNullException"><paramref name="visitor"/> is <c>null</c>.</exception>
        public T AcceptVisitor <T>(ILSLValidatorNodeVisitor <T> visitor)
        {
            if (visitor == null)
            {
                throw new ArgumentNullException("visitor");
            }

            return(visitor.VisitParameterDefinitionList(this));
        }
        /// <summary>
        ///     Accept a visit from an implementor of <see cref="ILSLValidatorNodeVisitor{T}" />
        /// </summary>
        /// <typeparam name="T">The visitors return type.</typeparam>
        /// <param name="visitor">The visitor instance.</param>
        /// <returns>The value returned from this method in the visitor used to visit this node.</returns>
        /// <exception cref="ArgumentNullException"><paramref name="visitor"/> is <c>null</c>.</exception>
        public T AcceptVisitor <T>(ILSLValidatorNodeVisitor <T> visitor)
        {
            if (visitor == null)
            {
                throw new ArgumentNullException("visitor");
            }

            return(visitor.VisitParenthesizedExpression(this));
        }
Ejemplo n.º 7
0
        /// <summary>
        ///     Accept a visit from an implementor of <see cref="ILSLValidatorNodeVisitor{T}" />
        /// </summary>
        /// <typeparam name="T">The visitors return type.</typeparam>
        /// <param name="visitor">The visitor instance.</param>
        /// <returns>The value returned from this method in the visitor used to visit this node.</returns>
        /// <exception cref="ArgumentNullException"><paramref name="visitor"/> is <c>null</c>.</exception>
        public override T AcceptVisitor <T>(ILSLValidatorNodeVisitor <T> visitor)
        {
            if (visitor == null)
            {
                throw new ArgumentNullException("visitor");
            }

            return(visitor.VisitIntegerLiteral(this));
        }
Ejemplo n.º 8
0
        /// <summary>
        ///     Accept a visit from an implementor of <see cref="ILSLValidatorNodeVisitor{T}" />
        /// </summary>
        /// <typeparam name="T">The visitors return type.</typeparam>
        /// <param name="visitor">The visitor instance.</param>
        /// <returns>The value returned from this method in the visitor used to visit this node.</returns>
        /// <exception cref="ArgumentNullException"><paramref name="visitor"/> is <c>null</c>.</exception>
        public T AcceptVisitor <T>(ILSLValidatorNodeVisitor <T> visitor)
        {
            if (visitor == null)
            {
                throw new ArgumentNullException("visitor");
            }

            return(IsDefaultState ? visitor.VisitDefaultState(this) : visitor.VisitDefinedState(this));
        }
Ejemplo n.º 9
0
        /// <summary>
        ///     Accept a visit from an implementor of <see cref="ILSLValidatorNodeVisitor{T}" />
        /// </summary>
        /// <typeparam name="T">The visitors return type.</typeparam>
        /// <param name="visitor">The visitor instance.</param>
        /// <returns>The value returned from this method in the visitor used to visit this node.</returns>
        /// <exception cref="ArgumentNullException"><paramref name="visitor"/> is <c>null</c>.</exception>
        public T AcceptVisitor <T>(ILSLValidatorNodeVisitor <T> visitor)
        {
            if (visitor == null)
            {
                throw new ArgumentNullException("visitor");
            }

            return(IsSingleStatementScope
                ? visitor.VisitSingleStatementCodeScope(this)
                : visitor.VisitMultiStatementCodeScope(this));
        }
Ejemplo n.º 10
0
        /// <summary>
        ///     Accept a visit from an implementor of <see cref="ILSLValidatorNodeVisitor{T}" />
        /// </summary>
        /// <typeparam name="T">The visitors return type.</typeparam>
        /// <param name="visitor">The visitor instance.</param>
        /// <returns>The value returned from this method in the visitor used to visit this node.</returns>
        /// <exception cref="ArgumentNullException"><paramref name="visitor"/> is <c>null</c>.</exception>
        public T AcceptVisitor <T>(ILSLValidatorNodeVisitor <T> visitor)
        {
            if (visitor == null)
            {
                throw new ArgumentNullException("visitor");
            }

            if (ExpressionType == LSLExpressionType.LibraryFunction)
            {
                return(visitor.VisitLibraryFunctionCall(this));
            }

            if (ExpressionType == LSLExpressionType.UserFunction)
            {
                return(visitor.VisitUserFunctionCall(this));
            }

            throw new InvalidOperationException(
                      typeof(LSLFunctionCallNode).Name + " could not be visited, object is in an invalid state");
        }
Ejemplo n.º 11
0
 /// <summary>
 ///     Accept a visit from an implementor of <see cref="ILSLValidatorNodeVisitor{T}" />
 /// </summary>
 /// <typeparam name="T">The visitors return type.</typeparam>
 /// <param name="visitor">The visitor instance.</param>
 /// <returns>The value returned from this method in the visitor used to visit this node.</returns>
 public T AcceptVisitor <T>(ILSLValidatorNodeVisitor <T> visitor)
 {
     return(visitor.VisitBinaryExpression(this));
 }
Ejemplo n.º 12
0
 /// <summary>
 ///     Accept a visit from an implementor of <see cref="ILSLValidatorNodeVisitor{T}" />
 /// </summary>
 /// <typeparam name="T">The visitors return type.</typeparam>
 /// <param name="visitor">The visitor instance.</param>
 /// <returns>The value returned from this method in the visitor used to visit this node.</returns>
 public T AcceptVisitor <T>(ILSLValidatorNodeVisitor <T> visitor)
 {
     throw new NotImplementedException("Visited " + typeof(LSLCodeStatementError).Name);
 }
Ejemplo n.º 13
0
 public T AcceptVisitor <T>(ILSLValidatorNodeVisitor <T> visitor)
 {
     throw new NotImplementedException("Visited LSLDummyExpr, Don't visit trees with syntax errors.");
 }
Ejemplo n.º 14
0
 /// <summary>
 ///     Accept a visit from an implementor of <see cref="ILSLValidatorNodeVisitor{T}" />
 /// </summary>
 /// <typeparam name="T">The visitors return type.</typeparam>
 /// <param name="visitor">The visitor instance.</param>
 /// <returns>The value returned from this method in the visitor used to visit this node.</returns>
 public abstract T AcceptVisitor <T>(ILSLValidatorNodeVisitor <T> visitor);