Example #1
0
        private void ReadNumberBinary()
        {
            while (Current == '0' || Current == '1')
            {
                _position++;
            }

            var length = _position - _start - 2;
            var text   = _text.ToString(_start + 2, length);

            if (text.Length == 0)
            {
                _diagnostics.ReportInvalidBinaryNumber(new TextLocation(_text, new TextSpan(_start + 2, length)), text);
            }

            var value = Convert.ToInt32(text, 2);

            if (text.Length == 8)
            {
                _value = (byte)value;
            }
            else
            {
                _value = value;
            }

            _kind = SyntaxKind.NumberToken;
        }