protected void scanHexNumber() throws EOFException {
        nextChar();
        Type type = Type.INT_LITERAL;
        while (isHexDigit(ch) || ch == '_') {
            if (ch == '_') {
                nextChar();
                continue;
            }
            addChar(ch);
            if (index >= stream.length) {
                break;
            }
            nextChar();
        }
        if (index < stream.length) {
            switch (ch) {
            case 'l': case 'L':
                type = Type.LONG_LITERAL;
                break;
            default:
                putBack();
                break;
            }
        }
        switch(type) {
        case INT_LITERAL:
            currentToken = new Token(type, Integer.parseInt(bufferToString(), 16));
            break;
        case LONG_LITERAL:
            currentToken = new Token(type, Long.parseLong(bufferToString(), 16));
            break;
        default:
            throw new IllegalStateException();
        }
        clearBuffer();
    }