Esempio n. 1
0
        /// <summary>Initializes a new instance of the <see cref="PBXProjTokenType"/> class.</summary>
        /// <param name="type">The type of the token.</param>
        /// <param name="value">The value of the token.</param>
        public PBXProjToken(PBXProjTokenType type, string value)
        {
            if (string.IsNullOrEmpty(value))
            {
                throw new ArgumentNullException(nameof(value), "Value must not be null or empty");
            }

            _type  = type;
            _value = value;
        }
Esempio n. 2
0
        /// <summary>Skips the current token if it is the specified token, or throws a <see cref="PBXProjParserException"/>.</summary>
        /// <param name="type">The type of token to expect.</param>
        /// <param name="value">The value of the token to expect.</param>
        void SkipExpected(PBXProjTokenType type, string value)
        {
            CheckForUnexpectedEndOfSource();

            if (!_currentToken.Equals(type, value))
            {
                throw new PBXProjParserException("Expected '" + value + "'. Not " + _currentToken.Value);
            }

            ReadNextToken();
        }
Esempio n. 3
0
 /// <summary>Determines whether this token has the specified type and value.</summary>
 /// <param name="type">The type to check against.</param>
 /// <param name="value">The value to check against.</param>
 /// <returns>If this token has the specified type and value, <c>true</c>; otherwise, <c>false</c>.</returns>
 public bool Equals(PBXProjTokenType type, string value)
 {
     return(_type == type && _value == value);
 }