Exemplo n.º 1
0
        /// <summary>
        ///     Construct an <see cref="LSLCodeValidator" /> using <see cref="LSLCodeValidatorStrategies.Default(ILSLBasicLibraryDataProvider)" /> to initialize
        ///     the <see cref="ValidatorStrategies" /> property.
        /// </summary>
        /// <param name="libraryDataProvider">The library data provider to use.</param>
        /// <seealso cref="LSLCodeValidatorStrategies.Default()"/>
        public LSLCodeValidator(ILSLBasicLibraryDataProvider libraryDataProvider)
        {
            var validatorStrategies = LSLCodeValidatorStrategies.Default(libraryDataProvider);

            _validatorVisitor        = new LSLCodeValidatorVisitor(validatorStrategies);
            _antlrParserErrorHandler = new LSLAntlrErrorHandler(validatorStrategies.SyntaxErrorListener);
        }
Exemplo n.º 2
0
        /// <summary>
        ///     Construct an <see cref="LSLCodeValidator" /> using <see cref="LSLCodeValidatorStrategies.Default(ILSLSyntaxErrorListener, ILSLSyntaxWarningListener)" /> to initialize
        ///     the <see cref="ValidatorStrategies" /> property.
        /// </summary>
        /// <param name="errorListener">The syntax error listener to use.</param>
        /// <param name="warningListener">The warning error listener to use.</param>
        /// <seealso cref="LSLCodeValidatorStrategies.Default()"/>
        public LSLCodeValidator(ILSLSyntaxErrorListener errorListener, ILSLSyntaxWarningListener warningListener)
        {
            var validatorStrategies = LSLCodeValidatorStrategies.Default(errorListener, warningListener);

            _validatorVisitor        = new LSLCodeValidatorVisitor(validatorStrategies);
            _antlrParserErrorHandler = new LSLAntlrErrorHandler(validatorStrategies.SyntaxErrorListener);
        }
Exemplo n.º 3
0
        /// <summary>
        ///     Construct an <see cref="LSLCodeValidator" /> using <see cref="LSLCodeValidatorStrategies.Default()" /> to initialize
        ///     the <see cref="ValidatorStrategies" /> property.
        /// </summary>
        /// <seealso cref="LSLCodeValidatorStrategies.Default()"/>
        public LSLCodeValidator()
        {
            var validatorStrategies = LSLCodeValidatorStrategies.Default();

            _validatorVisitor        = new LSLCodeValidatorVisitor(validatorStrategies);
            _antlrParserErrorHandler = new LSLAntlrErrorHandler(validatorStrategies.SyntaxErrorListener);
        }
Exemplo n.º 4
0
        /// <summary>
        ///     Constructs an LSLCodeValidator using the given <see cref="ILSLCodeValidatorStrategies" />.
        /// </summary>
        /// <see cref="ILSLCodeValidatorStrategies" />
        /// <param name="validatorStrategies">The <see cref="ILSLCodeValidatorStrategies" /> to use.</param>
        /// <exception cref="ArgumentException">
        ///     If one or more of <paramref name="validatorStrategies" /> properties are
        ///     <c>null</c>.
        /// </exception>
        /// <exception cref="ArgumentNullException"><paramref name="validatorStrategies" /> is <c>null</c>.</exception>
        public LSLCodeValidator(ILSLCodeValidatorStrategies validatorStrategies)
        {
            if (validatorStrategies == null)
            {
                throw new ArgumentNullException("validatorStrategies");
            }


            ValidatorStrategies = validatorStrategies;

            string describeNulls;

            if (!validatorStrategies.IsComplete(out describeNulls))
            {
                throw new ArgumentException(typeof(ILSLCodeValidatorStrategies).Name + " is incomplete:" +
                                            Environment.NewLine +
                                            Environment.NewLine +
                                            describeNulls);
            }


            _validatorVisitor        = new LSLCodeValidatorVisitor(validatorStrategies);
            _antlrParserErrorHandler = new LSLAntlrErrorHandler(validatorStrategies.SyntaxErrorListener);
        }