Esempio n. 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Token"/> class.
        /// </summary>
        /// <exception cref="ArgumentNullException"><paramref name="lexicalToken"/> is <see langword="null" />.</exception>
        public Token(TokenType type, [NotNull] LexicalToken lexicalToken)
        {
            if (lexicalToken == null)
            {
                throw new ArgumentNullException(nameof(lexicalToken));
            }

            Type         = type;
            Value        = lexicalToken.Value;
            LexicalToken = lexicalToken;
        }
Esempio n. 2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Token"/> class.
 /// </summary>
 /// <exception cref="ArgumentNullException"><paramref name="value"/> is <see langword="null" />.</exception>
 /// <exception cref="ArgumentNullException"><paramref name="lexicalToken"/> is <see langword="null" />.</exception>
 public Token(TokenType type, [NotNull] string value, [NotNull] LexicalToken lexicalToken)
 {
     Type         = type;
     Value        = value ?? throw new ArgumentNullException(nameof(value));
     LexicalToken = lexicalToken ?? throw new ArgumentNullException(nameof(lexicalToken));
 }