Beispiel #1
0
        public Token(string value, TokenType type, TokenLiteralType literalType, IHoconLineInfo source)
        {
            Type        = type;
            LiteralType = literalType;
            Value       = value;

            if (source != null)
            {
                LineNumber   = source.LineNumber;
                LinePosition = source.LinePosition - (value?.Length ?? 0);
            }
        }
Beispiel #2
0
 /// <summary>
 /// Creates a string literal token with a given <paramref name="value"/>.
 /// </summary>
 /// <param name="value">The value to associate with this token.</param>
 /// <param name="literalType">The <see cref="TokenLiteralType"/> of this <see cref="Token"/>.</param>
 /// <param name="source">The <see cref="IHoconLineInfo"/> of this <see cref="Token"/>, used for exception generation purposes.</param>
 /// <returns>A string literal token with the given value.</returns>
 public static Token LiteralValue(string value, TokenLiteralType literalType, IHoconLineInfo source)
 {
     return(new Token(value, TokenType.LiteralValue, literalType, source));
 }