internal IntegerLiteralString(string value, NumberRadixFormat radix)
        {
            Debug.Assert(!string.IsNullOrWhiteSpace(value));

            switch (radix)
            {
            case NumberRadixFormat.Decimal:
                if (!this.ParseString(value, DecimalRegEx, radix))
                {
                    throw new ArgumentException("The provided string is not a supported number format.", nameof(value));
                }
                break;

            case NumberRadixFormat.Hexadecimal:
                if (!this.ParseString(value, HexRegEx, radix))
                {
                    throw new ArgumentException("The provided string is not a supported number format.", nameof(value));
                }
                break;

            case NumberRadixFormat.Octal:
                if (!this.ParseString(value, OctalRegEx, radix))
                {
                    throw new ArgumentException("The provided string is not a supported number format.", nameof(value));
                }
                break;
            }
        }
        private void AssignMatch(Match match, NumberRadixFormat radix)
        {
            Group plainNumberGroup = match.Groups["PlainNumber"];
            Group suffixGroup      = match.Groups["NumberSuffix"];

            // just an assert, because if this happens, it's a bug with the regex
            Debug.Assert(plainNumberGroup.Success);

            this.PlainNumber  = plainNumberGroup.Value;
            this.NumberSuffix = this.ParseIntegerSuffix(suffixGroup);
            this.Radix        = radix;
        }
        private bool ParseString(string integerString, Regex regex, NumberRadixFormat radix)
        {
            var match = ParseString(integerString, regex);

            if (match == null)
            {
                return(false);
            }

            this.AssignMatch(match, radix);

            return(true);
        }
        private IntegerLiteralString(Match match, NumberRadixFormat radix)
        {
            Debug.Assert(match != null);

            this.AssignMatch(match, radix);
        }