コード例 #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Lexer"/> class.
        /// </summary>
        /// <param name="input">The <see cref="System.IO.TextReader"/> to use for input. This need not be seekable.</param>
        /// <param name="escapeCharacters">The escape characters that should be recognized.</param>
        /// <param name="quotations">The quotations that should be recognized.</param>
        /// <param name="assignmentCharacters">The assignment characters that should be recognized.</param>
        public Lexer(TextReader input, ICollection<char> escapeCharacters, IDictionary<char, QuotationInfo> quotations,
            IDictionary<char, OptionStyles> assignmentCharacters)
        {
            mInput = input;
            FillCharacterBuffer();
            mEscapeCharacters = new GuardedCollection<char>(escapeCharacters);
            mQuotations = new GuardedDictionary<char, QuotationInfo>(quotations);
            mAssignmentCharacters = new GuardedDictionary<char, OptionStyles>(assignmentCharacters);

            mEnabledOptionStyles = OptionStyles.ShortUnix | OptionStyles.Windows | OptionStyles.File;
        }
コード例 #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Lexer"/> class.
        /// </summary>
        /// <param name="input">The <see cref="System.IO.TextReader"/> to use for input. This need not be seekable.</param>
        /// <param name="escapeCharacters">The escape characters that should be recognized.</param>
        /// <param name="quotations">The quotations that should be recognized.</param>
        /// <param name="assignmentCharacters">The assignment characters that should be recognized.</param>
        public Lexer(TextReader input, ICollection <char> escapeCharacters, IDictionary <char, QuotationInfo> quotations,
                     IDictionary <char, OptionStyles> assignmentCharacters)
        {
            mInput = input;
            FillCharacterBuffer();
            mEscapeCharacters     = new GuardedCollection <char>(escapeCharacters);
            mQuotations           = new GuardedDictionary <char, QuotationInfo>(quotations);
            mAssignmentCharacters = new GuardedDictionary <char, OptionStyles>(assignmentCharacters);

            mEnabledOptionStyles = OptionStyles.ShortUnix | OptionStyles.Windows | OptionStyles.File;
        }
コード例 #3
0
        public void Keys_returns_GuardedCollectionValue()
        {
            var source = new HashDictionary <int, string>
            {
                [1] = "one",
                [2] = "two",
                [3] = "three"
            };

            var guarded = new GuardedDictionary <int, string>(source);

            Assert.IsAssignableFrom <GuardedCollectionValue <int> >(guarded.Keys);
        }
コード例 #4
0
        public void Values_returns_Values()
        {
            var source = new HashDictionary <int, string>
            {
                [1] = "one",
                [2] = "two",
                [3] = "three"
            };

            var guarded = new GuardedDictionary <int, string>(source);

            CollectionAssert.AreEquivalent(new[] { "one", "two", "three" }, guarded.Values);
        }